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

@ -170,7 +170,7 @@ CrashGenerationServer::CrashGenerationServer(
OnClientExitingCallback exit_callback,
void* exit_context,
bool generate_dumps,
const std::string* dump_path) :
const string* dump_path) :
server_fd_(listen_fd),
dump_callback_(dump_callback),
dump_context_(dump_context),
@ -384,7 +384,7 @@ CrashGenerationServer::ClientEvent(short revents)
return true;
}
std::string minidump_filename;
string minidump_filename;
if (!MakeMinidumpFilename(minidump_filename))
return true;
@ -440,7 +440,7 @@ CrashGenerationServer::ControlEvent(short revents)
}
bool
CrashGenerationServer::MakeMinidumpFilename(std::string& outFilename)
CrashGenerationServer::MakeMinidumpFilename(string& outFilename)
{
GUID guid;
char guidString[kGUIDStringLength+1];

View file

@ -34,6 +34,8 @@
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
class ClientInfo;
@ -45,7 +47,7 @@ public:
// be thread safe.
typedef void (*OnClientDumpRequestCallback)(void* context,
const ClientInfo* client_info,
const std::string* file_path);
const string* file_path);
typedef void (*OnClientExitingCallback)(void* context,
const ClientInfo* client_info);
@ -69,7 +71,7 @@ public:
OnClientExitingCallback exit_callback,
void* exit_context,
bool generate_dumps,
const std::string* dump_path);
const string* dump_path);
~CrashGenerationServer();
@ -100,7 +102,7 @@ private:
bool ControlEvent(short revents);
// Return a unique filename at which a minidump can be written
bool MakeMinidumpFilename(std::string& outFilename);
bool MakeMinidumpFilename(string& outFilename);
// Trampoline to |Run()|
static void* ThreadMain(void* arg);
@ -115,7 +117,7 @@ private:
bool generate_dumps_;
std::string dump_dir_;
string dump_dir_;
bool started_;

View file

@ -126,7 +126,7 @@ pthread_mutex_t ExceptionHandler::handler_stack_mutex_ =
PTHREAD_MUTEX_INITIALIZER;
// Runs before crashing: normal context.
ExceptionHandler::ExceptionHandler(const std::string &dump_path,
ExceptionHandler::ExceptionHandler(const string &dump_path,
FilterCallback filter,
MinidumpCallback callback,
void *callback_context,
@ -139,7 +139,7 @@ ExceptionHandler::ExceptionHandler(const std::string &dump_path,
Init(dump_path, -1);
}
ExceptionHandler::ExceptionHandler(const std::string &dump_path,
ExceptionHandler::ExceptionHandler(const string &dump_path,
FilterCallback filter,
MinidumpCallback callback,
void* callback_context,
@ -158,7 +158,7 @@ ExceptionHandler::~ExceptionHandler() {
UninstallHandlers();
}
void ExceptionHandler::Init(const std::string &dump_path,
void ExceptionHandler::Init(const string &dump_path,
const int server_fd)
{
crash_handler_ = NULL;
@ -469,7 +469,7 @@ bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context,
}
// static
bool ExceptionHandler::WriteMinidump(const std::string &dump_path,
bool ExceptionHandler::WriteMinidump(const string &dump_path,
MinidumpCallback callback,
void* callback_context) {
ExceptionHandler eh(dump_path, NULL, callback, callback_context, false);
@ -497,7 +497,7 @@ bool ExceptionHandler::WriteMinidump() {
#endif // !defined(__ARM_EABI__)
}
void ExceptionHandler::AddMappingInfo(const std::string& name,
void ExceptionHandler::AddMappingInfo(const string& name,
const u_int8_t identifier[sizeof(MDGUID)],
uintptr_t start_address,
size_t mapping_size,

View file

@ -43,6 +43,7 @@
#endif
#include "client/linux/crash_generation/crash_generation_client.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "processor/scoped_ptr.h"
@ -127,7 +128,7 @@ class ExceptionHandler {
// If install_handler is true, then a minidump will be written whenever
// an unhandled exception occurs. If it is false, minidumps will only
// be written when WriteMinidump is called.
ExceptionHandler(const std::string &dump_path,
ExceptionHandler(const string &dump_path,
FilterCallback filter, MinidumpCallback callback,
void *callback_context,
bool install_handler);
@ -137,7 +138,7 @@ class ExceptionHandler {
// server_fd is invalid, in-process dump generation will be
// used. See the above ctor for a description of the other
// parameters.
ExceptionHandler(const std::string& dump_path,
ExceptionHandler(const string& dump_path,
FilterCallback filter, MinidumpCallback callback,
void* callback_context,
bool install_handler,
@ -146,8 +147,8 @@ class ExceptionHandler {
~ExceptionHandler();
// Get and set the minidump path.
std::string dump_path() const { return dump_path_; }
void set_dump_path(const std::string &dump_path) {
string dump_path() const { return dump_path_; }
void set_dump_path(const string &dump_path) {
dump_path_ = dump_path;
dump_path_c_ = dump_path_.c_str();
UpdateNextID();
@ -163,7 +164,7 @@ class ExceptionHandler {
// Convenience form of WriteMinidump which does not require an
// ExceptionHandler instance.
static bool WriteMinidump(const std::string &dump_path,
static bool WriteMinidump(const string &dump_path,
MinidumpCallback callback,
void *callback_context);
@ -187,14 +188,14 @@ class ExceptionHandler {
// Add information about a memory mapping. This can be used if
// a custom library loader is used that maps things in a way
// that the linux dumper can't handle by reading the maps file.
void AddMappingInfo(const std::string& name,
void AddMappingInfo(const string& name,
const u_int8_t identifier[sizeof(MDGUID)],
uintptr_t start_address,
size_t mapping_size,
size_t file_offset);
private:
void Init(const std::string &dump_path,
void Init(const string &dump_path,
const int server_fd);
bool InstallHandlers();
void UninstallHandlers();
@ -216,9 +217,9 @@ class ExceptionHandler {
scoped_ptr<CrashGenerationClient> crash_generation_client_;
std::string dump_path_;
std::string next_minidump_path_;
std::string next_minidump_id_;
string dump_path_;
string next_minidump_path_;
string next_minidump_id_;
// Pointers to C-string representations of the above. These are set
// when the above are set so we can avoid calling c_str during

View file

@ -45,6 +45,7 @@
#include "common/linux/file_id.h"
#include "common/linux/linux_libc_support.h"
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
#include "third_party/lss/linux_syscall_support.h"
#include "google_breakpad/processor/minidump.h"
@ -130,7 +131,7 @@ TEST(ExceptionHandlerTest, ChildCrash) {
filename[len] = 0;
close(fds[0]);
const std::string minidump_filename = temp_dir.path() + "/" + filename +
const string minidump_filename = temp_dir.path() + "/" + filename +
".dmp";
struct stat st;
@ -204,7 +205,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) {
filename[len] = 0;
close(fds[0]);
const std::string minidump_filename = temp_dir.path() + "/" + filename +
const string minidump_filename = temp_dir.path() + "/" + filename +
".dmp";
struct stat st;
@ -329,7 +330,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
filename[len] = 0;
close(fds[0]);
const std::string minidump_filename = temp_dir.path() + "/" + filename +
const string minidump_filename = temp_dir.path() + "/" + filename +
".dmp";
struct stat st;
@ -454,7 +455,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
filename[len] = 0;
close(fds[0]);
const std::string minidump_filename = temp_dir.path() + "/" + filename +
const string minidump_filename = temp_dir.path() + "/" + filename +
".dmp";
struct stat st;
@ -555,7 +556,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryNullPointer) {
filename[len] = 0;
close(fds[0]);
const std::string minidump_filename = temp_dir.path() + "/" + filename +
const string minidump_filename = temp_dir.path() + "/" + filename +
".dmp";
struct stat st;
@ -767,7 +768,7 @@ TEST(ExceptionHandlerTest, ExternalDumper) {
ASSERT_NE(signal_fd, -1);
AutoTempDir temp_dir;
std::string templ = temp_dir.path() + "/exception-handler-unittest";
string templ = temp_dir.path() + "/exception-handler-unittest";
ASSERT_TRUE(WriteMinidump(templ.c_str(), crashing_pid, context,
kCrashContextSize));
static const char b = 0;

View file

@ -35,6 +35,7 @@
#include <sys/types.h>
#include "client/linux/minidump_writer/directory_reader.h"
#include "common/using_std_string.h"
#include "breakpad_googletest_includes.h"
using namespace google_breakpad;
@ -44,7 +45,7 @@ typedef testing::Test DirectoryReaderTest;
}
TEST(DirectoryReaderTest, CompareResults) {
std::set<std::string> dent_set;
std::set<string> dent_set;
DIR *const dir = opendir("/proc/self");
ASSERT_TRUE(dir != NULL);

View file

@ -30,11 +30,13 @@
// linux_core_dumper_unittest.cc:
// Unit tests for google_breakpad::LinuxCoreDumoer.
#include <string>
#include "breakpad_googletest_includes.h"
#include "client/linux/minidump_writer/linux_core_dumper.h"
#include "common/linux/tests/crash_generator.h"
#include "common/using_std_string.h"
using std::string;
using namespace google_breakpad;
TEST(LinuxCoreDumperTest, BuildProcPath) {

View file

@ -51,8 +51,8 @@
#include "common/linux/file_id.h"
#include "common/linux/safe_readlink.h"
#include "common/memory.h"
#include "common/using_std_string.h"
using std::string;
using namespace google_breakpad;
namespace {

View file

@ -44,6 +44,7 @@
#include "common/linux/file_id.h"
#include "common/linux/safe_readlink.h"
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/minidump.h"
using namespace google_breakpad;
@ -74,7 +75,7 @@ TEST(MinidumpWriterTest, Setup) {
memset(&context, 0, sizeof(context));
AutoTempDir temp_dir;
std::string templ = temp_dir.path() + "/minidump-writer-unittest";
string templ = temp_dir.path() + "/minidump-writer-unittest";
// Set a non-zero tid to avoid tripping asserts.
context.tid = 1;
ASSERT_TRUE(WriteMinidump(templ.c_str(), child, &context, sizeof(context)));
@ -139,7 +140,7 @@ TEST(MinidumpWriterTest, MappingInfo) {
context.tid = 1;
AutoTempDir temp_dir;
std::string templ = temp_dir.path() + "/minidump-writer-unittest";
string templ = temp_dir.path() + "/minidump-writer-unittest";
// Add information about the mapped memory.
MappingInfo info;
@ -207,7 +208,7 @@ TEST(MinidumpWriterTest, MappingInfoContained) {
// mmap a file
AutoTempDir temp_dir;
std::string tempfile = temp_dir.path() + "/minidump-writer-unittest-temp";
string tempfile = temp_dir.path() + "/minidump-writer-unittest-temp";
int fd = open(tempfile.c_str(), O_RDWR | O_CREAT, 0);
ASSERT_NE(-1, fd);
unlink(tempfile.c_str());
@ -242,7 +243,7 @@ TEST(MinidumpWriterTest, MappingInfoContained) {
memset(&context, 0, sizeof(context));
context.tid = 1;
std::string dumpfile = temp_dir.path() + "/minidump-writer-unittest";
string dumpfile = temp_dir.path() + "/minidump-writer-unittest";
// Add information about the mapped memory. Report it as being larger than
// it actually is.
@ -303,7 +304,7 @@ TEST(MinidumpWriterTest, DeletedBinary) {
// Copy binary to a temp file.
AutoTempDir temp_dir;
std::string binpath = temp_dir.path() + "/linux-dumper-unittest-helper";
string binpath = temp_dir.path() + "/linux-dumper-unittest-helper";
char cmdline[2 * PATH_MAX];
sprintf(cmdline, "/bin/cp \"%s\" \"%s\"", helper_path.c_str(),
binpath.c_str());
@ -349,7 +350,7 @@ TEST(MinidumpWriterTest, DeletedBinary) {
ExceptionHandler::CrashContext context;
memset(&context, 0, sizeof(context));
std::string templ = temp_dir.path() + "/minidump-writer-unittest";
string templ = temp_dir.path() + "/minidump-writer-unittest";
// Set a non-zero tid to avoid tripping asserts.
context.tid = 1;
ASSERT_TRUE(WriteMinidump(templ.c_str(), child_pid, &context,

View file

@ -32,7 +32,7 @@
#include <string>
#include <iostream>
using std::string;
#include "common/using_std_string.h"
DEFINE_string(crash_server, "https://clients2.google.com/cr",
"The crash server to upload minidumps to.");
@ -59,7 +59,7 @@ DEFINE_string(proxy_userpasswd, "",
bool CheckForRequiredFlagsOrDie() {
std::string error_text = "";
string error_text = "";
if (FLAGS_product_name.empty()) {
error_text.append("\nProduct name must be specified.");
}

View file

@ -45,6 +45,8 @@
#include <string.h>
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
// A buffer holding a series of bytes.
@ -164,7 +166,7 @@ class ByteCursor {
// byte buffer does not contain a terminating zero, clear this cursor's
// complete_ flag, and set STR to the empty string. Return a reference to
// this cursor.
ByteCursor &CString(std::string *str) {
ByteCursor &CString(string *str) {
const uint8_t *end
= static_cast<const uint8_t *>(memchr(here_, '\0', Available()));
if (end) {
@ -191,7 +193,7 @@ class ByteCursor {
//
// - Otherwise, set *STR to a copy of those LIMIT bytes, and advance the
// cursor by LIMIT bytes.
ByteCursor &CString(std::string *str, size_t limit) {
ByteCursor &CString(string *str, size_t limit) {
if (CheckAvailable(limit)) {
const uint8_t *end
= static_cast<const uint8_t *>(memchr(here_, '\0', limit));

View file

@ -36,12 +36,12 @@
#include <string.h>
#include "common/byte_cursor.h"
#include "breakpad_googletest_includes.h"
#include "common/byte_cursor.h"
#include "common/using_std_string.h"
using google_breakpad::ByteBuffer;
using google_breakpad::ByteCursor;
using std::string;
TEST(Buffer, SizeOfNothing) {
uint8_t data[1];

View file

@ -37,6 +37,7 @@
#include "common/dwarf/bytereader.h"
#include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/cfi_assembler.h"
#include "common/using_std_string.h"
using dwarf2reader::ByteReader;
using dwarf2reader::DwarfPointerEncoding;
@ -47,7 +48,6 @@ using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Section;
using std::string;
using testing::Test;
struct ReaderFixture {

View file

@ -41,6 +41,7 @@
#include "common/dwarf/dwarf2enums.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
@ -49,7 +50,6 @@ using dwarf2reader::DwarfPointerEncoding;
using google_breakpad::test_assembler::Endianness;
using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using std::string;
class CFISection: public Section {
public:

View file

@ -31,10 +31,13 @@
// dwarf2diehandler.cc: Implement the dwarf2reader::DieDispatcher class.
// See dwarf2diehandler.h for details.
#include "common/dwarf/dwarf2diehandler.h"
#include <assert.h>
#include <string>
#include "common/dwarf/dwarf2diehandler.h"
#include "common/using_std_string.h"
namespace dwarf2reader {
DIEDispatcher::~DIEDispatcher() {
@ -176,7 +179,7 @@ void DIEDispatcher::ProcessAttributeBuffer(uint64 offset,
void DIEDispatcher::ProcessAttributeString(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const std::string& data) {
const string& data) {
HandlerStack &current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);

View file

@ -157,10 +157,12 @@
#define COMMON_DWARF_DWARF2DIEHANDLER_H__
#include <stack>
#include <string>
#include "common/dwarf/types.h"
#include "common/dwarf/dwarf2enums.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
namespace dwarf2reader {
@ -208,7 +210,7 @@ class DIEHandler {
uint64 len) { }
virtual void ProcessAttributeString(enum DwarfAttribute attr,
enum DwarfForm form,
const std::string& data) { }
const string& data) { }
virtual void ProcessAttributeSignature(enum DwarfAttribute attr,
enum DwarfForm form,
uint64 signture) { }
@ -316,7 +318,7 @@ class DIEDispatcher: public Dwarf2Handler {
void ProcessAttributeString(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const std::string &data);
const string &data);
void ProcessAttributeSignature(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,

View file

@ -38,9 +38,9 @@
#include "breakpad_googletest_includes.h"
#include "common/dwarf/dwarf2diehandler.h"
#include "common/using_std_string.h"
using std::make_pair;
using std::string;
using ::testing::_;
using ::testing::ContainerEq;

View file

@ -41,11 +41,13 @@
#include <map>
#include <memory>
#include <stack>
#include <string>
#include <utility>
#include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/bytereader.h"
#include "common/dwarf/line_state_machine.h"
#include "common/using_std_string.h"
namespace dwarf2reader {
@ -1004,7 +1006,7 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule {
// Rule: EXPRESSION evaluates to the address at which the register is saved.
class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
public:
explicit ExpressionRule(const std::string &expression)
explicit ExpressionRule(const string &expression)
: expression_(expression) { }
~ExpressionRule() { }
bool Handle(Handler *handler, uint64 address, int reg) const {
@ -1018,13 +1020,13 @@ class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
}
Rule *Copy() const { return new ExpressionRule(*this); }
private:
std::string expression_;
string expression_;
};
// Rule: EXPRESSION evaluates to the address at which the register is saved.
class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
public:
explicit ValExpressionRule(const std::string &expression)
explicit ValExpressionRule(const string &expression)
: expression_(expression) { }
~ValExpressionRule() { }
bool Handle(Handler *handler, uint64 address, int reg) const {
@ -1039,7 +1041,7 @@ class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
}
Rule *Copy() const { return new ValExpressionRule(*this); }
private:
std::string expression_;
string expression_;
};
// A map from register numbers to rules.
@ -1220,7 +1222,7 @@ class CallFrameInfo::State {
unsigned register_number; // A register number.
uint64 offset; // An offset or address.
long signed_offset; // A signed offset.
std::string expression; // A DWARF expression.
string expression; // A DWARF expression.
};
// Parse CFI instruction operands from STATE's instruction stream as
@ -1407,7 +1409,7 @@ bool CallFrameInfo::State::ParseOperands(const char *format,
if (len > bytes_left || expression_length > bytes_left - len)
return ReportIncomplete();
cursor_ += len;
operands->expression = std::string(cursor_, expression_length);
operands->expression = string(cursor_, expression_length);
cursor_ += expression_length;
break;
}
@ -1872,7 +1874,7 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
memchr(augmentation_start, '\0', cie->end - augmentation_start);
if (! augmentation_end) return ReportIncomplete(cie);
cursor = static_cast<const char *>(augmentation_end);
cie->augmentation = std::string(augmentation_start,
cie->augmentation = string(augmentation_start,
cursor - augmentation_start);
// Skip the terminating '\0'.
cursor++;
@ -2260,7 +2262,7 @@ void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) {
}
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
const std::string &aug) {
const string &aug) {
fprintf(stderr,
"%s: CFI frame description entry at offset 0x%llx in '%s':"
" CIE specifies unrecognized augmentation: '%s'\n",

View file

@ -49,6 +49,7 @@
#include "common/dwarf/bytereader.h"
#include "common/dwarf/dwarf2enums.h"
#include "common/dwarf/types.h"
#include "common/using_std_string.h"
namespace dwarf2reader {
struct LineStateMachine;
@ -57,7 +58,7 @@ class LineInfoHandler;
// This maps from a string naming a section to a pair containing a
// the data for the section, and the size of the section.
typedef std::map<std::string, std::pair<const char*, uint64> > SectionMap;
typedef std::map<string, std::pair<const char*, uint64> > SectionMap;
typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> >
AttributeList;
typedef AttributeList::iterator AttributeIterator;
@ -156,7 +157,7 @@ class LineInfoHandler {
// Called when we define a directory. NAME is the directory name,
// DIR_NUM is the directory number
virtual void DefineDir(const std::string& name, uint32 dir_num) { }
virtual void DefineDir(const string& name, uint32 dir_num) { }
// Called when we define a filename. NAME is the filename, FILE_NUM
// is the file number which is -1 if the file index is the next
@ -165,7 +166,7 @@ class LineInfoHandler {
// directory index for the directory name of this file, MOD_TIME is
// the modification time of the file, and LENGTH is the length of
// the file
virtual void DefineFile(const std::string& name, int32 file_num,
virtual void DefineFile(const string& name, int32 file_num,
uint32 dir_num, uint64 mod_time,
uint64 length) { }
@ -391,7 +392,7 @@ class Dwarf2Handler {
virtual void ProcessAttributeString(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const std::string& data) { }
const string& data) { }
// Called when we have an attribute whose value is the 64-bit signature
// of a type unit in the .debug_types section. OFFSET is the offset of
@ -699,7 +700,7 @@ class CallFrameInfo {
// A common information entry (CIE).
struct CIE: public Entry {
uint8 version; // CFI data version number
std::string augmentation; // vendor format extension markers
string augmentation; // vendor format extension markers
uint64 code_alignment_factor; // scale for code address adjustments
int data_alignment_factor; // scale for stack pointer adjustments
unsigned return_address_register; // which register holds the return addr
@ -833,7 +834,7 @@ class CallFrameInfo::Handler {
// process a given FDE, the parser reiterates the appropriate CIE's
// contents at the beginning of the FDE's rules.
virtual bool Entry(size_t offset, uint64 address, uint64 length,
uint8 version, const std::string &augmentation,
uint8 version, const string &augmentation,
unsigned return_address) = 0;
// When the Entry function returns true, the parser calls these
@ -882,13 +883,13 @@ class CallFrameInfo::Handler {
// At ADDRESS, the DWARF expression EXPRESSION yields the address at
// which REG was saved.
virtual bool ExpressionRule(uint64 address, int reg,
const std::string &expression) = 0;
const string &expression) = 0;
// At ADDRESS, the DWARF expression EXPRESSION yields the caller's
// value for REG. (This rule doesn't provide an address at which the
// register's value is saved.)
virtual bool ValExpressionRule(uint64 address, int reg,
const std::string &expression) = 0;
const string &expression) = 0;
// Indicate that the rules for the address range reported by the
// last call to Entry are complete. End should return true if
@ -965,8 +966,8 @@ class CallFrameInfo::Reporter {
// in a Mach-O section named __debug_frame. If we support
// Linux-style exception handling data, we could be reading an
// .eh_frame section.
Reporter(const std::string &filename,
const std::string &section = ".debug_frame")
Reporter(const string &filename,
const string &section = ".debug_frame")
: filename_(filename), section_(section) { }
virtual ~Reporter() { }
@ -998,7 +999,7 @@ class CallFrameInfo::Reporter {
// which we don't recognize. We cannot parse DWARF CFI if it uses
// augmentations we don't recognize.
virtual void UnrecognizedAugmentation(uint64 offset,
const std::string &augmentation);
const string &augmentation);
// The pointer encoding ENCODING, specified by the CIE at OFFSET, is not
// a valid encoding.
@ -1039,10 +1040,10 @@ class CallFrameInfo::Reporter {
protected:
// The name of the file whose CFI we're reading.
std::string filename_;
string filename_;
// The name of the CFI section in that file.
std::string section_;
string section_;
};
} // namespace dwarf2reader

View file

@ -62,6 +62,7 @@ extern "C" {
#include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/cfi_assembler.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
using google_breakpad::CFISection;
@ -76,7 +77,6 @@ using dwarf2reader::ENDIANNESS_LITTLE;
using dwarf2reader::ByteReader;
using dwarf2reader::CallFrameInfo;
using std::string;
using std::vector;
using testing::InSequence;
using testing::Return;

View file

@ -41,6 +41,7 @@
#include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/dwarf2reader_test_common.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
using google_breakpad::test_assembler::Endianness;
@ -61,7 +62,6 @@ using dwarf2reader::ENDIANNESS_BIG;
using dwarf2reader::ENDIANNESS_LITTLE;
using dwarf2reader::SectionMap;
using std::string;
using std::vector;
using testing::InSequence;
using testing::Pointee;
@ -98,7 +98,7 @@ class MockDwarf2Handler: public Dwarf2Handler {
MOCK_METHOD4(ProcessAttributeString, void(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const std::string& data));
const string& data));
MOCK_METHOD4(ProcessAttributeSignature, void(uint64 offset,
DwarfAttribute attr,
enum DwarfForm form,

View file

@ -39,14 +39,13 @@
#include <memory>
#include "common/dwarf/functioninfo.h"
#include "common/dwarf/bytereader.h"
#include "common/using_std_string.h"
namespace dwarf2reader {
CULineInfoHandler::CULineInfoHandler(std::vector<SourceFileInfo>* files,
std::vector<std::string>* dirs,
std::vector<string>* dirs,
LineMap* linemap):linemap_(linemap),
files_(files),
dirs_(dirs) {
@ -61,13 +60,13 @@ CULineInfoHandler::CULineInfoHandler(std::vector<SourceFileInfo>* files,
files->push_back(s);
}
void CULineInfoHandler::DefineDir(const std::string& name, uint32 dir_num) {
void CULineInfoHandler::DefineDir(const string& name, uint32 dir_num) {
// These should never come out of order, actually
assert(dir_num == dirs_->size());
dirs_->push_back(name);
}
void CULineInfoHandler::DefineFile(const std::string& name,
void CULineInfoHandler::DefineFile(const string& name,
int32 file_num, uint32 dir_num,
uint64 mod_time, uint64 length) {
assert(dir_num >= 0);
@ -75,7 +74,7 @@ void CULineInfoHandler::DefineFile(const std::string& name,
// These should never come out of order, actually.
if (file_num == (int32)files_->size() || file_num == -1) {
std::string dir = dirs_->at(dir_num);
string dir = dirs_->at(dir_num);
SourceFileInfo s;
s.lowpc = ULLONG_MAX;
@ -149,7 +148,7 @@ bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag,
void CUFunctionInfoHandler::ProcessAttributeString(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const std::string &data) {
const string &data) {
if (current_function_info_) {
if (attr == DW_AT_name)
current_function_info_->name = data;

View file

@ -40,17 +40,18 @@
#include <vector>
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
namespace dwarf2reader {
struct FunctionInfo {
// Name of the function
std::string name;
string name;
// Mangled name of the function
std::string mangled_name;
string mangled_name;
// File containing this function
std::string file;
string file;
// Line number for start of function.
uint32 line;
// Beginning address for this function
@ -61,13 +62,13 @@ struct FunctionInfo {
struct SourceFileInfo {
// Name of the source file name
std::string name;
string name;
// Low address of source file name
uint64 lowpc;
};
typedef std::map<uint64, FunctionInfo*> FunctionMap;
typedef std::map<uint64, std::pair<std::string, uint32> > LineMap;
typedef std::map<uint64, std::pair<string, uint32> > LineMap;
// This class is a basic line info handler that fills in the dirs,
// file, and linemap passed into it with the data produced from the
@ -77,17 +78,17 @@ class CULineInfoHandler: public LineInfoHandler {
//
CULineInfoHandler(std::vector<SourceFileInfo>* files,
std::vector<std::string>* dirs,
std::vector<string>* dirs,
LineMap* linemap);
virtual ~CULineInfoHandler() { }
// Called when we define a directory. We just place NAME into dirs_
// at position DIR_NUM.
virtual void DefineDir(const std::string& name, uint32 dir_num);
virtual void DefineDir(const string& name, uint32 dir_num);
// Called when we define a filename. We just place
// concat(dirs_[DIR_NUM], NAME) into files_ at position FILE_NUM.
virtual void DefineFile(const std::string& name, int32 file_num,
virtual void DefineFile(const string& name, int32 file_num,
uint32 dir_num, uint64 mod_time, uint64 length);
@ -103,13 +104,13 @@ class CULineInfoHandler: public LineInfoHandler {
private:
LineMap* linemap_;
std::vector<SourceFileInfo>* files_;
std::vector<std::string>* dirs_;
std::vector<string>* dirs_;
};
class CUFunctionInfoHandler: public Dwarf2Handler {
public:
CUFunctionInfoHandler(std::vector<SourceFileInfo>* files,
std::vector<std::string>* dirs,
std::vector<string>* dirs,
LineMap* linemap,
FunctionMap* offset_to_funcinfo,
FunctionMap* address_to_funcinfo,
@ -163,7 +164,7 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
virtual void ProcessAttributeString(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const std::string& data);
const string& data);
// Called when finished processing the DIE at OFFSET.
// Because DWARF2/3 specifies a tree of DIEs, you may get starts
@ -173,7 +174,7 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
private:
std::vector<SourceFileInfo>* files_;
std::vector<std::string>* dirs_;
std::vector<string>* dirs_;
LineMap* linemap_;
FunctionMap* offset_to_funcinfo_;
FunctionMap* address_to_funcinfo_;

View file

@ -48,13 +48,13 @@
#include "common/module.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
namespace google_breakpad {
using dwarf2reader::CallFrameInfo;
using google_breakpad::Module;
using std::set;
using std::string;
using std::vector;
// A class that accepts parsed call frame information from the DWARF

View file

@ -36,8 +36,8 @@
#include "breakpad_googletest_includes.h"
#include "common/dwarf_cfi_to_module.h"
#include "common/using_std_string.h"
using std::string;
using std::vector;
using google_breakpad::Module;

View file

@ -46,6 +46,7 @@
#include "common/dwarf/bytereader.h"
#include "common/dwarf/dwarf2diehandler.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
namespace google_breakpad {

View file

@ -37,9 +37,9 @@
#include "breakpad_googletest_includes.h"
#include "common/dwarf_cu_to_module.h"
#include "common/using_std_string.h"
using std::make_pair;
using std::string;
using std::vector;
using dwarf2reader::AttributeList;

View file

@ -32,23 +32,26 @@
// dwarf_line_to_module.cc: Implementation of DwarfLineToModule class.
// See dwarf_line_to_module.h for details.
#include "common/dwarf_line_to_module.h"
#include <stdio.h>
#include <string>
#include "common/dwarf_line_to_module.h"
#include "common/using_std_string.h"
// Trying to support Windows paths in a reasonable way adds a lot of
// variations to test; it would be better to just put off dealing with
// it until we actually have to deal with DWARF on Windows.
// Return true if PATH is an absolute path, false if it is relative.
static bool PathIsAbsolute(const std::string &path) {
static bool PathIsAbsolute(const string &path) {
return (path.size() >= 1 && path[0] == '/');
}
// If PATH is an absolute path, return PATH. If PATH is a relative path,
// treat it as relative to BASE and return the combined path.
static std::string ExpandPath(const std::string &path,
const std::string &base) {
static string ExpandPath(const string &path,
const string &base) {
if (PathIsAbsolute(path))
return path;
return base + "/" + path;
@ -56,14 +59,14 @@ static std::string ExpandPath(const std::string &path,
namespace google_breakpad {
void DwarfLineToModule::DefineDir(const std::string &name, uint32 dir_num) {
void DwarfLineToModule::DefineDir(const string &name, uint32 dir_num) {
// Directory number zero is reserved to mean the compilation
// directory. Silently ignore attempts to redefine it.
if (dir_num != 0)
directories_[dir_num] = name;
}
void DwarfLineToModule::DefineFile(const std::string &name, int32 file_num,
void DwarfLineToModule::DefineFile(const string &name, int32 file_num,
uint32 dir_num, uint64 mod_time,
uint64 length) {
if (file_num == -1)
@ -71,7 +74,7 @@ void DwarfLineToModule::DefineFile(const std::string &name, int32 file_num,
else if (file_num > highest_file_number_)
highest_file_number_ = file_num;
std::string full_name;
string full_name;
if (dir_num != 0) {
DirectoryTable::const_iterator directory_it = directories_.find(dir_num);
if (directory_it != directories_.end()) {

View file

@ -38,8 +38,11 @@
#ifndef COMMON_LINUX_DWARF_LINE_TO_MODULE_H
#define COMMON_LINUX_DWARF_LINE_TO_MODULE_H
#include <string>
#include "common/module.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
namespace google_breakpad {
@ -127,8 +130,8 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
~DwarfLineToModule() { }
void DefineDir(const std::string &name, uint32 dir_num);
void DefineFile(const std::string &name, int32 file_num,
void DefineDir(const string &name, uint32 dir_num);
void DefineFile(const string &name, int32 file_num,
uint32 dir_num, uint64 mod_time,
uint64 length);
void AddLine(uint64 address, uint64 length,
@ -136,7 +139,7 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
private:
typedef std::map<uint32, std::string> DirectoryTable;
typedef std::map<uint32, string> DirectoryTable;
typedef std::map<uint32, Module::File *> FileTable;
// The module we're contributing debugging info to. Owned by our

View file

@ -40,9 +40,9 @@
#include <string>
namespace google_breakpad {
#include "common/using_std_string.h"
using std::string;
namespace google_breakpad {
// An abstract base class for language-specific operations. We choose
// an instance of a subclass of this when we find the CU's language.

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

View file

@ -44,12 +44,12 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::set;
using std::string;
using std::vector;
using std::map;

View file

@ -42,9 +42,9 @@
#include "breakpad_googletest_includes.h"
#include "common/module.h"
#include "common/using_std_string.h"
using google_breakpad::Module;
using std::string;
using std::stringstream;
using std::vector;
using testing::ContainerEq;

View file

@ -37,6 +37,10 @@
#include <stab.h>
#include <string.h>
#include <string>
#include "common/using_std_string.h"
using std::vector;
namespace google_breakpad {
@ -225,7 +229,7 @@ bool StabsReader::ProcessFunction() {
const char *name_end = strchr(stab_string, ':');
if (! name_end)
name_end = stab_string + strlen(stab_string);
std::string name(stab_string, name_end - stab_string);
string name(stab_string, name_end - stab_string);
if (! handler_->StartFunction(name, function_address))
return false;
++iterator_;

View file

@ -64,6 +64,7 @@
#include <vector>
#include "common/byte_cursor.h"
#include "common/using_std_string.h"
namespace google_breakpad {
@ -292,7 +293,7 @@ class StabsHandler {
// StartFunction is the function name alone.
//
// In languages that use name mangling, like C++, NAME is mangled.
virtual bool StartFunction(const std::string &name, uint64_t address) {
virtual bool StartFunction(const string &name, uint64_t address) {
return true;
}
@ -311,7 +312,7 @@ class StabsHandler {
// Report that an exported function NAME is present at ADDRESS.
// The size of the function is unknown.
virtual bool Extern(const std::string &name, uint64_t address) {
virtual bool Extern(const string &name, uint64_t address) {
return true;
}

View file

@ -43,10 +43,12 @@
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/stabs_reader.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
using ::testing::Eq;
using ::testing::InSequence;
@ -61,7 +63,6 @@ using google_breakpad::test_assembler::Section;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using std::map;
using std::string;
namespace {
@ -218,10 +219,10 @@ class MockStabsReaderHandler: public StabsHandler {
MOCK_METHOD3(StartCompilationUnit,
bool(const char *, uint64_t, const char *));
MOCK_METHOD1(EndCompilationUnit, bool(uint64_t));
MOCK_METHOD2(StartFunction, bool(const std::string &, uint64_t));
MOCK_METHOD2(StartFunction, bool(const string &, uint64_t));
MOCK_METHOD1(EndFunction, bool(uint64_t));
MOCK_METHOD3(Line, bool(uint64_t, const char *, int));
MOCK_METHOD2(Extern, bool(const std::string &, uint64_t));
MOCK_METHOD2(Extern, bool(const string &, uint64_t));
void Warning(const char *format, ...) { MockWarning(format); }
MOCK_METHOD1(MockWarning, void(const char *));
};

View file

@ -39,11 +39,10 @@
#include <algorithm>
#include "common/stabs_to_module.h"
#include "common/using_std_string.h"
namespace google_breakpad {
using std::string;
// Demangle using abi call.
// Older GCC may not support it.
static string Demangle(const string &mangled) {

View file

@ -45,10 +45,10 @@
#include "common/module.h"
#include "common/stabs_reader.h"
#include "common/using_std_string.h"
namespace google_breakpad {
using std::string;
using std::vector;
// A StabsToModule is a handler that receives parsed STABS debugging

View file

@ -27,14 +27,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/convert_UTF.h"
#include "processor/scoped_ptr.h"
#include "common/string_conversion.h"
#include <string.h>
#include "common/convert_UTF.h"
#include "common/string_conversion.h"
#include "common/using_std_string.h"
#include "processor/scoped_ptr.h"
namespace google_breakpad {
using std::string;
using std::vector;
void UTF8ToUTF16(const char *in, vector<u_int16_t> *out) {

View file

@ -34,6 +34,8 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
@ -59,7 +61,7 @@ void UTF32ToUTF16(const wchar_t *in, vector<u_int16_t> *out);
void UTF32ToUTF16Char(wchar_t in, u_int16_t out[2]);
// Convert |in| to UTF-8. If |swap| is true, swap bytes before converting.
std::string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap);
string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap);
} // namespace google_breakpad

View file

@ -60,12 +60,12 @@
#include <vector>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::list;
using std::string;
using std::vector;
namespace test_assembler {

View file

@ -36,12 +36,12 @@
#include "breakpad_googletest_includes.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using std::string;
using testing::Test;
TEST(ConstructLabel, Simple) {

View file

@ -38,6 +38,7 @@
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#if !defined(__ANDROID__)
#define TEMPDIR "/tmp"
@ -59,12 +60,12 @@ class AutoTempDir {
DeleteRecursively(path_);
}
const std::string& path() const {
const string& path() const {
return path_;
}
private:
void DeleteRecursively(const std::string& path) {
void DeleteRecursively(const string& path) {
// First remove any files in the dir
DIR* dir = opendir(path.c_str());
if (!dir)
@ -74,7 +75,7 @@ class AutoTempDir {
while ((entry = readdir(dir)) != NULL) {
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
continue;
std::string entry_path = path + "/" + entry->d_name;
string entry_path = path + "/" + entry->d_name;
struct stat stats;
EXPECT_TRUE(lstat(entry_path.c_str(), &stats) == 0);
if (S_ISDIR(stats.st_mode))
@ -90,7 +91,7 @@ class AutoTempDir {
AutoTempDir(const AutoTempDir&);
AutoTempDir& operator=(const AutoTempDir&);
std::string path_;
string path_;
};
} // namespace google_breakpad

View file

@ -0,0 +1,65 @@
// -*- mode: C++ -*-
// Copyright (c) 2012, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Original author: Ivan Penkov
// using_std_string.h: Allows building this code in environments where
// global string (::string) exists.
//
// The problem:
// -------------
// Let's say you want to build this code in an environment where a global
// string type is defined (i.e. ::string). Now, let's suppose that ::string
// is different that std::string and you'd like to have the option to easily
// choose between the two string types. Ideally you'd like to control which
// string type is chosen by simply #defining an identifier.
//
// The solution:
// -------------
// #define HAS_GLOBAL_STRING somewhere in a global header file and then
// globally replace std::string with string. Then include this header
// file everywhere where string is used. If you want to revert back to
// using std::string, simply remove the #define (HAS_GLOBAL_STRING).
#ifndef THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_
#define THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_
#ifdef HAS_GLOBAL_STRING
typedef ::string google_breakpad_string;
#else
using std::string;
typedef std::string google_breakpad_string;
#endif
// Inicates that type google_breakpad_string is defined
#define HAS_GOOGLE_BREAKPAD_STRING
#endif // THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_

View file

@ -39,12 +39,13 @@
#define GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
#include <map>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/processor/source_line_resolver_base.h"
namespace google_breakpad {
using std::string;
using std::map;
class BasicSourceLineResolver : public SourceLineResolverBase {

View file

@ -36,12 +36,12 @@
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::string;
class CodeModule {
public:
virtual ~CodeModule() {}

View file

@ -88,6 +88,7 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h"
@ -98,7 +99,6 @@ namespace google_breakpad {
using std::map;
using std::string;
using std::vector;

View file

@ -32,12 +32,12 @@
#include <assert.h>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::string;
class Minidump;
class ProcessState;
class SourceLineResolverInterface;

View file

@ -36,13 +36,14 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/system_info.h"
#include "google_breakpad/processor/minidump.h"
namespace google_breakpad {
using std::string;
using std::vector;
class CallStack;

View file

@ -35,13 +35,13 @@
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_module.h"
namespace google_breakpad {
using std::string;
struct StackFrame;
struct WindowsFrameInfo;
class CFIFrameInfo;

View file

@ -31,14 +31,14 @@
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
class CodeModule;
using std::string;
struct StackFrame {
// Indicates how well the instruction pointer derived during
// stack walking is trusted. Since the stack walker can resort to

View file

@ -43,6 +43,8 @@
#include <set>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/memory_region.h"
@ -189,7 +191,7 @@ class Stackwalker {
// A list of modules that we haven't found symbols for. We track
// this in order to avoid repeatedly looking them up again within
// one minidump.
set<std::string> no_symbol_modules_;
set<string> no_symbol_modules_;
// The maximum number of frames Stackwalker will walk through.
// This defaults to 1024 to prevent infinite loops.

View file

@ -34,10 +34,10 @@
#define GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
using std::string;
class CodeModule;
struct SystemInfo;

View file

@ -37,9 +37,9 @@
#include <string>
namespace google_breakpad {
#include "common/using_std_string.h"
using std::string;
namespace google_breakpad {
struct SystemInfo {
public:

View file

@ -43,12 +43,11 @@
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/processor/code_module.h"
namespace google_breakpad {
using std::string;
class BasicCodeModule : public CodeModule {
public:
// Creates a new BasicCodeModule given any existing CodeModule

View file

@ -32,6 +32,7 @@
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/stack_frame.h"
@ -44,7 +45,6 @@
namespace {
using std::string;
using google_breakpad::BasicSourceLineResolver;
using google_breakpad::CFIFrameInfo;
using google_breakpad::CodeModule;

View file

@ -30,15 +30,16 @@
#include <arpa/inet.h>
#include <limits.h>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "processor/binarystream.h"
namespace google_breakpad {
using std::string;
using std::vector;
binarystream &binarystream::operator>>(std::string &str) {
binarystream &binarystream::operator>>(string &str) {
u_int16_t length;
*this >> length;
if (eof())
@ -83,7 +84,7 @@ binarystream &binarystream::operator>>(u_int64_t &u64) {
return *this;
}
binarystream &binarystream::operator<<(const std::string &str) {
binarystream &binarystream::operator<<(const string &str) {
if (str.length() > USHRT_MAX) {
// truncate to 16-bit length
*this << static_cast<u_int16_t>(USHRT_MAX);

View file

@ -28,8 +28,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// binarystream implements part of the std::iostream interface as a
// wrapper around std::stringstream to allow reading and writing
// std::string and integers of known size.
// wrapper around std::stringstream to allow reading and writing strings
// and integers of known size.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_BINARYSTREAM_H_
#define GOOGLE_BREAKPAD_PROCESSOR_BINARYSTREAM_H_
@ -37,6 +37,7 @@
#include <sstream>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
@ -47,21 +48,21 @@ class binarystream {
public:
explicit binarystream(ios_base::openmode which = ios_base::out|ios_base::in)
: stream_(which) {}
explicit binarystream(const std::string &str,
explicit binarystream(const string &str,
ios_base::openmode which = ios_base::out|ios_base::in)
: stream_(str, which) {}
explicit binarystream(const char *str, size_t size,
ios_base::openmode which = ios_base::out|ios_base::in)
: stream_(std::string(str, size), which) {}
: stream_(string(str, size), which) {}
binarystream &operator>>(std::string &str);
binarystream &operator>>(string &str);
binarystream &operator>>(u_int8_t &u8);
binarystream &operator>>(u_int16_t &u16);
binarystream &operator>>(u_int32_t &u32);
binarystream &operator>>(u_int64_t &u64);
// Note: strings are truncated at 65535 characters
binarystream &operator<<(const std::string &str);
binarystream &operator<<(const string &str);
binarystream &operator<<(u_int8_t u8);
binarystream &operator<<(u_int16_t u16);
binarystream &operator<<(u_int32_t u32);
@ -70,8 +71,8 @@ class binarystream {
// Forward a few methods directly from the stream object
bool eof() const { return stream_.eof(); }
void clear() { stream_.clear(); }
std::string str() const { return stream_.str(); }
void str(const std::string &s) { stream_.str(s); }
string str() const { return stream_.str(); }
void str(const string &s) { stream_.str(s); }
// Seek both read and write pointers to the beginning of the stream.
void rewind() {

View file

@ -32,11 +32,11 @@
#include <vector>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "processor/binarystream.h"
namespace {
using std::ios_base;
using std::string;
using std::vector;
using google_breakpad::binarystream;

View file

@ -41,12 +41,12 @@
#include <map>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::map;
using std::string;
class MemoryRegion;

View file

@ -35,6 +35,7 @@
#include <string.h>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "processor/cfi_frame_info.h"
#include "google_breakpad/processor/memory_region.h"
@ -43,7 +44,6 @@ using google_breakpad::CFIFrameInfoParseHandler;
using google_breakpad::CFIRuleParser;
using google_breakpad::MemoryRegion;
using google_breakpad::SimpleCFIWalker;
using std::string;
using testing::_;
using testing::A;
using testing::AtMost;

View file

@ -43,6 +43,7 @@
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_module.h"
@ -78,7 +79,6 @@ using google_breakpad::MockMinidump;
using google_breakpad::ProcessState;
using google_breakpad::SymbolSupplier;
using google_breakpad::SystemInfo;
using std::string;
class TestSymbolSupplier : public SymbolSupplier {
public:

View file

@ -41,8 +41,10 @@
#include "processor/fast_source_line_resolver_types.h"
#include <map>
#include <string>
#include <utility>
#include "common/using_std_string.h"
#include "processor/module_factory.h"
#include "processor/scoped_ptr.h"
@ -125,7 +127,7 @@ WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) {
u_int32_t max_stack_size = para_uint32[5];
const char *boolean = reinterpret_cast<const char*>(para_uint32 + 6);
bool allocates_base_pointer = (*boolean != 0);
std::string program_string = boolean + 1;
string program_string = boolean + 1;
return WindowsFrameInfo(type,
prolog_size,

View file

@ -43,6 +43,7 @@
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/stack_frame.h"
#include "google_breakpad/processor/memory_region.h"
@ -52,7 +53,6 @@
namespace {
using std::string;
using google_breakpad::SourceLineResolverBase;
using google_breakpad::BasicSourceLineResolver;
using google_breakpad::FastSourceLineResolver;

View file

@ -39,6 +39,9 @@
#include <string.h>
#include <time.h>
#include <string>
#include "common/using_std_string.h"
#include "processor/logging.h"
#include "processor/pathname_stripper.h"
@ -80,25 +83,25 @@ LogStream::~LogStream() {
stream_ << std::endl;
}
std::string HexString(u_int32_t number) {
string HexString(u_int32_t number) {
char buffer[11];
snprintf(buffer, sizeof(buffer), "0x%x", number);
return std::string(buffer);
return string(buffer);
}
std::string HexString(u_int64_t number) {
string HexString(u_int64_t number) {
char buffer[19];
snprintf(buffer, sizeof(buffer), "0x%" PRIx64, number);
return std::string(buffer);
return string(buffer);
}
std::string HexString(int number) {
string HexString(int number) {
char buffer[19];
snprintf(buffer, sizeof(buffer), "0x%x", number);
return std::string(buffer);
return string(buffer);
}
int ErrnoString(std::string *error_string) {
int ErrnoString(string *error_string) {
assert(error_string);
// strerror isn't necessarily thread-safe. strerror_r would be preferrable,

View file

@ -60,6 +60,7 @@
#include <iostream>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#ifdef BP_LOGGING_INCLUDE
@ -118,14 +119,14 @@ class LogMessageVoidify {
};
// Returns number formatted as a hexadecimal string, such as "0x7b".
std::string HexString(u_int32_t number);
std::string HexString(u_int64_t number);
std::string HexString(int number);
string HexString(u_int32_t number);
string HexString(u_int64_t number);
string HexString(int number);
// Returns the error code as set in the global errno variable, and sets
// error_string, a required argument, to a string describing that error
// code.
int ErrnoString(std::string *error_string);
int ErrnoString(string *error_string);
} // namespace google_breakpad

View file

@ -3079,13 +3079,13 @@ bool MinidumpSystemInfo::Read(u_int32_t expected_size) {
string MinidumpSystemInfo::GetOS() {
string os;
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpSystemInfo for GetOS";
return NULL;
return os;
}
string os;
switch (system_info_.platform_id) {
case MD_OS_WIN32_NT:
case MD_OS_WIN32_WINDOWS:

View file

@ -39,6 +39,7 @@
#include <utility>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_module.h"
@ -79,7 +80,6 @@ using google_breakpad::ProcessState;
using google_breakpad::scoped_ptr;
using google_breakpad::SymbolSupplier;
using google_breakpad::SystemInfo;
using std::string;
using ::testing::_;
using ::testing::Mock;
using ::testing::Ne;
@ -165,8 +165,8 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile(
symbol_file);
if (s == FOUND) {
std::ifstream in(symbol_file->c_str());
std::getline(in, *symbol_data, std::string::traits_type::to_char_type(
std::string::traits_type::eof()));
std::getline(in, *symbol_data, string::traits_type::to_char_type(
string::traits_type::eof()));
in.close();
}

View file

@ -39,6 +39,7 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_module.h"
@ -54,7 +55,6 @@
namespace {
using std::string;
using std::vector;
using google_breakpad::BasicSourceLineResolver;
using google_breakpad::CallStack;
@ -575,7 +575,7 @@ int main(int argc, char **argv) {
}
// extra arguments are symbol paths
std::vector<std::string> symbol_paths;
std::vector<string> symbol_paths;
if (argc > symbol_path_arg) {
for (int argi = symbol_path_arg; argi < argc; ++argi)
symbol_paths.push_back(argv[argi]);

View file

@ -36,7 +36,9 @@
#include <stdlib.h>
#include <string>
#include <vector>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/minidump.h"
#include "processor/logging.h"
@ -69,7 +71,6 @@ using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using std::ifstream;
using std::istringstream;
using std::string;
using std::vector;
using ::testing::Return;

View file

@ -36,9 +36,9 @@
#include <string>
namespace google_breakpad {
#include "common/using_std_string.h"
using std::string;
namespace google_breakpad {
class PathnameStripper {
public:

View file

@ -74,10 +74,11 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
namespace google_breakpad {
using std::map;
using std::string;
using std::vector;
class MemoryRegion;

View file

@ -38,6 +38,7 @@
#include "processor/postfix_evaluator-inl.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/memory_region.h"
#include "processor/logging.h"
@ -47,7 +48,6 @@ namespace {
using std::map;
using std::string;
using google_breakpad::MemoryRegion;
using google_breakpad::PostfixEvaluator;

View file

@ -44,6 +44,7 @@
#include <iostream>
#include <fstream>
#include "common/using_std_string.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/system_info.h"
#include "processor/logging.h"
@ -87,8 +88,8 @@ SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFile(
if (s == FOUND) {
std::ifstream in(symbol_file->c_str());
std::getline(in, *symbol_data, std::string::traits_type::to_char_type(
std::string::traits_type::eof()));
std::getline(in, *symbol_data, string::traits_type::to_char_type(
string::traits_type::eof()));
in.close();
}
return s;

View file

@ -80,12 +80,12 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/processor/symbol_supplier.h"
namespace google_breakpad {
using std::map;
using std::string;
using std::vector;
class CodeModule;

View file

@ -37,6 +37,7 @@
#include "breakpad_googletest_includes.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
@ -54,7 +55,6 @@ using google_breakpad::SystemInfo;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using std::string;
using std::vector;
using testing::_;
using testing::Return;

View file

@ -37,6 +37,7 @@
#include "breakpad_googletest_includes.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
@ -56,7 +57,6 @@ using google_breakpad::WindowsFrameInfo;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using std::string;
using std::vector;
using testing::_;
using testing::Return;

View file

@ -40,6 +40,7 @@
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h"
@ -54,7 +55,7 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion {
// Set this region's address and contents. If we have placed an
// instance of this class in a test fixture class, individual tests
// can use this to provide the region's contents.
void Init(u_int64_t base_address, const std::string &contents) {
void Init(u_int64_t base_address, const string &contents) {
base_address_ = base_address;
contents_ = contents;
}
@ -93,22 +94,22 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion {
}
u_int64_t base_address_;
std::string contents_;
string contents_;
};
class MockCodeModule: public google_breakpad::CodeModule {
public:
MockCodeModule(u_int64_t base_address, u_int64_t size,
const std::string &code_file, const std::string &version)
const string &code_file, const string &version)
: base_address_(base_address), size_(size), code_file_(code_file) { }
u_int64_t base_address() const { return base_address_; }
u_int64_t size() const { return size_; }
std::string code_file() const { return code_file_; }
std::string code_identifier() const { return code_file_; }
std::string debug_file() const { return code_file_; }
std::string debug_identifier() const { return code_file_; }
std::string version() const { return version_; }
string code_file() const { return code_file_; }
string code_identifier() const { return code_file_; }
string debug_file() const { return code_file_; }
string debug_identifier() const { return code_file_; }
string version() const { return version_; }
const google_breakpad::CodeModule *Copy() const {
abort(); // Tests won't use this.
}
@ -116,8 +117,8 @@ class MockCodeModule: public google_breakpad::CodeModule {
private:
u_int64_t base_address_;
u_int64_t size_;
std::string code_file_;
std::string version_;
string code_file_;
string version_;
};
class MockCodeModules: public google_breakpad::CodeModules {
@ -165,14 +166,14 @@ class MockSymbolSupplier: public google_breakpad::SymbolSupplier {
typedef google_breakpad::SystemInfo SystemInfo;
MOCK_METHOD3(GetSymbolFile, SymbolResult(const CodeModule *module,
const SystemInfo *system_info,
std::string *symbol_file));
string *symbol_file));
MOCK_METHOD4(GetSymbolFile, SymbolResult(const CodeModule *module,
const SystemInfo *system_info,
std::string *symbol_file,
std::string *symbol_data));
string *symbol_file,
string *symbol_data));
MOCK_METHOD4(GetCStringSymbolData, SymbolResult(const CodeModule *module,
const SystemInfo *system_info,
std::string *symbol_file,
string *symbol_file,
char **symbol_data));
MOCK_METHOD1(FreeSymbolData, void(const CodeModule *module));
};

View file

@ -36,6 +36,7 @@
#include "breakpad_googletest_includes.h"
#include "common/test_assembler.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
@ -55,7 +56,6 @@ using google_breakpad::WindowsFrameInfo;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using std::string;
using std::vector;
using testing::_;
using testing::Return;

View file

@ -39,13 +39,14 @@
#include <sstream>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "processor/address_map-inl.h"
#include "processor/static_address_map-inl.h"
#include "processor/simple_serializer-inl.h"
#include "map_serializers-inl.h"
typedef google_breakpad::StaticAddressMap<int, char> TestMap;
typedef google_breakpad::AddressMap<int, std::string> AddrMap;
typedef google_breakpad::AddressMap<int, string> AddrMap;
class TestStaticAddressMap : public ::testing::Test {
protected:
@ -92,8 +93,8 @@ class TestStaticAddressMap : public ::testing::Test {
void CompareRetrieveResult(int testcase, int target) {
int address;
int address_test;
std::string entry;
std::string entry_test;
string entry;
string entry_test;
const char *entry_cstring = NULL;
bool found;
bool found_test;
@ -147,7 +148,7 @@ class TestStaticAddressMap : public ::testing::Test {
AddrMap addr_map[kNumberTestCases];
TestMap test_map[kNumberTestCases];
char *map_data[kNumberTestCases];
google_breakpad::AddressMapSerializer<int, std::string> serializer;
google_breakpad::AddressMapSerializer<int, string> serializer;
};
const int TestStaticAddressMap::testsize[] = {0, 1, 6, 1000};

View file

@ -114,6 +114,7 @@
#include <string>
#include "common/test_assembler.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/common/minidump_format.h"
@ -121,7 +122,6 @@ namespace google_breakpad {
namespace SynthMinidump {
using std::string;
using test_assembler::Endianness;
using test_assembler::kBigEndian;
using test_assembler::kLittleEndian;

View file

@ -36,6 +36,7 @@
#include <string>
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "processor/synth_minidump.h"
#include "processor/synth_minidump_unittest_data.h"
@ -54,7 +55,6 @@ using google_breakpad::SynthMinidump::Thread;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using google_breakpad::test_assembler::Label;
using std::string;
TEST(Section, Simple) {
Dump dump(0);

Some files were not shown because too many files have changed in this diff Show more