From 0a5ebafdf088ae580a005a3ff2df227b98ce0582 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Fri, 11 Jul 2014 10:57:30 +0000 Subject: Stringify minidump stream_type constants in minidump_dump output R=mark at https://breakpad.appspot.com/3704002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1347 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/minidump.cc | 73 ++++++++++++++++++++++++++++++- src/processor/testdata/minidump2.dump.out | 34 +++++++------- 2 files changed, 88 insertions(+), 19 deletions(-) (limited to 'src/processor') diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc index 99f285ca..ee936719 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -4803,6 +4803,72 @@ MinidumpMemoryInfoList* Minidump::GetMemoryInfoList() { return GetStream(&memory_info_list); } +static const char* get_stream_name(uint32_t stream_type) { + switch (stream_type) { + case MD_UNUSED_STREAM: + return "MD_UNUSED_STREAM"; + case MD_RESERVED_STREAM_0: + return "MD_RESERVED_STREAM_0"; + case MD_RESERVED_STREAM_1: + return "MD_RESERVED_STREAM_1"; + case MD_THREAD_LIST_STREAM: + return "MD_THREAD_LIST_STREAM"; + case MD_MODULE_LIST_STREAM: + return "MD_MODULE_LIST_STREAM"; + case MD_MEMORY_LIST_STREAM: + return "MD_MEMORY_LIST_STREAM"; + case MD_EXCEPTION_STREAM: + return "MD_EXCEPTION_STREAM"; + case MD_SYSTEM_INFO_STREAM: + return "MD_SYSTEM_INFO_STREAM"; + case MD_THREAD_EX_LIST_STREAM: + return "MD_THREAD_EX_LIST_STREAM"; + case MD_MEMORY_64_LIST_STREAM: + return "MD_MEMORY_64_LIST_STREAM"; + case MD_COMMENT_STREAM_A: + return "MD_COMMENT_STREAM_A"; + case MD_COMMENT_STREAM_W: + return "MD_COMMENT_STREAM_W"; + case MD_HANDLE_DATA_STREAM: + return "MD_HANDLE_DATA_STREAM"; + case MD_FUNCTION_TABLE_STREAM: + return "MD_FUNCTION_TABLE_STREAM"; + case MD_UNLOADED_MODULE_LIST_STREAM: + return "MD_UNLOADED_MODULE_LIST_STREAM"; + case MD_MISC_INFO_STREAM: + return "MD_MISC_INFO_STREAM"; + case MD_MEMORY_INFO_LIST_STREAM: + return "MD_MEMORY_INFO_LIST_STREAM"; + case MD_THREAD_INFO_LIST_STREAM: + return "MD_THREAD_INFO_LIST_STREAM"; + case MD_HANDLE_OPERATION_LIST_STREAM: + return "MD_HANDLE_OPERATION_LIST_STREAM"; + case MD_LAST_RESERVED_STREAM: + return "MD_LAST_RESERVED_STREAM"; + case MD_BREAKPAD_INFO_STREAM: + return "MD_BREAKPAD_INFO_STREAM"; + case MD_ASSERTION_INFO_STREAM: + return "MD_ASSERTION_INFO_STREAM"; + case MD_LINUX_CPU_INFO: + return "MD_LINUX_CPU_INFO"; + case MD_LINUX_PROC_STATUS: + return "MD_LINUX_PROC_STATUS"; + case MD_LINUX_LSB_RELEASE: + return "MD_LINUX_LSB_RELEASE"; + case MD_LINUX_CMD_LINE: + return "MD_LINUX_CMD_LINE"; + case MD_LINUX_ENVIRON: + return "MD_LINUX_ENVIRON"; + case MD_LINUX_AUXV: + return "MD_LINUX_AUXV"; + case MD_LINUX_MAPS: + return "MD_LINUX_MAPS"; + case MD_LINUX_DSO_DEBUG: + return "MD_LINUX_DSO_DEBUG"; + default: + return "unknown"; + } +} void Minidump::Print() { if (!valid_) { @@ -4829,7 +4895,8 @@ void Minidump::Print() { printf("mDirectory[%d]\n", stream_index); printf("MDRawDirectory\n"); - printf(" stream_type = %d\n", directory_entry->stream_type); + printf(" stream_type = 0x%x (%s)\n", directory_entry->stream_type, + get_stream_name(directory_entry->stream_type)); printf(" location.data_size = %d\n", directory_entry->location.data_size); printf(" location.rva = 0x%x\n", directory_entry->location.rva); @@ -4842,7 +4909,9 @@ void Minidump::Print() { ++iterator) { uint32_t stream_type = iterator->first; MinidumpStreamInfo info = iterator->second; - printf(" stream type 0x%x at index %d\n", stream_type, info.stream_index); + printf(" stream type 0x%x (%s) at index %d\n", stream_type, + get_stream_name(stream_type), + info.stream_index); } printf("\n"); } diff --git a/src/processor/testdata/minidump2.dump.out b/src/processor/testdata/minidump2.dump.out index 41ababb1..8585c89b 100644 --- a/src/processor/testdata/minidump2.dump.out +++ b/src/processor/testdata/minidump2.dump.out @@ -9,67 +9,67 @@ MDRawHeader mDirectory[0] MDRawDirectory - stream_type = 3 + stream_type = 0x3 (MD_THREAD_LIST_STREAM) location.data_size = 100 location.rva = 0x184 mDirectory[1] MDRawDirectory - stream_type = 4 + stream_type = 0x4 (MD_MODULE_LIST_STREAM) location.data_size = 1408 location.rva = 0x1e8 mDirectory[2] MDRawDirectory - stream_type = 5 + stream_type = 0x5 (MD_MEMORY_LIST_STREAM) location.data_size = 52 location.rva = 0x1505 mDirectory[3] MDRawDirectory - stream_type = 6 + stream_type = 0x6 (MD_EXCEPTION_STREAM) location.data_size = 168 location.rva = 0xdc mDirectory[4] MDRawDirectory - stream_type = 7 + stream_type = 0x7 (MD_SYSTEM_INFO_STREAM) location.data_size = 56 location.rva = 0x8c mDirectory[5] MDRawDirectory - stream_type = 15 + stream_type = 0xf (MD_MISC_INFO_STREAM) location.data_size = 24 location.rva = 0xc4 mDirectory[6] MDRawDirectory - stream_type = 1197932545 + stream_type = 0x47670001 (MD_BREAKPAD_INFO_STREAM) location.data_size = 12 location.rva = 0x14f9 mDirectory[7] MDRawDirectory - stream_type = 0 + stream_type = 0x0 (MD_UNUSED_STREAM) location.data_size = 0 location.rva = 0x0 mDirectory[8] MDRawDirectory - stream_type = 0 + stream_type = 0x0 (MD_UNUSED_STREAM) location.data_size = 0 location.rva = 0x0 Streams: - stream type 0x0 at index 8 - stream type 0x3 at index 0 - stream type 0x4 at index 1 - stream type 0x5 at index 2 - stream type 0x6 at index 3 - stream type 0x7 at index 4 - stream type 0xf at index 5 - stream type 0x47670001 at index 6 + stream type 0x0 (MD_UNUSED_STREAM) at index 8 + stream type 0x3 (MD_THREAD_LIST_STREAM) at index 0 + stream type 0x4 (MD_MODULE_LIST_STREAM) at index 1 + stream type 0x5 (MD_MEMORY_LIST_STREAM) at index 2 + stream type 0x6 (MD_EXCEPTION_STREAM) at index 3 + stream type 0x7 (MD_SYSTEM_INFO_STREAM) at index 4 + stream type 0xf (MD_MISC_INFO_STREAM) at index 5 + stream type 0x47670001 (MD_BREAKPAD_INFO_STREAM) at index 6 MinidumpThreadList thread_count = 2 -- cgit v1.2.1