Breakpad processor: Support AMD64 stack unwinding driven by DWARF CFI.
This adds support for 'STACK CFI' records (DWARF CFI) to the AMD64 stack walker. This is necessary for the stack trace to include any frames other than the youngest. Unit tests are included. a=jimblandy, r=mmentovai git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@554 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
c609f474a9
commit
e7e1e1ebf5
7 changed files with 631 additions and 53 deletions
15
Makefile.am
15
Makefile.am
|
@ -139,6 +139,7 @@ check_PROGRAMS = \
|
|||
src/processor/pathname_stripper_unittest \
|
||||
src/processor/postfix_evaluator_unittest \
|
||||
src/processor/range_map_unittest \
|
||||
src/processor/stackwalker_amd64_unittest \
|
||||
src/processor/stackwalker_arm_unittest \
|
||||
src/processor/stackwalker_x86_unittest \
|
||||
src/processor/synth_minidump_unittest \
|
||||
|
@ -303,6 +304,20 @@ src_processor_stackwalker_selftest_LDADD = \
|
|||
src/processor/stackwalker_sparc.lo \
|
||||
src/processor/stackwalker_x86.lo
|
||||
|
||||
src_processor_stackwalker_amd64_unittest_SOURCES = \
|
||||
src/processor/stackwalker_amd64_unittest.cc \
|
||||
src/processor/test_assembler.cc \
|
||||
src/testing/gtest/src/gtest-all.cc \
|
||||
src/testing/gtest/src/gtest_main.cc \
|
||||
src/testing/src/gmock-all.cc
|
||||
src_processor_stackwalker_amd64_unittest_LDADD = \
|
||||
src/libbreakpad.la
|
||||
src_processor_stackwalker_amd64_unittest_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/testing/include \
|
||||
-I$(top_srcdir)/src/testing/gtest/include \
|
||||
-I$(top_srcdir)/src/testing/gtest \
|
||||
-I$(top_srcdir)/src/testing
|
||||
|
||||
src_processor_stackwalker_arm_unittest_SOURCES = \
|
||||
src/processor/stackwalker_arm_unittest.cc \
|
||||
src/processor/test_assembler.cc \
|
||||
|
|
126
Makefile.in
126
Makefile.in
|
@ -79,6 +79,7 @@ check_PROGRAMS = src/client/linux/linux_client_unittest$(EXEEXT) \
|
|||
src/processor/pathname_stripper_unittest$(EXEEXT) \
|
||||
src/processor/postfix_evaluator_unittest$(EXEEXT) \
|
||||
src/processor/range_map_unittest$(EXEEXT) \
|
||||
src/processor/stackwalker_amd64_unittest$(EXEEXT) \
|
||||
src/processor/stackwalker_arm_unittest$(EXEEXT) \
|
||||
src/processor/stackwalker_x86_unittest$(EXEEXT) \
|
||||
src/processor/synth_minidump_unittest$(EXEEXT) \
|
||||
|
@ -281,6 +282,15 @@ src_processor_range_map_unittest_OBJECTS = \
|
|||
$(am_src_processor_range_map_unittest_OBJECTS)
|
||||
src_processor_range_map_unittest_DEPENDENCIES = \
|
||||
src/processor/logging.lo src/processor/pathname_stripper.lo
|
||||
am_src_processor_stackwalker_amd64_unittest_OBJECTS = src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.$(OBJEXT) \
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.$(OBJEXT) \
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.$(OBJEXT) \
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.$(OBJEXT) \
|
||||
src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.$(OBJEXT)
|
||||
src_processor_stackwalker_amd64_unittest_OBJECTS = \
|
||||
$(am_src_processor_stackwalker_amd64_unittest_OBJECTS)
|
||||
src_processor_stackwalker_amd64_unittest_DEPENDENCIES = \
|
||||
src/libbreakpad.la
|
||||
am_src_processor_stackwalker_arm_unittest_OBJECTS = src/processor/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.$(OBJEXT) \
|
||||
src/processor/src_processor_stackwalker_arm_unittest-test_assembler.$(OBJEXT) \
|
||||
src/testing/gtest/src/src_processor_stackwalker_arm_unittest-gtest-all.$(OBJEXT) \
|
||||
|
@ -369,6 +379,7 @@ SOURCES = $(src_client_linux_libbreakpad_client_la_SOURCES) \
|
|||
$(src_processor_pathname_stripper_unittest_SOURCES) \
|
||||
$(src_processor_postfix_evaluator_unittest_SOURCES) \
|
||||
$(src_processor_range_map_unittest_SOURCES) \
|
||||
$(src_processor_stackwalker_amd64_unittest_SOURCES) \
|
||||
$(src_processor_stackwalker_arm_unittest_SOURCES) \
|
||||
$(src_processor_stackwalker_selftest_SOURCES) \
|
||||
$(src_processor_stackwalker_x86_unittest_SOURCES) \
|
||||
|
@ -389,6 +400,7 @@ DIST_SOURCES = $(src_client_linux_libbreakpad_client_la_SOURCES) \
|
|||
$(src_processor_pathname_stripper_unittest_SOURCES) \
|
||||
$(src_processor_postfix_evaluator_unittest_SOURCES) \
|
||||
$(src_processor_range_map_unittest_SOURCES) \
|
||||
$(src_processor_stackwalker_amd64_unittest_SOURCES) \
|
||||
$(src_processor_stackwalker_arm_unittest_SOURCES) \
|
||||
$(src_processor_stackwalker_selftest_SOURCES) \
|
||||
$(src_processor_stackwalker_x86_unittest_SOURCES) \
|
||||
|
@ -782,6 +794,22 @@ src_processor_stackwalker_selftest_LDADD = \
|
|||
src/processor/stackwalker_sparc.lo \
|
||||
src/processor/stackwalker_x86.lo
|
||||
|
||||
src_processor_stackwalker_amd64_unittest_SOURCES = \
|
||||
src/processor/stackwalker_amd64_unittest.cc \
|
||||
src/processor/test_assembler.cc \
|
||||
src/testing/gtest/src/gtest-all.cc \
|
||||
src/testing/gtest/src/gtest_main.cc \
|
||||
src/testing/src/gmock-all.cc
|
||||
|
||||
src_processor_stackwalker_amd64_unittest_LDADD = \
|
||||
src/libbreakpad.la
|
||||
|
||||
src_processor_stackwalker_amd64_unittest_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/testing/include \
|
||||
-I$(top_srcdir)/src/testing/gtest/include \
|
||||
-I$(top_srcdir)/src/testing/gtest \
|
||||
-I$(top_srcdir)/src/testing
|
||||
|
||||
src_processor_stackwalker_arm_unittest_SOURCES = \
|
||||
src/processor/stackwalker_arm_unittest.cc \
|
||||
src/processor/test_assembler.cc \
|
||||
|
@ -1403,6 +1431,24 @@ src/processor/range_map_unittest.$(OBJEXT): \
|
|||
src/processor/range_map_unittest$(EXEEXT): $(src_processor_range_map_unittest_OBJECTS) $(src_processor_range_map_unittest_DEPENDENCIES) src/processor/$(am__dirstamp)
|
||||
@rm -f src/processor/range_map_unittest$(EXEEXT)
|
||||
$(CXXLINK) $(src_processor_range_map_unittest_OBJECTS) $(src_processor_range_map_unittest_LDADD) $(LIBS)
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.$(OBJEXT): \
|
||||
src/processor/$(am__dirstamp) \
|
||||
src/processor/$(DEPDIR)/$(am__dirstamp)
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.$(OBJEXT): \
|
||||
src/processor/$(am__dirstamp) \
|
||||
src/processor/$(DEPDIR)/$(am__dirstamp)
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.$(OBJEXT): \
|
||||
src/testing/gtest/src/$(am__dirstamp) \
|
||||
src/testing/gtest/src/$(DEPDIR)/$(am__dirstamp)
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.$(OBJEXT): \
|
||||
src/testing/gtest/src/$(am__dirstamp) \
|
||||
src/testing/gtest/src/$(DEPDIR)/$(am__dirstamp)
|
||||
src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.$(OBJEXT): \
|
||||
src/testing/src/$(am__dirstamp) \
|
||||
src/testing/src/$(DEPDIR)/$(am__dirstamp)
|
||||
src/processor/stackwalker_amd64_unittest$(EXEEXT): $(src_processor_stackwalker_amd64_unittest_OBJECTS) $(src_processor_stackwalker_amd64_unittest_DEPENDENCIES) src/processor/$(am__dirstamp)
|
||||
@rm -f src/processor/stackwalker_amd64_unittest$(EXEEXT)
|
||||
$(CXXLINK) $(src_processor_stackwalker_amd64_unittest_OBJECTS) $(src_processor_stackwalker_amd64_unittest_LDADD) $(LIBS)
|
||||
src/processor/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.$(OBJEXT): \
|
||||
src/processor/$(am__dirstamp) \
|
||||
src/processor/$(DEPDIR)/$(am__dirstamp)
|
||||
|
@ -1546,6 +1592,8 @@ mostlyclean-compile:
|
|||
-rm -f src/processor/src_processor_minidump_unittest-minidump_unittest.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_minidump_unittest-synth_minidump.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_minidump_unittest-test_assembler.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_stackwalker_arm_unittest-test_assembler.$(OBJEXT)
|
||||
-rm -f src/processor/src_processor_stackwalker_x86_unittest-stackwalker_x86_unittest.$(OBJEXT)
|
||||
|
@ -1575,6 +1623,8 @@ mostlyclean-compile:
|
|||
-rm -f src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_minidump_unittest-gtest-all.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_minidump_unittest-gtest_main.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_stackwalker_arm_unittest-gtest-all.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_stackwalker_arm_unittest-gtest_main.$(OBJEXT)
|
||||
-rm -f src/testing/gtest/src/src_processor_stackwalker_x86_unittest-gtest-all.$(OBJEXT)
|
||||
|
@ -1587,6 +1637,7 @@ mostlyclean-compile:
|
|||
-rm -f src/testing/src/src_processor_cfi_frame_info_unittest-gmock-all.$(OBJEXT)
|
||||
-rm -f src/testing/src/src_processor_minidump_processor_unittest-gmock-all.$(OBJEXT)
|
||||
-rm -f src/testing/src/src_processor_minidump_unittest-gmock-all.$(OBJEXT)
|
||||
-rm -f src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.$(OBJEXT)
|
||||
-rm -f src/testing/src/src_processor_stackwalker_arm_unittest-gmock-all.$(OBJEXT)
|
||||
-rm -f src/testing/src/src_processor_stackwalker_x86_unittest-gmock-all.$(OBJEXT)
|
||||
-rm -f src/testing/src/src_processor_synth_minidump_unittest-gmock-all.$(OBJEXT)
|
||||
|
@ -1634,6 +1685,8 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_minidump_unittest-minidump_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_minidump_unittest-synth_minidump.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_minidump_unittest-test_assembler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_stackwalker_arm_unittest-test_assembler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/src_processor_stackwalker_x86_unittest-stackwalker_x86_unittest.Po@am__quote@
|
||||
|
@ -1657,6 +1710,8 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_unittest-gtest-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_unittest-gtest_main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_arm_unittest-gtest-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_arm_unittest-gtest_main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_x86_unittest-gtest-all.Po@am__quote@
|
||||
|
@ -1669,6 +1724,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_cfi_frame_info_unittest-gmock-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_minidump_unittest-gmock-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_stackwalker_arm_unittest-gmock-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_stackwalker_x86_unittest-gmock-all.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_synth_minidump_unittest-gmock-all.Po@am__quote@
|
||||
|
@ -2030,6 +2086,76 @@ src/testing/src/src_processor_minidump_unittest-gmock-all.obj: src/testing/src/g
|
|||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/src/src_processor_minidump_unittest-gmock-all.obj `if test -f 'src/testing/src/gmock-all.cc'; then $(CYGPATH_W) 'src/testing/src/gmock-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/src/gmock-all.cc'; fi`
|
||||
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.o: src/processor/stackwalker_amd64_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.o -MD -MP -MF src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Tpo -c -o src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.o `test -f 'src/processor/stackwalker_amd64_unittest.cc' || echo '$(srcdir)/'`src/processor/stackwalker_amd64_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Tpo src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/processor/stackwalker_amd64_unittest.cc' object='src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.o `test -f 'src/processor/stackwalker_amd64_unittest.cc' || echo '$(srcdir)/'`src/processor/stackwalker_amd64_unittest.cc
|
||||
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.obj: src/processor/stackwalker_amd64_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.obj -MD -MP -MF src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Tpo -c -o src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.obj `if test -f 'src/processor/stackwalker_amd64_unittest.cc'; then $(CYGPATH_W) 'src/processor/stackwalker_amd64_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/stackwalker_amd64_unittest.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Tpo src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/processor/stackwalker_amd64_unittest.cc' object='src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_processor_stackwalker_amd64_unittest-stackwalker_amd64_unittest.obj `if test -f 'src/processor/stackwalker_amd64_unittest.cc'; then $(CYGPATH_W) 'src/processor/stackwalker_amd64_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/stackwalker_amd64_unittest.cc'; fi`
|
||||
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.o: src/processor/test_assembler.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.o -MD -MP -MF src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Tpo -c -o src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.o `test -f 'src/processor/test_assembler.cc' || echo '$(srcdir)/'`src/processor/test_assembler.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Tpo src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/processor/test_assembler.cc' object='src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.o `test -f 'src/processor/test_assembler.cc' || echo '$(srcdir)/'`src/processor/test_assembler.cc
|
||||
|
||||
src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.obj: src/processor/test_assembler.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.obj -MD -MP -MF src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Tpo -c -o src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.obj `if test -f 'src/processor/test_assembler.cc'; then $(CYGPATH_W) 'src/processor/test_assembler.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/test_assembler.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Tpo src/processor/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-test_assembler.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/processor/test_assembler.cc' object='src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_processor_stackwalker_amd64_unittest-test_assembler.obj `if test -f 'src/processor/test_assembler.cc'; then $(CYGPATH_W) 'src/processor/test_assembler.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/test_assembler.cc'; fi`
|
||||
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.o: src/testing/gtest/src/gtest-all.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.o -MD -MP -MF src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Tpo -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.o `test -f 'src/testing/gtest/src/gtest-all.cc' || echo '$(srcdir)/'`src/testing/gtest/src/gtest-all.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Tpo src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/gtest/src/gtest-all.cc' object='src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.o `test -f 'src/testing/gtest/src/gtest-all.cc' || echo '$(srcdir)/'`src/testing/gtest/src/gtest-all.cc
|
||||
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.obj: src/testing/gtest/src/gtest-all.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.obj -MD -MP -MF src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Tpo -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.obj `if test -f 'src/testing/gtest/src/gtest-all.cc'; then $(CYGPATH_W) 'src/testing/gtest/src/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/gtest/src/gtest-all.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Tpo src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest-all.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/gtest/src/gtest-all.cc' object='src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest-all.obj `if test -f 'src/testing/gtest/src/gtest-all.cc'; then $(CYGPATH_W) 'src/testing/gtest/src/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/gtest/src/gtest-all.cc'; fi`
|
||||
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.o: src/testing/gtest/src/gtest_main.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.o -MD -MP -MF src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Tpo -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.o `test -f 'src/testing/gtest/src/gtest_main.cc' || echo '$(srcdir)/'`src/testing/gtest/src/gtest_main.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Tpo src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/gtest/src/gtest_main.cc' object='src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.o `test -f 'src/testing/gtest/src/gtest_main.cc' || echo '$(srcdir)/'`src/testing/gtest/src/gtest_main.cc
|
||||
|
||||
src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.obj: src/testing/gtest/src/gtest_main.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.obj -MD -MP -MF src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Tpo -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.obj `if test -f 'src/testing/gtest/src/gtest_main.cc'; then $(CYGPATH_W) 'src/testing/gtest/src/gtest_main.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/gtest/src/gtest_main.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Tpo src/testing/gtest/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gtest_main.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/gtest/src/gtest_main.cc' object='src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/gtest/src/src_processor_stackwalker_amd64_unittest-gtest_main.obj `if test -f 'src/testing/gtest/src/gtest_main.cc'; then $(CYGPATH_W) 'src/testing/gtest/src/gtest_main.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/gtest/src/gtest_main.cc'; fi`
|
||||
|
||||
src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.o: src/testing/src/gmock-all.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.o -MD -MP -MF src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Tpo -c -o src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.o `test -f 'src/testing/src/gmock-all.cc' || echo '$(srcdir)/'`src/testing/src/gmock-all.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Tpo src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/src/gmock-all.cc' object='src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.o `test -f 'src/testing/src/gmock-all.cc' || echo '$(srcdir)/'`src/testing/src/gmock-all.cc
|
||||
|
||||
src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.obj: src/testing/src/gmock-all.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.obj -MD -MP -MF src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Tpo -c -o src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.obj `if test -f 'src/testing/src/gmock-all.cc'; then $(CYGPATH_W) 'src/testing/src/gmock-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/src/gmock-all.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Tpo src/testing/src/$(DEPDIR)/src_processor_stackwalker_amd64_unittest-gmock-all.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/src/gmock-all.cc' object='src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_amd64_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/src/src_processor_stackwalker_amd64_unittest-gmock-all.obj `if test -f 'src/testing/src/gmock-all.cc'; then $(CYGPATH_W) 'src/testing/src/gmock-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/src/gmock-all.cc'; fi`
|
||||
|
||||
src/processor/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.o: src/processor/stackwalker_arm_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_stackwalker_arm_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.o -MD -MP -MF src/processor/$(DEPDIR)/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.Tpo -c -o src/processor/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.o `test -f 'src/processor/stackwalker_arm_unittest.cc' || echo '$(srcdir)/'`src/processor/stackwalker_arm_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/processor/$(DEPDIR)/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.Tpo src/processor/$(DEPDIR)/src_processor_stackwalker_arm_unittest-stackwalker_arm_unittest.Po
|
||||
|
|
|
@ -139,28 +139,44 @@ struct StackFramePPC : public StackFrame {
|
|||
};
|
||||
|
||||
struct StackFrameAMD64 : public StackFrame {
|
||||
// ContextValidity has one entry for each relevant hardware pointer register
|
||||
// (%rip and %rsp) and one entry for each nonvolatile (callee-save) register.
|
||||
//FIXME: validate this list
|
||||
// ContextValidity has one entry for each register that we might be able
|
||||
// to recover.
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_RIP = 1 << 0,
|
||||
CONTEXT_VALID_RSP = 1 << 1,
|
||||
CONTEXT_VALID_RBP = 1 << 2,
|
||||
CONTEXT_VALID_RAX = 1 << 0,
|
||||
CONTEXT_VALID_RDX = 1 << 1,
|
||||
CONTEXT_VALID_RCX = 1 << 2,
|
||||
CONTEXT_VALID_RBX = 1 << 3,
|
||||
CONTEXT_VALID_RSI = 1 << 4,
|
||||
CONTEXT_VALID_RDI = 1 << 5,
|
||||
CONTEXT_VALID_RBP = 1 << 6,
|
||||
CONTEXT_VALID_RSP = 1 << 7,
|
||||
CONTEXT_VALID_R8 = 1 << 8,
|
||||
CONTEXT_VALID_R9 = 1 << 9,
|
||||
CONTEXT_VALID_R10 = 1 << 10,
|
||||
CONTEXT_VALID_R11 = 1 << 11,
|
||||
CONTEXT_VALID_R12 = 1 << 12,
|
||||
CONTEXT_VALID_R13 = 1 << 13,
|
||||
CONTEXT_VALID_R14 = 1 << 14,
|
||||
CONTEXT_VALID_R15 = 1 << 15,
|
||||
CONTEXT_VALID_RIP = 1 << 16,
|
||||
CONTEXT_VALID_ALL = -1
|
||||
};
|
||||
|
||||
StackFrameAMD64() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information we had available. Refer to context_validity.
|
||||
MDRawContextAMD64 context;
|
||||
|
||||
// context_validity is actually ContextValidity, but int is used because
|
||||
// the OR operator doesn't work well with enumerated types. This indicates
|
||||
// which fields in context are valid.
|
||||
// For each register in context whose value has been recovered, we set
|
||||
// the corresponding CONTEXT_VALID_ bit in context_validity.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// we use int instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
|
|
|
@ -196,6 +196,16 @@ static void PrintStack(const CallStack *stack, const string &cpu) {
|
|||
const StackFrameAMD64 *frame_amd64 =
|
||||
reinterpret_cast<const StackFrameAMD64*>(frame);
|
||||
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_RBX)
|
||||
sequence = PrintRegister("rbx", frame_amd64->context.rbx, sequence);
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_R12)
|
||||
sequence = PrintRegister("r12", frame_amd64->context.r12, sequence);
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_R13)
|
||||
sequence = PrintRegister("r13", frame_amd64->context.r13, sequence);
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_R14)
|
||||
sequence = PrintRegister("r14", frame_amd64->context.r14, sequence);
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_R15)
|
||||
sequence = PrintRegister("r15", frame_amd64->context.r15, sequence);
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_RIP)
|
||||
sequence = PrintRegister("rip", frame_amd64->context.rip, sequence);
|
||||
if (frame_amd64->context_validity & StackFrameAMD64::CONTEXT_VALID_RSP)
|
||||
|
|
|
@ -34,15 +34,61 @@
|
|||
// Author: Mark Mentovai, Ted Mielczarek
|
||||
|
||||
|
||||
#include "processor/stackwalker_amd64.h"
|
||||
#include "google_breakpad/processor/call_stack.h"
|
||||
#include "google_breakpad/processor/memory_region.h"
|
||||
#include "google_breakpad/processor/source_line_resolver_interface.h"
|
||||
#include "google_breakpad/processor/stack_frame_cpu.h"
|
||||
#include "processor/cfi_frame_info.h"
|
||||
#include "processor/logging.h"
|
||||
#include "processor/scoped_ptr.h"
|
||||
#include "processor/stackwalker_amd64.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
||||
const StackwalkerAMD64::CFIWalker::RegisterSet
|
||||
StackwalkerAMD64::cfi_register_map_[] = {
|
||||
// It may seem like $rip and $rsp are callee-saves, because the callee is
|
||||
// responsible for having them restored upon return. But the callee_saves
|
||||
// flags here really means that the walker should assume they're
|
||||
// unchanged if the CFI doesn't mention them --- clearly wrong for $rip
|
||||
// and $rsp.
|
||||
{ "$rax", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RAX, &MDRawContextAMD64::rax },
|
||||
{ "$rdx", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RDX, &MDRawContextAMD64::rdx },
|
||||
{ "$rcx", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RCX, &MDRawContextAMD64::rcx },
|
||||
{ "$rbx", NULL, true,
|
||||
StackFrameAMD64::CONTEXT_VALID_RBX, &MDRawContextAMD64::rbx },
|
||||
{ "$rsi", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RSI, &MDRawContextAMD64::rsi },
|
||||
{ "$rdi", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RDI, &MDRawContextAMD64::rdi },
|
||||
{ "$rbp", NULL, true,
|
||||
StackFrameAMD64::CONTEXT_VALID_RBP, &MDRawContextAMD64::rbp },
|
||||
{ "$rsp", ".cfa", false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RSP, &MDRawContextAMD64::rsp },
|
||||
{ "$r8", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_R8, &MDRawContextAMD64::r8 },
|
||||
{ "$r9", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_R9, &MDRawContextAMD64::r9 },
|
||||
{ "$r10", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_R10, &MDRawContextAMD64::r10 },
|
||||
{ "$r11", NULL, false,
|
||||
StackFrameAMD64::CONTEXT_VALID_R11, &MDRawContextAMD64::r11 },
|
||||
{ "$r12", NULL, true,
|
||||
StackFrameAMD64::CONTEXT_VALID_R12, &MDRawContextAMD64::r12 },
|
||||
{ "$r13", NULL, true,
|
||||
StackFrameAMD64::CONTEXT_VALID_R13, &MDRawContextAMD64::r13 },
|
||||
{ "$r14", NULL, true,
|
||||
StackFrameAMD64::CONTEXT_VALID_R14, &MDRawContextAMD64::r14 },
|
||||
{ "$r15", NULL, true,
|
||||
StackFrameAMD64::CONTEXT_VALID_R15, &MDRawContextAMD64::r15 },
|
||||
{ "$rip", ".ra", false,
|
||||
StackFrameAMD64::CONTEXT_VALID_RIP, &MDRawContextAMD64::rip },
|
||||
};
|
||||
|
||||
StackwalkerAMD64::StackwalkerAMD64(const SystemInfo *system_info,
|
||||
const MDRawContextAMD64 *context,
|
||||
MemoryRegion *memory,
|
||||
|
@ -50,7 +96,9 @@ StackwalkerAMD64::StackwalkerAMD64(const SystemInfo *system_info,
|
|||
SymbolSupplier *supplier,
|
||||
SourceLineResolverInterface *resolver)
|
||||
: Stackwalker(system_info, memory, modules, supplier, resolver),
|
||||
context_(context) {
|
||||
context_(context),
|
||||
cfi_walker_(cfi_register_map_,
|
||||
(sizeof(cfi_register_map_) / sizeof(cfi_register_map_[0]))) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,6 +119,26 @@ StackFrame* StackwalkerAMD64::GetContextFrame() {
|
|||
return frame;
|
||||
}
|
||||
|
||||
StackFrameAMD64 *StackwalkerAMD64::GetCallerByCFIFrameInfo(
|
||||
const vector<StackFrame *> &frames,
|
||||
CFIFrameInfo *cfi_frame_info) {
|
||||
StackFrameAMD64 *last_frame = static_cast<StackFrameAMD64*>(frames.back());
|
||||
|
||||
scoped_ptr<StackFrameAMD64> frame(new StackFrameAMD64());
|
||||
if (!cfi_walker_
|
||||
.FindCallerRegisters(*memory_, *cfi_frame_info,
|
||||
last_frame->context, last_frame->context_validity,
|
||||
&frame->context, &frame->context_validity))
|
||||
return NULL;
|
||||
|
||||
// Make sure we recovered all the essentials.
|
||||
static const int essentials = (StackFrameAMD64::CONTEXT_VALID_RIP
|
||||
| StackFrameAMD64::CONTEXT_VALID_RSP);
|
||||
if ((frame->context_validity & essentials) != essentials)
|
||||
return NULL;
|
||||
|
||||
return frame.release();
|
||||
}
|
||||
|
||||
StackFrame* StackwalkerAMD64::GetCallerFrame(const CallStack *stack) {
|
||||
if (!memory_ || !stack) {
|
||||
|
@ -78,51 +146,43 @@ StackFrame* StackwalkerAMD64::GetCallerFrame(const CallStack *stack) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
StackFrameAMD64 *last_frame = static_cast<StackFrameAMD64*>(
|
||||
stack->frames()->back());
|
||||
const vector<StackFrame *> &frames = *stack->frames();
|
||||
StackFrameAMD64 *last_frame = static_cast<StackFrameAMD64 *>(frames.back());
|
||||
scoped_ptr<StackFrameAMD64> new_frame;
|
||||
|
||||
//FIXME: this pretty much doesn't work at all due to FPO
|
||||
// being enabled by default.
|
||||
// Brain-dead stackwalking:
|
||||
// %rip_new = *(%rbp_old + 8)
|
||||
// %rsp_new = %rbp_old + 16
|
||||
// %rbp_new = *(%rbp_old)
|
||||
|
||||
// A caller frame must reside higher in memory than its callee frames.
|
||||
// Anything else is an error, or an indication that we've reached the
|
||||
// end of the stack.
|
||||
u_int64_t stack_pointer = last_frame->context.rbp + 16;
|
||||
if (stack_pointer <= last_frame->context.rsp) {
|
||||
return NULL;
|
||||
// If we have DWARF CFI information, use it.
|
||||
if (!new_frame.get()) {
|
||||
scoped_ptr<CFIFrameInfo> cfi_frame_info(resolver_
|
||||
->FindCFIFrameInfo(last_frame));
|
||||
if (cfi_frame_info.get())
|
||||
new_frame.reset(GetCallerByCFIFrameInfo(frames, cfi_frame_info.get()));
|
||||
}
|
||||
|
||||
u_int64_t instruction;
|
||||
if (!memory_->GetMemoryAtAddress(last_frame->context.rbp + 8,
|
||||
&instruction) ||
|
||||
instruction <= 1) {
|
||||
// If nothing worked, tell the caller.
|
||||
if (!new_frame.get())
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u_int64_t stack_base;
|
||||
if (!memory_->GetMemoryAtAddress(last_frame->context.rbp,
|
||||
&stack_base) ||
|
||||
stack_base <= 1) {
|
||||
// Treat an instruction address of 0 as end-of-stack.
|
||||
if (new_frame->context.rip == 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
StackFrameAMD64 *frame = new StackFrameAMD64();
|
||||
// If the new stack pointer is at a lower address than the old, then
|
||||
// that's clearly incorrect. Treat this as end-of-stack to enforce
|
||||
// progress and avoid infinite loops.
|
||||
if (new_frame->context.rsp <= last_frame->context.rsp)
|
||||
return NULL;
|
||||
|
||||
frame->context = last_frame->context;
|
||||
frame->context.rip = instruction;
|
||||
frame->context.rsp = stack_pointer;
|
||||
frame->context.rbp = stack_base;
|
||||
frame->context_validity = StackFrameAMD64::CONTEXT_VALID_RIP |
|
||||
StackFrameAMD64::CONTEXT_VALID_RSP |
|
||||
StackFrameAMD64::CONTEXT_VALID_RBP;
|
||||
// new_frame->context.rip is the return address, which is one instruction
|
||||
// past the CALL that caused us to arrive at the callee. Set
|
||||
// new_frame->instruction to one less than that. This won't reference the
|
||||
// beginning of the CALL instruction, but it's guaranteed to be within
|
||||
// the CALL, which is sufficient to get the source line information to
|
||||
// match up with the line that contains a function call. Callers that
|
||||
// require the exact return address value may access the context.rip
|
||||
// field of StackFrameAMD64.
|
||||
new_frame->instruction = new_frame->context.rip - 1;
|
||||
|
||||
frame->instruction = frame->context.rip - 1;
|
||||
|
||||
return frame;
|
||||
return new_frame.release();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
#include "google_breakpad/processor/stackwalker.h"
|
||||
#include "google_breakpad/processor/stack_frame_cpu.h"
|
||||
#include "processor/cfi_frame_info.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
@ -61,14 +63,29 @@ class StackwalkerAMD64 : public Stackwalker {
|
|||
SourceLineResolverInterface *resolver);
|
||||
|
||||
private:
|
||||
// A STACK CFI-driven frame walker for the AMD64
|
||||
typedef SimpleCFIWalker<u_int64_t, MDRawContextAMD64> CFIWalker;
|
||||
|
||||
// Implementation of Stackwalker, using amd64 context (stack pointer in %rsp,
|
||||
// stack base in %rbp) and stack conventions (saved stack pointer at 0(%rbp))
|
||||
virtual StackFrame* GetContextFrame();
|
||||
virtual StackFrame* GetCallerFrame(const CallStack *stack);
|
||||
|
||||
// Use cfi_frame_info (derived from STACK CFI records) to construct
|
||||
// the frame that called frames.back(). The caller takes ownership
|
||||
// of the returned frame. Return NULL on failure.
|
||||
StackFrameAMD64 *GetCallerByCFIFrameInfo(const vector<StackFrame *> &frames,
|
||||
CFIFrameInfo *cfi_frame_info);
|
||||
|
||||
// Stores the CPU context corresponding to the innermost stack frame to
|
||||
// be returned by GetContextFrame.
|
||||
const MDRawContextAMD64 *context_;
|
||||
|
||||
// Our register map, for cfi_walker_.
|
||||
static const CFIWalker::RegisterSet cfi_register_map_[];
|
||||
|
||||
// Our CFI frame walker.
|
||||
const CFIWalker cfi_walker_;
|
||||
};
|
||||
|
||||
|
||||
|
|
334
src/processor/stackwalker_amd64_unittest.cc
Normal file
334
src/processor/stackwalker_amd64_unittest.cc
Normal file
|
@ -0,0 +1,334 @@
|
|||
// 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.
|
||||
|
||||
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
|
||||
|
||||
// stackwalker_amd64_unittest.cc: Unit tests for StackwalkerAMD64 class.
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#include "breakpad_googletest_includes.h"
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
#include "google_breakpad/processor/basic_source_line_resolver.h"
|
||||
#include "google_breakpad/processor/call_stack.h"
|
||||
#include "google_breakpad/processor/source_line_resolver_interface.h"
|
||||
#include "google_breakpad/processor/stack_frame_cpu.h"
|
||||
#include "processor/stackwalker_unittest_utils.h"
|
||||
#include "processor/stackwalker_amd64.h"
|
||||
#include "processor/test_assembler.h"
|
||||
|
||||
using google_breakpad::BasicSourceLineResolver;
|
||||
using google_breakpad::CallStack;
|
||||
using google_breakpad::StackFrame;
|
||||
using google_breakpad::StackFrameAMD64;
|
||||
using google_breakpad::StackwalkerAMD64;
|
||||
using google_breakpad::SystemInfo;
|
||||
using google_breakpad::TestAssembler::kLittleEndian;
|
||||
using google_breakpad::TestAssembler::Label;
|
||||
using google_breakpad::TestAssembler::Section;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using testing::_;
|
||||
using testing::Return;
|
||||
using testing::SetArgumentPointee;
|
||||
using testing::Test;
|
||||
|
||||
class StackwalkerAMD64Fixture {
|
||||
public:
|
||||
StackwalkerAMD64Fixture()
|
||||
: stack_section(kLittleEndian),
|
||||
// Give the two modules reasonable standard locations and names
|
||||
// for tests to play with.
|
||||
module1(0x40000000c0000000ULL, 0x10000, "module1", "version1"),
|
||||
module2(0x50000000b0000000ULL, 0x10000, "module2", "version2") {
|
||||
// Identify the system as a Linux system.
|
||||
system_info.os = "Linux";
|
||||
system_info.os_short = "linux";
|
||||
system_info.os_version = "Horrendous Hippo";
|
||||
system_info.cpu = "x86";
|
||||
system_info.cpu_info = "";
|
||||
|
||||
// Put distinctive values in the raw CPU context.
|
||||
BrandContext(&raw_context);
|
||||
|
||||
// Create some modules with some stock debugging information.
|
||||
modules.Add(&module1);
|
||||
modules.Add(&module2);
|
||||
|
||||
// By default, none of the modules have symbol info; call
|
||||
// SetModuleSymbols to override this.
|
||||
EXPECT_CALL(supplier, GetSymbolFile(_, _, _, _))
|
||||
.WillRepeatedly(Return(MockSymbolSupplier::NOT_FOUND));
|
||||
}
|
||||
|
||||
// Set the Breakpad symbol information that supplier should return for
|
||||
// MODULE to INFO.
|
||||
void SetModuleSymbols(MockCodeModule *module, const string &info) {
|
||||
EXPECT_CALL(supplier, GetSymbolFile(module, &system_info, _, _))
|
||||
.WillRepeatedly(DoAll(SetArgumentPointee<3>(info),
|
||||
Return(MockSymbolSupplier::FOUND)));
|
||||
}
|
||||
|
||||
// Populate stack_region with the contents of stack_section. Use
|
||||
// stack_section.start() as the region's starting address.
|
||||
void RegionFromSection() {
|
||||
string contents;
|
||||
ASSERT_TRUE(stack_section.GetContents(&contents));
|
||||
stack_region.Init(stack_section.start().Value(), contents);
|
||||
}
|
||||
|
||||
// Fill RAW_CONTEXT with pseudo-random data, for round-trip checking.
|
||||
void BrandContext(MDRawContextAMD64 *raw_context) {
|
||||
u_int8_t x = 173;
|
||||
for (size_t i = 0; i < sizeof(*raw_context); i++)
|
||||
reinterpret_cast<u_int8_t *>(raw_context)[i] = (x += 17);
|
||||
}
|
||||
|
||||
SystemInfo system_info;
|
||||
MDRawContextAMD64 raw_context;
|
||||
Section stack_section;
|
||||
MockMemoryRegion stack_region;
|
||||
MockCodeModule module1;
|
||||
MockCodeModule module2;
|
||||
MockCodeModules modules;
|
||||
MockSymbolSupplier supplier;
|
||||
BasicSourceLineResolver resolver;
|
||||
CallStack call_stack;
|
||||
const vector<StackFrame *> *frames;
|
||||
};
|
||||
|
||||
class GetContextFrame: public StackwalkerAMD64Fixture, public Test { };
|
||||
|
||||
TEST_F(GetContextFrame, Simple) {
|
||||
// There should be no references to the stack in this walk: we don't
|
||||
// provide any call frame information, so trying to reconstruct the
|
||||
// context frame's caller should fail. So there's no need for us to
|
||||
// provide stack contents.
|
||||
raw_context.rip = 0x40000000c0000200ULL;
|
||||
raw_context.rbp = 0x8000000080000000ULL;
|
||||
|
||||
StackwalkerAMD64 walker(&system_info, &raw_context, &stack_region, &modules,
|
||||
&supplier, &resolver);
|
||||
ASSERT_TRUE(walker.Walk(&call_stack));
|
||||
frames = call_stack.frames();
|
||||
ASSERT_GE(1U, frames->size());
|
||||
StackFrameAMD64 *frame = static_cast<StackFrameAMD64 *>(frames->at(0));
|
||||
// Check that the values from the original raw context made it
|
||||
// through to the context in the stack frame.
|
||||
EXPECT_TRUE(memcmp(&raw_context, &frame->context, sizeof(raw_context)) == 0);
|
||||
}
|
||||
|
||||
struct CFIFixture: public StackwalkerAMD64Fixture {
|
||||
CFIFixture() {
|
||||
// Provide a bunch of STACK CFI records; we'll walk to the caller
|
||||
// from every point in this series, expecting to find the same set
|
||||
// of register values.
|
||||
SetModuleSymbols(&module1,
|
||||
// The youngest frame's function.
|
||||
"FUNC 4000 1000 10 enchiridion\n"
|
||||
// Initially, just a return address.
|
||||
"STACK CFI INIT 4000 100 .cfa: $rsp 8 + .ra: .cfa 8 - ^\n"
|
||||
// Push %rbx.
|
||||
"STACK CFI 4001 .cfa: $rsp 16 + $rbx: .cfa 16 - ^\n"
|
||||
// Save %r12 in %rbx. Weird, but permitted.
|
||||
"STACK CFI 4002 $r12: $rbx\n"
|
||||
// Allocate frame space, and save %r13.
|
||||
"STACK CFI 4003 .cfa: $rsp 40 + $r13: .cfa 32 - ^\n"
|
||||
// Put the return address in %r13.
|
||||
"STACK CFI 4005 .ra: $r13\n"
|
||||
// Save %rbp, and use it as a frame pointer.
|
||||
"STACK CFI 4006 .cfa: $rbp 16 + $rbp: .cfa 24 - ^\n"
|
||||
|
||||
// The calling function.
|
||||
"FUNC 5000 1000 10 epictetus\n"
|
||||
// Mark it as end of stack.
|
||||
"STACK CFI INIT 5000 1000 .cfa: $rsp .ra 0\n");
|
||||
|
||||
// Provide some distinctive values for the caller's registers.
|
||||
expected.rsp = 0x8000000080000000ULL;
|
||||
expected.rip = 0x40000000c0005510ULL;
|
||||
expected.rbp = 0x68995b1de4700266ULL;
|
||||
expected.rbx = 0x5a5beeb38de23be8ULL;
|
||||
expected.r12 = 0xed1b02e8cc0fc79cULL;
|
||||
expected.r13 = 0x1d20ad8acacbe930ULL;
|
||||
expected.r14 = 0xe94cffc2f7adaa28ULL;
|
||||
expected.r15 = 0xb638d17d8da413b5ULL;
|
||||
|
||||
// By default, registers are unchanged.
|
||||
raw_context = expected;
|
||||
}
|
||||
|
||||
// Walk the stack, using stack_section as the contents of the stack
|
||||
// and raw_context as the current register values. (Set
|
||||
// raw_context.rsp to the stack's starting address.) Expect two
|
||||
// stack frames; in the older frame, expect the callee-saves
|
||||
// registers to have values matching those in 'expected'.
|
||||
void CheckWalk() {
|
||||
RegionFromSection();
|
||||
raw_context.rsp = stack_section.start().Value();
|
||||
|
||||
StackwalkerAMD64 walker(&system_info, &raw_context, &stack_region, &modules,
|
||||
&supplier, &resolver);
|
||||
ASSERT_TRUE(walker.Walk(&call_stack));
|
||||
frames = call_stack.frames();
|
||||
ASSERT_EQ(2U, frames->size());
|
||||
|
||||
StackFrameAMD64 *frame0 = static_cast<StackFrameAMD64 *>(frames->at(0));
|
||||
ASSERT_EQ(StackFrameAMD64::CONTEXT_VALID_ALL, frame0->context_validity);
|
||||
EXPECT_EQ("enchiridion", frame0->function_name);
|
||||
EXPECT_EQ(0x40000000c0004000ULL, frame0->function_base);
|
||||
|
||||
StackFrameAMD64 *frame1 = static_cast<StackFrameAMD64 *>(frames->at(1));
|
||||
ASSERT_EQ((StackFrameAMD64::CONTEXT_VALID_RIP |
|
||||
StackFrameAMD64::CONTEXT_VALID_RSP |
|
||||
StackFrameAMD64::CONTEXT_VALID_RBP |
|
||||
StackFrameAMD64::CONTEXT_VALID_RBX |
|
||||
StackFrameAMD64::CONTEXT_VALID_R12 |
|
||||
StackFrameAMD64::CONTEXT_VALID_R13 |
|
||||
StackFrameAMD64::CONTEXT_VALID_R14 |
|
||||
StackFrameAMD64::CONTEXT_VALID_R15),
|
||||
frame1->context_validity);
|
||||
EXPECT_EQ(expected.rip, frame1->context.rip);
|
||||
EXPECT_EQ(expected.rsp, frame1->context.rsp);
|
||||
EXPECT_EQ(expected.rbp, frame1->context.rbp);
|
||||
EXPECT_EQ(expected.rbx, frame1->context.rbx);
|
||||
EXPECT_EQ(expected.r12, frame1->context.r12);
|
||||
EXPECT_EQ(expected.r13, frame1->context.r13);
|
||||
EXPECT_EQ(expected.r14, frame1->context.r14);
|
||||
EXPECT_EQ(expected.r15, frame1->context.r15);
|
||||
EXPECT_EQ("epictetus", frame1->function_name);
|
||||
}
|
||||
|
||||
// The values we expect to find for the caller's registers.
|
||||
MDRawContextAMD64 expected;
|
||||
};
|
||||
|
||||
class CFI: public CFIFixture, public Test { };
|
||||
|
||||
TEST_F(CFI, At4000) {
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x40000000c0005510ULL) // return address
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004000ULL;
|
||||
CheckWalk();
|
||||
}
|
||||
|
||||
TEST_F(CFI, At4001) {
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x5a5beeb38de23be8ULL) // saved %rbx
|
||||
.D64(0x40000000c0005510ULL) // return address
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004001ULL;
|
||||
raw_context.rbx = 0xbe0487d2f9eafe29ULL; // callee's (distinct) %rbx value
|
||||
CheckWalk();
|
||||
}
|
||||
|
||||
TEST_F(CFI, At4002) {
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x5a5beeb38de23be8ULL) // saved %rbx
|
||||
.D64(0x40000000c0005510ULL) // return address
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004002ULL;
|
||||
raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12
|
||||
raw_context.r12 = 0xb0118de918a4bceaULL; // callee's (distinct) %r12 value
|
||||
CheckWalk();
|
||||
}
|
||||
|
||||
TEST_F(CFI, At4003) {
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x0e023828dffd4d81ULL) // garbage
|
||||
.D64(0x1d20ad8acacbe930ULL) // saved %r13
|
||||
.D64(0x319e68b49e3ace0fULL) // garbage
|
||||
.D64(0x5a5beeb38de23be8ULL) // saved %rbx
|
||||
.D64(0x40000000c0005510ULL) // return address
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004003ULL;
|
||||
raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12
|
||||
raw_context.r12 = 0x89d04fa804c87a43ULL; // callee's (distinct) %r12
|
||||
raw_context.r13 = 0x5118e02cbdb24b03ULL; // callee's (distinct) %r13
|
||||
CheckWalk();
|
||||
}
|
||||
|
||||
// The results here should be the same as those at module offset 0x4003.
|
||||
TEST_F(CFI, At4004) {
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x0e023828dffd4d81ULL) // garbage
|
||||
.D64(0x1d20ad8acacbe930ULL) // saved %r13
|
||||
.D64(0x319e68b49e3ace0fULL) // garbage
|
||||
.D64(0x5a5beeb38de23be8ULL) // saved %rbx
|
||||
.D64(0x40000000c0005510ULL) // return address
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004004ULL;
|
||||
raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12
|
||||
raw_context.r12 = 0x89d04fa804c87a43ULL; // callee's (distinct) %r12
|
||||
raw_context.r13 = 0x5118e02cbdb24b03ULL; // callee's (distinct) %r13
|
||||
CheckWalk();
|
||||
}
|
||||
|
||||
TEST_F(CFI, At4005) {
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x4b516dd035745953ULL) // garbage
|
||||
.D64(0x1d20ad8acacbe930ULL) // saved %r13
|
||||
.D64(0xa6d445e16ae3d872ULL) // garbage
|
||||
.D64(0x5a5beeb38de23be8ULL) // saved %rbx
|
||||
.D64(0xaa95fa054aedfbaeULL) // garbage
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004005ULL;
|
||||
raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12
|
||||
raw_context.r12 = 0x46b1b8868891b34aULL; // callee's %r12
|
||||
raw_context.r13 = 0x40000000c0005510ULL; // return address
|
||||
CheckWalk();
|
||||
}
|
||||
|
||||
TEST_F(CFI, At4006) {
|
||||
Label frame0_rbp;
|
||||
Label frame1_rsp = expected.rsp;
|
||||
stack_section
|
||||
.D64(0x043c6dfceb91aa34ULL) // garbage
|
||||
.D64(0x1d20ad8acacbe930ULL) // saved %r13
|
||||
.D64(0x68995b1de4700266ULL) // saved %rbp
|
||||
.Mark(&frame0_rbp) // frame pointer points here
|
||||
.D64(0x5a5beeb38de23be8ULL) // saved %rbx
|
||||
.D64(0xf015ee516ad89eabULL) // garbage
|
||||
.Mark(&frame1_rsp); // This effectively sets stack_section.start().
|
||||
raw_context.rip = 0x40000000c0004006ULL;
|
||||
raw_context.rbp = frame0_rbp.Value();
|
||||
raw_context.rbx = 0xed1b02e8cc0fc79cULL; // saved %r12
|
||||
raw_context.r12 = 0x26e007b341acfebdULL; // callee's %r12
|
||||
raw_context.r13 = 0x40000000c0005510ULL; // return address
|
||||
CheckWalk();
|
||||
}
|
Loading…
Reference in a new issue