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.");
}