Add an abstract interface to SourceLineResolver, and allow any implementation

to be used with MinidumpProcessor.  The basic SourceLineResolver is now a
public interface (#89)



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@83 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
bryner 2006-12-11 23:22:54 +00:00
parent 65dbfcc15f
commit fd38d48e6d
18 changed files with 252 additions and 157 deletions

View File

@ -52,6 +52,7 @@ lib_LTLIBRARIES = src/libairbag.la
src_libairbag_la_SOURCES = \ src_libairbag_la_SOURCES = \
src/google_airbag/common/airbag_types.h \ src/google_airbag/common/airbag_types.h \
src/google_airbag/common/minidump_format.h \ src/google_airbag/common/minidump_format.h \
src/google_airbag/processor/basic_source_line_resolver.h \
src/google_airbag/processor/call_stack.h \ src/google_airbag/processor/call_stack.h \
src/google_airbag/processor/code_module.h \ src/google_airbag/processor/code_module.h \
src/google_airbag/processor/code_modules.h \ src/google_airbag/processor/code_modules.h \
@ -68,6 +69,7 @@ src_libairbag_la_SOURCES = \
src/processor/basic_code_module.h \ src/processor/basic_code_module.h \
src/processor/basic_code_modules.cc \ src/processor/basic_code_modules.cc \
src/processor/basic_code_modules.h \ src/processor/basic_code_modules.h \
src/processor/basic_source_line_resolver.cc \
src/processor/call_stack.cc \ src/processor/call_stack.cc \
src/processor/contained_range_map.h \ src/processor/contained_range_map.h \
src/processor/contained_range_map-inl.h \ src/processor/contained_range_map-inl.h \
@ -84,8 +86,6 @@ src_libairbag_la_SOURCES = \
src/processor/scoped_ptr.h \ src/processor/scoped_ptr.h \
src/processor/simple_symbol_supplier.cc \ src/processor/simple_symbol_supplier.cc \
src/processor/simple_symbol_supplier.h \ src/processor/simple_symbol_supplier.h \
src/processor/source_line_resolver.cc \
src/processor/source_line_resolver.h \
src/processor/stack_frame_info.h \ src/processor/stack_frame_info.h \
src/processor/stackwalker.cc \ src/processor/stackwalker.cc \
src/processor/stackwalker_ppc.cc \ src/processor/stackwalker_ppc.cc \
@ -103,12 +103,12 @@ bin_PROGRAMS = \
## Tests ## Tests
check_PROGRAMS = \ check_PROGRAMS = \
src/processor/address_map_unittest \ src/processor/address_map_unittest \
src/processor/basic_source_line_resolver_unittest \
src/processor/contained_range_map_unittest \ src/processor/contained_range_map_unittest \
src/processor/minidump_processor_unittest \ src/processor/minidump_processor_unittest \
src/processor/pathname_stripper_unittest \ src/processor/pathname_stripper_unittest \
src/processor/postfix_evaluator_unittest \ src/processor/postfix_evaluator_unittest \
src/processor/range_map_unittest \ src/processor/range_map_unittest
src/processor/source_line_resolver_unittest
if SELFTEST if SELFTEST
check_PROGRAMS += \ check_PROGRAMS += \
@ -125,6 +125,11 @@ TESTS_ENVIRONMENT =
src_processor_address_map_unittest_SOURCES = \ src_processor_address_map_unittest_SOURCES = \
src/processor/address_map_unittest.cc src/processor/address_map_unittest.cc
src_processor_basic_source_line_resolver_unittest_SOURCES = \
src/processor/basic_source_line_resolver_unittest.cc
src_processor_basic_source_line_resolver_unittest_LDADD = \
src/processor/basic_source_line_resolver.lo
src_processor_contained_range_map_unittest_SOURCES = \ src_processor_contained_range_map_unittest_SOURCES = \
src/processor/contained_range_map_unittest.cc src/processor/contained_range_map_unittest.cc
@ -132,14 +137,14 @@ src_processor_minidump_processor_unittest_SOURCES = \
src/processor/minidump_processor_unittest.cc src/processor/minidump_processor_unittest.cc
src_processor_minidump_processor_unittest_LDADD = \ src_processor_minidump_processor_unittest_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump_processor.lo \ src/processor/minidump_processor.lo \
src/processor/minidump.lo \ src/processor/minidump.lo \
src/processor/process_state.lo \ src/processor/process_state.lo \
src/processor/stackwalker.lo \ src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo \ src/processor/stackwalker_x86.lo
src/processor/source_line_resolver.lo
src_processor_pathname_stripper_unittest_SOURCES = \ src_processor_pathname_stripper_unittest_SOURCES = \
src/processor/pathname_stripper_unittest.cc src/processor/pathname_stripper_unittest.cc
@ -152,18 +157,13 @@ src_processor_postfix_evaluator_unittest_SOURCES = \
src_processor_range_map_unittest_SOURCES = \ src_processor_range_map_unittest_SOURCES = \
src/processor/range_map_unittest.cc src/processor/range_map_unittest.cc
src_processor_source_line_resolver_unittest_SOURCES = \
src/processor/source_line_resolver_unittest.cc
src_processor_source_line_resolver_unittest_LDADD = \
src/processor/source_line_resolver.lo
src_processor_stackwalker_selftest_SOURCES = \ src_processor_stackwalker_selftest_SOURCES = \
src/processor/stackwalker_selftest.cc src/processor/stackwalker_selftest.cc
src_processor_stackwalker_selftest_LDADD = \ src_processor_stackwalker_selftest_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump.lo \ src/processor/minidump.lo \
src/processor/source_line_resolver.lo \
src/processor/stackwalker.lo \ src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo src/processor/stackwalker_x86.lo
@ -182,6 +182,7 @@ src_processor_minidump_stackwalk_SOURCES = \
src/processor/minidump_stackwalk.cc src/processor/minidump_stackwalk.cc
src_processor_minidump_stackwalk_LDADD = \ src_processor_minidump_stackwalk_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump.lo \ src/processor/minidump.lo \
src/processor/minidump_processor.lo \ src/processor/minidump_processor.lo \
@ -190,8 +191,7 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/simple_symbol_supplier.lo \ src/processor/simple_symbol_supplier.lo \
src/processor/stackwalker.lo \ src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo \ src/processor/stackwalker_x86.lo
src/processor/source_line_resolver.lo
## Additional files to be included in a source distribution ## Additional files to be included in a source distribution

View File

@ -71,13 +71,12 @@ host_triplet = @host@
bin_PROGRAMS = src/processor/minidump_dump$(EXEEXT) \ bin_PROGRAMS = src/processor/minidump_dump$(EXEEXT) \
src/processor/minidump_stackwalk$(EXEEXT) src/processor/minidump_stackwalk$(EXEEXT)
check_PROGRAMS = src/processor/address_map_unittest$(EXEEXT) \ check_PROGRAMS = src/processor/address_map_unittest$(EXEEXT) \
src/processor/basic_source_line_resolver_unittest$(EXEEXT) \
src/processor/contained_range_map_unittest$(EXEEXT) \ src/processor/contained_range_map_unittest$(EXEEXT) \
src/processor/minidump_processor_unittest$(EXEEXT) \ src/processor/minidump_processor_unittest$(EXEEXT) \
src/processor/pathname_stripper_unittest$(EXEEXT) \ src/processor/pathname_stripper_unittest$(EXEEXT) \
src/processor/postfix_evaluator_unittest$(EXEEXT) \ src/processor/postfix_evaluator_unittest$(EXEEXT) \
src/processor/range_map_unittest$(EXEEXT) \ src/processor/range_map_unittest$(EXEEXT) $(am__EXEEXT_1)
src/processor/source_line_resolver_unittest$(EXEEXT) \
$(am__EXEEXT_1)
@SELFTEST_TRUE@am__append_1 = \ @SELFTEST_TRUE@am__append_1 = \
@SELFTEST_TRUE@ src/processor/stackwalker_selftest @SELFTEST_TRUE@ src/processor/stackwalker_selftest
@ -111,12 +110,12 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
src_libairbag_la_LIBADD = src_libairbag_la_LIBADD =
am__dirstamp = $(am__leading_dot)dirstamp am__dirstamp = $(am__leading_dot)dirstamp
am_src_libairbag_la_OBJECTS = src/processor/basic_code_modules.lo \ am_src_libairbag_la_OBJECTS = src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo src/processor/minidump.lo \ src/processor/call_stack.lo src/processor/minidump.lo \
src/processor/minidump_processor.lo \ src/processor/minidump_processor.lo \
src/processor/pathname_stripper.lo \ src/processor/pathname_stripper.lo \
src/processor/process_state.lo \ src/processor/process_state.lo \
src/processor/simple_symbol_supplier.lo \ src/processor/simple_symbol_supplier.lo \
src/processor/source_line_resolver.lo \
src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \ src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo src/processor/stackwalker_x86.lo
src_libairbag_la_OBJECTS = $(am_src_libairbag_la_OBJECTS) src_libairbag_la_OBJECTS = $(am_src_libairbag_la_OBJECTS)
@ -129,6 +128,11 @@ am_src_processor_address_map_unittest_OBJECTS = \
src_processor_address_map_unittest_OBJECTS = \ src_processor_address_map_unittest_OBJECTS = \
$(am_src_processor_address_map_unittest_OBJECTS) $(am_src_processor_address_map_unittest_OBJECTS)
src_processor_address_map_unittest_LDADD = $(LDADD) src_processor_address_map_unittest_LDADD = $(LDADD)
am_src_processor_basic_source_line_resolver_unittest_OBJECTS = \
src/processor/basic_source_line_resolver_unittest.$(OBJEXT)
src_processor_basic_source_line_resolver_unittest_OBJECTS = $(am_src_processor_basic_source_line_resolver_unittest_OBJECTS)
src_processor_basic_source_line_resolver_unittest_DEPENDENCIES = \
src/processor/basic_source_line_resolver.lo
am_src_processor_contained_range_map_unittest_OBJECTS = \ am_src_processor_contained_range_map_unittest_OBJECTS = \
src/processor/contained_range_map_unittest.$(OBJEXT) src/processor/contained_range_map_unittest.$(OBJEXT)
src_processor_contained_range_map_unittest_OBJECTS = \ src_processor_contained_range_map_unittest_OBJECTS = \
@ -146,26 +150,26 @@ src_processor_minidump_processor_unittest_OBJECTS = \
$(am_src_processor_minidump_processor_unittest_OBJECTS) $(am_src_processor_minidump_processor_unittest_OBJECTS)
src_processor_minidump_processor_unittest_DEPENDENCIES = \ src_processor_minidump_processor_unittest_DEPENDENCIES = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump_processor.lo src/processor/minidump.lo \ src/processor/minidump_processor.lo src/processor/minidump.lo \
src/processor/process_state.lo src/processor/stackwalker.lo \ src/processor/process_state.lo src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo \ src/processor/stackwalker_x86.lo
src/processor/source_line_resolver.lo
am_src_processor_minidump_stackwalk_OBJECTS = \ am_src_processor_minidump_stackwalk_OBJECTS = \
src/processor/minidump_stackwalk.$(OBJEXT) src/processor/minidump_stackwalk.$(OBJEXT)
src_processor_minidump_stackwalk_OBJECTS = \ src_processor_minidump_stackwalk_OBJECTS = \
$(am_src_processor_minidump_stackwalk_OBJECTS) $(am_src_processor_minidump_stackwalk_OBJECTS)
src_processor_minidump_stackwalk_DEPENDENCIES = \ src_processor_minidump_stackwalk_DEPENDENCIES = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo src/processor/minidump.lo \ src/processor/call_stack.lo src/processor/minidump.lo \
src/processor/minidump_processor.lo \ src/processor/minidump_processor.lo \
src/processor/pathname_stripper.lo \ src/processor/pathname_stripper.lo \
src/processor/process_state.lo \ src/processor/process_state.lo \
src/processor/simple_symbol_supplier.lo \ src/processor/simple_symbol_supplier.lo \
src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \ src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo \ src/processor/stackwalker_x86.lo
src/processor/source_line_resolver.lo
am_src_processor_pathname_stripper_unittest_OBJECTS = \ am_src_processor_pathname_stripper_unittest_OBJECTS = \
src/processor/pathname_stripper_unittest.$(OBJEXT) src/processor/pathname_stripper_unittest.$(OBJEXT)
src_processor_pathname_stripper_unittest_OBJECTS = \ src_processor_pathname_stripper_unittest_OBJECTS = \
@ -182,20 +186,14 @@ am_src_processor_range_map_unittest_OBJECTS = \
src_processor_range_map_unittest_OBJECTS = \ src_processor_range_map_unittest_OBJECTS = \
$(am_src_processor_range_map_unittest_OBJECTS) $(am_src_processor_range_map_unittest_OBJECTS)
src_processor_range_map_unittest_LDADD = $(LDADD) src_processor_range_map_unittest_LDADD = $(LDADD)
am_src_processor_source_line_resolver_unittest_OBJECTS = \
src/processor/source_line_resolver_unittest.$(OBJEXT)
src_processor_source_line_resolver_unittest_OBJECTS = \
$(am_src_processor_source_line_resolver_unittest_OBJECTS)
src_processor_source_line_resolver_unittest_DEPENDENCIES = \
src/processor/source_line_resolver.lo
am_src_processor_stackwalker_selftest_OBJECTS = \ am_src_processor_stackwalker_selftest_OBJECTS = \
src/processor/stackwalker_selftest.$(OBJEXT) src/processor/stackwalker_selftest.$(OBJEXT)
src_processor_stackwalker_selftest_OBJECTS = \ src_processor_stackwalker_selftest_OBJECTS = \
$(am_src_processor_stackwalker_selftest_OBJECTS) $(am_src_processor_stackwalker_selftest_OBJECTS)
src_processor_stackwalker_selftest_DEPENDENCIES = \ src_processor_stackwalker_selftest_DEPENDENCIES = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo src/processor/minidump.lo \ src/processor/call_stack.lo src/processor/minidump.lo \
src/processor/source_line_resolver.lo \
src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \ src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo src/processor/stackwalker_x86.lo
SCRIPTS = $(noinst_SCRIPTS) SCRIPTS = $(noinst_SCRIPTS)
@ -220,6 +218,7 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(src_libairbag_la_SOURCES) \ SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_address_map_unittest_SOURCES) \ $(src_processor_address_map_unittest_SOURCES) \
$(src_processor_basic_source_line_resolver_unittest_SOURCES) \
$(src_processor_contained_range_map_unittest_SOURCES) \ $(src_processor_contained_range_map_unittest_SOURCES) \
$(src_processor_minidump_dump_SOURCES) \ $(src_processor_minidump_dump_SOURCES) \
$(src_processor_minidump_processor_unittest_SOURCES) \ $(src_processor_minidump_processor_unittest_SOURCES) \
@ -227,10 +226,10 @@ SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_pathname_stripper_unittest_SOURCES) \ $(src_processor_pathname_stripper_unittest_SOURCES) \
$(src_processor_postfix_evaluator_unittest_SOURCES) \ $(src_processor_postfix_evaluator_unittest_SOURCES) \
$(src_processor_range_map_unittest_SOURCES) \ $(src_processor_range_map_unittest_SOURCES) \
$(src_processor_source_line_resolver_unittest_SOURCES) \
$(src_processor_stackwalker_selftest_SOURCES) $(src_processor_stackwalker_selftest_SOURCES)
DIST_SOURCES = $(src_libairbag_la_SOURCES) \ DIST_SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_address_map_unittest_SOURCES) \ $(src_processor_address_map_unittest_SOURCES) \
$(src_processor_basic_source_line_resolver_unittest_SOURCES) \
$(src_processor_contained_range_map_unittest_SOURCES) \ $(src_processor_contained_range_map_unittest_SOURCES) \
$(src_processor_minidump_dump_SOURCES) \ $(src_processor_minidump_dump_SOURCES) \
$(src_processor_minidump_processor_unittest_SOURCES) \ $(src_processor_minidump_processor_unittest_SOURCES) \
@ -238,7 +237,6 @@ DIST_SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_pathname_stripper_unittest_SOURCES) \ $(src_processor_pathname_stripper_unittest_SOURCES) \
$(src_processor_postfix_evaluator_unittest_SOURCES) \ $(src_processor_postfix_evaluator_unittest_SOURCES) \
$(src_processor_range_map_unittest_SOURCES) \ $(src_processor_range_map_unittest_SOURCES) \
$(src_processor_source_line_resolver_unittest_SOURCES) \
$(src_processor_stackwalker_selftest_SOURCES) $(src_processor_stackwalker_selftest_SOURCES)
dist_docDATA_INSTALL = $(INSTALL_DATA) dist_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_doc_DATA) DATA = $(dist_doc_DATA)
@ -284,7 +282,6 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
F77 = @F77@ F77 = @F77@
FFLAGS = @FFLAGS@ FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -312,9 +309,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@ ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@ ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@ ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@ -331,30 +331,23 @@ build_cpu = @build_cpu@
build_os = @build_os@ build_os = @build_os@
build_vendor = @build_vendor@ build_vendor = @build_vendor@
datadir = @datadir@ datadir = @datadir@
datarootdir = @datarootdir@
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
dvidir = @dvidir@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
host = @host@ host = @host@
host_alias = @host_alias@ host_alias = @host_alias@
host_cpu = @host_cpu@ host_cpu = @host_cpu@
host_os = @host_os@ host_os = @host_os@
host_vendor = @host_vendor@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@ includedir = @includedir@
infodir = @infodir@ infodir = @infodir@
install_sh = @install_sh@ install_sh = @install_sh@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
@ -362,6 +355,7 @@ target_alias = @target_alias@
# This allows #includes to be relative to src/ # This allows #includes to be relative to src/
AM_CPPFLAGS = -I$(top_srcdir)/src AM_CPPFLAGS = -I$(top_srcdir)/src
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
dist_doc_DATA = \ dist_doc_DATA = \
AUTHORS \ AUTHORS \
COPYING \ COPYING \
@ -374,6 +368,7 @@ lib_LTLIBRARIES = src/libairbag.la
src_libairbag_la_SOURCES = \ src_libairbag_la_SOURCES = \
src/google_airbag/common/airbag_types.h \ src/google_airbag/common/airbag_types.h \
src/google_airbag/common/minidump_format.h \ src/google_airbag/common/minidump_format.h \
src/google_airbag/processor/basic_source_line_resolver.h \
src/google_airbag/processor/call_stack.h \ src/google_airbag/processor/call_stack.h \
src/google_airbag/processor/code_module.h \ src/google_airbag/processor/code_module.h \
src/google_airbag/processor/code_modules.h \ src/google_airbag/processor/code_modules.h \
@ -390,6 +385,7 @@ src_libairbag_la_SOURCES = \
src/processor/basic_code_module.h \ src/processor/basic_code_module.h \
src/processor/basic_code_modules.cc \ src/processor/basic_code_modules.cc \
src/processor/basic_code_modules.h \ src/processor/basic_code_modules.h \
src/processor/basic_source_line_resolver.cc \
src/processor/call_stack.cc \ src/processor/call_stack.cc \
src/processor/contained_range_map.h \ src/processor/contained_range_map.h \
src/processor/contained_range_map-inl.h \ src/processor/contained_range_map-inl.h \
@ -406,8 +402,6 @@ src_libairbag_la_SOURCES = \
src/processor/scoped_ptr.h \ src/processor/scoped_ptr.h \
src/processor/simple_symbol_supplier.cc \ src/processor/simple_symbol_supplier.cc \
src/processor/simple_symbol_supplier.h \ src/processor/simple_symbol_supplier.h \
src/processor/source_line_resolver.cc \
src/processor/source_line_resolver.h \
src/processor/stack_frame_info.h \ src/processor/stack_frame_info.h \
src/processor/stackwalker.cc \ src/processor/stackwalker.cc \
src/processor/stackwalker_ppc.cc \ src/processor/stackwalker_ppc.cc \
@ -424,6 +418,12 @@ TESTS_ENVIRONMENT =
src_processor_address_map_unittest_SOURCES = \ src_processor_address_map_unittest_SOURCES = \
src/processor/address_map_unittest.cc src/processor/address_map_unittest.cc
src_processor_basic_source_line_resolver_unittest_SOURCES = \
src/processor/basic_source_line_resolver_unittest.cc
src_processor_basic_source_line_resolver_unittest_LDADD = \
src/processor/basic_source_line_resolver.lo
src_processor_contained_range_map_unittest_SOURCES = \ src_processor_contained_range_map_unittest_SOURCES = \
src/processor/contained_range_map_unittest.cc src/processor/contained_range_map_unittest.cc
@ -432,14 +432,14 @@ src_processor_minidump_processor_unittest_SOURCES = \
src_processor_minidump_processor_unittest_LDADD = \ src_processor_minidump_processor_unittest_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump_processor.lo \ src/processor/minidump_processor.lo \
src/processor/minidump.lo \ src/processor/minidump.lo \
src/processor/process_state.lo \ src/processor/process_state.lo \
src/processor/stackwalker.lo \ src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo \ src/processor/stackwalker_x86.lo
src/processor/source_line_resolver.lo
src_processor_pathname_stripper_unittest_SOURCES = \ src_processor_pathname_stripper_unittest_SOURCES = \
src/processor/pathname_stripper_unittest.cc src/processor/pathname_stripper_unittest.cc
@ -453,20 +453,14 @@ src_processor_postfix_evaluator_unittest_SOURCES = \
src_processor_range_map_unittest_SOURCES = \ src_processor_range_map_unittest_SOURCES = \
src/processor/range_map_unittest.cc src/processor/range_map_unittest.cc
src_processor_source_line_resolver_unittest_SOURCES = \
src/processor/source_line_resolver_unittest.cc
src_processor_source_line_resolver_unittest_LDADD = \
src/processor/source_line_resolver.lo
src_processor_stackwalker_selftest_SOURCES = \ src_processor_stackwalker_selftest_SOURCES = \
src/processor/stackwalker_selftest.cc src/processor/stackwalker_selftest.cc
src_processor_stackwalker_selftest_LDADD = \ src_processor_stackwalker_selftest_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump.lo \ src/processor/minidump.lo \
src/processor/source_line_resolver.lo \
src/processor/stackwalker.lo \ src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo src/processor/stackwalker_x86.lo
@ -484,6 +478,7 @@ src_processor_minidump_stackwalk_SOURCES = \
src_processor_minidump_stackwalk_LDADD = \ src_processor_minidump_stackwalk_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \ src/processor/call_stack.lo \
src/processor/minidump.lo \ src/processor/minidump.lo \
src/processor/minidump_processor.lo \ src/processor/minidump_processor.lo \
@ -492,8 +487,7 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/simple_symbol_supplier.lo \ src/processor/simple_symbol_supplier.lo \
src/processor/stackwalker.lo \ src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \ src/processor/stackwalker_ppc.lo \
src/processor/stackwalker_x86.lo \ src/processor/stackwalker_x86.lo
src/processor/source_line_resolver.lo
EXTRA_DIST = \ EXTRA_DIST = \
$(SCRIPTS) \ $(SCRIPTS) \
@ -620,6 +614,9 @@ src/processor/$(DEPDIR)/$(am__dirstamp):
@: > src/processor/$(DEPDIR)/$(am__dirstamp) @: > src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/basic_code_modules.lo: src/processor/$(am__dirstamp) \ src/processor/basic_code_modules.lo: src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/basic_source_line_resolver.lo: \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/call_stack.lo: src/processor/$(am__dirstamp) \ src/processor/call_stack.lo: src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/minidump.lo: src/processor/$(am__dirstamp) \ src/processor/minidump.lo: src/processor/$(am__dirstamp) \
@ -633,8 +630,6 @@ src/processor/process_state.lo: src/processor/$(am__dirstamp) \
src/processor/simple_symbol_supplier.lo: \ src/processor/simple_symbol_supplier.lo: \
src/processor/$(am__dirstamp) \ src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/source_line_resolver.lo: src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/stackwalker.lo: src/processor/$(am__dirstamp) \ src/processor/stackwalker.lo: src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/stackwalker_ppc.lo: src/processor/$(am__dirstamp) \ src/processor/stackwalker_ppc.lo: src/processor/$(am__dirstamp) \
@ -694,6 +689,12 @@ src/processor/address_map_unittest.$(OBJEXT): \
src/processor/address_map_unittest$(EXEEXT): $(src_processor_address_map_unittest_OBJECTS) $(src_processor_address_map_unittest_DEPENDENCIES) src/processor/$(am__dirstamp) src/processor/address_map_unittest$(EXEEXT): $(src_processor_address_map_unittest_OBJECTS) $(src_processor_address_map_unittest_DEPENDENCIES) src/processor/$(am__dirstamp)
@rm -f src/processor/address_map_unittest$(EXEEXT) @rm -f src/processor/address_map_unittest$(EXEEXT)
$(CXXLINK) $(src_processor_address_map_unittest_LDFLAGS) $(src_processor_address_map_unittest_OBJECTS) $(src_processor_address_map_unittest_LDADD) $(LIBS) $(CXXLINK) $(src_processor_address_map_unittest_LDFLAGS) $(src_processor_address_map_unittest_OBJECTS) $(src_processor_address_map_unittest_LDADD) $(LIBS)
src/processor/basic_source_line_resolver_unittest.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/basic_source_line_resolver_unittest$(EXEEXT): $(src_processor_basic_source_line_resolver_unittest_OBJECTS) $(src_processor_basic_source_line_resolver_unittest_DEPENDENCIES) src/processor/$(am__dirstamp)
@rm -f src/processor/basic_source_line_resolver_unittest$(EXEEXT)
$(CXXLINK) $(src_processor_basic_source_line_resolver_unittest_LDFLAGS) $(src_processor_basic_source_line_resolver_unittest_OBJECTS) $(src_processor_basic_source_line_resolver_unittest_LDADD) $(LIBS)
src/processor/contained_range_map_unittest.$(OBJEXT): \ src/processor/contained_range_map_unittest.$(OBJEXT): \
src/processor/$(am__dirstamp) \ src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
@ -735,12 +736,6 @@ 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) 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) @rm -f src/processor/range_map_unittest$(EXEEXT)
$(CXXLINK) $(src_processor_range_map_unittest_LDFLAGS) $(src_processor_range_map_unittest_OBJECTS) $(src_processor_range_map_unittest_LDADD) $(LIBS) $(CXXLINK) $(src_processor_range_map_unittest_LDFLAGS) $(src_processor_range_map_unittest_OBJECTS) $(src_processor_range_map_unittest_LDADD) $(LIBS)
src/processor/source_line_resolver_unittest.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/source_line_resolver_unittest$(EXEEXT): $(src_processor_source_line_resolver_unittest_OBJECTS) $(src_processor_source_line_resolver_unittest_DEPENDENCIES) src/processor/$(am__dirstamp)
@rm -f src/processor/source_line_resolver_unittest$(EXEEXT)
$(CXXLINK) $(src_processor_source_line_resolver_unittest_LDFLAGS) $(src_processor_source_line_resolver_unittest_OBJECTS) $(src_processor_source_line_resolver_unittest_LDADD) $(LIBS)
src/processor/stackwalker_selftest.$(OBJEXT): \ src/processor/stackwalker_selftest.$(OBJEXT): \
src/processor/$(am__dirstamp) \ src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
@ -753,6 +748,9 @@ mostlyclean-compile:
-rm -f src/processor/address_map_unittest.$(OBJEXT) -rm -f src/processor/address_map_unittest.$(OBJEXT)
-rm -f src/processor/basic_code_modules.$(OBJEXT) -rm -f src/processor/basic_code_modules.$(OBJEXT)
-rm -f src/processor/basic_code_modules.lo -rm -f src/processor/basic_code_modules.lo
-rm -f src/processor/basic_source_line_resolver.$(OBJEXT)
-rm -f src/processor/basic_source_line_resolver.lo
-rm -f src/processor/basic_source_line_resolver_unittest.$(OBJEXT)
-rm -f src/processor/call_stack.$(OBJEXT) -rm -f src/processor/call_stack.$(OBJEXT)
-rm -f src/processor/call_stack.lo -rm -f src/processor/call_stack.lo
-rm -f src/processor/contained_range_map_unittest.$(OBJEXT) -rm -f src/processor/contained_range_map_unittest.$(OBJEXT)
@ -772,9 +770,6 @@ mostlyclean-compile:
-rm -f src/processor/range_map_unittest.$(OBJEXT) -rm -f src/processor/range_map_unittest.$(OBJEXT)
-rm -f src/processor/simple_symbol_supplier.$(OBJEXT) -rm -f src/processor/simple_symbol_supplier.$(OBJEXT)
-rm -f src/processor/simple_symbol_supplier.lo -rm -f src/processor/simple_symbol_supplier.lo
-rm -f src/processor/source_line_resolver.$(OBJEXT)
-rm -f src/processor/source_line_resolver.lo
-rm -f src/processor/source_line_resolver_unittest.$(OBJEXT)
-rm -f src/processor/stackwalker.$(OBJEXT) -rm -f src/processor/stackwalker.$(OBJEXT)
-rm -f src/processor/stackwalker.lo -rm -f src/processor/stackwalker.lo
-rm -f src/processor/stackwalker_ppc.$(OBJEXT) -rm -f src/processor/stackwalker_ppc.$(OBJEXT)
@ -788,6 +783,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/address_map_unittest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/address_map_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/basic_code_modules.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/basic_code_modules.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/basic_source_line_resolver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/basic_source_line_resolver_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/call_stack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/call_stack.Plo@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)/contained_range_map_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump.Plo@am__quote@
@ -801,8 +798,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/process_state.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/process_state.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/range_map_unittest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/range_map_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/simple_symbol_supplier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/simple_symbol_supplier.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/source_line_resolver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/source_line_resolver_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_ppc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_ppc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_selftest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_selftest.Po@am__quote@

View File

@ -28,7 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// PDBSourceLineWriter uses a pdb file produced by Visual C++ to output // PDBSourceLineWriter uses a pdb file produced by Visual C++ to output
// a line/address map for use with SourceLineResolver. // a line/address map for use with BasicSourceLineResolver.
#ifndef _PDB_SOURCE_LINE_WRITER_H__ #ifndef _PDB_SOURCE_LINE_WRITER_H__
#define _PDB_SOURCE_LINE_WRITER_H__ #define _PDB_SOURCE_LINE_WRITER_H__

View File

@ -0,0 +1,84 @@
// Copyright (c) 2006, 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.
// BasicSourceLineResolver implements SourceLineResolverInterface, using
// address map files produced by a compatible writer, e.g. PDBSourceLineWriter.
#ifndef GOOGLE_AIRBAG_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
#define GOOGLE_AIRBAG_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
#include <ext/hash_map>
#include "google_airbag/processor/source_line_resolver_interface.h"
namespace google_airbag {
using std::string;
using __gnu_cxx::hash_map;
class BasicSourceLineResolver : public SourceLineResolverInterface {
public:
BasicSourceLineResolver();
virtual ~BasicSourceLineResolver();
// SourceLineResolverInterface methods, see source_line_resolver_interface.h
// for more details.
// Adds a module to this resolver, returning true on success.
// The given map_file is read into memory, and its symbols will be
// retained until the BasicSourceLineResolver is destroyed.
virtual bool LoadModule(const string &module_name, const string &map_file);
virtual bool HasModule(const string &module_name) const;
virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const;
private:
template<class T> class MemAddrMap;
struct Line;
struct Function;
struct PublicSymbol;
struct File;
struct HashString {
size_t operator()(const string &s) const;
};
class Module;
// All of the modules we've loaded
typedef hash_map<string, Module*, HashString> ModuleMap;
ModuleMap *modules_;
// Disallow unwanted copy ctor and assignment operator
BasicSourceLineResolver(const BasicSourceLineResolver&);
void operator=(const BasicSourceLineResolver&);
};
} // namespace google_airbag
#endif // GOOGLE_AIRBAG_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__

View File

@ -38,6 +38,7 @@ using std::string;
class Minidump; class Minidump;
class ProcessState; class ProcessState;
class SourceLineResolverInterface;
class SymbolSupplier; class SymbolSupplier;
class MinidumpProcessor { class MinidumpProcessor {
@ -51,7 +52,8 @@ class MinidumpProcessor {
// Initializes this MinidumpProcessor. supplier should be an // Initializes this MinidumpProcessor. supplier should be an
// implementation of the SymbolSupplier abstract base class. // implementation of the SymbolSupplier abstract base class.
explicit MinidumpProcessor(SymbolSupplier *supplier); MinidumpProcessor(SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
~MinidumpProcessor(); ~MinidumpProcessor();
// Processes the minidump file and fills process_state with the result. // Processes the minidump file and fills process_state with the result.
@ -84,6 +86,7 @@ class MinidumpProcessor {
private: private:
SymbolSupplier *supplier_; SymbolSupplier *supplier_;
SourceLineResolverInterface *resolver_;
}; };
} // namespace google_airbag } // namespace google_airbag

View File

@ -27,31 +27,26 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// SourceLineResolver returns function/file/line info for a memory address. // Abstract interface to return function/file/line info for a memory address.
// It uses address map files produced by a compatible writer, e.g.
// PDBSourceLineWriter.
#ifndef PROCESSOR_SOURCE_LINE_RESOLVER_H__ #ifndef GOOGLE_AIRBAG_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#define PROCESSOR_SOURCE_LINE_RESOLVER_H__ #define GOOGLE_AIRBAG_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#include <string> #include <string>
#include <ext/hash_map>
#include "google_airbag/common/airbag_types.h" #include "google_airbag/common/airbag_types.h"
namespace google_airbag { namespace google_airbag {
using std::string; using std::string;
using __gnu_cxx::hash_map;
struct StackFrame; struct StackFrame;
struct StackFrameInfo; struct StackFrameInfo;
class SourceLineResolver { class SourceLineResolverInterface {
public: public:
typedef u_int64_t MemAddr; typedef u_int64_t MemAddr;
SourceLineResolver(); virtual ~SourceLineResolverInterface() {}
~SourceLineResolver();
// Adds a module to this resolver, returning true on success. // Adds a module to this resolver, returning true on success.
// //
@ -59,10 +54,11 @@ class SourceLineResolver {
// filename of the module, optionally with version identifiers. // filename of the module, optionally with version identifiers.
// //
// map_file should contain line/address mappings for this module. // map_file should contain line/address mappings for this module.
bool LoadModule(const string &module_name, const string &map_file); virtual bool LoadModule(const string &module_name,
const string &map_file) = 0;
// Returns true if a module with the given name has been loaded. // Returns true if a module with the given name has been loaded.
bool HasModule(const string &module_name) const; virtual bool HasModule(const string &module_name) const = 0;
// Fills in the function_base, function_name, source_file_name, // Fills in the function_base, function_name, source_file_name,
// and source_line fields of the StackFrame. The instruction and // and source_line fields of the StackFrame. The instruction and
@ -71,28 +67,13 @@ class SourceLineResolver {
// available, returns NULL. A NULL return value does not indicate an // available, returns NULL. A NULL return value does not indicate an
// error. The caller takes ownership of any returned StackFrameInfo // error. The caller takes ownership of any returned StackFrameInfo
// object. // object.
StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const; virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const = 0;
private: protected:
template<class T> class MemAddrMap; // SourceLineResolverInterface cannot be instantiated except by subclasses
struct Line; SourceLineResolverInterface() {}
struct Function;
struct PublicSymbol;
struct File;
struct HashString {
size_t operator()(const string &s) const;
};
class Module;
// All of the modules we've loaded
typedef hash_map<string, Module*, HashString> ModuleMap;
ModuleMap *modules_;
// Disallow unwanted copy ctor and assignment operator
SourceLineResolver(const SourceLineResolver&);
void operator=(const SourceLineResolver&);
}; };
} // namespace google_airbag } // namespace google_airbag
#endif // PROCESSOR_SOURCE_LINE_RESOLVER_H__ #endif // GOOGLE_AIRBAG_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__

View File

@ -50,6 +50,7 @@ class CodeModules;
template<typename T> class linked_ptr; template<typename T> class linked_ptr;
class MemoryRegion; class MemoryRegion;
class MinidumpContext; class MinidumpContext;
class SourceLineResolverInterface;
struct StackFrame; struct StackFrame;
struct StackFrameInfo; struct StackFrameInfo;
class SymbolSupplier; class SymbolSupplier;
@ -73,7 +74,8 @@ class Stackwalker {
static Stackwalker* StackwalkerForCPU(MinidumpContext *context, static Stackwalker* StackwalkerForCPU(MinidumpContext *context,
MemoryRegion *memory, MemoryRegion *memory,
const CodeModules *modules, const CodeModules *modules,
SymbolSupplier *supplier); SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
protected: protected:
// memory identifies a MemoryRegion that provides the stack memory // memory identifies a MemoryRegion that provides the stack memory
@ -81,10 +83,13 @@ class Stackwalker {
// object that is used to look up which code module each stack frame is // object that is used to look up which code module each stack frame is
// associated with. supplier is an optional caller-supplied SymbolSupplier // associated with. supplier is an optional caller-supplied SymbolSupplier
// implementation. If supplier is NULL, source line info will not be // implementation. If supplier is NULL, source line info will not be
// resolved. // resolved. resolver is an instance of SourceLineResolverInterface
// (see source_line_resolver_interface.h and basic_source_line_resolver.h).
// If resolver is NULL, source line info will not be resolved.
Stackwalker(MemoryRegion *memory, Stackwalker(MemoryRegion *memory,
const CodeModules *modules, const CodeModules *modules,
SymbolSupplier *supplier); SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
// The stack memory to walk. Subclasses will require this region to // The stack memory to walk. Subclasses will require this region to
// get information from the stack. // get information from the stack.
@ -115,6 +120,9 @@ class Stackwalker {
// The optional SymbolSupplier for resolving source line info. // The optional SymbolSupplier for resolving source line info.
SymbolSupplier *supplier_; SymbolSupplier *supplier_;
// The SourceLineResolver implementation
SourceLineResolverInterface *resolver_;
}; };

View File

@ -38,7 +38,7 @@
#include "processor/contained_range_map-inl.h" #include "processor/contained_range_map-inl.h"
#include "processor/range_map-inl.h" #include "processor/range_map-inl.h"
#include "processor/source_line_resolver.h" #include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/code_module.h" #include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/stack_frame.h" #include "google_airbag/processor/stack_frame.h"
#include "processor/linked_ptr.h" #include "processor/linked_ptr.h"
@ -52,7 +52,7 @@ using __gnu_cxx::hash;
namespace google_airbag { namespace google_airbag {
struct SourceLineResolver::Line { struct BasicSourceLineResolver::Line {
Line(MemAddr addr, MemAddr code_size, int file_id, int source_line) Line(MemAddr addr, MemAddr code_size, int file_id, int source_line)
: address(addr) : address(addr)
, size(code_size) , size(code_size)
@ -65,7 +65,7 @@ struct SourceLineResolver::Line {
int line; int line;
}; };
struct SourceLineResolver::Function { struct BasicSourceLineResolver::Function {
Function(const string &function_name, Function(const string &function_name,
MemAddr function_address, MemAddr function_address,
MemAddr code_size, MemAddr code_size,
@ -83,7 +83,7 @@ struct SourceLineResolver::Function {
RangeMap< MemAddr, linked_ptr<Line> > lines; RangeMap< MemAddr, linked_ptr<Line> > lines;
}; };
struct SourceLineResolver::PublicSymbol { struct BasicSourceLineResolver::PublicSymbol {
PublicSymbol(const string& set_name, PublicSymbol(const string& set_name,
MemAddr set_address, MemAddr set_address,
int set_parameter_size) int set_parameter_size)
@ -100,7 +100,7 @@ struct SourceLineResolver::PublicSymbol {
int parameter_size; int parameter_size;
}; };
class SourceLineResolver::Module { class BasicSourceLineResolver::Module {
public: public:
Module(const string &name) : name_(name) { } Module(const string &name) : name_(name) { }
@ -115,7 +115,7 @@ class SourceLineResolver::Module {
StackFrameInfo* LookupAddress(StackFrame *frame) const; StackFrameInfo* LookupAddress(StackFrame *frame) const;
private: private:
friend class SourceLineResolver; friend class BasicSourceLineResolver;
typedef hash_map<int, string> FileMap; typedef hash_map<int, string> FileMap;
// The types for stack_info_. This is equivalent to MS DIA's // The types for stack_info_. This is equivalent to MS DIA's
@ -173,10 +173,10 @@ class SourceLineResolver::Module {
stack_info_[STACK_INFO_LAST]; stack_info_[STACK_INFO_LAST];
}; };
SourceLineResolver::SourceLineResolver() : modules_(new ModuleMap) { BasicSourceLineResolver::BasicSourceLineResolver() : modules_(new ModuleMap) {
} }
SourceLineResolver::~SourceLineResolver() { BasicSourceLineResolver::~BasicSourceLineResolver() {
ModuleMap::iterator it; ModuleMap::iterator it;
for (it = modules_->begin(); it != modules_->end(); ++it) { for (it = modules_->begin(); it != modules_->end(); ++it) {
delete it->second; delete it->second;
@ -184,8 +184,8 @@ SourceLineResolver::~SourceLineResolver() {
delete modules_; delete modules_;
} }
bool SourceLineResolver::LoadModule(const string &module_name, bool BasicSourceLineResolver::LoadModule(const string &module_name,
const string &map_file) { const string &map_file) {
// Make sure we don't already have a module with the given name. // Make sure we don't already have a module with the given name.
if (modules_->find(module_name) != modules_->end()) { if (modules_->find(module_name) != modules_->end()) {
return false; return false;
@ -201,11 +201,11 @@ bool SourceLineResolver::LoadModule(const string &module_name,
return true; return true;
} }
bool SourceLineResolver::HasModule(const string &module_name) const { bool BasicSourceLineResolver::HasModule(const string &module_name) const {
return modules_->find(module_name) != modules_->end(); return modules_->find(module_name) != modules_->end();
} }
StackFrameInfo* SourceLineResolver::FillSourceLineInfo( StackFrameInfo* BasicSourceLineResolver::FillSourceLineInfo(
StackFrame *frame) const { StackFrame *frame) const {
if (frame->module) { if (frame->module) {
ModuleMap::const_iterator it = modules_->find(frame->module->code_file()); ModuleMap::const_iterator it = modules_->find(frame->module->code_file());
@ -216,7 +216,7 @@ StackFrameInfo* SourceLineResolver::FillSourceLineInfo(
return NULL; return NULL;
} }
bool SourceLineResolver::Module::LoadMap(const string &map_file) { bool BasicSourceLineResolver::Module::LoadMap(const string &map_file) {
FILE *f = fopen(map_file.c_str(), "r"); FILE *f = fopen(map_file.c_str(), "r");
if (!f) { if (!f) {
return false; return false;
@ -252,8 +252,8 @@ bool SourceLineResolver::Module::LoadMap(const string &map_file) {
return false; return false;
} }
} else if (strncmp(buffer, "MODULE ", 7) == 0) { } else if (strncmp(buffer, "MODULE ", 7) == 0) {
// Ignore these. They're not of any use to SourceLineResolver, which // Ignore these. They're not of any use to BasicSourceLineResolver,
// is fed modules by a SymbolSupplier. These lines are present to // which is fed modules by a SymbolSupplier. These lines are present to
// aid other tools in properly placing symbol files so that they can // aid other tools in properly placing symbol files so that they can
// be accessed by a SymbolSupplier. // be accessed by a SymbolSupplier.
// //
@ -275,8 +275,8 @@ bool SourceLineResolver::Module::LoadMap(const string &map_file) {
return true; return true;
} }
StackFrameInfo* SourceLineResolver::Module::LookupAddress(StackFrame *frame) StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress(
const { StackFrame *frame) const {
MemAddr address = frame->instruction - frame->module->base_address(); MemAddr address = frame->instruction - frame->module->base_address();
linked_ptr<StackFrameInfo> retrieved_info; linked_ptr<StackFrameInfo> retrieved_info;
@ -360,8 +360,8 @@ StackFrameInfo* SourceLineResolver::Module::LookupAddress(StackFrame *frame)
} }
// static // static
bool SourceLineResolver::Module::Tokenize(char *line, int max_tokens, bool BasicSourceLineResolver::Module::Tokenize(char *line, int max_tokens,
vector<char*> *tokens) { vector<char*> *tokens) {
tokens->clear(); tokens->clear();
tokens->reserve(max_tokens); tokens->reserve(max_tokens);
@ -387,7 +387,7 @@ bool SourceLineResolver::Module::Tokenize(char *line, int max_tokens,
return tokens->size() == static_cast<unsigned int>(max_tokens); return tokens->size() == static_cast<unsigned int>(max_tokens);
} }
void SourceLineResolver::Module::ParseFile(char *file_line) { void BasicSourceLineResolver::Module::ParseFile(char *file_line) {
// FILE <id> <filename> // FILE <id> <filename>
file_line += 5; // skip prefix file_line += 5; // skip prefix
@ -407,8 +407,8 @@ void SourceLineResolver::Module::ParseFile(char *file_line) {
} }
} }
SourceLineResolver::Function* SourceLineResolver::Module::ParseFunction( BasicSourceLineResolver::Function*
char *function_line) { BasicSourceLineResolver::Module::ParseFunction(char *function_line) {
// FUNC <address> <size> <stack_param_size> <name> // FUNC <address> <size> <stack_param_size> <name>
function_line += 5; // skip prefix function_line += 5; // skip prefix
@ -425,7 +425,7 @@ SourceLineResolver::Function* SourceLineResolver::Module::ParseFunction(
return new Function(name, address, size, stack_param_size); return new Function(name, address, size, stack_param_size);
} }
SourceLineResolver::Line* SourceLineResolver::Module::ParseLine( BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine(
char *line_line) { char *line_line) {
// <address> <line number> <source file id> // <address> <line number> <source file id>
vector<char*> tokens; vector<char*> tokens;
@ -444,7 +444,7 @@ SourceLineResolver::Line* SourceLineResolver::Module::ParseLine(
return new Line(address, size, source_file, line_number); return new Line(address, size, source_file, line_number);
} }
bool SourceLineResolver::Module::ParsePublicSymbol(char *public_line) { bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) {
// PUBLIC <address> <stack_param_size> <name> // PUBLIC <address> <stack_param_size> <name>
// Skip "PUBLIC " prefix. // Skip "PUBLIC " prefix.
@ -474,7 +474,7 @@ bool SourceLineResolver::Module::ParsePublicSymbol(char *public_line) {
return public_symbols_.Store(address, symbol); return public_symbols_.Store(address, symbol);
} }
bool SourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) {
// STACK WIN <type> <rva> <code_size> <prolog_size> <epliog_size> // STACK WIN <type> <rva> <code_size> <prolog_size> <epliog_size>
// <parameter_size> <saved_register_size> <local_size> <max_stack_size> // <parameter_size> <saved_register_size> <local_size> <max_stack_size>
// <has_program_string> <program_string_OR_allocates_base_pointer> // <has_program_string> <program_string_OR_allocates_base_pointer>
@ -554,7 +554,7 @@ bool SourceLineResolver::Module::ParseStackInfo(char *stack_info_line) {
return true; return true;
} }
size_t SourceLineResolver::HashString::operator()(const string &s) const { size_t BasicSourceLineResolver::HashString::operator()(const string &s) const {
return hash<const char*>()(s.c_str()); return hash<const char*>()(s.c_str());
} }

View File

@ -29,7 +29,7 @@
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include "processor/source_line_resolver.h" #include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/code_module.h" #include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/stack_frame.h" #include "google_airbag/processor/stack_frame.h"
#include "processor/linked_ptr.h" #include "processor/linked_ptr.h"
@ -49,10 +49,10 @@
namespace { namespace {
using std::string; using std::string;
using google_airbag::BasicSourceLineResolver;
using google_airbag::CodeModule; using google_airbag::CodeModule;
using google_airbag::linked_ptr; using google_airbag::linked_ptr;
using google_airbag::scoped_ptr; using google_airbag::scoped_ptr;
using google_airbag::SourceLineResolver;
using google_airbag::StackFrame; using google_airbag::StackFrame;
using google_airbag::StackFrameInfo; using google_airbag::StackFrameInfo;
@ -94,7 +94,7 @@ static bool RunTests() {
string testdata_dir = string(getenv("srcdir") ? getenv("srcdir") : ".") + string testdata_dir = string(getenv("srcdir") ? getenv("srcdir") : ".") +
"/src/processor/testdata"; "/src/processor/testdata";
SourceLineResolver resolver; BasicSourceLineResolver resolver;
ASSERT_TRUE(resolver.LoadModule("module1", testdata_dir + "/module1.out")); ASSERT_TRUE(resolver.LoadModule("module1", testdata_dir + "/module1.out"));
ASSERT_TRUE(resolver.HasModule("module1")); ASSERT_TRUE(resolver.HasModule("module1"));
ASSERT_TRUE(resolver.LoadModule("module2", testdata_dir + "/module2.out")); ASSERT_TRUE(resolver.LoadModule("module2", testdata_dir + "/module2.out"));

View File

@ -38,8 +38,9 @@
namespace google_airbag { namespace google_airbag {
MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier) MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier,
: supplier_(supplier) { SourceLineResolverInterface *resolver)
: supplier_(supplier), resolver_(resolver) {
} }
MinidumpProcessor::~MinidumpProcessor() { MinidumpProcessor::~MinidumpProcessor() {
@ -164,7 +165,8 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
Stackwalker::StackwalkerForCPU(context, Stackwalker::StackwalkerForCPU(context,
thread_memory, thread_memory,
process_state->modules_, process_state->modules_,
supplier_)); supplier_,
resolver_));
if (!stackwalker.get()) { if (!stackwalker.get()) {
return PROCESS_ERROR; return PROCESS_ERROR;
} }

View File

@ -31,6 +31,7 @@
// corresponding symbol file, and checks the stack frames for correctness. // corresponding symbol file, and checks the stack frames for correctness.
#include <string> #include <string>
#include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/call_stack.h" #include "google_airbag/processor/call_stack.h"
#include "google_airbag/processor/code_module.h" #include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h" #include "google_airbag/processor/code_modules.h"
@ -43,6 +44,7 @@
namespace { namespace {
using std::string; using std::string;
using google_airbag::BasicSourceLineResolver;
using google_airbag::CallStack; using google_airbag::CallStack;
using google_airbag::CodeModule; using google_airbag::CodeModule;
using google_airbag::MinidumpProcessor; using google_airbag::MinidumpProcessor;
@ -93,7 +95,8 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile(
static bool RunTests() { static bool RunTests() {
TestSymbolSupplier supplier; TestSymbolSupplier supplier;
MinidumpProcessor processor(&supplier); BasicSourceLineResolver resolver;
MinidumpProcessor processor(&supplier, &resolver);
string minidump_file = string(getenv("srcdir") ? getenv("srcdir") : ".") + string minidump_file = string(getenv("srcdir") ? getenv("srcdir") : ".") +
"/src/processor/testdata/minidump2.dmp"; "/src/processor/testdata/minidump2.dmp";

View File

@ -36,6 +36,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/call_stack.h" #include "google_airbag/processor/call_stack.h"
#include "google_airbag/processor/code_module.h" #include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h" #include "google_airbag/processor/code_modules.h"
@ -50,6 +51,7 @@
namespace { namespace {
using std::string; using std::string;
using google_airbag::BasicSourceLineResolver;
using google_airbag::CallStack; using google_airbag::CallStack;
using google_airbag::CodeModule; using google_airbag::CodeModule;
using google_airbag::CodeModules; using google_airbag::CodeModules;
@ -192,7 +194,8 @@ static bool PrintMinidumpProcess(const string &minidump_file,
symbol_supplier.reset(new SimpleSymbolSupplier(symbol_path)); symbol_supplier.reset(new SimpleSymbolSupplier(symbol_path));
} }
MinidumpProcessor minidump_processor(symbol_supplier.get()); BasicSourceLineResolver resolver;
MinidumpProcessor minidump_processor(symbol_supplier.get(), &resolver);
// Process the minidump. // Process the minidump.
ProcessState process_state; ProcessState process_state;

View File

@ -41,11 +41,11 @@
#include "google_airbag/processor/code_module.h" #include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h" #include "google_airbag/processor/code_modules.h"
#include "google_airbag/processor/minidump.h" #include "google_airbag/processor/minidump.h"
#include "google_airbag/processor/source_line_resolver_interface.h"
#include "google_airbag/processor/stack_frame.h" #include "google_airbag/processor/stack_frame.h"
#include "google_airbag/processor/symbol_supplier.h" #include "google_airbag/processor/symbol_supplier.h"
#include "processor/linked_ptr.h" #include "processor/linked_ptr.h"
#include "processor/scoped_ptr.h" #include "processor/scoped_ptr.h"
#include "processor/source_line_resolver.h"
#include "processor/stack_frame_info.h" #include "processor/stack_frame_info.h"
#include "processor/stackwalker_ppc.h" #include "processor/stackwalker_ppc.h"
#include "processor/stackwalker_x86.h" #include "processor/stackwalker_x86.h"
@ -54,14 +54,17 @@ namespace google_airbag {
Stackwalker::Stackwalker(MemoryRegion *memory, const CodeModules *modules, Stackwalker::Stackwalker(MemoryRegion *memory, const CodeModules *modules,
SymbolSupplier *supplier) SymbolSupplier *supplier,
: memory_(memory), modules_(modules), supplier_(supplier) { SourceLineResolverInterface *resolver)
: memory_(memory),
modules_(modules),
supplier_(supplier),
resolver_(resolver) {
} }
bool Stackwalker::Walk(CallStack *stack) { bool Stackwalker::Walk(CallStack *stack) {
assert(stack); assert(stack);
SourceLineResolver resolver;
stack->Clear(); stack->Clear();
// stack_frame_info parallels the CallStack. The vector is passed to the // stack_frame_info parallels the CallStack. The vector is passed to the
@ -88,14 +91,16 @@ bool Stackwalker::Walk(CallStack *stack) {
modules_->GetModuleForAddress(frame->instruction); modules_->GetModuleForAddress(frame->instruction);
if (module) { if (module) {
frame->module = module; frame->module = module;
if (!resolver.HasModule(frame->module->code_file()) && supplier_) { if (resolver_ &&
!resolver_->HasModule(frame->module->code_file()) &&
supplier_) {
string symbol_file; string symbol_file;
SymbolSupplier::SymbolResult symbol_result = SymbolSupplier::SymbolResult symbol_result =
supplier_->GetSymbolFile(module, &symbol_file); supplier_->GetSymbolFile(module, &symbol_file);
switch (symbol_result) { switch (symbol_result) {
case SymbolSupplier::FOUND: case SymbolSupplier::FOUND:
resolver.LoadModule(frame->module->code_file(), symbol_file); resolver_->LoadModule(frame->module->code_file(), symbol_file);
break; break;
case SymbolSupplier::NOT_FOUND: case SymbolSupplier::NOT_FOUND:
break; // nothing to do break; // nothing to do
@ -103,7 +108,7 @@ bool Stackwalker::Walk(CallStack *stack) {
return false; return false;
} }
} }
frame_info.reset(resolver.FillSourceLineInfo(frame.get())); frame_info.reset(resolver_->FillSourceLineInfo(frame.get()));
} }
} }
@ -124,22 +129,26 @@ bool Stackwalker::Walk(CallStack *stack) {
// static // static
Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context, Stackwalker* Stackwalker::StackwalkerForCPU(
MemoryRegion *memory, MinidumpContext *context,
const CodeModules *modules, MemoryRegion *memory,
SymbolSupplier *supplier) { const CodeModules *modules,
SymbolSupplier *supplier,
SourceLineResolverInterface *resolver) {
Stackwalker *cpu_stackwalker = NULL; Stackwalker *cpu_stackwalker = NULL;
u_int32_t cpu = context->GetContextCPU(); u_int32_t cpu = context->GetContextCPU();
switch (cpu) { switch (cpu) {
case MD_CONTEXT_X86: case MD_CONTEXT_X86:
cpu_stackwalker = new StackwalkerX86(context->GetContextX86(), cpu_stackwalker = new StackwalkerX86(context->GetContextX86(),
memory, modules, supplier); memory, modules, supplier,
resolver);
break; break;
case MD_CONTEXT_PPC: case MD_CONTEXT_PPC:
cpu_stackwalker = new StackwalkerPPC(context->GetContextPPC(), cpu_stackwalker = new StackwalkerPPC(context->GetContextPPC(),
memory, modules, supplier); memory, modules, supplier,
resolver);
break; break;
} }

View File

@ -45,8 +45,9 @@ namespace google_airbag {
StackwalkerPPC::StackwalkerPPC(const MDRawContextPPC *context, StackwalkerPPC::StackwalkerPPC(const MDRawContextPPC *context,
MemoryRegion *memory, MemoryRegion *memory,
const CodeModules *modules, const CodeModules *modules,
SymbolSupplier *supplier) SymbolSupplier *supplier,
: Stackwalker(memory, modules, supplier), SourceLineResolverInterface *resolver)
: Stackwalker(memory, modules, supplier, resolver),
context_(context) { context_(context) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) { if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// This implementation only covers 32-bit ppc CPUs. The limits of the // This implementation only covers 32-bit ppc CPUs. The limits of the

View File

@ -56,7 +56,8 @@ class StackwalkerPPC : public Stackwalker {
StackwalkerPPC(const MDRawContextPPC *context, StackwalkerPPC(const MDRawContextPPC *context,
MemoryRegion *memory, MemoryRegion *memory,
const CodeModules *modules, const CodeModules *modules,
SymbolSupplier *supplier); SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
private: private:
// Implementation of Stackwalker, using ppc context (stack pointer in %r1, // Implementation of Stackwalker, using ppc context (stack pointer in %r1,

View File

@ -217,6 +217,7 @@ static u_int32_t GetPC() {
static unsigned int CountCallerFrames() __attribute__((noinline)); static unsigned int CountCallerFrames() __attribute__((noinline));
static unsigned int CountCallerFrames() { static unsigned int CountCallerFrames() {
SelfMemoryRegion memory; SelfMemoryRegion memory;
BasicSourceLineResolver resolver;
#if defined(__i386__) #if defined(__i386__)
MDRawContextX86 context = MDRawContextX86(); MDRawContextX86 context = MDRawContextX86();
@ -224,13 +225,15 @@ static unsigned int CountCallerFrames() {
context.ebp = GetEBP(); context.ebp = GetEBP();
context.esp = GetESP(); context.esp = GetESP();
StackwalkerX86 stackwalker = StackwalkerX86(&context, &memory, NULL, NULL); StackwalkerX86 stackwalker = StackwalkerX86(&context, &memory, NULL, NULL,
&resolver);
#elif defined(__ppc__) #elif defined(__ppc__)
MDRawContextPPC context = MDRawContextPPC(); MDRawContextPPC context = MDRawContextPPC();
context.srr0 = GetPC(); context.srr0 = GetPC();
context.gpr[1] = GetSP(); context.gpr[1] = GetSP();
StackwalkerPPC stackwalker = StackwalkerPPC(&context, &memory, NULL, NULL); StackwalkerPPC stackwalker = StackwalkerPPC(&context, &memory, NULL, NULL,
&resolver);
#endif // __i386__ || __ppc__ #endif // __i386__ || __ppc__
scoped_ptr<CallStack> stack(stackwalker.Walk()); scoped_ptr<CallStack> stack(stackwalker.Walk());

View File

@ -49,8 +49,9 @@ namespace google_airbag {
StackwalkerX86::StackwalkerX86(const MDRawContextX86 *context, StackwalkerX86::StackwalkerX86(const MDRawContextX86 *context,
MemoryRegion *memory, MemoryRegion *memory,
const CodeModules *modules, const CodeModules *modules,
SymbolSupplier *supplier) SymbolSupplier *supplier,
: Stackwalker(memory, modules, supplier), SourceLineResolverInterface *resolver)
: Stackwalker(memory, modules, supplier, resolver),
context_(context) { context_(context) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) { if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// The x86 is a 32-bit CPU, the limits of the supplied stack are invalid. // The x86 is a 32-bit CPU, the limits of the supplied stack are invalid.

View File

@ -57,7 +57,8 @@ class StackwalkerX86 : public Stackwalker {
StackwalkerX86(const MDRawContextX86 *context, StackwalkerX86(const MDRawContextX86 *context,
MemoryRegion *memory, MemoryRegion *memory,
const CodeModules *modules, const CodeModules *modules,
SymbolSupplier *supplier); SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
private: private:
// Implementation of Stackwalker, using x86 context (%ebp, %esp, %eip) and // Implementation of Stackwalker, using x86 context (%ebp, %esp, %eip) and