diff options
author | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-11-06 20:54:19 +0000 |
---|---|---|
committer | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-11-06 20:54:19 +0000 |
commit | 5ac32b6534688b71a2b6fe7841cf7e552a992d01 (patch) | |
tree | 5f114d6826ebebbdf88d04b89305106473743cd2 /src | |
parent | Move headers for exported interfaces into src/google_airbag (#51). r=bryner (diff) | |
download | breakpad-5ac32b6534688b71a2b6fe7841cf7e552a992d01.tar.xz |
Minidumps should indicate which thread generated the dump and which requested
dump generation (#57). r=bryner
http://groups.google.com/group/airbag-dev/browse_thread/thread/f11758d171261184
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@61 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r-- | src/client/windows/handler/exception_handler.cc | 24 | ||||
-rw-r--r-- | src/client/windows/handler/exception_handler.vcproj | 4 | ||||
-rw-r--r-- | src/google_airbag/common/minidump_format.h | 60 |
3 files changed, 85 insertions, 3 deletions
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index 1d64cf9e..761f3151 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -33,6 +33,7 @@ #include "client/windows/handler/exception_handler.h" #include "common/windows/guid_string.h" +#include "google_airbag/common/minidump_format.h" namespace google_airbag { @@ -189,7 +190,26 @@ bool ExceptionHandler::WriteMinidumpWithException(DWORD requesting_thread_id, except_info.ExceptionPointers = exinfo; except_info.ClientPointers = FALSE; - // TODO(mmentovai): include IDs of handler and requesting threads. + // Add an MDRawAirbagInfo stream to the minidump, to provide additional + // information about the exception handler to the Airbag processor. The + // information will help the processor determine which threads are + // relevant. The Airbag processor does not require this information but + // can function better with Airbag-generated dumps when it is present. + // The native debugger is not harmed by the presence of this information. + MDRawAirbagInfo airbag_info; + airbag_info.validity = MD_AIRBAG_INFO_VALID_DUMP_THREAD_ID | + MD_AIRBAG_INFO_VALID_REQUESTING_THREAD_ID; + airbag_info.dump_thread_id = GetCurrentThreadId(); + airbag_info.requesting_thread_id = requesting_thread_id; + + MINIDUMP_USER_STREAM airbag_info_stream; + airbag_info_stream.Type = MD_AIRBAG_INFO_STREAM; + airbag_info_stream.BufferSize = sizeof(airbag_info); + airbag_info_stream.Buffer = &airbag_info; + + MINIDUMP_USER_STREAM_INFORMATION user_streams; + user_streams.UserStreamCount = 1; + user_streams.UserStreamArray = &airbag_info_stream; // The explicit comparison to TRUE avoids a warning (C4800). success = (minidump_write_dump_(GetCurrentProcess(), @@ -197,7 +217,7 @@ bool ExceptionHandler::WriteMinidumpWithException(DWORD requesting_thread_id, dump_file, MiniDumpNormal, exinfo ? &except_info : NULL, - NULL, + &user_streams, NULL) == TRUE); CloseHandle(dump_file); diff --git a/src/client/windows/handler/exception_handler.vcproj b/src/client/windows/handler/exception_handler.vcproj index 70efe119..458cac4b 100644 --- a/src/client/windows/handler/exception_handler.vcproj +++ b/src/client/windows/handler/exception_handler.vcproj @@ -294,6 +294,10 @@ RelativePath="..\..\..\common\windows\guid_string.h"
>
</File>
+ <File
+ RelativePath="..\..\..\google_airbag\common\minidump_format.h"
+ >
+ </File>
</Filter>
<Filter
Name="Resource Files"
diff --git a/src/google_airbag/common/minidump_format.h b/src/google_airbag/common/minidump_format.h index 9ee63ab3..977cbc3c 100644 --- a/src/google_airbag/common/minidump_format.h +++ b/src/google_airbag/common/minidump_format.h @@ -71,6 +71,14 @@ #include "google_airbag/common/airbag_types.h" +#if defined(_MSC_VER) +/* Disable "zero-sized array in struct/union" warnings when compiling in + * MSVC. DbgHelp.h does this too. */ +#pragma warning(push) +#pragma warning(disable:4200) +#endif /* _MSC_VER */ + + /* * guiddef.h */ @@ -483,7 +491,10 @@ typedef enum { MD_FUNCTION_TABLE_STREAM = 13, MD_UNLOADED_MODULE_LIST_STREAM = 14, MD_MISC_INFO_STREAM = 15, /* MDRawMiscInfo */ - MD_LAST_RESERVED_STREAM = 0x0000ffff + MD_LAST_RESERVED_STREAM = 0x0000ffff, + + /* Airbag extension types. 0x4767 = "Gg" */ + MD_AIRBAG_INFO_STREAM = 0x47670001 /* MDRawAirbagInfo */ } MDStreamType; /* MINIDUMP_STREAM_TYPE */ @@ -963,4 +974,51 @@ typedef enum { } MDMiscInfoFlags1; +/* + * Airbag extension types + */ + + +typedef struct { + /* validity is a bitmask with values from MDAirbagInfoValidity, indicating + * which of the other fields in the structure are valid. */ + u_int32_t validity; + + /* Thread ID of the handler thread. dump_thread_id should correspond to + * the thread_id of an MDRawThread in the minidump's MDRawThreadList if + * a dedicated thread in that list was used to produce the minidump. If + * the MDRawThreadList does not contain a dedicated thread used to produce + * the minidump, this field should be set to 0 and the validity field + * must not contain MD_AIRBAG_INFO_VALID_DUMP_THREAD_ID. */ + u_int32_t dump_thread_id; + + /* Thread ID of the thread that requested the minidump be produced. As + * with dump_thread_id, requesting_thread_id should correspond to the + * thread_id of an MDRawThread in the minidump's MDRawThreadList. For + * minidumps produced as a result of an exception, requesting_thread_id + * will be the same as the MDRawExceptionStream's thread_id field. For + * minidumps produced "manually" at the program's request, + * requesting_thread_id will indicate which thread caused the dump to be + * written. If the minidump was produced at the request of something + * other than a thread in the MDRawThreadList, this field should be set + * to 0 and the validity field must not contain + * MD_AIRBAG_INFO_VALID_REQUESTING_THREAD_ID. */ + u_int32_t requesting_thread_id; +} MDRawAirbagInfo; + +/* For (MDRawAirbagInfo).validity: */ +typedef enum { + /* When set, the dump_thread_id field is valid. */ + MD_AIRBAG_INFO_VALID_DUMP_THREAD_ID = 1 << 0, + + /* When set, the requesting_thread_id field is valid. */ + MD_AIRBAG_INFO_VALID_REQUESTING_THREAD_ID = 1 << 1 +} MDAirbagInfoValidity; + + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + + #endif /* GOOGLE_AIRBAG_COMMON_MINIDUMP_FORMAT_H__ */ |