aboutsummaryrefslogtreecommitdiff
path: root/src/tools/linux
diff options
context:
space:
mode:
authorIvan Penkov <ivanpe@chromium.org>2016-08-30 14:00:56 -0700
committerIvan Penkov <ivanpe@chromium.org>2016-08-30 23:31:43 +0000
commit704f41ec901c419f8c321742114b415e6f5ceacc (patch)
treea377b2ea62db6918fb0192ba15d4bdc6649e0ce3 /src/tools/linux
parentFixing some casts in order to be able to build with new Xcode and SDK version... (diff)
downloadbreakpad-704f41ec901c419f8c321742114b415e6f5ceacc.tar.xz
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 BUG= Change-Id: I11f1ce697be23e13f12ea8f0468bbe02fa63c967 Reviewed-on: https://chromium-review.googlesource.com/378159 Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/tools/linux')
-rw-r--r--src/tools/linux/md2core/minidump-2-core.cc35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc
index 322bbad6..6f637845 100644
--- a/src/tools/linux/md2core/minidump-2-core.cc
+++ b/src/tools/linux/md2core/minidump-2-core.cc
@@ -49,6 +49,7 @@
#include "common/linux/memory_mapped_file.h"
#include "common/minidump_type_helper.h"
#include "common/scoped_ptr.h"
+#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/common/minidump_format.h"
#include "third_party/lss/linux_syscall_support.h"
@@ -97,7 +98,7 @@ typedef MDTypeHelper<sizeof(ElfW(Addr))>::MDRawLinkMap MDRawLinkMap;
static const MDRVA kInvalidMDRVA = static_cast<MDRVA>(-1);
static bool verbose;
-static std::string g_custom_so_basedir;
+static string g_custom_so_basedir;
static int usage(const char* argv0) {
fprintf(stderr, "Usage: %s [-v] <minidump file>\n", argv0);
@@ -203,8 +204,8 @@ struct CrashedProcess {
uint32_t permissions;
uint64_t start_address, end_address, offset;
- std::string filename;
- std::string data;
+ string filename;
+ string data;
};
std::map<uint64_t, Mapping> mappings;
@@ -238,9 +239,9 @@ struct CrashedProcess {
prpsinfo prps;
- std::map<uintptr_t, std::string> signatures;
+ std::map<uintptr_t, string> signatures;
- std::string dynamic_data;
+ string dynamic_data;
MDRawDebug debug;
std::vector<MDRawLinkMap> link_map;
};
@@ -597,8 +598,8 @@ ParseMaps(CrashedProcess* crashinfo, const MinidumpMemoryRange& range) {
ptr < range.data() + range.length();) {
const uint8_t* eol = (uint8_t*)memchr(ptr, '\n',
range.data() + range.length() - ptr);
- std::string line((const char*)ptr,
- eol ? eol - ptr : range.data() + range.length() - ptr);
+ string line((const char*)ptr,
+ eol ? eol - ptr : range.data() + range.length() - ptr);
ptr = eol ? eol + 1 : range.data() + range.length();
unsigned long long start, stop, offset;
char* permissions = NULL;
@@ -875,17 +876,17 @@ ParseModuleStream(CrashedProcess* crashinfo, const MinidumpMemoryRange& range,
record->signature.data4[2], record->signature.data4[3],
record->signature.data4[4], record->signature.data4[5],
record->signature.data4[6], record->signature.data4[7]);
- std::string filename =
+ string filename =
full_file.GetAsciiMDString(rawmodule->module_name_rva);
size_t slash = filename.find_last_of('/');
- std::string basename = slash == std::string::npos ?
- filename : filename.substr(slash + 1);
+ string basename = slash == string::npos ?
+ filename : filename.substr(slash + 1);
if (strcmp(guid, "00000000-0000-0000-0000-000000000000")) {
- std::string prefix;
+ string prefix;
if (!g_custom_so_basedir.empty())
prefix = g_custom_so_basedir;
else
- prefix = std::string("/var/lib/breakpad/") + guid + "-" + basename;
+ prefix = string("/var/lib/breakpad/") + guid + "-" + basename;
crashinfo->signatures[rawmodule->base_of_image] = prefix + basename;
}
@@ -904,7 +905,7 @@ ParseModuleStream(CrashedProcess* crashinfo, const MinidumpMemoryRange& range,
}
static void
-AddDataToMapping(CrashedProcess* crashinfo, const std::string& data,
+AddDataToMapping(CrashedProcess* crashinfo, const string& data,
uintptr_t addr) {
for (std::map<uint64_t, CrashedProcess::Mapping>::iterator
iter = crashinfo->mappings.begin();
@@ -960,7 +961,7 @@ AugmentMappings(CrashedProcess* crashinfo,
for (unsigned i = 0; i < crashinfo->threads.size(); ++i) {
const CrashedProcess::Thread& thread = crashinfo->threads[i];
AddDataToMapping(crashinfo,
- std::string((char *)thread.stack, thread.stack_length),
+ string((char *)thread.stack, thread.stack_length),
thread.stack_addr);
}
@@ -968,7 +969,7 @@ AugmentMappings(CrashedProcess* crashinfo,
// the beginning of the address space, as this area should always be
// available.
static const uintptr_t start_addr = 4096;
- std::string data;
+ string data;
struct r_debug debug = { 0 };
debug.r_version = crashinfo->debug.version;
debug.r_brk = (ElfW(Addr))crashinfo->debug.brk;
@@ -988,11 +989,11 @@ AugmentMappings(CrashedProcess* crashinfo,
link_map.l_ld = (ElfW(Dyn)*)iter->ld;
link_map.l_prev = prev;
prev = (struct link_map*)(start_addr + data.size());
- std::string filename = full_file.GetAsciiMDString(iter->name);
+ string filename = full_file.GetAsciiMDString(iter->name);
// Look up signature for this filename. If available, change filename
// to point to GUID, instead.
- std::map<uintptr_t, std::string>::const_iterator guid =
+ std::map<uintptr_t, string>::const_iterator guid =
crashinfo->signatures.find((uintptr_t)iter->addr);
if (guid != crashinfo->signatures.end()) {
filename = guid->second;