diff options
author | ted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-12-16 22:52:38 +0000 |
---|---|---|
committer | ted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-12-16 22:52:38 +0000 |
commit | c45b12b4225be716eba98f8305eebe36b2b19dbb (patch) | |
tree | 04abc736760349d6d8d4880c3e3d75cfb21197fc /src/client/mac/tests/minidump_generator_test_helper.cc | |
parent | Allow out-of-process minidump generation to work on processes of a different ... (diff) | |
download | breakpad-c45b12b4225be716eba98f8305eebe36b2b19dbb.tar.xz |
Fix MinidumpGenerator::WriteExceptionStream for writing cross-architecture dumps
R=mark at http://breakpad.appspot.com/244001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@747 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/mac/tests/minidump_generator_test_helper.cc')
-rw-r--r-- | src/client/mac/tests/minidump_generator_test_helper.cc | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/client/mac/tests/minidump_generator_test_helper.cc b/src/client/mac/tests/minidump_generator_test_helper.cc index 41ef449d..4e8ce3cf 100644 --- a/src/client/mac/tests/minidump_generator_test_helper.cc +++ b/src/client/mac/tests/minidump_generator_test_helper.cc @@ -31,9 +31,11 @@ // minidump_generator_test.cc can launch to test certain things // that require a separate executable. -#include "common/mac/MachIPC.h" #include <unistd.h> +#include "client/mac/handler/exception_handler.h" +#include "common/mac/MachIPC.h" + using google_breakpad::MachPortSender; using google_breakpad::MachReceiveMessage; using google_breakpad::MachSendMessage; @@ -43,21 +45,30 @@ int main(int argc, char** argv) { if (argc < 2) return 1; - const int kTimeoutMs = 2000; - // Send parent process the task and thread ports. - MachSendMessage child_message(0); - child_message.AddDescriptor(mach_task_self()); - child_message.AddDescriptor(mach_thread_self()); + if (strcmp(argv[1], "crash") != 0) { + const int kTimeoutMs = 2000; + // Send parent process the task and thread ports. + MachSendMessage child_message(0); + child_message.AddDescriptor(mach_task_self()); + child_message.AddDescriptor(mach_thread_self()); - MachPortSender child_sender(argv[1]); - if (child_sender.SendMessage(child_message, kTimeoutMs) != KERN_SUCCESS) { - fprintf(stderr, "Error sending message from child process!\n"); - exit(1); - } + MachPortSender child_sender(argv[1]); + if (child_sender.SendMessage(child_message, kTimeoutMs) != KERN_SUCCESS) { + fprintf(stderr, "Error sending message from child process!\n"); + exit(1); + } - // Loop forever. - while (true) { - sleep(100); + // Loop forever. + while (true) { + sleep(100); + } + } else if (argc == 3 && strcmp(argv[1], "crash") == 0) { + // Instantiate an OOP exception handler + google_breakpad::ExceptionHandler eh("", NULL, NULL, NULL, true, argv[2]); + // and crash. + int *a = (int*)0x42; + *a = 1; } + return 0; } |