Refactoring in preparation for microdump processing

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1370 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmandlis@chromium.org 2014-09-08 19:10:42 +00:00
parent a58de86bcd
commit 54c2560a82
22 changed files with 1058 additions and 666 deletions

View File

@ -159,11 +159,14 @@ src_libbreakpad_a_SOURCES = \
src/google_breakpad/processor/call_stack.h \
src/google_breakpad/processor/code_module.h \
src/google_breakpad/processor/code_modules.h \
src/google_breakpad/processor/dump_context.h \
src/google_breakpad/processor/dump_object.h \
src/google_breakpad/processor/exploitability.h \
src/google_breakpad/processor/fast_source_line_resolver.h \
src/google_breakpad/processor/memory_region.h \
src/google_breakpad/processor/minidump.h \
src/google_breakpad/processor/minidump_processor.h \
src/google_breakpad/processor/process_result.h \
src/google_breakpad/processor/process_state.h \
src/google_breakpad/processor/source_line_resolver_base.h \
src/google_breakpad/processor/source_line_resolver_interface.h \
@ -189,6 +192,8 @@ src_libbreakpad_a_SOURCES = \
src/processor/contained_range_map.h \
src/processor/disassembler_x86.h \
src/processor/disassembler_x86.cc \
src/processor/dump_context.cc \
src/processor/dump_object.cc \
src/processor/exploitability.cc \
src/processor/exploitability_linux.h \
src/processor/exploitability_linux.cc \
@ -412,6 +417,8 @@ src_client_linux_linux_client_unittest_shlib_SOURCES = \
src/testing/gtest/src/gtest_main.cc \
src/testing/src/gmock-all.cc \
src/processor/basic_code_modules.cc \
src/processor/dump_context.cc \
src/processor/dump_object.cc \
src/processor/logging.cc \
src/processor/minidump.cc \
src/processor/pathname_stripper.cc
@ -676,6 +683,8 @@ src_processor_exploitability_unittest_LDADD = \
src/processor/basic_source_line_resolver.o \
src/processor/call_stack.o \
src/processor/cfi_frame_info.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
src/processor/logging.o \
src/processor/minidump.o \
src/processor/pathname_stripper.o \
@ -766,6 +775,8 @@ src_processor_minidump_processor_unittest_LDADD = \
src/processor/call_stack.o \
src/processor/cfi_frame_info.o \
src/processor/disassembler_x86.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
src/processor/exploitability_win.o \
@ -806,6 +817,8 @@ src_processor_minidump_unittest_CPPFLAGS = \
-I$(top_srcdir)/src/testing
src_processor_minidump_unittest_LDADD = \
src/processor/basic_code_modules.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
src/processor/logging.o \
src/processor/minidump.o \
src/processor/pathname_stripper.o \
@ -1056,6 +1069,8 @@ src_processor_minidump_dump_SOURCES = \
src/processor/minidump_dump.cc
src_processor_minidump_dump_LDADD = \
src/processor/basic_code_modules.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
src/processor/logging.o \
src/processor/minidump.o \
src/processor/pathname_stripper.o
@ -1069,6 +1084,8 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/call_stack.o \
src/processor/cfi_frame_info.o \
src/processor/disassembler_x86.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
src/processor/exploitability_win.o \

View File

@ -328,11 +328,14 @@ am__src_libbreakpad_a_SOURCES_DIST = \
src/google_breakpad/processor/call_stack.h \
src/google_breakpad/processor/code_module.h \
src/google_breakpad/processor/code_modules.h \
src/google_breakpad/processor/dump_context.h \
src/google_breakpad/processor/dump_object.h \
src/google_breakpad/processor/exploitability.h \
src/google_breakpad/processor/fast_source_line_resolver.h \
src/google_breakpad/processor/memory_region.h \
src/google_breakpad/processor/minidump.h \
src/google_breakpad/processor/minidump_processor.h \
src/google_breakpad/processor/process_result.h \
src/google_breakpad/processor/process_state.h \
src/google_breakpad/processor/source_line_resolver_base.h \
src/google_breakpad/processor/source_line_resolver_interface.h \
@ -355,6 +358,7 @@ am__src_libbreakpad_a_SOURCES_DIST = \
src/processor/contained_range_map.h \
src/processor/disassembler_x86.h \
src/processor/disassembler_x86.cc \
src/processor/dump_context.cc src/processor/dump_object.cc \
src/processor/exploitability.cc \
src/processor/exploitability_linux.h \
src/processor/exploitability_linux.cc \
@ -420,6 +424,8 @@ am__src_libbreakpad_a_SOURCES_DIST = \
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.$(OBJEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_win.$(OBJEXT) \
@ -556,8 +562,10 @@ am__src_client_linux_linux_client_unittest_shlib_SOURCES_DIST = \
src/testing/gtest/src/gtest-all.cc \
src/testing/gtest/src/gtest_main.cc \
src/testing/src/gmock-all.cc \
src/processor/basic_code_modules.cc src/processor/logging.cc \
src/processor/minidump.cc src/processor/pathname_stripper.cc \
src/processor/basic_code_modules.cc \
src/processor/dump_context.cc src/processor/dump_object.cc \
src/processor/logging.cc src/processor/minidump.cc \
src/processor/pathname_stripper.cc \
src/common/android/breakpad_getcontext.S \
src/common/android/breakpad_getcontext_unittest.cc
@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@am__objects_2 = src/common/android/src_client_linux_linux_client_unittest_shlib-breakpad_getcontext.$(OBJEXT) \
@ -581,6 +589,8 @@ am__src_client_linux_linux_client_unittest_shlib_SOURCES_DIST = \
@LINUX_HOST_TRUE@ src/testing/gtest/src/src_client_linux_linux_client_unittest_shlib-gtest_main.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/testing/src/src_client_linux_linux_client_unittest_shlib-gmock-all.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/processor/src_client_linux_linux_client_unittest_shlib-basic_code_modules.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/processor/src_client_linux_linux_client_unittest_shlib-logging.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/processor/src_client_linux_linux_client_unittest_shlib-minidump.$(OBJEXT) \
@LINUX_HOST_TRUE@ src/processor/src_client_linux_linux_client_unittest_shlib-pathname_stripper.$(OBJEXT) \
@ -810,6 +820,8 @@ src_processor_exploitability_unittest_OBJECTS = \
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_source_line_resolver.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/logging.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/pathname_stripper.o \
@ -871,6 +883,8 @@ src_processor_minidump_dump_OBJECTS = \
$(am_src_processor_minidump_dump_OBJECTS)
@DISABLE_PROCESSOR_FALSE@src_processor_minidump_dump_DEPENDENCIES = \
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_code_modules.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/logging.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/pathname_stripper.o
@ -889,6 +903,8 @@ src_processor_minidump_processor_unittest_OBJECTS = \
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_win.o \
@ -926,6 +942,8 @@ src_processor_minidump_stackwalk_OBJECTS = \
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_win.o \
@ -967,6 +985,8 @@ src_processor_minidump_unittest_OBJECTS = \
$(am_src_processor_minidump_unittest_OBJECTS)
@DISABLE_PROCESSOR_FALSE@src_processor_minidump_unittest_DEPENDENCIES = \
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_code_modules.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/logging.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/pathname_stripper.o \
@ -1832,11 +1852,14 @@ lib_LIBRARIES = $(am__append_5) $(am__append_8)
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/call_stack.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/code_module.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/code_modules.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/dump_context.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/dump_object.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/exploitability.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/fast_source_line_resolver.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/memory_region.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/minidump.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/minidump_processor.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/process_result.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/process_state.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/source_line_resolver_base.h \
@DISABLE_PROCESSOR_FALSE@ src/google_breakpad/processor/source_line_resolver_interface.h \
@ -1862,6 +1885,8 @@ lib_LIBRARIES = $(am__append_5) $(am__append_8)
@DISABLE_PROCESSOR_FALSE@ src/processor/contained_range_map.h \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.h \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.cc \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.cc \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.cc \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability.cc \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.h \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.cc \
@ -2000,6 +2025,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@LINUX_HOST_TRUE@ src/testing/gtest/src/gtest_main.cc \
@LINUX_HOST_TRUE@ src/testing/src/gmock-all.cc \
@LINUX_HOST_TRUE@ src/processor/basic_code_modules.cc \
@LINUX_HOST_TRUE@ src/processor/dump_context.cc \
@LINUX_HOST_TRUE@ src/processor/dump_object.cc \
@LINUX_HOST_TRUE@ src/processor/logging.cc \
@LINUX_HOST_TRUE@ src/processor/minidump.cc \
@LINUX_HOST_TRUE@ src/processor/pathname_stripper.cc \
@ -2258,6 +2285,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_source_line_resolver.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/logging.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/pathname_stripper.o \
@ -2356,6 +2385,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_win.o \
@ -2398,6 +2429,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@DISABLE_PROCESSOR_FALSE@src_processor_minidump_unittest_LDADD = \
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_code_modules.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/logging.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/pathname_stripper.o \
@ -2672,6 +2705,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@DISABLE_PROCESSOR_FALSE@src_processor_minidump_dump_LDADD = \
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_code_modules.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/logging.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/pathname_stripper.o
@ -2686,6 +2721,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@DISABLE_PROCESSOR_FALSE@ src/processor/call_stack.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_context.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/dump_object.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_linux.o \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_win.o \
@ -3069,6 +3106,10 @@ src/processor/cfi_frame_info.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/disassembler_x86.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/dump_context.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/dump_object.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/exploitability.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/exploitability_linux.$(OBJEXT): \
@ -3335,6 +3376,12 @@ src/testing/src/src_client_linux_linux_client_unittest_shlib-gmock-all.$(OBJEXT)
src/processor/src_client_linux_linux_client_unittest_shlib-basic_code_modules.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/src_client_linux_linux_client_unittest_shlib-logging.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
@ -4161,6 +4208,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/cfi_frame_info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/contained_range_map_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/disassembler_x86.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/dump_context.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/dump_object.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/exploitability.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/exploitability_linux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/exploitability_win.Po@am__quote@
@ -4180,6 +4229,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/simple_symbol_supplier.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/source_line_resolver_base.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-basic_code_modules.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-logging.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-minidump.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-pathname_stripper.Po@am__quote@
@ -4631,6 +4682,34 @@ src/processor/src_client_linux_linux_client_unittest_shlib-basic_code_modules.ob
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_client_linux_linux_client_unittest_shlib-basic_code_modules.obj `if test -f 'src/processor/basic_code_modules.cc'; then $(CYGPATH_W) 'src/processor/basic_code_modules.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/basic_code_modules.cc'; fi`
src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.o: src/processor/dump_context.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.o -MD -MP -MF src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Tpo -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.o `test -f 'src/processor/dump_context.cc' || echo '$(srcdir)/'`src/processor/dump_context.cc
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Tpo src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/processor/dump_context.cc' object='src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.o `test -f 'src/processor/dump_context.cc' || echo '$(srcdir)/'`src/processor/dump_context.cc
src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.obj: src/processor/dump_context.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.obj -MD -MP -MF src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Tpo -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.obj `if test -f 'src/processor/dump_context.cc'; then $(CYGPATH_W) 'src/processor/dump_context.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/dump_context.cc'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Tpo src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_context.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/processor/dump_context.cc' object='src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_context.obj `if test -f 'src/processor/dump_context.cc'; then $(CYGPATH_W) 'src/processor/dump_context.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/dump_context.cc'; fi`
src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.o: src/processor/dump_object.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.o -MD -MP -MF src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Tpo -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.o `test -f 'src/processor/dump_object.cc' || echo '$(srcdir)/'`src/processor/dump_object.cc
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Tpo src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/processor/dump_object.cc' object='src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.o `test -f 'src/processor/dump_object.cc' || echo '$(srcdir)/'`src/processor/dump_object.cc
src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.obj: src/processor/dump_object.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.obj -MD -MP -MF src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Tpo -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.obj `if test -f 'src/processor/dump_object.cc'; then $(CYGPATH_W) 'src/processor/dump_object.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/dump_object.cc'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Tpo src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-dump_object.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/processor/dump_object.cc' object='src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_client_linux_linux_client_unittest_shlib-dump_object.obj `if test -f 'src/processor/dump_object.cc'; then $(CYGPATH_W) 'src/processor/dump_object.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/dump_object.cc'; fi`
src/processor/src_client_linux_linux_client_unittest_shlib-logging.o: src/processor/logging.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_client_linux_linux_client_unittest_shlib-logging.o -MD -MP -MF src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-logging.Tpo -c -o src/processor/src_client_linux_linux_client_unittest_shlib-logging.o `test -f 'src/processor/logging.cc' || echo '$(srcdir)/'`src/processor/logging.cc
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-logging.Tpo src/processor/$(DEPDIR)/src_client_linux_linux_client_unittest_shlib-logging.Po

View File

@ -0,0 +1,112 @@
// Copyright (c) 2014 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.
// dump_context.h: A (mini/micro) dump CPU-specific context.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
#define GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/dump_object.h"
namespace google_breakpad {
// DumpContext carries a CPU-specific MDRawContext structure, which contains CPU
// context such as register states.
class DumpContext : public DumpObject {
public:
virtual ~DumpContext();
// Returns an MD_CONTEXT_* value such as MD_CONTEXT_X86 or MD_CONTEXT_PPC
// identifying the CPU type that the context was collected from. The
// returned value will identify the CPU only, and will have any other
// MD_CONTEXT_* bits masked out. Returns 0 on failure.
uint32_t GetContextCPU() const;
// Return the raw value of |context_flags_|
uint32_t GetContextFlags() const;
// Returns raw CPU-specific context data for the named CPU type. If the
// context data does not match the CPU type or does not exist, returns NULL.
const MDRawContextAMD64* GetContextAMD64() const;
const MDRawContextARM* GetContextARM() const;
const MDRawContextARM64* GetContextARM64() const;
const MDRawContextMIPS* GetContextMIPS() const;
const MDRawContextPPC* GetContextPPC() const;
const MDRawContextPPC64* GetContextPPC64() const;
const MDRawContextSPARC* GetContextSPARC() const;
const MDRawContextX86* GetContextX86() const;
// A convenience method to get the instruction pointer out of the
// MDRawContext, since it varies per-CPU architecture.
bool GetInstructionPointer(uint64_t* ip) const;
// Print a human-readable representation of the object to stdout.
void Print();
protected:
DumpContext();
// Sets row CPU-specific context data for the names CPU type.
void SetContextFlags(uint32_t context_flags);
void SetContextX86(MDRawContextX86* x86);
void SetContextPPC(MDRawContextPPC* ppc);
void SetContextPPC64(MDRawContextPPC64* ppc64);
void SetContextAMD64(MDRawContextAMD64* amd64);
void SetContextSPARC(MDRawContextSPARC* ctx_sparc);
void SetContextARM(MDRawContextARM* arm);
void SetContextARM64(MDRawContextARM64* arm64);
void SetContextMIPS(MDRawContextMIPS* ctx_mips);
// Free the CPU-specific context structure.
void FreeContext();
private:
// The CPU-specific context structure.
union {
MDRawContextBase* base;
MDRawContextX86* x86;
MDRawContextPPC* ppc;
MDRawContextPPC64* ppc64;
MDRawContextAMD64* amd64;
// on Solaris SPARC, sparc is defined as a numeric constant,
// so variables can NOT be named as sparc
MDRawContextSPARC* ctx_sparc;
MDRawContextARM* arm;
MDRawContextARM64* arm64;
MDRawContextMIPS* ctx_mips;
} context_;
// Store this separately because of the weirdo AMD64 context
uint32_t context_flags_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__

View File

@ -0,0 +1,53 @@
// Copyright (c) 2014 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.
// dump_object.h: A base class for all mini/micro dump object.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
#define GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
namespace google_breakpad {
// DumpObject is the base of various mini/micro dump's objects.
class DumpObject {
public:
DumpObject();
bool valid() const { return valid_; }
protected:
// DumpObjects are not valid when created. When a subclass populates its own
// fields, it can set valid_ to true. Accessors and mutators may wish to
// consider or alter the valid_ state as they interact with objects.
bool valid_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__

View File

@ -67,6 +67,9 @@ class MemoryRegion {
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const = 0;
// Print a human-readable representation of the object to stdout.
virtual void Print() const = 0;
};

View File

@ -89,9 +89,10 @@
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/dump_context.h"
#include "google_breakpad/processor/dump_object.h"
#include "google_breakpad/processor/memory_region.h"
@ -108,12 +109,10 @@ template<typename AddressType, typename EntryType> class RangeMap;
// MinidumpObject is the base of all Minidump* objects except for Minidump
// itself.
class MinidumpObject {
class MinidumpObject : public DumpObject {
public:
virtual ~MinidumpObject() {}
bool valid() const { return valid_; }
protected:
explicit MinidumpObject(Minidump* minidump);
@ -124,21 +123,14 @@ class MinidumpObject {
// for access to data about the minidump file itself, such as whether
// it should be byte-swapped.
Minidump* minidump_;
// MinidumpObjects are not valid when created. When a subclass populates
// its own fields, it can set valid_ to true. Accessors and mutators may
// wish to consider or alter the valid_ state as they interact with
// objects.
bool valid_;
};
// This class exists primarily to provide a virtual destructor in a base
// class common to all objects that might be stored in
// Minidump::mStreamObjects. Some object types (MinidumpContext) will
// never be stored in Minidump::mStreamObjects, but are represented as
// streams and adhere to the same interface, and may be derived from
// this class.
// Minidump::mStreamObjects. Some object types will never be stored in
// Minidump::mStreamObjects, but are represented as streams and adhere to the
// same interface, and may be derived from this class.
class MinidumpStream : public MinidumpObject {
public:
virtual ~MinidumpStream() {}
@ -168,71 +160,33 @@ class MinidumpStream : public MinidumpObject {
// context for the exception handler (which performs minidump generation),
// and not the context that caused the exception (which is probably what the
// user wants).
class MinidumpContext : public MinidumpStream {
class MinidumpContext : public DumpContext {
public:
virtual ~MinidumpContext();
// Returns an MD_CONTEXT_* value such as MD_CONTEXT_X86 or MD_CONTEXT_PPC
// identifying the CPU type that the context was collected from. The
// returned value will identify the CPU only, and will have any other
// MD_CONTEXT_* bits masked out. Returns 0 on failure.
uint32_t GetContextCPU() const;
// A convenience method to get the instruction pointer out of the
// MDRawContext, since it varies per-CPU architecture.
bool GetInstructionPointer(uint64_t* ip) const;
// Returns raw CPU-specific context data for the named CPU type. If the
// context data does not match the CPU type or does not exist, returns
// NULL.
const MDRawContextAMD64* GetContextAMD64() const;
const MDRawContextARM* GetContextARM() const;
const MDRawContextARM64* GetContextARM64() const;
const MDRawContextMIPS* GetContextMIPS() const;
const MDRawContextPPC* GetContextPPC() const;
const MDRawContextPPC64* GetContextPPC64() const;
const MDRawContextSPARC* GetContextSPARC() const;
const MDRawContextX86* GetContextX86() const;
// Print a human-readable representation of the object to stdout.
void Print();
protected:
explicit MinidumpContext(Minidump* minidump);
// The CPU-specific context structure.
union {
MDRawContextBase* base;
MDRawContextX86* x86;
MDRawContextPPC* ppc;
MDRawContextPPC64* ppc64;
MDRawContextAMD64* amd64;
// on Solaris SPARC, sparc is defined as a numeric constant,
// so variables can NOT be named as sparc
MDRawContextSPARC* ctx_sparc;
MDRawContextARM* arm;
MDRawContextARM64* arm64;
MDRawContextMIPS* ctx_mips;
} context_;
// Store this separately because of the weirdo AMD64 context
uint32_t context_flags_;
private:
friend class MinidumpThread;
friend class MinidumpException;
bool Read(uint32_t expected_size);
// Free the CPU-specific context structure.
void FreeContext();
// If the minidump contains a SYSTEM_INFO_STREAM, makes sure that the
// system info stream gives an appropriate CPU type matching the context
// CPU type in context_cpu_type. Returns false if the CPU type does not
// match. Returns true if the CPU type matches or if the minidump does
// not contain a system info stream.
bool CheckAgainstSystemInfo(uint32_t context_cpu_type);
// Refers to the Minidump object that is the ultimate parent of this
// Some MinidumpObjects are owned by other MinidumpObjects, but at the
// root of the ownership tree is always a Minidump. The Minidump object
// is kept here for access to its seeking and reading facilities, and
// for access to data about the minidump file itself, such as whether
// it should be byte-swapped.
Minidump* minidump_;
};
@ -273,7 +227,7 @@ class MinidumpMemoryRegion : public MinidumpObject,
bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const;
// Print a human-readable representation of the object to stdout.
void Print();
void Print() const;
protected:
explicit MinidumpMemoryRegion(Minidump* minidump);
@ -634,10 +588,10 @@ class MinidumpMemoryList : public MinidumpStream {
// MinidumpException wraps MDRawExceptionStream, which contains information
// about the exception that caused the minidump to be generated, if the
// minidump was generated in an exception handler called as a result of
// an exception. It also provides access to a MinidumpContext object,
// which contains the CPU context for the exception thread at the time
// the exception occurred.
// minidump was generated in an exception handler called as a result of an
// exception. It also provides access to a MinidumpContext object, which
// contains the CPU context for the exception thread at the time the exception
// occurred.
class MinidumpException : public MinidumpStream {
public:
virtual ~MinidumpException();

View File

@ -35,6 +35,7 @@
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/process_result.h"
namespace google_breakpad {
@ -44,41 +45,6 @@ class StackFrameSymbolizer;
class SourceLineResolverInterface;
class SymbolSupplier;
struct SystemInfo;
// Return type for Process()
enum ProcessResult {
PROCESS_OK, // The minidump was
// processed
// successfully.
PROCESS_ERROR_MINIDUMP_NOT_FOUND, // The minidump file
// was not found.
PROCESS_ERROR_NO_MINIDUMP_HEADER, // The minidump file
// had no header
PROCESS_ERROR_NO_THREAD_LIST, // The minidump file
// had no thread list.
PROCESS_ERROR_GETTING_THREAD, // There was an error
// getting one
// thread's data from
// the minidump.
PROCESS_ERROR_GETTING_THREAD_ID, // There was an error
// getting a thread id
// from the thread's
// data.
PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than
// one requesting
// thread.
PROCESS_SYMBOL_SUPPLIER_INTERRUPTED // The minidump
// processing was
// interrupted by the
// SymbolSupplier(not
// fatal)
};
class MinidumpProcessor {
public:

View File

@ -0,0 +1,66 @@
// Copyright (c) 2014, 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.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
#define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
namespace google_breakpad {
// Return type for MinidumpProcessor or MicrodumpProcessor's Process()
enum ProcessResult {
PROCESS_OK, // The dump was processed
// successfully.
PROCESS_ERROR_MINIDUMP_NOT_FOUND, // The minidump file was not
// found.
PROCESS_ERROR_NO_MINIDUMP_HEADER, // The minidump file had no
// header.
PROCESS_ERROR_NO_THREAD_LIST, // The minidump file has no
// thread list.
PROCESS_ERROR_GETTING_THREAD, // There was an error getting one
// thread's data from th dump.
PROCESS_ERROR_GETTING_THREAD_ID, // There was an error getting a
// thread id from the thread's
// data.
PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than one
// requesting thread.
PROCESS_SYMBOL_SUPPLIER_INTERRUPTED // The dump processing was
// interrupted by the
// SymbolSupplier(not fatal).
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__

View File

@ -103,7 +103,7 @@ class ProcessState {
string assertion() const { return assertion_; }
int requesting_thread() const { return requesting_thread_; }
const vector<CallStack*>* threads() const { return &threads_; }
const vector<MinidumpMemoryRegion*>* thread_memory_regions() const {
const vector<MemoryRegion*>* thread_memory_regions() const {
return &thread_memory_regions_;
}
const SystemInfo* system_info() const { return &system_info_; }
@ -157,7 +157,7 @@ class ProcessState {
// Stacks for each thread (except possibly the exception handler
// thread) at the time of the crash.
vector<CallStack*> threads_;
vector<MinidumpMemoryRegion*> thread_memory_regions_;
vector<MemoryRegion*> thread_memory_regions_;
// OS and CPU information.
SystemInfo system_info_;

View File

@ -54,7 +54,7 @@
namespace google_breakpad {
class CallStack;
class MinidumpContext;
class DumpContext;
class StackFrameSymbolizer;
using std::set;
@ -86,7 +86,7 @@ class Stackwalker {
// argument. If no suitable concrete subclass exists, returns NULL.
static Stackwalker* StackwalkerForCPU(
const SystemInfo* system_info,
MinidumpContext* context,
DumpContext* context,
MemoryRegion* memory,
const CodeModules* modules,
StackFrameSymbolizer* resolver_helper);

View File

@ -27,6 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include <stdio.h>
#include <string>
@ -102,6 +103,9 @@ class MockMemoryRegion: public MemoryRegion {
*value = address;
return true;
}
void Print() const {
assert(false);
}
};
// Verify that, for every association in ACTUAL, EXPECTED has the same

View File

@ -60,6 +60,7 @@ class MockMemoryRegion: public MemoryRegion {
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint16_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint32_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint64_t *));
MOCK_CONST_METHOD0(Print, void());
};
// Handy definitions for all tests.

View File

@ -0,0 +1,605 @@
// Copyright (c) 2010 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.
// dump_context.cc: A (mini/micro)dump context.
//
// See dump_context.h for documentation.
#include "google_breakpad/processor/dump_context.h"
#include <assert.h>
#include <stdio.h>
#include "processor/logging.h"
namespace google_breakpad {
DumpContext::DumpContext() : context_(),
context_flags_(0) { }
DumpContext::~DumpContext() {
FreeContext();
}
uint32_t DumpContext::GetContextCPU() const {
if (!valid_) {
// Don't log a message, GetContextCPU can be legitimately called with
// valid_ false by FreeContext, which is called by Read.
return 0;
}
return context_flags_ & MD_CONTEXT_CPU_MASK;
}
uint32_t DumpContext::GetContextFlags() const {
return context_flags_;
}
const MDRawContextX86* DumpContext::GetContextX86() const {
if (GetContextCPU() != MD_CONTEXT_X86) {
BPLOG(ERROR) << "DumpContext cannot get x86 context";
return NULL;
}
return context_.x86;
}
const MDRawContextPPC* DumpContext::GetContextPPC() const {
if (GetContextCPU() != MD_CONTEXT_PPC) {
BPLOG(ERROR) << "DumpContext cannot get ppc context";
return NULL;
}
return context_.ppc;
}
const MDRawContextPPC64* DumpContext::GetContextPPC64() const {
if (GetContextCPU() != MD_CONTEXT_PPC64) {
BPLOG(ERROR) << "DumpContext cannot get ppc64 context";
return NULL;
}
return context_.ppc64;
}
const MDRawContextAMD64* DumpContext::GetContextAMD64() const {
if (GetContextCPU() != MD_CONTEXT_AMD64) {
BPLOG(ERROR) << "DumpContext cannot get amd64 context";
return NULL;
}
return context_.amd64;
}
const MDRawContextSPARC* DumpContext::GetContextSPARC() const {
if (GetContextCPU() != MD_CONTEXT_SPARC) {
BPLOG(ERROR) << "DumpContext cannot get sparc context";
return NULL;
}
return context_.ctx_sparc;
}
const MDRawContextARM* DumpContext::GetContextARM() const {
if (GetContextCPU() != MD_CONTEXT_ARM) {
BPLOG(ERROR) << "DumpContext cannot get arm context";
return NULL;
}
return context_.arm;
}
const MDRawContextARM64* DumpContext::GetContextARM64() const {
if (GetContextCPU() != MD_CONTEXT_ARM64) {
BPLOG(ERROR) << "DumpContext cannot get arm64 context";
return NULL;
}
return context_.arm64;
}
const MDRawContextMIPS* DumpContext::GetContextMIPS() const {
if (GetContextCPU() != MD_CONTEXT_MIPS) {
BPLOG(ERROR) << "DumpContext cannot get MIPS context";
return NULL;
}
return context_.ctx_mips;
}
bool DumpContext::GetInstructionPointer(uint64_t* ip) const {
BPLOG_IF(ERROR, !ip) << "DumpContext::GetInstructionPointer requires |ip|";
assert(ip);
*ip = 0;
if (!valid_) {
BPLOG(ERROR) << "Invalid DumpContext for GetInstructionPointer";
return false;
}
switch (GetContextCPU()) {
case MD_CONTEXT_AMD64:
*ip = GetContextAMD64()->rip;
break;
case MD_CONTEXT_ARM:
*ip = GetContextARM()->iregs[MD_CONTEXT_ARM_REG_PC];
break;
case MD_CONTEXT_ARM64:
*ip = GetContextARM64()->iregs[MD_CONTEXT_ARM64_REG_PC];
break;
case MD_CONTEXT_PPC:
*ip = GetContextPPC()->srr0;
break;
case MD_CONTEXT_PPC64:
*ip = GetContextPPC64()->srr0;
break;
case MD_CONTEXT_SPARC:
*ip = GetContextSPARC()->pc;
break;
case MD_CONTEXT_X86:
*ip = GetContextX86()->eip;
break;
case MD_CONTEXT_MIPS:
*ip = GetContextMIPS()->epc;
break;
default:
// This should never happen.
BPLOG(ERROR) << "Unknown CPU architecture in GetInstructionPointer";
return false;
}
return true;
}
void DumpContext::SetContextFlags(uint32_t context_flags) {
context_flags_ = context_flags;
}
void DumpContext::SetContextX86(MDRawContextX86* x86) {
context_.x86 = x86;
}
void DumpContext::SetContextPPC(MDRawContextPPC* ppc) {
context_.ppc = ppc;
}
void DumpContext::SetContextPPC64(MDRawContextPPC64* ppc64) {
context_.ppc64 = ppc64;
}
void DumpContext::SetContextAMD64(MDRawContextAMD64* amd64) {
context_.amd64 = amd64;
}
void DumpContext::SetContextSPARC(MDRawContextSPARC* ctx_sparc) {
context_.ctx_sparc = ctx_sparc;
}
void DumpContext::SetContextARM(MDRawContextARM* arm) {
context_.arm = arm;
}
void DumpContext::SetContextARM64(MDRawContextARM64* arm64) {
context_.arm64 = arm64;
}
void DumpContext::SetContextMIPS(MDRawContextMIPS* ctx_mips) {
context_.ctx_mips = ctx_mips;
}
void DumpContext::FreeContext() {
switch (GetContextCPU()) {
case MD_CONTEXT_X86:
delete context_.x86;
break;
case MD_CONTEXT_PPC:
delete context_.ppc;
break;
case MD_CONTEXT_PPC64:
delete context_.ppc64;
break;
case MD_CONTEXT_AMD64:
delete context_.amd64;
break;
case MD_CONTEXT_SPARC:
delete context_.ctx_sparc;
break;
case MD_CONTEXT_ARM:
delete context_.arm;
break;
case MD_CONTEXT_ARM64:
delete context_.arm64;
break;
case MD_CONTEXT_MIPS:
delete context_.ctx_mips;
break;
default:
// There is no context record (valid_ is false) or there's a
// context record for an unknown CPU (shouldn't happen, only known
// records are stored by Read).
break;
}
context_flags_ = 0;
context_.base = NULL;
}
void DumpContext::Print() {
if (!valid_) {
BPLOG(ERROR) << "DumpContext cannot print invalid data";
return;
}
switch (GetContextCPU()) {
case MD_CONTEXT_X86: {
const MDRawContextX86* context_x86 = GetContextX86();
printf("MDRawContextX86\n");
printf(" context_flags = 0x%x\n",
context_x86->context_flags);
printf(" dr0 = 0x%x\n", context_x86->dr0);
printf(" dr1 = 0x%x\n", context_x86->dr1);
printf(" dr2 = 0x%x\n", context_x86->dr2);
printf(" dr3 = 0x%x\n", context_x86->dr3);
printf(" dr6 = 0x%x\n", context_x86->dr6);
printf(" dr7 = 0x%x\n", context_x86->dr7);
printf(" float_save.control_word = 0x%x\n",
context_x86->float_save.control_word);
printf(" float_save.status_word = 0x%x\n",
context_x86->float_save.status_word);
printf(" float_save.tag_word = 0x%x\n",
context_x86->float_save.tag_word);
printf(" float_save.error_offset = 0x%x\n",
context_x86->float_save.error_offset);
printf(" float_save.error_selector = 0x%x\n",
context_x86->float_save.error_selector);
printf(" float_save.data_offset = 0x%x\n",
context_x86->float_save.data_offset);
printf(" float_save.data_selector = 0x%x\n",
context_x86->float_save.data_selector);
printf(" float_save.register_area[%2d] = 0x",
MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE);
for (unsigned int register_index = 0;
register_index < MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE;
++register_index) {
printf("%02x", context_x86->float_save.register_area[register_index]);
}
printf("\n");
printf(" float_save.cr0_npx_state = 0x%x\n",
context_x86->float_save.cr0_npx_state);
printf(" gs = 0x%x\n", context_x86->gs);
printf(" fs = 0x%x\n", context_x86->fs);
printf(" es = 0x%x\n", context_x86->es);
printf(" ds = 0x%x\n", context_x86->ds);
printf(" edi = 0x%x\n", context_x86->edi);
printf(" esi = 0x%x\n", context_x86->esi);
printf(" ebx = 0x%x\n", context_x86->ebx);
printf(" edx = 0x%x\n", context_x86->edx);
printf(" ecx = 0x%x\n", context_x86->ecx);
printf(" eax = 0x%x\n", context_x86->eax);
printf(" ebp = 0x%x\n", context_x86->ebp);
printf(" eip = 0x%x\n", context_x86->eip);
printf(" cs = 0x%x\n", context_x86->cs);
printf(" eflags = 0x%x\n", context_x86->eflags);
printf(" esp = 0x%x\n", context_x86->esp);
printf(" ss = 0x%x\n", context_x86->ss);
printf(" extended_registers[%3d] = 0x",
MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE);
for (unsigned int register_index = 0;
register_index < MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE;
++register_index) {
printf("%02x", context_x86->extended_registers[register_index]);
}
printf("\n\n");
break;
}
case MD_CONTEXT_PPC: {
const MDRawContextPPC* context_ppc = GetContextPPC();
printf("MDRawContextPPC\n");
printf(" context_flags = 0x%x\n",
context_ppc->context_flags);
printf(" srr0 = 0x%x\n", context_ppc->srr0);
printf(" srr1 = 0x%x\n", context_ppc->srr1);
for (unsigned int gpr_index = 0;
gpr_index < MD_CONTEXT_PPC_GPR_COUNT;
++gpr_index) {
printf(" gpr[%2d] = 0x%x\n",
gpr_index, context_ppc->gpr[gpr_index]);
}
printf(" cr = 0x%x\n", context_ppc->cr);
printf(" xer = 0x%x\n", context_ppc->xer);
printf(" lr = 0x%x\n", context_ppc->lr);
printf(" ctr = 0x%x\n", context_ppc->ctr);
printf(" mq = 0x%x\n", context_ppc->mq);
printf(" vrsave = 0x%x\n", context_ppc->vrsave);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT;
++fpr_index) {
printf(" float_save.fpregs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_ppc->float_save.fpregs[fpr_index]);
}
printf(" float_save.fpscr = 0x%x\n",
context_ppc->float_save.fpscr);
// TODO(mmentovai): print the 128-bit quantities in
// context_ppc->vector_save. This isn't done yet because printf
// doesn't support 128-bit quantities, and printing them using
// PRIx64 as two 64-bit quantities requires knowledge of the CPU's
// byte ordering.
printf(" vector_save.save_vrvalid = 0x%x\n",
context_ppc->vector_save.save_vrvalid);
printf("\n");
break;
}
case MD_CONTEXT_PPC64: {
const MDRawContextPPC64* context_ppc64 = GetContextPPC64();
printf("MDRawContextPPC64\n");
printf(" context_flags = 0x%" PRIx64 "\n",
context_ppc64->context_flags);
printf(" srr0 = 0x%" PRIx64 "\n",
context_ppc64->srr0);
printf(" srr1 = 0x%" PRIx64 "\n",
context_ppc64->srr1);
for (unsigned int gpr_index = 0;
gpr_index < MD_CONTEXT_PPC64_GPR_COUNT;
++gpr_index) {
printf(" gpr[%2d] = 0x%" PRIx64 "\n",
gpr_index, context_ppc64->gpr[gpr_index]);
}
printf(" cr = 0x%" PRIx64 "\n", context_ppc64->cr);
printf(" xer = 0x%" PRIx64 "\n",
context_ppc64->xer);
printf(" lr = 0x%" PRIx64 "\n", context_ppc64->lr);
printf(" ctr = 0x%" PRIx64 "\n",
context_ppc64->ctr);
printf(" vrsave = 0x%" PRIx64 "\n",
context_ppc64->vrsave);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT;
++fpr_index) {
printf(" float_save.fpregs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_ppc64->float_save.fpregs[fpr_index]);
}
printf(" float_save.fpscr = 0x%x\n",
context_ppc64->float_save.fpscr);
// TODO(mmentovai): print the 128-bit quantities in
// context_ppc64->vector_save. This isn't done yet because printf
// doesn't support 128-bit quantities, and printing them using
// PRIx64 as two 64-bit quantities requires knowledge of the CPU's
// byte ordering.
printf(" vector_save.save_vrvalid = 0x%x\n",
context_ppc64->vector_save.save_vrvalid);
printf("\n");
break;
}
case MD_CONTEXT_AMD64: {
const MDRawContextAMD64* context_amd64 = GetContextAMD64();
printf("MDRawContextAMD64\n");
printf(" p1_home = 0x%" PRIx64 "\n",
context_amd64->p1_home);
printf(" p2_home = 0x%" PRIx64 "\n",
context_amd64->p2_home);
printf(" p3_home = 0x%" PRIx64 "\n",
context_amd64->p3_home);
printf(" p4_home = 0x%" PRIx64 "\n",
context_amd64->p4_home);
printf(" p5_home = 0x%" PRIx64 "\n",
context_amd64->p5_home);
printf(" p6_home = 0x%" PRIx64 "\n",
context_amd64->p6_home);
printf(" context_flags = 0x%x\n",
context_amd64->context_flags);
printf(" mx_csr = 0x%x\n",
context_amd64->mx_csr);
printf(" cs = 0x%x\n", context_amd64->cs);
printf(" ds = 0x%x\n", context_amd64->ds);
printf(" es = 0x%x\n", context_amd64->es);
printf(" fs = 0x%x\n", context_amd64->fs);
printf(" gs = 0x%x\n", context_amd64->gs);
printf(" ss = 0x%x\n", context_amd64->ss);
printf(" eflags = 0x%x\n", context_amd64->eflags);
printf(" dr0 = 0x%" PRIx64 "\n", context_amd64->dr0);
printf(" dr1 = 0x%" PRIx64 "\n", context_amd64->dr1);
printf(" dr2 = 0x%" PRIx64 "\n", context_amd64->dr2);
printf(" dr3 = 0x%" PRIx64 "\n", context_amd64->dr3);
printf(" dr6 = 0x%" PRIx64 "\n", context_amd64->dr6);
printf(" dr7 = 0x%" PRIx64 "\n", context_amd64->dr7);
printf(" rax = 0x%" PRIx64 "\n", context_amd64->rax);
printf(" rcx = 0x%" PRIx64 "\n", context_amd64->rcx);
printf(" rdx = 0x%" PRIx64 "\n", context_amd64->rdx);
printf(" rbx = 0x%" PRIx64 "\n", context_amd64->rbx);
printf(" rsp = 0x%" PRIx64 "\n", context_amd64->rsp);
printf(" rbp = 0x%" PRIx64 "\n", context_amd64->rbp);
printf(" rsi = 0x%" PRIx64 "\n", context_amd64->rsi);
printf(" rdi = 0x%" PRIx64 "\n", context_amd64->rdi);
printf(" r8 = 0x%" PRIx64 "\n", context_amd64->r8);
printf(" r9 = 0x%" PRIx64 "\n", context_amd64->r9);
printf(" r10 = 0x%" PRIx64 "\n", context_amd64->r10);
printf(" r11 = 0x%" PRIx64 "\n", context_amd64->r11);
printf(" r12 = 0x%" PRIx64 "\n", context_amd64->r12);
printf(" r13 = 0x%" PRIx64 "\n", context_amd64->r13);
printf(" r14 = 0x%" PRIx64 "\n", context_amd64->r14);
printf(" r15 = 0x%" PRIx64 "\n", context_amd64->r15);
printf(" rip = 0x%" PRIx64 "\n", context_amd64->rip);
// TODO: print xmm, vector, debug registers
printf("\n");
break;
}
case MD_CONTEXT_SPARC: {
const MDRawContextSPARC* context_sparc = GetContextSPARC();
printf("MDRawContextSPARC\n");
printf(" context_flags = 0x%x\n",
context_sparc->context_flags);
for (unsigned int g_r_index = 0;
g_r_index < MD_CONTEXT_SPARC_GPR_COUNT;
++g_r_index) {
printf(" g_r[%2d] = 0x%" PRIx64 "\n",
g_r_index, context_sparc->g_r[g_r_index]);
}
printf(" ccr = 0x%" PRIx64 "\n", context_sparc->ccr);
printf(" pc = 0x%" PRIx64 "\n", context_sparc->pc);
printf(" npc = 0x%" PRIx64 "\n", context_sparc->npc);
printf(" y = 0x%" PRIx64 "\n", context_sparc->y);
printf(" asi = 0x%" PRIx64 "\n", context_sparc->asi);
printf(" fprs = 0x%" PRIx64 "\n", context_sparc->fprs);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT;
++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_sparc->float_save.regs[fpr_index]);
}
printf(" float_save.filler = 0x%" PRIx64 "\n",
context_sparc->float_save.filler);
printf(" float_save.fsr = 0x%" PRIx64 "\n",
context_sparc->float_save.fsr);
break;
}
case MD_CONTEXT_ARM: {
const MDRawContextARM* context_arm = GetContextARM();
printf("MDRawContextARM\n");
printf(" context_flags = 0x%x\n",
context_arm->context_flags);
for (unsigned int ireg_index = 0;
ireg_index < MD_CONTEXT_ARM_GPR_COUNT;
++ireg_index) {
printf(" iregs[%2d] = 0x%x\n",
ireg_index, context_arm->iregs[ireg_index]);
}
printf(" cpsr = 0x%x\n", context_arm->cpsr);
printf(" float_save.fpscr = 0x%" PRIx64 "\n",
context_arm->float_save.fpscr);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_ARM_FPR_COUNT;
++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_arm->float_save.regs[fpr_index]);
}
for (unsigned int fpe_index = 0;
fpe_index < MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT;
++fpe_index) {
printf(" float_save.extra[%2d] = 0x%" PRIx32 "\n",
fpe_index, context_arm->float_save.extra[fpe_index]);
}
break;
}
case MD_CONTEXT_ARM64: {
const MDRawContextARM64* context_arm64 = GetContextARM64();
printf("MDRawContextARM64\n");
printf(" context_flags = 0x%" PRIx64 "\n",
context_arm64->context_flags);
for (unsigned int ireg_index = 0;
ireg_index < MD_CONTEXT_ARM64_GPR_COUNT;
++ireg_index) {
printf(" iregs[%2d] = 0x%" PRIx64 "\n",
ireg_index, context_arm64->iregs[ireg_index]);
}
printf(" cpsr = 0x%x\n", context_arm64->cpsr);
printf(" float_save.fpsr = 0x%x\n", context_arm64->float_save.fpsr);
printf(" float_save.fpcr = 0x%x\n", context_arm64->float_save.fpcr);
for (unsigned int freg_index = 0;
freg_index < MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT;
++freg_index) {
uint128_struct fp_value = context_arm64->float_save.regs[freg_index];
printf(" float_save.regs[%2d] = 0x%" PRIx64 "%" PRIx64 "\n",
freg_index, fp_value.high, fp_value.low);
}
break;
}
case MD_CONTEXT_MIPS: {
const MDRawContextMIPS* context_mips = GetContextMIPS();
printf("MDRawContextMIPS\n");
printf(" context_flags = 0x%x\n",
context_mips->context_flags);
for (int ireg_index = 0;
ireg_index < MD_CONTEXT_MIPS_GPR_COUNT;
++ireg_index) {
printf(" iregs[%2d] = 0x%" PRIx64 "\n",
ireg_index, context_mips->iregs[ireg_index]);
}
printf(" mdhi = 0x%" PRIx64 "\n",
context_mips->mdhi);
printf(" mdlo = 0x%" PRIx64 "\n",
context_mips->mdhi);
for (int dsp_index = 0;
dsp_index < MD_CONTEXT_MIPS_DSP_COUNT;
++dsp_index) {
printf(" hi[%1d] = 0x%" PRIx32 "\n",
dsp_index, context_mips->hi[dsp_index]);
printf(" lo[%1d] = 0x%" PRIx32 "\n",
dsp_index, context_mips->lo[dsp_index]);
}
printf(" dsp_control = 0x%" PRIx32 "\n",
context_mips->dsp_control);
printf(" epc = 0x%" PRIx64 "\n",
context_mips->epc);
printf(" badvaddr = 0x%" PRIx64 "\n",
context_mips->badvaddr);
printf(" status = 0x%" PRIx32 "\n",
context_mips->status);
printf(" cause = 0x%" PRIx32 "\n",
context_mips->cause);
for (int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT;
++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_mips->float_save.regs[fpr_index]);
}
printf(" float_save.fpcsr = 0x%" PRIx32 "\n",
context_mips->float_save.fpcsr);
printf(" float_save.fir = 0x%" PRIx32 "\n",
context_mips->float_save.fir);
break;
}
default: {
break;
}
}
}
} // namespace google_breakpad

View File

@ -0,0 +1,39 @@
// Copyright (c) 2010 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.
// dump_object.cc: A base class for all mini/micro dump object.
#include "google_breakpad/processor/dump_object.h"
namespace google_breakpad {
DumpObject::DumpObject() : valid_(false) {
}
} // namespace google_breakpad

View File

@ -37,6 +37,7 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#include <assert.h>
#include <stdio.h>
#include <sstream>
@ -113,6 +114,9 @@ class MockMemoryRegion: public MemoryRegion {
*value = address;
return true;
}
void Print() const {
assert(false);
}
};
// Verify that, for every association in ACTUAL, EXPECTED has the same

View File

@ -61,6 +61,7 @@
#include "processor/range_map-inl.h"
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/dump_context.h"
#include "processor/basic_code_module.h"
#include "processor/basic_code_modules.h"
#include "processor/logging.h"
@ -391,8 +392,8 @@ string TimeTToUTCString(time_t tt) {
MinidumpObject::MinidumpObject(Minidump* minidump)
: minidump_(minidump),
valid_(false) {
: DumpObject(),
minidump_(minidump) {
}
@ -412,17 +413,13 @@ MinidumpStream::MinidumpStream(Minidump* minidump)
MinidumpContext::MinidumpContext(Minidump* minidump)
: MinidumpStream(minidump),
context_(),
context_flags_(0) {
: DumpContext(),
minidump_(minidump) {
}
MinidumpContext::~MinidumpContext() {
FreeContext();
}
bool MinidumpContext::Read(uint32_t expected_size) {
valid_ = false;
@ -547,9 +544,9 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_amd64->last_exception_from_rip);
}
context_flags_ = context_amd64->context_flags;
SetContextFlags(context_amd64->context_flags);
context_.amd64 = context_amd64.release();
SetContextAMD64(context_amd64.release());
} else if (expected_size == sizeof(MDRawContextPPC64)) {
// |context_flags| of MDRawContextPPC64 is 64 bits, but other MDRawContext
// in the else case have 32 bits |context_flags|, so special case it here.
@ -633,17 +630,17 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_ppc64->vector_save.save_vrvalid);
}
context_flags_ = static_cast<uint32_t>(context_ppc64->context_flags);
SetContextFlags(static_cast<uint32_t>(context_ppc64->context_flags));
// Check for data loss when converting context flags from uint64_t into
// uint32_t
if (static_cast<uint64_t>(context_flags_) !=
if (static_cast<uint64_t>(GetContextFlags()) !=
context_ppc64->context_flags) {
BPLOG(ERROR) << "Data loss detected when converting PPC64 context_flags";
return false;
}
context_.ppc64 = context_ppc64.release();
SetContextPPC64(context_ppc64.release());
} else if (expected_size == sizeof(MDRawContextARM64)) {
// |context_flags| of MDRawContextARM64 is 64 bits, but other MDRawContext
// in the else case have 32 bits |context_flags|, so special case it here.
@ -718,17 +715,17 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_arm64->float_save.regs[fpr_index]);
}
}
context_flags_ = static_cast<uint32_t>(context_arm64->context_flags);
SetContextFlags(static_cast<uint32_t>(context_arm64->context_flags));
// Check for data loss when converting context flags from uint64_t into
// uint32_t
if (static_cast<uint64_t>(context_flags_) !=
if (static_cast<uint64_t>(GetContextFlags()) !=
context_arm64->context_flags) {
BPLOG(ERROR) << "Data loss detected when converting ARM64 context_flags";
return false;
}
context_.arm64 = context_arm64.release();
SetContextARM64(context_arm64.release());
} else {
uint32_t context_flags;
if (!minidump_->ReadBytes(&context_flags, sizeof(context_flags))) {
@ -833,7 +830,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
// does not need to be swapped.
}
context_.x86 = context_x86.release();
SetContextX86(context_x86.release());
break;
}
@ -909,7 +906,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_ppc->vector_save.save_vrvalid);
}
context_.ppc = context_ppc.release();
SetContextPPC(context_ppc.release());
break;
}
@ -965,7 +962,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_sparc->float_save.filler);
Swap(&context_sparc->float_save.fsr);
}
context_.ctx_sparc = context_sparc.release();
SetContextSPARC(context_sparc.release());
break;
}
@ -1020,16 +1017,16 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_arm->float_save.extra[fpe_index]);
}
}
context_.arm = context_arm.release();
SetContextARM(context_arm.release());
break;
}
case MD_CONTEXT_MIPS: {
if (expected_size != sizeof(MDRawContextMIPS)) {
BPLOG(ERROR) << "MinidumpContext MIPS size mismatch, "
<< expected_size
<< " != "
BPLOG(ERROR) << "MinidumpContext MIPS size mismatch, "
<< expected_size
<< " != "
<< sizeof(MDRawContextMIPS);
return false;
}
@ -1085,7 +1082,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_mips->float_save.fpcsr);
Swap(&context_mips->float_save.fir);
}
context_.ctx_mips = context_mips.release();
SetContextMIPS(context_mips.release());
break;
}
@ -1099,188 +1096,13 @@ bool MinidumpContext::Read(uint32_t expected_size) {
break;
}
}
context_flags_ = context_flags;
SetContextFlags(context_flags);
}
valid_ = true;
return true;
}
uint32_t MinidumpContext::GetContextCPU() const {
if (!valid_) {
// Don't log a message, GetContextCPU can be legitimately called with
// valid_ false by FreeContext, which is called by Read.
return 0;
}
return context_flags_ & MD_CONTEXT_CPU_MASK;
}
bool MinidumpContext::GetInstructionPointer(uint64_t* ip) const {
BPLOG_IF(ERROR, !ip) << "MinidumpContext::GetInstructionPointer "
"requires |ip|";
assert(ip);
*ip = 0;
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpContext for GetInstructionPointer";
return false;
}
switch (context_flags_ & MD_CONTEXT_CPU_MASK) {
case MD_CONTEXT_AMD64:
*ip = context_.amd64->rip;
break;
case MD_CONTEXT_ARM:
*ip = context_.arm->iregs[MD_CONTEXT_ARM_REG_PC];
break;
case MD_CONTEXT_ARM64:
*ip = context_.arm64->iregs[MD_CONTEXT_ARM64_REG_PC];
break;
case MD_CONTEXT_PPC:
*ip = context_.ppc->srr0;
break;
case MD_CONTEXT_PPC64:
*ip = context_.ppc64->srr0;
break;
case MD_CONTEXT_SPARC:
*ip = context_.ctx_sparc->pc;
break;
case MD_CONTEXT_X86:
*ip = context_.x86->eip;
break;
case MD_CONTEXT_MIPS:
*ip = context_.ctx_mips->epc;
break;
default:
// This should never happen.
BPLOG(ERROR) << "Unknown CPU architecture in GetInstructionPointer";
return false;
}
return true;
}
const MDRawContextX86* MinidumpContext::GetContextX86() const {
if (GetContextCPU() != MD_CONTEXT_X86) {
BPLOG(ERROR) << "MinidumpContext cannot get x86 context";
return NULL;
}
return context_.x86;
}
const MDRawContextPPC* MinidumpContext::GetContextPPC() const {
if (GetContextCPU() != MD_CONTEXT_PPC) {
BPLOG(ERROR) << "MinidumpContext cannot get ppc context";
return NULL;
}
return context_.ppc;
}
const MDRawContextPPC64* MinidumpContext::GetContextPPC64() const {
if (GetContextCPU() != MD_CONTEXT_PPC64) {
BPLOG(ERROR) << "MinidumpContext cannot get ppc64 context";
return NULL;
}
return context_.ppc64;
}
const MDRawContextAMD64* MinidumpContext::GetContextAMD64() const {
if (GetContextCPU() != MD_CONTEXT_AMD64) {
BPLOG(ERROR) << "MinidumpContext cannot get amd64 context";
return NULL;
}
return context_.amd64;
}
const MDRawContextSPARC* MinidumpContext::GetContextSPARC() const {
if (GetContextCPU() != MD_CONTEXT_SPARC) {
BPLOG(ERROR) << "MinidumpContext cannot get sparc context";
return NULL;
}
return context_.ctx_sparc;
}
const MDRawContextARM* MinidumpContext::GetContextARM() const {
if (GetContextCPU() != MD_CONTEXT_ARM) {
BPLOG(ERROR) << "MinidumpContext cannot get arm context";
return NULL;
}
return context_.arm;
}
const MDRawContextARM64* MinidumpContext::GetContextARM64() const {
if (GetContextCPU() != MD_CONTEXT_ARM64) {
BPLOG(ERROR) << "MinidumpContext cannot get arm64 context";
return NULL;
}
return context_.arm64;
}
const MDRawContextMIPS* MinidumpContext::GetContextMIPS() const {
if (GetContextCPU() != MD_CONTEXT_MIPS) {
BPLOG(ERROR) << "MinidumpContext cannot get MIPS context";
return NULL;
}
return context_.ctx_mips;
}
void MinidumpContext::FreeContext() {
switch (GetContextCPU()) {
case MD_CONTEXT_X86:
delete context_.x86;
break;
case MD_CONTEXT_PPC:
delete context_.ppc;
break;
case MD_CONTEXT_PPC64:
delete context_.ppc64;
break;
case MD_CONTEXT_AMD64:
delete context_.amd64;
break;
case MD_CONTEXT_SPARC:
delete context_.ctx_sparc;
break;
case MD_CONTEXT_ARM:
delete context_.arm;
break;
case MD_CONTEXT_ARM64:
delete context_.arm64;
break;
case MD_CONTEXT_MIPS:
delete context_.ctx_mips;
break;
default:
// There is no context record (valid_ is false) or there's a
// context record for an unknown CPU (shouldn't happen, only known
// records are stored by Read).
break;
}
context_flags_ = 0;
context_.base = NULL;
}
bool MinidumpContext::CheckAgainstSystemInfo(uint32_t context_cpu_type) {
// It's OK if the minidump doesn't contain an MD_SYSTEM_INFO_STREAM,
// as this function just implements a sanity check.
@ -1359,352 +1181,6 @@ bool MinidumpContext::CheckAgainstSystemInfo(uint32_t context_cpu_type) {
}
void MinidumpContext::Print() {
if (!valid_) {
BPLOG(ERROR) << "MinidumpContext cannot print invalid data";
return;
}
switch (GetContextCPU()) {
case MD_CONTEXT_X86: {
const MDRawContextX86* context_x86 = GetContextX86();
printf("MDRawContextX86\n");
printf(" context_flags = 0x%x\n",
context_x86->context_flags);
printf(" dr0 = 0x%x\n", context_x86->dr0);
printf(" dr1 = 0x%x\n", context_x86->dr1);
printf(" dr2 = 0x%x\n", context_x86->dr2);
printf(" dr3 = 0x%x\n", context_x86->dr3);
printf(" dr6 = 0x%x\n", context_x86->dr6);
printf(" dr7 = 0x%x\n", context_x86->dr7);
printf(" float_save.control_word = 0x%x\n",
context_x86->float_save.control_word);
printf(" float_save.status_word = 0x%x\n",
context_x86->float_save.status_word);
printf(" float_save.tag_word = 0x%x\n",
context_x86->float_save.tag_word);
printf(" float_save.error_offset = 0x%x\n",
context_x86->float_save.error_offset);
printf(" float_save.error_selector = 0x%x\n",
context_x86->float_save.error_selector);
printf(" float_save.data_offset = 0x%x\n",
context_x86->float_save.data_offset);
printf(" float_save.data_selector = 0x%x\n",
context_x86->float_save.data_selector);
printf(" float_save.register_area[%2d] = 0x",
MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE);
for (unsigned int register_index = 0;
register_index < MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE;
++register_index) {
printf("%02x", context_x86->float_save.register_area[register_index]);
}
printf("\n");
printf(" float_save.cr0_npx_state = 0x%x\n",
context_x86->float_save.cr0_npx_state);
printf(" gs = 0x%x\n", context_x86->gs);
printf(" fs = 0x%x\n", context_x86->fs);
printf(" es = 0x%x\n", context_x86->es);
printf(" ds = 0x%x\n", context_x86->ds);
printf(" edi = 0x%x\n", context_x86->edi);
printf(" esi = 0x%x\n", context_x86->esi);
printf(" ebx = 0x%x\n", context_x86->ebx);
printf(" edx = 0x%x\n", context_x86->edx);
printf(" ecx = 0x%x\n", context_x86->ecx);
printf(" eax = 0x%x\n", context_x86->eax);
printf(" ebp = 0x%x\n", context_x86->ebp);
printf(" eip = 0x%x\n", context_x86->eip);
printf(" cs = 0x%x\n", context_x86->cs);
printf(" eflags = 0x%x\n", context_x86->eflags);
printf(" esp = 0x%x\n", context_x86->esp);
printf(" ss = 0x%x\n", context_x86->ss);
printf(" extended_registers[%3d] = 0x",
MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE);
for (unsigned int register_index = 0;
register_index < MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE;
++register_index) {
printf("%02x", context_x86->extended_registers[register_index]);
}
printf("\n\n");
break;
}
case MD_CONTEXT_PPC: {
const MDRawContextPPC* context_ppc = GetContextPPC();
printf("MDRawContextPPC\n");
printf(" context_flags = 0x%x\n",
context_ppc->context_flags);
printf(" srr0 = 0x%x\n", context_ppc->srr0);
printf(" srr1 = 0x%x\n", context_ppc->srr1);
for (unsigned int gpr_index = 0;
gpr_index < MD_CONTEXT_PPC_GPR_COUNT;
++gpr_index) {
printf(" gpr[%2d] = 0x%x\n",
gpr_index, context_ppc->gpr[gpr_index]);
}
printf(" cr = 0x%x\n", context_ppc->cr);
printf(" xer = 0x%x\n", context_ppc->xer);
printf(" lr = 0x%x\n", context_ppc->lr);
printf(" ctr = 0x%x\n", context_ppc->ctr);
printf(" mq = 0x%x\n", context_ppc->mq);
printf(" vrsave = 0x%x\n", context_ppc->vrsave);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT;
++fpr_index) {
printf(" float_save.fpregs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_ppc->float_save.fpregs[fpr_index]);
}
printf(" float_save.fpscr = 0x%x\n",
context_ppc->float_save.fpscr);
// TODO(mmentovai): print the 128-bit quantities in
// context_ppc->vector_save. This isn't done yet because printf
// doesn't support 128-bit quantities, and printing them using
// PRIx64 as two 64-bit quantities requires knowledge of the CPU's
// byte ordering.
printf(" vector_save.save_vrvalid = 0x%x\n",
context_ppc->vector_save.save_vrvalid);
printf("\n");
break;
}
case MD_CONTEXT_PPC64: {
const MDRawContextPPC64* context_ppc64 = GetContextPPC64();
printf("MDRawContextPPC64\n");
printf(" context_flags = 0x%" PRIx64 "\n",
context_ppc64->context_flags);
printf(" srr0 = 0x%" PRIx64 "\n",
context_ppc64->srr0);
printf(" srr1 = 0x%" PRIx64 "\n",
context_ppc64->srr1);
for (unsigned int gpr_index = 0;
gpr_index < MD_CONTEXT_PPC64_GPR_COUNT;
++gpr_index) {
printf(" gpr[%2d] = 0x%" PRIx64 "\n",
gpr_index, context_ppc64->gpr[gpr_index]);
}
printf(" cr = 0x%" PRIx64 "\n", context_ppc64->cr);
printf(" xer = 0x%" PRIx64 "\n",
context_ppc64->xer);
printf(" lr = 0x%" PRIx64 "\n", context_ppc64->lr);
printf(" ctr = 0x%" PRIx64 "\n",
context_ppc64->ctr);
printf(" vrsave = 0x%" PRIx64 "\n",
context_ppc64->vrsave);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT;
++fpr_index) {
printf(" float_save.fpregs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_ppc64->float_save.fpregs[fpr_index]);
}
printf(" float_save.fpscr = 0x%x\n",
context_ppc64->float_save.fpscr);
// TODO(mmentovai): print the 128-bit quantities in
// context_ppc64->vector_save. This isn't done yet because printf
// doesn't support 128-bit quantities, and printing them using
// PRIx64 as two 64-bit quantities requires knowledge of the CPU's
// byte ordering.
printf(" vector_save.save_vrvalid = 0x%x\n",
context_ppc64->vector_save.save_vrvalid);
printf("\n");
break;
}
case MD_CONTEXT_AMD64: {
const MDRawContextAMD64* context_amd64 = GetContextAMD64();
printf("MDRawContextAMD64\n");
printf(" p1_home = 0x%" PRIx64 "\n",
context_amd64->p1_home);
printf(" p2_home = 0x%" PRIx64 "\n",
context_amd64->p2_home);
printf(" p3_home = 0x%" PRIx64 "\n",
context_amd64->p3_home);
printf(" p4_home = 0x%" PRIx64 "\n",
context_amd64->p4_home);
printf(" p5_home = 0x%" PRIx64 "\n",
context_amd64->p5_home);
printf(" p6_home = 0x%" PRIx64 "\n",
context_amd64->p6_home);
printf(" context_flags = 0x%x\n",
context_amd64->context_flags);
printf(" mx_csr = 0x%x\n",
context_amd64->mx_csr);
printf(" cs = 0x%x\n", context_amd64->cs);
printf(" ds = 0x%x\n", context_amd64->ds);
printf(" es = 0x%x\n", context_amd64->es);
printf(" fs = 0x%x\n", context_amd64->fs);
printf(" gs = 0x%x\n", context_amd64->gs);
printf(" ss = 0x%x\n", context_amd64->ss);
printf(" eflags = 0x%x\n", context_amd64->eflags);
printf(" dr0 = 0x%" PRIx64 "\n", context_amd64->dr0);
printf(" dr1 = 0x%" PRIx64 "\n", context_amd64->dr1);
printf(" dr2 = 0x%" PRIx64 "\n", context_amd64->dr2);
printf(" dr3 = 0x%" PRIx64 "\n", context_amd64->dr3);
printf(" dr6 = 0x%" PRIx64 "\n", context_amd64->dr6);
printf(" dr7 = 0x%" PRIx64 "\n", context_amd64->dr7);
printf(" rax = 0x%" PRIx64 "\n", context_amd64->rax);
printf(" rcx = 0x%" PRIx64 "\n", context_amd64->rcx);
printf(" rdx = 0x%" PRIx64 "\n", context_amd64->rdx);
printf(" rbx = 0x%" PRIx64 "\n", context_amd64->rbx);
printf(" rsp = 0x%" PRIx64 "\n", context_amd64->rsp);
printf(" rbp = 0x%" PRIx64 "\n", context_amd64->rbp);
printf(" rsi = 0x%" PRIx64 "\n", context_amd64->rsi);
printf(" rdi = 0x%" PRIx64 "\n", context_amd64->rdi);
printf(" r8 = 0x%" PRIx64 "\n", context_amd64->r8);
printf(" r9 = 0x%" PRIx64 "\n", context_amd64->r9);
printf(" r10 = 0x%" PRIx64 "\n", context_amd64->r10);
printf(" r11 = 0x%" PRIx64 "\n", context_amd64->r11);
printf(" r12 = 0x%" PRIx64 "\n", context_amd64->r12);
printf(" r13 = 0x%" PRIx64 "\n", context_amd64->r13);
printf(" r14 = 0x%" PRIx64 "\n", context_amd64->r14);
printf(" r15 = 0x%" PRIx64 "\n", context_amd64->r15);
printf(" rip = 0x%" PRIx64 "\n", context_amd64->rip);
// TODO: print xmm, vector, debug registers
printf("\n");
break;
}
case MD_CONTEXT_SPARC: {
const MDRawContextSPARC* context_sparc = GetContextSPARC();
printf("MDRawContextSPARC\n");
printf(" context_flags = 0x%x\n",
context_sparc->context_flags);
for (unsigned int g_r_index = 0;
g_r_index < MD_CONTEXT_SPARC_GPR_COUNT;
++g_r_index) {
printf(" g_r[%2d] = 0x%" PRIx64 "\n",
g_r_index, context_sparc->g_r[g_r_index]);
}
printf(" ccr = 0x%" PRIx64 "\n", context_sparc->ccr);
printf(" pc = 0x%" PRIx64 "\n", context_sparc->pc);
printf(" npc = 0x%" PRIx64 "\n", context_sparc->npc);
printf(" y = 0x%" PRIx64 "\n", context_sparc->y);
printf(" asi = 0x%" PRIx64 "\n", context_sparc->asi);
printf(" fprs = 0x%" PRIx64 "\n", context_sparc->fprs);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT;
++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_sparc->float_save.regs[fpr_index]);
}
printf(" float_save.filler = 0x%" PRIx64 "\n",
context_sparc->float_save.filler);
printf(" float_save.fsr = 0x%" PRIx64 "\n",
context_sparc->float_save.fsr);
break;
}
case MD_CONTEXT_ARM: {
const MDRawContextARM* context_arm = GetContextARM();
printf("MDRawContextARM\n");
printf(" context_flags = 0x%x\n",
context_arm->context_flags);
for (unsigned int ireg_index = 0;
ireg_index < MD_CONTEXT_ARM_GPR_COUNT;
++ireg_index) {
printf(" iregs[%2d] = 0x%x\n",
ireg_index, context_arm->iregs[ireg_index]);
}
printf(" cpsr = 0x%x\n", context_arm->cpsr);
printf(" float_save.fpscr = 0x%" PRIx64 "\n",
context_arm->float_save.fpscr);
for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_ARM_FPR_COUNT;
++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_arm->float_save.regs[fpr_index]);
}
for (unsigned int fpe_index = 0;
fpe_index < MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT;
++fpe_index) {
printf(" float_save.extra[%2d] = 0x%" PRIx32 "\n",
fpe_index, context_arm->float_save.extra[fpe_index]);
}
break;
}
case MD_CONTEXT_ARM64: {
const MDRawContextARM64* context_arm64 = GetContextARM64();
printf("MDRawContextARM64\n");
printf(" context_flags = 0x%" PRIx64 "\n",
context_arm64->context_flags);
for (unsigned int ireg_index = 0;
ireg_index < MD_CONTEXT_ARM64_GPR_COUNT;
++ireg_index) {
printf(" iregs[%2d] = 0x%" PRIx64 "\n",
ireg_index, context_arm64->iregs[ireg_index]);
}
printf(" cpsr = 0x%x\n", context_arm64->cpsr);
printf(" float_save.fpsr = 0x%x\n", context_arm64->float_save.fpsr);
printf(" float_save.fpcr = 0x%x\n", context_arm64->float_save.fpcr);
for (unsigned int freg_index = 0;
freg_index < MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT;
++freg_index) {
uint128_struct fp_value = context_arm64->float_save.regs[freg_index];
printf(" float_save.regs[%2d] = 0x%" PRIx64 "%" PRIx64 "\n",
freg_index, fp_value.high, fp_value.low);
}
break;
}
case MD_CONTEXT_MIPS: {
const MDRawContextMIPS* context_mips = GetContextMIPS();
printf("MDRawContextMIPS\n");
printf(" context_flags = 0x%x\n",
context_mips->context_flags);
for (int ireg_index = 0;
ireg_index < MD_CONTEXT_MIPS_GPR_COUNT;
++ireg_index) {
printf(" iregs[%2d] = 0x%" PRIx64 "\n",
ireg_index, context_mips->iregs[ireg_index]);
}
printf(" mdhi = 0x%" PRIx64 "\n",
context_mips->mdhi);
printf(" mdlo = 0x%" PRIx64 "\n",
context_mips->mdhi);
for (int dsp_index = 0;
dsp_index < MD_CONTEXT_MIPS_DSP_COUNT;
++dsp_index) {
printf(" hi[%1d] = 0x%" PRIx32 "\n",
dsp_index, context_mips->hi[dsp_index]);
printf(" lo[%1d] = 0x%" PRIx32 "\n",
dsp_index, context_mips->lo[dsp_index]);
}
printf(" dsp_control = 0x%" PRIx32 "\n",
context_mips->dsp_control);
printf(" epc = 0x%" PRIx64 "\n",
context_mips->epc);
printf(" badvaddr = 0x%" PRIx64 "\n",
context_mips->badvaddr);
printf(" status = 0x%" PRIx32 "\n",
context_mips->status);
printf(" cause = 0x%" PRIx32 "\n",
context_mips->cause);
for (int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT;
++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_mips->float_save.regs[fpr_index]);
}
printf(" float_save.fpcsr = 0x%" PRIx32 "\n",
context_mips->float_save.fpcsr);
printf(" float_save.fir = 0x%" PRIx32 "\n",
context_mips->float_save.fir);
break;
}
default: {
break;
}
}
}
//
// MinidumpMemoryRegion
//
@ -1867,7 +1343,7 @@ bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
}
void MinidumpMemoryRegion::Print() {
void MinidumpMemoryRegion::Print() const {
if (!valid_) {
BPLOG(ERROR) << "MinidumpMemoryRegion cannot print invalid data";
return;

View File

@ -299,8 +299,8 @@ class TestMinidumpContext : public MinidumpContext {
explicit TestMinidumpContext(const MDRawContextX86& context) :
MinidumpContext(NULL) {
valid_ = true;
context_.x86 = new MDRawContextX86(context);
context_flags_ = MD_CONTEXT_X86;
SetContextX86(new MDRawContextX86(context));
SetContextFlags(MD_CONTEXT_X86);
}
};

View File

@ -31,6 +31,7 @@
//
// Author: Mark Mentovai
#include <assert.h>
#include <stdio.h>
#include <map>
@ -75,6 +76,9 @@ class FakeMemoryRegion : public MemoryRegion {
*value = address + 1;
return true;
}
virtual void Print() const {
assert(false);
}
};

View File

@ -41,7 +41,7 @@
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/minidump.h"
#include "google_breakpad/processor/dump_context.h"
#include "google_breakpad/processor/stack_frame.h"
#include "google_breakpad/processor/stack_frame_symbolizer.h"
#include "google_breakpad/processor/system_info.h"
@ -190,7 +190,7 @@ bool Stackwalker::Walk(
// static
Stackwalker* Stackwalker::StackwalkerForCPU(
const SystemInfo* system_info,
MinidumpContext* context,
DumpContext* context,
MemoryRegion* memory,
const CodeModules* modules,
StackFrameSymbolizer* frame_symbolizer) {

View File

@ -49,6 +49,8 @@
//
// Author: Mark Mentovai
#include <assert.h>
#include "processor/logging.h"
#if defined(__i386) && !defined(__i386__)
@ -102,17 +104,20 @@ using google_breakpad::StackwalkerSPARC;
// process' memory space by pointer.
class SelfMemoryRegion : public MemoryRegion {
public:
virtual uint64_t GetBase() { return 0; }
virtual uint32_t GetSize() { return 0xffffffff; }
virtual uint64_t GetBase() const { return 0; }
virtual uint32_t GetSize() const { return 0xffffffff; }
bool GetMemoryAtAddress(uint64_t address, uint8_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const {
return GetMemoryAtAddressInternal(address, value); }
bool GetMemoryAtAddress(uint64_t address, uint16_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const {
return GetMemoryAtAddressInternal(address, value); }
bool GetMemoryAtAddress(uint64_t address, uint32_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const {
return GetMemoryAtAddressInternal(address, value); }
bool GetMemoryAtAddress(uint64_t address, uint64_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const {
return GetMemoryAtAddressInternal(address, value); }
void Print() const {
assert(false);
}
private:
template<typename T> bool GetMemoryAtAddressInternal(uint64_t address,

View File

@ -36,6 +36,7 @@
#ifndef PROCESSOR_STACKWALKER_UNITTEST_UTILS_H_
#define PROCESSOR_STACKWALKER_UNITTEST_UTILS_H_
#include <assert.h>
#include <stdlib.h>
#include <string>
#include <vector>
@ -75,6 +76,9 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion {
bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const {
return GetMemoryLittleEndian(address, value);
}
void Print() const {
assert(false);
}
private:
// Fetch a little-endian value from ADDRESS in contents_ whose size

View File

@ -280,7 +280,7 @@ static void ProcessSingleReport(Options *options, NSString *file_path) {
// Print all of the threads in the dump.
int thread_count = static_cast<int>(process_state.threads()->size());
const std::vector<google_breakpad::MinidumpMemoryRegion*>
const std::vector<google_breakpad::MemoryRegion*>
*thread_memory_regions = process_state.thread_memory_regions();
for (int thread_index = 0; thread_index < thread_count; ++thread_index) {
@ -289,7 +289,7 @@ static void ProcessSingleReport(Options *options, NSString *file_path) {
printf("\n");
printf("Thread %d\n", thread_index);
PrintStack(process_state.threads()->at(thread_index), cpu);
google_breakpad::MinidumpMemoryRegion *thread_stack_bytes =
google_breakpad::MemoryRegion *thread_stack_bytes =
thread_memory_regions->at(thread_index);
if (options->printThreadMemory) {
thread_stack_bytes->Print();