mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-22 19:36:05 +00:00
Add module list to machine-readable minidump_stackwalk output (#119).
Patch by Ted Mielczarek. r=me http://groups.google.com/group/airbag-dev/browse_thread/thread/144e66b1de80b1db git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@114 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
482e44bf51
commit
d986a54f67
|
@ -118,7 +118,8 @@ endif SELFTEST
|
|||
|
||||
check_SCRIPTS = \
|
||||
src/processor/minidump_dump_test \
|
||||
src/processor/minidump_stackwalk_test
|
||||
src/processor/minidump_stackwalk_test \
|
||||
src/processor/minidump_stackwalk_machine_readable_test
|
||||
|
||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||
TESTS_ENVIRONMENT =
|
||||
|
@ -220,6 +221,7 @@ EXTRA_DIST = \
|
|||
src/common/windows/string_utils-inl.h \
|
||||
src/processor/testdata/minidump2.dmp \
|
||||
src/processor/testdata/minidump2.dump.out \
|
||||
src/processor/testdata/minidump2.stackwalk.machine_readable.out \
|
||||
src/processor/testdata/minidump2.stackwalk.out \
|
||||
src/processor/testdata/module1.out \
|
||||
src/processor/testdata/module2.out \
|
||||
|
|
|
@ -416,7 +416,8 @@ src_libairbag_la_SOURCES = \
|
|||
|
||||
check_SCRIPTS = \
|
||||
src/processor/minidump_dump_test \
|
||||
src/processor/minidump_stackwalk_test
|
||||
src/processor/minidump_stackwalk_test \
|
||||
src/processor/minidump_stackwalk_machine_readable_test
|
||||
|
||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||
TESTS_ENVIRONMENT =
|
||||
|
@ -515,6 +516,7 @@ EXTRA_DIST = \
|
|||
src/common/windows/string_utils-inl.h \
|
||||
src/processor/testdata/minidump2.dmp \
|
||||
src/processor/testdata/minidump2.dump.out \
|
||||
src/processor/testdata/minidump2.stackwalk.machine_readable.out \
|
||||
src/processor/testdata/minidump2.stackwalk.out \
|
||||
src/processor/testdata/module1.out \
|
||||
src/processor/testdata/module2.out \
|
||||
|
|
|
@ -232,7 +232,11 @@ static void PrintModules(const CodeModules *modules) {
|
|||
printf("\n");
|
||||
printf("Loaded modules:\n");
|
||||
|
||||
u_int64_t main_address = modules->GetMainModule()->base_address();
|
||||
u_int64_t main_address = 0xffffffffffffffffLL;
|
||||
const CodeModule *main_module = modules->GetMainModule();
|
||||
if (main_module) {
|
||||
main_address = main_module->base_address();
|
||||
}
|
||||
|
||||
unsigned int module_count = modules->module_count();
|
||||
for (unsigned int module_sequence = 0;
|
||||
|
@ -244,7 +248,37 @@ static void PrintModules(const CodeModules *modules) {
|
|||
base_address, base_address + module->size() - 1,
|
||||
PathnameStripper::File(module->code_file()).c_str(),
|
||||
module->version().empty() ? "???" : module->version().c_str(),
|
||||
module->base_address() == main_address ? " (main)" : "");
|
||||
base_address == main_address ? " (main)" : "");
|
||||
}
|
||||
}
|
||||
|
||||
// PrintModulesMachineReadable outputs a list of loaded modules,
|
||||
// one per line, in the following machine-readable pipe-delimited
|
||||
// text format:
|
||||
// Module|{Module Filename}|{Version}|{Base Address}|{Max Address}|{Main}
|
||||
static void PrintModulesMachineReadable(const CodeModules *modules) {
|
||||
if (!modules)
|
||||
return;
|
||||
|
||||
u_int64_t main_address = 0xffffffffffffffffLL;
|
||||
const CodeModule *main_module = modules->GetMainModule();
|
||||
if (main_module) {
|
||||
main_address = main_module->base_address();
|
||||
}
|
||||
|
||||
unsigned int module_count = modules->module_count();
|
||||
for (unsigned int module_sequence = 0;
|
||||
module_sequence < module_count;
|
||||
++module_sequence) {
|
||||
const CodeModule *module = modules->GetModuleAtSequence(module_sequence);
|
||||
u_int64_t base_address = module->base_address();
|
||||
printf("Module%c%s%c%s%c0x%08llx%c0x%08llx%c%d\n",
|
||||
kOutputSeparator,
|
||||
StripSeparator(PathnameStripper::File(module->code_file())).c_str(),
|
||||
kOutputSeparator, StripSeparator(module->version()).c_str(),
|
||||
kOutputSeparator, base_address,
|
||||
kOutputSeparator, base_address + module->size() - 1,
|
||||
kOutputSeparator, base_address == main_address ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,6 +363,8 @@ static void PrintProcessStateMachineReadable(const ProcessState& process_state)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
PrintModulesMachineReadable(process_state.modules());
|
||||
|
||||
// blank line to indicate start of threads
|
||||
printf("\n");
|
||||
|
||||
|
|
37
src/processor/minidump_stackwalk_machine_readable_test
Executable file
37
src/processor/minidump_stackwalk_machine_readable_test
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2007, Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
testdata_dir=$srcdir/src/processor/testdata
|
||||
./src/processor/minidump_stackwalk -m $testdata_dir/minidump2.dmp \
|
||||
$testdata_dir/symbols | \
|
||||
tr -d '\015' | \
|
||||
diff -u $testdata_dir/minidump2.stackwalk.machine_readable.out -
|
||||
exit $?
|
21
src/processor/testdata/minidump2.stackwalk.machine_readable.out
vendored
Normal file
21
src/processor/testdata/minidump2.stackwalk.machine_readable.out
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
OS|Windows NT|5.1.2600 Service Pack 2
|
||||
CPU|x86|GenuineIntel family 6 model 13 stepping 8
|
||||
Crash|EXCEPTION_ACCESS_VIOLATION|0x45|0
|
||||
Module|test_app.exe||0x00400000|0x0042bfff|1
|
||||
Module|dbghelp.dll|5.1.2600.2180|0x59a60000|0x59b00fff|0
|
||||
Module|imm32.dll|5.1.2600.2180|0x76390000|0x763acfff|0
|
||||
Module|psapi.dll|5.1.2600.2180|0x76bf0000|0x76bfafff|0
|
||||
Module|ole32.dll|5.1.2600.2726|0x774e0000|0x7761cfff|0
|
||||
Module|version.dll|5.1.2600.2180|0x77c00000|0x77c07fff|0
|
||||
Module|msvcrt.dll|7.0.2600.2180|0x77c10000|0x77c67fff|0
|
||||
Module|user32.dll|5.1.2600.2622|0x77d40000|0x77dcffff|0
|
||||
Module|advapi32.dll|5.1.2600.2180|0x77dd0000|0x77e6afff|0
|
||||
Module|rpcrt4.dll|5.1.2600.2180|0x77e70000|0x77f00fff|0
|
||||
Module|gdi32.dll|5.1.2600.2818|0x77f10000|0x77f56fff|0
|
||||
Module|kernel32.dll|5.1.2600.2945|0x7c800000|0x7c8f3fff|0
|
||||
Module|ntdll.dll|5.1.2600.2180|0x7c900000|0x7c9affff|0
|
||||
|
||||
0|0|test_app.exe|`anonymous namespace'::CrashFunction|c:\test_app.cc|56|0x3
|
||||
0|1|test_app.exe|main|c:\test_app.cc|63|0x4
|
||||
0|2|test_app.exe|__tmainCRTStartup|f:\rtm\vctools\crt_bld\self_x86\crt\src\crt0.c|318|0x11
|
||||
0|3|kernel32.dll|BaseProcessStart|||0x22
|
Loading…
Reference in a new issue