OLD | NEW |
1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 // This code exists to generate minidump files for testing. | 30 // This code exists to generate minidump files for testing. |
31 | 31 |
32 #include <stdlib.h> | 32 #include <stdlib.h> |
33 | 33 |
34 #include <unistd.h> | 34 #include <unistd.h> |
35 | 35 |
36 #include "breakpad/src/client/linux/handler/exception_handler.h" | 36 #include "breakpad/src/client/linux/handler/exception_handler.h" |
37 #include "breakpad/src/common/linux/linux_libc_support.h" | 37 #include "breakpad/src/common/linux/linux_libc_support.h" |
38 #include "breakpad/src/common/linux/linux_syscall_support.h" | 38 #include "breakpad/src/third_party/lss/linux_syscall_support.h" |
39 | 39 |
40 static bool DumpCallback(const char* dump_path, const char* minidump_id, | 40 static bool DumpCallback(const char* dump_path, const char* minidump_id, |
41 void* context, bool success) { | 41 void* context, bool success) { |
42 if (!success) { | 42 if (!success) { |
43 static const char msg[] = "Failed to write minidump\n"; | 43 static const char msg[] = "Failed to write minidump\n"; |
44 sys_write(2, msg, sizeof(msg) - 1); | 44 sys_write(2, msg, sizeof(msg) - 1); |
45 return false; | 45 return false; |
46 } | 46 } |
47 | 47 |
48 static const char msg[] = "Wrote minidump: "; | 48 static const char msg[] = "Wrote minidump: "; |
(...skipping 10 matching lines...) Expand all Loading... |
59 int local_var = 1; | 59 int local_var = 1; |
60 *reinterpret_cast<char*>(NULL) = 1; | 60 *reinterpret_cast<char*>(NULL) = 1; |
61 } | 61 } |
62 | 62 |
63 int main() { | 63 int main() { |
64 google_breakpad::ExceptionHandler breakpad(".", NULL, DumpCallback, NULL, | 64 google_breakpad::ExceptionHandler breakpad(".", NULL, DumpCallback, NULL, |
65 true); | 65 true); |
66 DoSomethingWhichCrashes(); | 66 DoSomethingWhichCrashes(); |
67 return 0; | 67 return 0; |
68 } | 68 } |
OLD | NEW |