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>
This commit is contained in:
Ivan Penkov 2016-08-30 14:00:56 -07:00
parent 3fef603b65
commit 704f41ec90
7 changed files with 34 additions and 31 deletions

View file

@ -12,6 +12,7 @@
#include <inttypes.h>
#include <stdio.h>
#include "common/using_std_string.h"
#include "processor/logging.h"
#if defined(OS_ANDROID) && !defined(__LP64__)
@ -25,7 +26,7 @@
namespace google_breakpad {
bool ParseProcMaps(const std::string& input,
bool ParseProcMaps(const string& input,
std::vector<MappedMemoryRegion>* regions_out) {
std::vector<MappedMemoryRegion> regions;
@ -33,8 +34,8 @@ bool ParseProcMaps(const std::string& input,
// this point in time.
// Split the string by newlines.
std::vector<std::string> lines;
std::string l = "";
std::vector<string> lines;
string l = "";
for (size_t i = 0; i < input.size(); i++) {
if (input[i] != '\n' && input[i] != '\r') {
l.push_back(input[i]);

View file

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/proc_maps_linux.h"
namespace {
@ -227,7 +228,7 @@ TEST(ProcMapsTest, ParseProcMapsEmptyString) {
// - File name has whitespaces.
TEST(ProcMapsTest, ParseProcMapsWeirdCorrectInput) {
std::vector<google_breakpad::MappedMemoryRegion> regions;
const std::string kContents =
const string kContents =
"00400000-0040b000 r-xp 00000000 fc:00 2106562 "
" /bin/cat\r\n"
"7f53b7dad000-7f53b7f62000 r-xp 00000000 fc:00 263011 "

View file

@ -112,10 +112,10 @@ static string StripSeparator(const string &original) {
}
// PrintStackContents prints the stack contents of the current frame to stdout.
static void PrintStackContents(const std::string &indent,
static void PrintStackContents(const string &indent,
const StackFrame *frame,
const StackFrame *prev_frame,
const std::string &cpu,
const string &cpu,
const MemoryRegion *memory,
const CodeModules* modules,
SourceLineResolverInterface *resolver) {
@ -181,7 +181,7 @@ static void PrintStackContents(const std::string &indent,
// Print data in hex.
const int kBytesPerRow = 16;
std::string data_as_string;
string data_as_string;
for (int i = 0; i < kBytesPerRow; ++i, ++address) {
uint8_t value = 0;
if (address < stack_end &&
@ -607,7 +607,7 @@ static void PrintStack(const CallStack *stack,
// Print stack contents.
if (output_stack_contents && frame_index + 1 < frame_count) {
const std::string indent(" ");
const string indent(" ");
PrintStackContents(indent, frame, stack->frames()->at(frame_index + 1),
cpu, memory, modules, resolver);
}

View file

@ -36,14 +36,15 @@
#include <string>
#include "common/stdio_wrapper.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/common/minidump_exception_win32.h"
#include "processor/symbolic_constants_win.h"
namespace google_breakpad {
std::string NTStatusToString(uint32_t ntstatus) {
std::string reason;
string NTStatusToString(uint32_t ntstatus) {
string reason;
// The content of this switch was created from ntstatus.h in the 8.1 SDK with
//
// egrep '#define [A-Z_0-9]+\s+\(\(NTSTATUS\)0xC[0-9A-F]+L\)' ntstatus.h