Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: breakpad/linux/generate-test-dump.cc

Issue 10825329: Rolling the DEPS of Breakpad. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed some breadpad targets Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
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 "third_party/lss/linux_syscall_support.h" 38 #include "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 google_breakpad::MinidumpDescriptor& descriptor,
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: ";
49 sys_write(2, msg, sizeof(msg) - 1); 49 sys_write(2, msg, sizeof(msg) - 1);
50 sys_write(2, dump_path, my_strlen(dump_path)); 50 sys_write(2, descriptor.path(), strlen(descriptor.path()));
51 sys_write(2, "/", 1); 51 sys_write(2, "\n", 1);
52 sys_write(2, minidump_id, my_strlen(minidump_id));
53 sys_write(2, ".dmp\n", 5);
54 52
55 return true; 53 return true;
56 } 54 }
57 55
58 static void DoSomethingWhichCrashes() { 56 static void DoSomethingWhichCrashes() {
59 int local_var = 1; 57 int local_var = 1;
60 *reinterpret_cast<volatile char*>(NULL) = 1; 58 *reinterpret_cast<volatile char*>(NULL) = 1;
61 } 59 }
62 60
63 int main() { 61 int main() {
64 google_breakpad::ExceptionHandler breakpad(".", NULL, DumpCallback, NULL, 62 google_breakpad::MinidumpDescriptor minidump(".");
65 true); 63 google_breakpad::ExceptionHandler breakpad(minidump, NULL, DumpCallback, NULL,
64 true, -1);
66 DoSomethingWhichCrashes(); 65 DoSomethingWhichCrashes();
67 return 0; 66 return 0;
68 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698