This change allows compiling the google-breakpad code using a global ::string class instead of std::string. For more details take a look at common/using_std_string.h

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@974 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2012-06-28 22:46:01 +00:00
parent 93cebf538e
commit 6de969a304
103 changed files with 521 additions and 385 deletions

View file

@ -62,6 +62,7 @@
#include "common/module.h"
#include "common/stabs_reader.h"
#include "common/stabs_to_module.h"
#include "common/using_std_string.h"
// This namespace contains helper functions.
namespace {
@ -235,7 +236,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleFunctor {
dwarf2reader::ByteReader *byte_reader_;
};
static bool LoadDwarf(const std::string &dwarf_filename,
static bool LoadDwarf(const string &dwarf_filename,
const ElfW(Ehdr) *elf_header,
const bool big_endian,
Module *module) {
@ -253,8 +254,8 @@ static bool LoadDwarf(const std::string &dwarf_filename,
const ElfW(Shdr) *section_names = sections + elf_header->e_shstrndx;
for (int i = 0; i < num_sections; i++) {
const ElfW(Shdr) *section = &sections[i];
std::string name = reinterpret_cast<const char *>(section_names->sh_offset +
section->sh_name);
string name = reinterpret_cast<const char *>(section_names->sh_offset +
section->sh_name);
const char *contents = reinterpret_cast<const char *>(section->sh_offset);
uint64 length = section->sh_size;
file_context.section_map[name] = std::make_pair(contents, length);
@ -292,7 +293,7 @@ static bool LoadDwarf(const std::string &dwarf_filename,
// success, or false if we don't recognize HEADER's machine
// architecture.
static bool DwarfCFIRegisterNames(const ElfW(Ehdr) *elf_header,
std::vector<std::string> *register_names) {
std::vector<string> *register_names) {
switch (elf_header->e_machine) {
case EM_386:
*register_names = DwarfCFIToModule::RegisterNames::I386();
@ -308,7 +309,7 @@ static bool DwarfCFIRegisterNames(const ElfW(Ehdr) *elf_header,
}
}
static bool LoadDwarfCFI(const std::string &dwarf_filename,
static bool LoadDwarfCFI(const string &dwarf_filename,
const ElfW(Ehdr) *elf_header,
const char *section_name,
const ElfW(Shdr) *section,
@ -319,7 +320,7 @@ static bool LoadDwarfCFI(const std::string &dwarf_filename,
Module *module) {
// Find the appropriate set of register names for this file's
// architecture.
std::vector<std::string> register_names;
std::vector<string> register_names;
if (!DwarfCFIRegisterNames(elf_header, &register_names)) {
fprintf(stderr, "%s: unrecognized ELF machine architecture '%d';"
" cannot convert DWARF call frame information\n",
@ -367,7 +368,7 @@ static bool LoadDwarfCFI(const std::string &dwarf_filename,
return true;
}
bool LoadELF(const std::string &obj_file, MmapWrapper* map_wrapper,
bool LoadELF(const string &obj_file, MmapWrapper* map_wrapper,
ElfW(Ehdr) **elf_header) {
int obj_fd = open(obj_file.c_str(), O_RDONLY);
if (obj_fd < 0) {
@ -416,9 +417,9 @@ bool ElfEndianness(const ElfW(Ehdr) *elf_header, bool *big_endian) {
// Read the .gnu_debuglink and get the debug file name. If anything goes
// wrong, return an empty string.
static std::string ReadDebugLink(const ElfW(Shdr) *debuglink_section,
const std::string &obj_file,
const std::string &debug_dir) {
static string ReadDebugLink(const ElfW(Shdr) *debuglink_section,
const string &obj_file,
const string &debug_dir) {
char *debuglink = reinterpret_cast<char *>(debuglink_section->sh_offset);
size_t debuglink_len = strlen(debuglink) + 5; // '\0' + CRC32.
debuglink_len = 4 * ((debuglink_len + 3) / 4); // Round to nearest 4 bytes.
@ -430,7 +431,7 @@ static std::string ReadDebugLink(const ElfW(Shdr) *debuglink_section,
return "";
}
std::string debuglink_path = debug_dir + "/" + debuglink;
string debuglink_path = debug_dir + "/" + debuglink;
int debuglink_fd = open(debuglink_path.c_str(), O_RDONLY);
if (debuglink_fd < 0) {
fprintf(stderr, "Failed to open debug ELF file '%s' for '%s': %s\n",
@ -453,13 +454,13 @@ static std::string ReadDebugLink(const ElfW(Shdr) *debuglink_section,
//
class LoadSymbolsInfo {
public:
explicit LoadSymbolsInfo(const std::string &dbg_dir) :
explicit LoadSymbolsInfo(const string &dbg_dir) :
debug_dir_(dbg_dir),
has_loading_addr_(false) {}
// Keeps track of which sections have been loaded so we don't accidentally
// load it twice from two different files.
void LoadedSection(const std::string &section) {
void LoadedSection(const string &section) {
if (loaded_sections_.count(section) == 0) {
loaded_sections_.insert(section);
} else {
@ -470,7 +471,7 @@ class LoadSymbolsInfo {
// We expect the ELF file and linked debug file to have the same preferred
// loading address.
void set_loading_addr(ElfW(Addr) addr, const std::string &filename) {
void set_loading_addr(ElfW(Addr) addr, const string &filename) {
if (!has_loading_addr_) {
loading_addr_ = addr;
loaded_file_ = filename;
@ -487,35 +488,35 @@ class LoadSymbolsInfo {
}
// Setters and getters
const std::string &debug_dir() const {
const string &debug_dir() const {
return debug_dir_;
}
std::string debuglink_file() const {
string debuglink_file() const {
return debuglink_file_;
}
void set_debuglink_file(std::string file) {
void set_debuglink_file(string file) {
debuglink_file_ = file;
}
private:
const std::string &debug_dir_; // Directory with the debug ELF file.
const string &debug_dir_; // Directory with the debug ELF file.
std::string debuglink_file_; // Full path to the debug ELF file.
string debuglink_file_; // Full path to the debug ELF file.
bool has_loading_addr_; // Indicate if LOADING_ADDR_ is valid.
ElfW(Addr) loading_addr_; // Saves the preferred loading address from the
// first call to LoadSymbols().
std::string loaded_file_; // Name of the file loaded from the first call to
string loaded_file_; // Name of the file loaded from the first call to
// LoadSymbols().
std::set<std::string> loaded_sections_; // Tracks the Loaded ELF sections
std::set<string> loaded_sections_; // Tracks the Loaded ELF sections
// between calls to LoadSymbols().
};
static bool LoadSymbols(const std::string &obj_file,
static bool LoadSymbols(const string &obj_file,
const bool big_endian,
ElfW(Ehdr) *elf_header,
const bool read_gnu_debug_link,
@ -615,7 +616,7 @@ static bool LoadSymbols(const std::string &obj_file,
elf_header->e_shnum);
if (gnu_debuglink_section) {
if (!info->debug_dir().empty()) {
std::string debuglink_file =
string debuglink_file =
ReadDebugLink(gnu_debuglink_section, obj_file, info->debug_dir());
info->set_debuglink_file(debuglink_file);
} else {
@ -690,13 +691,13 @@ const char *ElfArchitecture(const ElfW(Ehdr) *elf_header) {
// Format the Elf file identifier in IDENTIFIER as a UUID with the
// dashes removed.
std::string FormatIdentifier(unsigned char identifier[16]) {
string FormatIdentifier(unsigned char identifier[16]) {
char identifier_str[40];
google_breakpad::FileID::ConvertIdentifierToString(
identifier,
identifier_str,
sizeof(identifier_str));
std::string id_no_dash;
string id_no_dash;
for (int i = 0; identifier_str[i] != '\0'; ++i)
if (identifier_str[i] != '-')
id_no_dash += identifier_str[i];
@ -710,10 +711,10 @@ std::string FormatIdentifier(unsigned char identifier[16]) {
// Return the non-directory portion of FILENAME: the portion after the
// last slash, or the whole filename if there are no slashes.
std::string BaseFileName(const std::string &filename) {
string BaseFileName(const string &filename) {
// Lots of copies! basename's behavior is less than ideal.
char *c_filename = strdup(filename.c_str());
std::string base = basename(c_filename);
string base = basename(c_filename);
free(c_filename);
return base;
}
@ -726,8 +727,8 @@ namespace google_breakpad {
// Ideally obj_file would be const, but internally this code does write
// to some ELF header fields to make its work simpler.
bool WriteSymbolFileInternal(uint8_t* obj_file,
const std::string &obj_filename,
const std::string &debug_dir,
const string &obj_filename,
const string &debug_dir,
bool cfi,
std::ostream &sym_stream) {
ElfW(Ehdr) *elf_header = reinterpret_cast<ElfW(Ehdr) *>(obj_file);
@ -757,15 +758,15 @@ bool WriteSymbolFileInternal(uint8_t* obj_file,
if (!ElfEndianness(elf_header, &big_endian))
return false;
std::string name = BaseFileName(obj_filename);
std::string os = "Linux";
std::string id = FormatIdentifier(identifier);
string name = BaseFileName(obj_filename);
string os = "Linux";
string id = FormatIdentifier(identifier);
LoadSymbolsInfo info(debug_dir);
Module module(name, os, architecture, id);
if (!LoadSymbols(obj_filename, big_endian, elf_header, !debug_dir.empty(),
&info, &module)) {
const std::string debuglink_file = info.debuglink_file();
const string debuglink_file = info.debuglink_file();
if (debuglink_file.empty())
return false;
@ -810,8 +811,8 @@ bool WriteSymbolFileInternal(uint8_t* obj_file,
return true;
}
bool WriteSymbolFile(const std::string &obj_file,
const std::string &debug_dir,
bool WriteSymbolFile(const string &obj_file,
const string &debug_dir,
bool cfi,
std::ostream &sym_stream) {
MmapWrapper map_wrapper;

View file

@ -38,6 +38,8 @@
#include <iostream>
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
// Find all the debugging information in OBJ_FILE, an ELF executable
@ -46,8 +48,8 @@ namespace google_breakpad {
// If OBJ_FILE has been stripped but contains a .gnu_debuglink section,
// then look for the debug file in DEBUG_DIR.
// If CFI is set to false, then omit the CFI section.
bool WriteSymbolFile(const std::string &obj_file,
const std::string &debug_dir,
bool WriteSymbolFile(const string &obj_file,
const string &debug_dir,
bool cfi,
std::ostream &sym_stream);

View file

@ -42,11 +42,12 @@
#include "breakpad_googletest_includes.h"
#include "common/linux/synth_elf.h"
#include "common/using_std_string.h"
namespace google_breakpad {
bool WriteSymbolFileInternal(uint8_t* obj_file,
const std::string &obj_filename,
const std::string &debug_dir,
const string &obj_filename,
const string &debug_dir,
bool cfi,
std::ostream &sym_stream);
}
@ -57,7 +58,6 @@ using google_breakpad::synth_elf::SymbolTable;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Section;
using google_breakpad::WriteSymbolFileInternal;
using std::string;
using std::stringstream;
using std::vector;
using ::testing::Test;

View file

@ -39,6 +39,7 @@
#include "common/linux/memory_mapped_file.h"
#include "common/tests/file_utils.h"
#include "common/linux/tests/crash_generator.h"
#include "common/using_std_string.h"
using google_breakpad::AutoTempDir;
using google_breakpad::CrashGenerator;
@ -47,7 +48,6 @@ using google_breakpad::MemoryMappedFile;
using google_breakpad::MemoryRange;
using google_breakpad::WriteFile;
using std::set;
using std::string;
TEST(ElfCoreDumpTest, DefaultConstructor) {
ElfCoreDump core;

View file

@ -42,6 +42,7 @@
#include "common/linux/synth_elf.h"
#include "common/module.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
using google_breakpad::Module;
using google_breakpad::synth_elf::StringTable;
@ -52,7 +53,6 @@ using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using ::testing::Test;
using ::testing::TestWithParam;
using std::string;
using std::vector;
class ELFSymbolsToModuleTestFixture {

View file

@ -32,11 +32,14 @@
#include <elf.h>
#include <stdlib.h>
#include <string>
#include "common/linux/file_id.h"
#include "common/linux/safe_readlink.h"
#include "common/linux/synth_elf.h"
#include "common/test_assembler.h"
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
#include "breakpad_googletest_includes.h"
using namespace google_breakpad;
@ -67,7 +70,7 @@ TEST(FileIDStripTest, StripSelf) {
// copy our binary to a temp file, and strip it
AutoTempDir temp_dir;
std::string templ = temp_dir.path() + "/file-id-unittest";
string templ = temp_dir.path() + "/file-id-unittest";
char cmdline[4096];
sprintf(cmdline, "cp \"%s\" \"%s\"", exe_name, templ.c_str());
ASSERT_EQ(system(cmdline), 0);

View file

@ -37,21 +37,21 @@
#include <iostream>
using std::string;
#include "common/using_std_string.h"
namespace google_breakpad {
GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product,
const std::string& version,
const std::string& guid,
const std::string& ptime,
const std::string& ctime,
const std::string& email,
const std::string& comments,
const std::string& minidump_pathname,
const std::string& crash_server,
const std::string& proxy_host,
const std::string& proxy_userpassword) {
GoogleCrashdumpUploader::GoogleCrashdumpUploader(const string& product,
const string& version,
const string& guid,
const string& ptime,
const string& ctime,
const string& email,
const string& comments,
const string& minidump_pathname,
const string& crash_server,
const string& proxy_host,
const string& proxy_userpassword) {
LibcurlWrapper* http_layer = new LibcurlWrapper();
Init(product,
version,
@ -67,17 +67,17 @@ GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product,
http_layer);
}
GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product,
const std::string& version,
const std::string& guid,
const std::string& ptime,
const std::string& ctime,
const std::string& email,
const std::string& comments,
const std::string& minidump_pathname,
const std::string& crash_server,
const std::string& proxy_host,
const std::string& proxy_userpassword,
GoogleCrashdumpUploader::GoogleCrashdumpUploader(const string& product,
const string& version,
const string& guid,
const string& ptime,
const string& ctime,
const string& email,
const string& comments,
const string& minidump_pathname,
const string& crash_server,
const string& proxy_host,
const string& proxy_userpassword,
LibcurlWrapper* http_layer) {
Init(product,
version,
@ -93,17 +93,17 @@ GoogleCrashdumpUploader::GoogleCrashdumpUploader(const std::string& product,
http_layer);
}
void GoogleCrashdumpUploader::Init(const std::string& product,
const std::string& version,
const std::string& guid,
const std::string& ptime,
const std::string& ctime,
const std::string& email,
const std::string& comments,
const std::string& minidump_pathname,
const std::string& crash_server,
const std::string& proxy_host,
const std::string& proxy_userpassword,
void GoogleCrashdumpUploader::Init(const string& product,
const string& version,
const string& guid,
const string& ptime,
const string& ctime,
const string& email,
const string& comments,
const string& minidump_pathname,
const string& crash_server,
const string& proxy_host,
const string& proxy_userpassword,
LibcurlWrapper* http_layer) {
product_ = product;
version_ = version;
@ -137,7 +137,7 @@ void GoogleCrashdumpUploader::Init(const std::string& product,
}
bool GoogleCrashdumpUploader::CheckRequiredParametersArePresent() {
std::string error_text;
string error_text;
if (product_.empty()) {
error_text.append("\nProduct name must be specified.");
}

View file

@ -31,48 +31,50 @@
#include <string>
#include <map>
#include "common/using_std_string.h"
namespace google_breakpad {
class LibcurlWrapper;
class GoogleCrashdumpUploader {
public:
GoogleCrashdumpUploader(const std::string& product,
const std::string& version,
const std::string& guid,
const std::string& ptime,
const std::string& ctime,
const std::string& email,
const std::string& comments,
const std::string& minidump_pathname,
const std::string& crash_server,
const std::string& proxy_host,
const std::string& proxy_userpassword);
GoogleCrashdumpUploader(const string& product,
const string& version,
const string& guid,
const string& ptime,
const string& ctime,
const string& email,
const string& comments,
const string& minidump_pathname,
const string& crash_server,
const string& proxy_host,
const string& proxy_userpassword);
GoogleCrashdumpUploader(const std::string& product,
const std::string& version,
const std::string& guid,
const std::string& ptime,
const std::string& ctime,
const std::string& email,
const std::string& comments,
const std::string& minidump_pathname,
const std::string& crash_server,
const std::string& proxy_host,
const std::string& proxy_userpassword,
GoogleCrashdumpUploader(const string& product,
const string& version,
const string& guid,
const string& ptime,
const string& ctime,
const string& email,
const string& comments,
const string& minidump_pathname,
const string& crash_server,
const string& proxy_host,
const string& proxy_userpassword,
LibcurlWrapper* http_layer);
void Init(const std::string& product,
const std::string& version,
const std::string& guid,
const std::string& ptime,
const std::string& ctime,
const std::string& email,
const std::string& comments,
const std::string& minidump_pathname,
const std::string& crash_server,
const std::string& proxy_host,
const std::string& proxy_userpassword,
void Init(const string& product,
const string& version,
const string& guid,
const string& ptime,
const string& ctime,
const string& email,
const string& comments,
const string& minidump_pathname,
const string& crash_server,
const string& proxy_host,
const string& proxy_userpassword,
LibcurlWrapper* http_layer);
bool Upload();
@ -80,19 +82,19 @@ class GoogleCrashdumpUploader {
bool CheckRequiredParametersArePresent();
LibcurlWrapper* http_layer_;
std::string product_;
std::string version_;
std::string guid_;
std::string ptime_;
std::string ctime_;
std::string email_;
std::string comments_;
std::string minidump_pathname_;
string product_;
string version_;
string guid_;
string ptime_;
string ctime_;
string email_;
string comments_;
string minidump_pathname_;
std::string crash_server_;
std::string proxy_host_;
std::string proxy_userpassword_;
string crash_server_;
string proxy_host_;
string proxy_userpassword_;
std::map<std::string, std::string> parameters_;
std::map<string, string> parameters_;
};
}

View file

@ -29,9 +29,12 @@
// Unit test for crash dump uploader.
#include <string>
#include "common/linux/google_crashdump_uploader.h"
#include "common/linux/libcurl_wrapper.h"
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
namespace google_breakpad {
@ -41,14 +44,14 @@ using ::testing::_;
class MockLibcurlWrapper : public LibcurlWrapper {
public:
MOCK_METHOD0(Init, bool());
MOCK_METHOD2(SetProxy, bool(const std::string& proxy_host,
const std::string& proxy_userpwd));
MOCK_METHOD2(AddFile, bool(const std::string& upload_file_path,
const std::string& basename));
MOCK_METHOD2(SetProxy, bool(const string& proxy_host,
const string& proxy_userpwd));
MOCK_METHOD2(AddFile, bool(const string& upload_file_path,
const string& basename));
MOCK_METHOD3(SendRequest,
bool(const std::string& url,
const std::map<std::string, std::string>& parameters,
std::string* server_response));
bool(const string& url,
const std::map<string, string>& parameters,
string* server_response));
};
class GoogleCrashdumpUploaderTest : public ::testing::Test {

View file

@ -41,7 +41,7 @@ static size_t WriteCallback(void *ptr, size_t size,
if (!userp)
return 0;
std::string *response = reinterpret_cast<std::string *>(userp);
string *response = reinterpret_cast<string *>(userp);
size_t real_size = size * nmemb;
response->append(reinterpret_cast<char *>(ptr), real_size);
return real_size;

View file

@ -37,9 +37,10 @@
#include <map>
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
using std::string;
using std::map;
class HTTPUpload {

View file

@ -33,8 +33,7 @@
#include <string>
#include "common/linux/libcurl_wrapper.h"
using std::string;
#include "common/using_std_string.h"
namespace google_breakpad {
LibcurlWrapper::LibcurlWrapper()
@ -58,8 +57,8 @@ LibcurlWrapper::LibcurlWrapper()
return;
}
bool LibcurlWrapper::SetProxy(const std::string& proxy_host,
const std::string& proxy_userpwd) {
bool LibcurlWrapper::SetProxy(const string& proxy_host,
const string& proxy_userpwd) {
if (!init_ok_) {
return false;
}
@ -80,8 +79,8 @@ bool LibcurlWrapper::SetProxy(const std::string& proxy_host,
return true;
}
bool LibcurlWrapper::AddFile(const std::string& upload_file_path,
const std::string& basename) {
bool LibcurlWrapper::AddFile(const string& upload_file_path,
const string& basename) {
if (!init_ok_) {
return false;
}
@ -101,17 +100,17 @@ static size_t WriteCallback(void *ptr, size_t size,
if (!userp)
return 0;
std::string *response = reinterpret_cast<std::string *>(userp);
string *response = reinterpret_cast<string *>(userp);
size_t real_size = size * nmemb;
response->append(reinterpret_cast<char *>(ptr), real_size);
return real_size;
}
bool LibcurlWrapper::SendRequest(const std::string& url,
const std::map<std::string, std::string>& parameters,
std::string* server_response) {
bool LibcurlWrapper::SendRequest(const string& url,
const std::map<string, string>& parameters,
string* server_response) {
(*easy_setopt_)(curl_, CURLOPT_URL, url.c_str());
std::map<std::string, std::string>::const_iterator iter = parameters.begin();
std::map<string, string>::const_iterator iter = parameters.begin();
for (; iter != parameters.end(); ++iter)
(*formadd_)(&formpost_, &lastptr_,
CURLFORM_COPYNAME, iter->first.c_str(),

View file

@ -33,6 +33,7 @@
#include <string>
#include <map>
#include "common/using_std_string.h"
#include "third_party/curl/curl.h"
namespace google_breakpad {
@ -40,13 +41,13 @@ class LibcurlWrapper {
public:
LibcurlWrapper();
virtual bool Init();
virtual bool SetProxy(const std::string& proxy_host,
const std::string& proxy_userpwd);
virtual bool AddFile(const std::string& upload_file_path,
const std::string& basename);
virtual bool SendRequest(const std::string& url,
const std::map<std::string, std::string>& parameters,
std::string* server_response);
virtual bool SetProxy(const string& proxy_host,
const string& proxy_userpwd);
virtual bool AddFile(const string& upload_file_path,
const string& basename);
virtual bool SendRequest(const string& url,
const std::map<string, string>& parameters,
string* server_response);
private:
// This function initializes class state corresponding to function
// pointers into the CURL library.
@ -55,7 +56,7 @@ class LibcurlWrapper {
bool init_ok_; // Whether init succeeded
void* curl_lib_; // Pointer to result of dlopen() on
// curl library
std::string last_curl_error_; // The text of the last error when
string last_curl_error_; // The text of the last error when
// dealing
// with CURL.

View file

@ -41,11 +41,11 @@
#include "common/linux/memory_mapped_file.h"
#include "common/tests/auto_tempdir.h"
#include "common/tests/file_utils.h"
#include "common/using_std_string.h"
using google_breakpad::AutoTempDir;
using google_breakpad::MemoryMappedFile;
using google_breakpad::WriteFile;
using std::string;
namespace {

View file

@ -5,6 +5,8 @@
#include <stdio.h>
#include <string.h>
#include "common/using_std_string.h"
namespace google_breakpad {
namespace synth_elf {

View file

@ -43,13 +43,14 @@
#include <string>
#include <utility>
#include "common/using_std_string.h"
namespace google_breakpad {
namespace synth_elf {
using std::list;
using std::map;
using std::pair;
using std::string;
using test_assembler::Endianness;
using test_assembler::kLittleEndian;
using test_assembler::kUnsetEndian;

View file

@ -36,6 +36,7 @@
#include "breakpad_googletest_includes.h"
#include "common/linux/synth_elf.h"
#include "common/using_std_string.h"
using google_breakpad::synth_elf::ELF;
using google_breakpad::synth_elf::StringTable;
@ -44,7 +45,6 @@ using google_breakpad::test_assembler::Endianness;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Label;
using std::string;
using ::testing::Test;
class StringTableTest : public Test {

View file

@ -46,6 +46,7 @@
#include "common/linux/eintr_wrapper.h"
#include "common/tests/auto_tempdir.h"
#include "common/tests/file_utils.h"
#include "common/using_std_string.h"
namespace {
@ -97,11 +98,11 @@ bool CrashGenerator::HasDefaultCorePattern() const {
buffer_size == 5 && memcmp(buffer, "core", 4) == 0;
}
std::string CrashGenerator::GetCoreFilePath() const {
string CrashGenerator::GetCoreFilePath() const {
return temp_dir_.path() + "/core";
}
std::string CrashGenerator::GetDirectoryOfProcFilesCopy() const {
string CrashGenerator::GetDirectoryOfProcFilesCopy() const {
return temp_dir_.path() + "/proc";
}
@ -170,7 +171,7 @@ bool CrashGenerator::CreateChildCrash(
}
if (SetCoreFileSizeLimit(kCoreSizeLimit)) {
CreateThreadsInChildProcess(num_threads);
std::string proc_dir = GetDirectoryOfProcFilesCopy();
string proc_dir = GetDirectoryOfProcFilesCopy();
if (mkdir(proc_dir.c_str(), 0755) == -1) {
perror("CrashGenerator: Failed to create proc directory");
exit(1);

View file

@ -38,6 +38,7 @@
#include <string>
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
namespace google_breakpad {
@ -59,10 +60,10 @@ class CrashGenerator {
bool HasDefaultCorePattern() const;
// Returns the expected path of the core dump file.
std::string GetCoreFilePath() const;
string GetCoreFilePath() const;
// Returns the directory of a copy of proc files of the child process.
std::string GetDirectoryOfProcFilesCopy() const;
string GetDirectoryOfProcFilesCopy() const;
// Creates a crash (and a core dump file) by creating a child process with
// |num_threads| threads, and the terminating the child process by sending