aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/google_breakpad/Android.mk1
-rw-r--r--android/sample_app/jni/test_breakpad.cpp10
-rw-r--r--src/client/linux/handler/exception_handler.cc5
-rw-r--r--src/client/linux/handler/minidump_descriptor.h6
4 files changed, 16 insertions, 6 deletions
diff --git a/android/google_breakpad/Android.mk b/android/google_breakpad/Android.mk
index 00ea737e..f6d0b22a 100644
--- a/android/google_breakpad/Android.mk
+++ b/android/google_breakpad/Android.mk
@@ -77,6 +77,7 @@ LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := \
src/client/linux/crash_generation/crash_generation_client.cc \
src/client/linux/handler/exception_handler.cc \
+ src/client/linux/handler/minidump_descriptor.cc \
src/client/linux/log/log.cc \
src/client/linux/minidump_writer/linux_dumper.cc \
src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
diff --git a/android/sample_app/jni/test_breakpad.cpp b/android/sample_app/jni/test_breakpad.cpp
index 6c18edfb..9c4ebbb1 100644
--- a/android/sample_app/jni/test_breakpad.cpp
+++ b/android/sample_app/jni/test_breakpad.cpp
@@ -30,14 +30,14 @@
#include <stdio.h>
#include "client/linux/handler/exception_handler.h"
+#include "client/linux/handler/minidump_descriptor.h"
namespace {
-bool DumpCallback(const char* dump_path,
- const char* minidump_id,
+bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
void* context,
bool succeeded) {
- printf("Dump path: %s/%s.dmp\n", dump_path, minidump_id);
+ printf("Dump path: %s\n", descriptor.path());
return succeeded;
}
@@ -49,7 +49,9 @@ void Crash() {
} // namespace
int main(int argc, char* argv[]) {
- google_breakpad::ExceptionHandler eh(".", NULL, DumpCallback, NULL, true);
+ google_breakpad::MinidumpDescriptor descriptor(".");
+ google_breakpad::ExceptionHandler eh(descriptor, NULL, DumpCallback,
+ NULL, true, -1);
Crash();
return 0;
}
diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
index 61dc2a1a..f10cdbf1 100644
--- a/src/client/linux/handler/exception_handler.cc
+++ b/src/client/linux/handler/exception_handler.cc
@@ -326,11 +326,16 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
// This is a public interface to HandleSignal that allows the client to
// generate a crash dump. This function may run in a compromised context.
bool ExceptionHandler::SimulateSignalDelivery(int sig) {
+#ifdef __ANDROID__
+ // Android doesn't provide getcontext().
+ return false;
+#else
siginfo_t siginfo;
my_memset(&siginfo, 0, sizeof(siginfo_t));
struct ucontext context;
getcontext(&context);
return HandleSignal(sig, &siginfo, &context);
+#endif
}
// This function may run in a compromised context: see the top of the file.
diff --git a/src/client/linux/handler/minidump_descriptor.h b/src/client/linux/handler/minidump_descriptor.h
index 18e2cb41..5d331a3e 100644
--- a/src/client/linux/handler/minidump_descriptor.h
+++ b/src/client/linux/handler/minidump_descriptor.h
@@ -33,6 +33,8 @@
#include <assert.h>
#include <string>
+#include "common/using_std_string.h"
+
// The MinidumpDescriptor describes how to access a minidump: it can contain
// either a file descriptor or a path.
// Note that when using files, it is created with the path to a directory.
@@ -71,9 +73,9 @@ class MinidumpDescriptor {
const int fd_;
// The directory where the minidump should be generated.
- const std::string directory_;
+ const string directory_;
// The full path to the generated minidump.
- std::string path_;
+ string path_;
// The C string of |path_|. Precomputed so it can be access from a compromised
// context.
const char* c_path_;