aboutsummaryrefslogtreecommitdiff
path: root/src/processor/testdata/test_app.cc
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-11-06 23:00:19 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-11-06 23:00:19 +0000
commit76f052f8fbf8864dee5992b857229d06560a766a (patch)
tree330fbb8f2e053ab28e1a22ae825e2b94bd2026d9 /src/processor/testdata/test_app.cc
parentMinidumps should indicate which thread generated the dump and which requested (diff)
downloadbreakpad-76f052f8fbf8864dee5992b857229d06560a766a.tar.xz
Suppress handler thread from appearing in MinidumpProcessor's ProcessState
(#65). r=bryner - Interface change: (ProcessState).crash_thread is now requesting_thread and will be populated for non-crash dumps. If the requesting thread cannot be determined, requesting_thread is set to -1. http://groups.google.com/group/airbag-dev/browse_thread/thread/c422ec481a2db440 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@62 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/testdata/test_app.cc')
-rw-r--r--src/processor/testdata/test_app.cc49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/processor/testdata/test_app.cc b/src/processor/testdata/test_app.cc
index 9b34f440..da0ac197 100644
--- a/src/processor/testdata/test_app.cc
+++ b/src/processor/testdata/test_app.cc
@@ -28,47 +28,32 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file is used to generate minidump2.dmp and minidump2.sym.
-// cl /Zi /Fetest_app.exe test_app.cc dbghelp.lib
+// cl /Zi test_app.cc /Fetest_app.exe /I airbag/src \
+// airbag/src/client/windows/releasestaticcrt/exception_handler.lib \
+// ole32.lib
// Then run test_app to generate a dump, and dump_syms to create the .sym file.
-#include <windows.h>
-#include <dbghelp.h>
+#include <cstdio>
-static LONG HandleException(EXCEPTION_POINTERS *exinfo) {
- HANDLE dump_file = CreateFile("dump.dmp",
- GENERIC_WRITE,
- FILE_SHARE_WRITE,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
+#include "client/windows/handler/exception_handler.h"
- MINIDUMP_EXCEPTION_INFORMATION except_info;
- except_info.ThreadId = GetCurrentThreadId();
- except_info.ExceptionPointers = exinfo;
- except_info.ClientPointers = false;
-
- MiniDumpWriteDump(GetCurrentProcess(),
- GetCurrentProcessId(),
- dump_file,
- MiniDumpNormal,
- &except_info,
- NULL,
- NULL);
-
- CloseHandle(dump_file);
- return EXCEPTION_EXECUTE_HANDLER;
+void callback(const std::wstring &id, void *context, bool succeeded) {
+ if (succeeded) {
+ printf("dump guid is %ws\n", id.c_str());
+ } else {
+ printf("dump failed\n");
+ }
+ exit(1);
}
void CrashFunction() {
- int *i = NULL;
+ int *i = reinterpret_cast<int*>(0x45);
*i = 5; // crash!
}
-int main(int argc, char *argv[]) {
- __try {
- CrashFunction();
- } __except(HandleException(GetExceptionInformation())) {
- }
+int main(int argc, char **argv) {
+ google_airbag::ExceptionHandler eh(L".", callback, NULL, true);
+ CrashFunction();
+ printf("did not crash?\n");
return 0;
}