From a56db25fedf0daa27a9426ecff7bb92511ca94ab Mon Sep 17 00:00:00 2001 From: "qsr@chromium.org" Date: Tue, 2 Oct 2012 10:46:31 +0000 Subject: Fix linux compile errors for some systems. Codereview: https://breakpad.appspot.com/460002/ Patch by: jakerr@google.com git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1055 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/crash_generation/client_info.h | 2 +- .../linux/handler/exception_handler_unittest.cc | 19 ++++++++++--------- src/google_breakpad/common/minidump_exception_linux.h | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/client/linux/crash_generation/client_info.h b/src/client/linux/crash_generation/client_info.h index 75fe1a8a..d0a184a6 100644 --- a/src/client/linux/crash_generation/client_info.h +++ b/src/client/linux/crash_generation/client_info.h @@ -37,7 +37,7 @@ class CrashGenerationServer; class ClientInfo { public: ClientInfo(pid_t pid, CrashGenerationServer* crash_server) - : crash_server_(crash_server_), + : crash_server_(crash_server), pid_(pid) {} CrashGenerationServer* crash_server() const { return crash_server_; } diff --git a/src/client/linux/handler/exception_handler_unittest.cc b/src/client/linux/handler/exception_handler_unittest.cc index a558449f..763adf07 100644 --- a/src/client/linux/handler/exception_handler_unittest.cc +++ b/src/client/linux/handler/exception_handler_unittest.cc @@ -60,8 +60,8 @@ const int kGUIDStringSize = 37; void sigchld_handler(int signo) { } -int CreateTMPFile(const std::string& dir, std::string* path) { - std::string file = dir + "/exception-handler-unittest.XXXXXX"; +int CreateTMPFile(const string& dir, string* path) { + string file = dir + "/exception-handler-unittest.XXXXXX"; const char* c_file = file.c_str(); // Copy that string, mkstemp needs a C string it can modify. char* c_path = strdup(c_file); @@ -98,7 +98,7 @@ void WaitForProcessToTerminate(pid_t process_id, int expected_status) { } // Reads the minidump path sent over the pipe |fd| and sets it in |path|. -void ReadMinidumpPathFromPipe(int fd, std::string* path) { +void ReadMinidumpPathFromPipe(int fd, string* path) { struct pollfd pfd; memset(&pfd, 0, sizeof(pfd)); pfd.fd = fd; @@ -133,7 +133,7 @@ TEST(ExceptionHandlerTest, SimpleWithPath) { TEST(ExceptionHandlerTest, SimpleWithFD) { AutoTempDir temp_dir; - std::string path; + string path; const int fd = CreateTMPFile(temp_dir.path(), &path); ExceptionHandler handler(MinidumpDescriptor(fd), NULL, NULL, NULL, true, -1); close(fd); @@ -159,7 +159,7 @@ void ChildCrash(bool use_fd) { AutoTempDir temp_dir; int fds[2] = {0}; int minidump_fd = -1; - std::string minidump_path; + string minidump_path; if (use_fd) { minidump_fd = CreateTMPFile(temp_dir.path(), &minidump_path); } else { @@ -169,7 +169,7 @@ void ChildCrash(bool use_fd) { const pid_t child = fork(); if (child == 0) { { - scoped_ptr handler; + google_breakpad::scoped_ptr handler; if (use_fd) { handler.reset(new ExceptionHandler(MinidumpDescriptor(minidump_fd), NULL, NULL, NULL, true, -1)); @@ -238,6 +238,7 @@ static bool FilterCallbackReturnTrue(void* context) { // redelivered to this handler. If the child dies with SIGSEGV then it wasn't. static void RaiseSIGKILL(int sig) { raise(SIGKILL); + return false; } static bool InstallRaiseSIGKILL() { @@ -917,7 +918,7 @@ TEST(ExceptionHandlerTest, WriteMinidumpExceptionStream) { TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithFD) { AutoTempDir temp_dir; - std::string path; + string path; const int fd = CreateTMPFile(temp_dir.path(), &path); ExceptionHandler handler(MinidumpDescriptor(fd), NULL, NULL, NULL, false, -1); ASSERT_TRUE(handler.WriteMinidump()); @@ -942,7 +943,7 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) { struct stat st; ASSERT_EQ(0, stat(minidump_1.path(), &st)); ASSERT_GT(st.st_size, 0U); - std::string minidump_1_path(minidump_1.path()); + string minidump_1_path(minidump_1.path()); // Check it is a valid minidump. Minidump minidump1(minidump_1_path); ASSERT_TRUE(minidump1.Read()); @@ -953,7 +954,7 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) { const MinidumpDescriptor& minidump_2 = handler.minidump_descriptor(); ASSERT_EQ(0, stat(minidump_2.path(), &st)); ASSERT_GT(st.st_size, 0U); - std::string minidump_2_path(minidump_2.path()); + string minidump_2_path(minidump_2.path()); // Check it is a valid minidump. Minidump minidump2(minidump_2_path); ASSERT_TRUE(minidump2.Read()); diff --git a/src/google_breakpad/common/minidump_exception_linux.h b/src/google_breakpad/common/minidump_exception_linux.h index c8c87568..9e7e4f1e 100644 --- a/src/google_breakpad/common/minidump_exception_linux.h +++ b/src/google_breakpad/common/minidump_exception_linux.h @@ -80,7 +80,8 @@ typedef enum { MD_EXCEPTION_CODE_LIN_SIGIO = 29, /* I/O now possible (4.2 BSD) */ MD_EXCEPTION_CODE_LIN_SIGPWR = 30, /* Power failure restart (System V) */ MD_EXCEPTION_CODE_LIN_SIGSYS = 31, /* Bad system call */ - MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED = -1 /* No exception, dump requested */ + MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED = 0xFFFFFFFF /* No exception, + dump requested. */ } MDExceptionCodeLinux; #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__ */ -- cgit v1.2.1