aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am28
-rw-r--r--Makefile.in97
-rw-r--r--src/common/windows/pdb_source_line_writer.h2
-rw-r--r--src/google_airbag/processor/basic_source_line_resolver.h84
-rw-r--r--src/google_airbag/processor/minidump_processor.h5
-rw-r--r--src/google_airbag/processor/source_line_resolver_interface.h (renamed from src/processor/source_line_resolver.h)45
-rw-r--r--src/google_airbag/processor/stackwalker.h14
-rw-r--r--src/processor/basic_source_line_resolver.cc (renamed from src/processor/source_line_resolver.cc)52
-rw-r--r--src/processor/basic_source_line_resolver_unittest.cc (renamed from src/processor/source_line_resolver_unittest.cc)6
-rw-r--r--src/processor/minidump_processor.cc8
-rw-r--r--src/processor/minidump_processor_unittest.cc5
-rw-r--r--src/processor/minidump_stackwalk.cc5
-rw-r--r--src/processor/stackwalker.cc35
-rw-r--r--src/processor/stackwalker_ppc.cc5
-rw-r--r--src/processor/stackwalker_ppc.h3
-rw-r--r--src/processor/stackwalker_selftest.cc7
-rw-r--r--src/processor/stackwalker_x86.cc5
-rw-r--r--src/processor/stackwalker_x86.h3
18 files changed, 252 insertions, 157 deletions
diff --git a/Makefile.am b/Makefile.am
index 6f1ca84e..ff45f10a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,6 +52,7 @@ lib_LTLIBRARIES = src/libairbag.la
src_libairbag_la_SOURCES = \
src/google_airbag/common/airbag_types.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/code_module.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_modules.cc \
src/processor/basic_code_modules.h \
+ src/processor/basic_source_line_resolver.cc \
src/processor/call_stack.cc \
src/processor/contained_range_map.h \
src/processor/contained_range_map-inl.h \
@@ -84,8 +86,6 @@ src_libairbag_la_SOURCES = \
src/processor/scoped_ptr.h \
src/processor/simple_symbol_supplier.cc \
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/stackwalker.cc \
src/processor/stackwalker_ppc.cc \
@@ -103,12 +103,12 @@ bin_PROGRAMS = \
## Tests
check_PROGRAMS = \
src/processor/address_map_unittest \
+ src/processor/basic_source_line_resolver_unittest \
src/processor/contained_range_map_unittest \
src/processor/minidump_processor_unittest \
src/processor/pathname_stripper_unittest \
src/processor/postfix_evaluator_unittest \
- src/processor/range_map_unittest \
- src/processor/source_line_resolver_unittest
+ src/processor/range_map_unittest
if SELFTEST
check_PROGRAMS += \
@@ -125,6 +125,11 @@ TESTS_ENVIRONMENT =
src_processor_address_map_unittest_SOURCES = \
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.cc
@@ -132,14 +137,14 @@ src_processor_minidump_processor_unittest_SOURCES = \
src/processor/minidump_processor_unittest.cc
src_processor_minidump_processor_unittest_LDADD = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \
src/processor/minidump_processor.lo \
src/processor/minidump.lo \
src/processor/process_state.lo \
src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \
- src/processor/stackwalker_x86.lo \
- src/processor/source_line_resolver.lo
+ src/processor/stackwalker_x86.lo
src_processor_pathname_stripper_unittest_SOURCES = \
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.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.cc
src_processor_stackwalker_selftest_LDADD = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.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_x86.lo
@@ -182,6 +182,7 @@ src_processor_minidump_stackwalk_SOURCES = \
src/processor/minidump_stackwalk.cc
src_processor_minidump_stackwalk_LDADD = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \
src/processor/minidump.lo \
src/processor/minidump_processor.lo \
@@ -190,8 +191,7 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/simple_symbol_supplier.lo \
src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \
- src/processor/stackwalker_x86.lo \
- src/processor/source_line_resolver.lo
+ src/processor/stackwalker_x86.lo
## Additional files to be included in a source distribution
diff --git a/Makefile.in b/Makefile.in
index 10d7108a..5ffd7550 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -71,13 +71,12 @@ host_triplet = @host@
bin_PROGRAMS = src/processor/minidump_dump$(EXEEXT) \
src/processor/minidump_stackwalk$(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/minidump_processor_unittest$(EXEEXT) \
src/processor/pathname_stripper_unittest$(EXEEXT) \
src/processor/postfix_evaluator_unittest$(EXEEXT) \
- src/processor/range_map_unittest$(EXEEXT) \
- src/processor/source_line_resolver_unittest$(EXEEXT) \
- $(am__EXEEXT_1)
+ src/processor/range_map_unittest$(EXEEXT) $(am__EXEEXT_1)
@SELFTEST_TRUE@am__append_1 = \
@SELFTEST_TRUE@ src/processor/stackwalker_selftest
@@ -111,12 +110,12 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
src_libairbag_la_LIBADD =
am__dirstamp = $(am__leading_dot)dirstamp
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/minidump_processor.lo \
src/processor/pathname_stripper.lo \
src/processor/process_state.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_x86.lo
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 = \
$(am_src_processor_address_map_unittest_OBJECTS)
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 = \
src/processor/contained_range_map_unittest.$(OBJEXT)
src_processor_contained_range_map_unittest_OBJECTS = \
@@ -146,26 +150,26 @@ src_processor_minidump_processor_unittest_OBJECTS = \
$(am_src_processor_minidump_processor_unittest_OBJECTS)
src_processor_minidump_processor_unittest_DEPENDENCIES = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \
src/processor/minidump_processor.lo src/processor/minidump.lo \
src/processor/process_state.lo src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \
- src/processor/stackwalker_x86.lo \
- src/processor/source_line_resolver.lo
+ src/processor/stackwalker_x86.lo
am_src_processor_minidump_stackwalk_OBJECTS = \
src/processor/minidump_stackwalk.$(OBJEXT)
src_processor_minidump_stackwalk_OBJECTS = \
$(am_src_processor_minidump_stackwalk_OBJECTS)
src_processor_minidump_stackwalk_DEPENDENCIES = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo src/processor/minidump.lo \
src/processor/minidump_processor.lo \
src/processor/pathname_stripper.lo \
src/processor/process_state.lo \
src/processor/simple_symbol_supplier.lo \
src/processor/stackwalker.lo src/processor/stackwalker_ppc.lo \
- src/processor/stackwalker_x86.lo \
- src/processor/source_line_resolver.lo
+ src/processor/stackwalker_x86.lo
am_src_processor_pathname_stripper_unittest_OBJECTS = \
src/processor/pathname_stripper_unittest.$(OBJEXT)
src_processor_pathname_stripper_unittest_OBJECTS = \
@@ -182,20 +186,14 @@ am_src_processor_range_map_unittest_OBJECTS = \
src_processor_range_map_unittest_OBJECTS = \
$(am_src_processor_range_map_unittest_OBJECTS)
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 = \
src/processor/stackwalker_selftest.$(OBJEXT)
src_processor_stackwalker_selftest_OBJECTS = \
$(am_src_processor_stackwalker_selftest_OBJECTS)
src_processor_stackwalker_selftest_DEPENDENCIES = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.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_x86.lo
SCRIPTS = $(noinst_SCRIPTS)
@@ -220,6 +218,7 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_address_map_unittest_SOURCES) \
+ $(src_processor_basic_source_line_resolver_unittest_SOURCES) \
$(src_processor_contained_range_map_unittest_SOURCES) \
$(src_processor_minidump_dump_SOURCES) \
$(src_processor_minidump_processor_unittest_SOURCES) \
@@ -227,10 +226,10 @@ SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_pathname_stripper_unittest_SOURCES) \
$(src_processor_postfix_evaluator_unittest_SOURCES) \
$(src_processor_range_map_unittest_SOURCES) \
- $(src_processor_source_line_resolver_unittest_SOURCES) \
$(src_processor_stackwalker_selftest_SOURCES)
DIST_SOURCES = $(src_libairbag_la_SOURCES) \
$(src_processor_address_map_unittest_SOURCES) \
+ $(src_processor_basic_source_line_resolver_unittest_SOURCES) \
$(src_processor_contained_range_map_unittest_SOURCES) \
$(src_processor_minidump_dump_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_postfix_evaluator_unittest_SOURCES) \
$(src_processor_range_map_unittest_SOURCES) \
- $(src_processor_source_line_resolver_unittest_SOURCES) \
$(src_processor_stackwalker_selftest_SOURCES)
dist_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_doc_DATA)
@@ -284,7 +282,6 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
-GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -312,9 +309,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
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_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -331,30 +331,23 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
-dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
-htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
-localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
-psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
@@ -362,6 +355,7 @@ target_alias = @target_alias@
# This allows #includes to be relative to src/
AM_CPPFLAGS = -I$(top_srcdir)/src
+docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
dist_doc_DATA = \
AUTHORS \
COPYING \
@@ -374,6 +368,7 @@ lib_LTLIBRARIES = src/libairbag.la
src_libairbag_la_SOURCES = \
src/google_airbag/common/airbag_types.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/code_module.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_modules.cc \
src/processor/basic_code_modules.h \
+ src/processor/basic_source_line_resolver.cc \
src/processor/call_stack.cc \
src/processor/contained_range_map.h \
src/processor/contained_range_map-inl.h \
@@ -406,8 +402,6 @@ src_libairbag_la_SOURCES = \
src/processor/scoped_ptr.h \
src/processor/simple_symbol_supplier.cc \
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/stackwalker.cc \
src/processor/stackwalker_ppc.cc \
@@ -424,6 +418,12 @@ TESTS_ENVIRONMENT =
src_processor_address_map_unittest_SOURCES = \
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.cc
@@ -432,14 +432,14 @@ src_processor_minidump_processor_unittest_SOURCES = \
src_processor_minidump_processor_unittest_LDADD = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \
src/processor/minidump_processor.lo \
src/processor/minidump.lo \
src/processor/process_state.lo \
src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \
- src/processor/stackwalker_x86.lo \
- src/processor/source_line_resolver.lo
+ src/processor/stackwalker_x86.lo
src_processor_pathname_stripper_unittest_SOURCES = \
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.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.cc
src_processor_stackwalker_selftest_LDADD = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.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_x86.lo
@@ -484,6 +478,7 @@ src_processor_minidump_stackwalk_SOURCES = \
src_processor_minidump_stackwalk_LDADD = \
src/processor/basic_code_modules.lo \
+ src/processor/basic_source_line_resolver.lo \
src/processor/call_stack.lo \
src/processor/minidump.lo \
src/processor/minidump_processor.lo \
@@ -492,8 +487,7 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/simple_symbol_supplier.lo \
src/processor/stackwalker.lo \
src/processor/stackwalker_ppc.lo \
- src/processor/stackwalker_x86.lo \
- src/processor/source_line_resolver.lo
+ src/processor/stackwalker_x86.lo
EXTRA_DIST = \
$(SCRIPTS) \
@@ -620,6 +614,9 @@ src/processor/$(DEPDIR)/$(am__dirstamp):
@: > src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/basic_code_modules.lo: src/processor/$(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/$(DEPDIR)/$(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/$(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/$(DEPDIR)/$(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)
@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)
+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/$(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)
@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)
-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/$(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/basic_code_modules.$(OBJEXT)
-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.lo
-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/simple_symbol_supplier.$(OBJEXT)
-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.lo
-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)/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)/contained_range_map_unittest.Po@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)/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)/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_ppc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_selftest.Po@am__quote@
diff --git a/src/common/windows/pdb_source_line_writer.h b/src/common/windows/pdb_source_line_writer.h
index a2818263..58c8f5e0 100644
--- a/src/common/windows/pdb_source_line_writer.h
+++ b/src/common/windows/pdb_source_line_writer.h
@@ -28,7 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 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__
#define _PDB_SOURCE_LINE_WRITER_H__
diff --git a/src/google_airbag/processor/basic_source_line_resolver.h b/src/google_airbag/processor/basic_source_line_resolver.h
new file mode 100644
index 00000000..c688191a
--- /dev/null
+++ b/src/google_airbag/processor/basic_source_line_resolver.h
@@ -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__
diff --git a/src/google_airbag/processor/minidump_processor.h b/src/google_airbag/processor/minidump_processor.h
index 604eae45..a50d8a79 100644
--- a/src/google_airbag/processor/minidump_processor.h
+++ b/src/google_airbag/processor/minidump_processor.h
@@ -38,6 +38,7 @@ using std::string;
class Minidump;
class ProcessState;
+class SourceLineResolverInterface;
class SymbolSupplier;
class MinidumpProcessor {
@@ -51,7 +52,8 @@ class MinidumpProcessor {
// Initializes this MinidumpProcessor. supplier should be an
// implementation of the SymbolSupplier abstract base class.
- explicit MinidumpProcessor(SymbolSupplier *supplier);
+ MinidumpProcessor(SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver);
~MinidumpProcessor();
// Processes the minidump file and fills process_state with the result.
@@ -84,6 +86,7 @@ class MinidumpProcessor {
private:
SymbolSupplier *supplier_;
+ SourceLineResolverInterface *resolver_;
};
} // namespace google_airbag
diff --git a/src/processor/source_line_resolver.h b/src/google_airbag/processor/source_line_resolver_interface.h
index 3e992607..2afd4d8f 100644
--- a/src/processor/source_line_resolver.h
+++ b/src/google_airbag/processor/source_line_resolver_interface.h
@@ -27,31 +27,26 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// SourceLineResolver returns function/file/line info for a memory address.
-// It uses address map files produced by a compatible writer, e.g.
-// PDBSourceLineWriter.
+// Abstract interface to return function/file/line info for a memory address.
-#ifndef PROCESSOR_SOURCE_LINE_RESOLVER_H__
-#define PROCESSOR_SOURCE_LINE_RESOLVER_H__
+#ifndef GOOGLE_AIRBAG_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
+#define GOOGLE_AIRBAG_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#include <string>
-#include <ext/hash_map>
#include "google_airbag/common/airbag_types.h"
namespace google_airbag {
using std::string;
-using __gnu_cxx::hash_map;
struct StackFrame;
struct StackFrameInfo;
-class SourceLineResolver {
+class SourceLineResolverInterface {
public:
typedef u_int64_t MemAddr;
- SourceLineResolver();
- ~SourceLineResolver();
+ virtual ~SourceLineResolverInterface() {}
// Adds a module to this resolver, returning true on success.
//
@@ -59,10 +54,11 @@ class SourceLineResolver {
// filename of the module, optionally with version identifiers.
//
// 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.
- 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,
// 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
// error. The caller takes ownership of any returned StackFrameInfo
// object.
- StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const;
+ virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const = 0;
- 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
- SourceLineResolver(const SourceLineResolver&);
- void operator=(const SourceLineResolver&);
+ protected:
+ // SourceLineResolverInterface cannot be instantiated except by subclasses
+ SourceLineResolverInterface() {}
};
} // namespace google_airbag
-#endif // PROCESSOR_SOURCE_LINE_RESOLVER_H__
+#endif // GOOGLE_AIRBAG_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
diff --git a/src/google_airbag/processor/stackwalker.h b/src/google_airbag/processor/stackwalker.h
index 70da125e..381b9e29 100644
--- a/src/google_airbag/processor/stackwalker.h
+++ b/src/google_airbag/processor/stackwalker.h
@@ -50,6 +50,7 @@ class CodeModules;
template<typename T> class linked_ptr;
class MemoryRegion;
class MinidumpContext;
+class SourceLineResolverInterface;
struct StackFrame;
struct StackFrameInfo;
class SymbolSupplier;
@@ -73,7 +74,8 @@ class Stackwalker {
static Stackwalker* StackwalkerForCPU(MinidumpContext *context,
MemoryRegion *memory,
const CodeModules *modules,
- SymbolSupplier *supplier);
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver);
protected:
// 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
// associated with. supplier is an optional caller-supplied SymbolSupplier
// 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,
const CodeModules *modules,
- SymbolSupplier *supplier);
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver);
// The stack memory to walk. Subclasses will require this region to
// get information from the stack.
@@ -115,6 +120,9 @@ class Stackwalker {
// The optional SymbolSupplier for resolving source line info.
SymbolSupplier *supplier_;
+
+ // The SourceLineResolver implementation
+ SourceLineResolverInterface *resolver_;
};
diff --git a/src/processor/source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc
index 1ebc1bf4..a170be6e 100644
--- a/src/processor/source_line_resolver.cc
+++ b/src/processor/basic_source_line_resolver.cc
@@ -38,7 +38,7 @@
#include "processor/contained_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/stack_frame.h"
#include "processor/linked_ptr.h"
@@ -52,7 +52,7 @@ using __gnu_cxx::hash;
namespace google_airbag {
-struct SourceLineResolver::Line {
+struct BasicSourceLineResolver::Line {
Line(MemAddr addr, MemAddr code_size, int file_id, int source_line)
: address(addr)
, size(code_size)
@@ -65,7 +65,7 @@ struct SourceLineResolver::Line {
int line;
};
-struct SourceLineResolver::Function {
+struct BasicSourceLineResolver::Function {
Function(const string &function_name,
MemAddr function_address,
MemAddr code_size,
@@ -83,7 +83,7 @@ struct SourceLineResolver::Function {
RangeMap< MemAddr, linked_ptr<Line> > lines;
};
-struct SourceLineResolver::PublicSymbol {
+struct BasicSourceLineResolver::PublicSymbol {
PublicSymbol(const string& set_name,
MemAddr set_address,
int set_parameter_size)
@@ -100,7 +100,7 @@ struct SourceLineResolver::PublicSymbol {
int parameter_size;
};
-class SourceLineResolver::Module {
+class BasicSourceLineResolver::Module {
public:
Module(const string &name) : name_(name) { }
@@ -115,7 +115,7 @@ class SourceLineResolver::Module {
StackFrameInfo* LookupAddress(StackFrame *frame) const;
private:
- friend class SourceLineResolver;
+ friend class BasicSourceLineResolver;
typedef hash_map<int, string> FileMap;
// The types for stack_info_. This is equivalent to MS DIA's
@@ -173,10 +173,10 @@ class SourceLineResolver::Module {
stack_info_[STACK_INFO_LAST];
};
-SourceLineResolver::SourceLineResolver() : modules_(new ModuleMap) {
+BasicSourceLineResolver::BasicSourceLineResolver() : modules_(new ModuleMap) {
}
-SourceLineResolver::~SourceLineResolver() {
+BasicSourceLineResolver::~BasicSourceLineResolver() {
ModuleMap::iterator it;
for (it = modules_->begin(); it != modules_->end(); ++it) {
delete it->second;
@@ -184,8 +184,8 @@ SourceLineResolver::~SourceLineResolver() {
delete modules_;
}
-bool SourceLineResolver::LoadModule(const string &module_name,
- const string &map_file) {
+bool BasicSourceLineResolver::LoadModule(const string &module_name,
+ const string &map_file) {
// Make sure we don't already have a module with the given name.
if (modules_->find(module_name) != modules_->end()) {
return false;
@@ -201,11 +201,11 @@ bool SourceLineResolver::LoadModule(const string &module_name,
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();
}
-StackFrameInfo* SourceLineResolver::FillSourceLineInfo(
+StackFrameInfo* BasicSourceLineResolver::FillSourceLineInfo(
StackFrame *frame) const {
if (frame->module) {
ModuleMap::const_iterator it = modules_->find(frame->module->code_file());
@@ -216,7 +216,7 @@ StackFrameInfo* SourceLineResolver::FillSourceLineInfo(
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");
if (!f) {
return false;
@@ -252,8 +252,8 @@ bool SourceLineResolver::Module::LoadMap(const string &map_file) {
return false;
}
} else if (strncmp(buffer, "MODULE ", 7) == 0) {
- // Ignore these. They're not of any use to SourceLineResolver, which
- // is fed modules by a SymbolSupplier. These lines are present to
+ // Ignore these. They're not of any use to BasicSourceLineResolver,
+ // which is fed modules by a SymbolSupplier. These lines are present to
// aid other tools in properly placing symbol files so that they can
// be accessed by a SymbolSupplier.
//
@@ -275,8 +275,8 @@ bool SourceLineResolver::Module::LoadMap(const string &map_file) {
return true;
}
-StackFrameInfo* SourceLineResolver::Module::LookupAddress(StackFrame *frame)
- const {
+StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress(
+ StackFrame *frame) const {
MemAddr address = frame->instruction - frame->module->base_address();
linked_ptr<StackFrameInfo> retrieved_info;
@@ -360,8 +360,8 @@ StackFrameInfo* SourceLineResolver::Module::LookupAddress(StackFrame *frame)
}
// static
-bool SourceLineResolver::Module::Tokenize(char *line, int max_tokens,
- vector<char*> *tokens) {
+bool BasicSourceLineResolver::Module::Tokenize(char *line, int max_tokens,
+ vector<char*> *tokens) {
tokens->clear();
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);
}
-void SourceLineResolver::Module::ParseFile(char *file_line) {
+void BasicSourceLineResolver::Module::ParseFile(char *file_line) {
// FILE <id> <filename>
file_line += 5; // skip prefix
@@ -407,8 +407,8 @@ void SourceLineResolver::Module::ParseFile(char *file_line) {
}
}
-SourceLineResolver::Function* SourceLineResolver::Module::ParseFunction(
- char *function_line) {
+BasicSourceLineResolver::Function*
+BasicSourceLineResolver::Module::ParseFunction(char *function_line) {
// FUNC <address> <size> <stack_param_size> <name>
function_line += 5; // skip prefix
@@ -425,7 +425,7 @@ SourceLineResolver::Function* SourceLineResolver::Module::ParseFunction(
return new Function(name, address, size, stack_param_size);
}
-SourceLineResolver::Line* SourceLineResolver::Module::ParseLine(
+BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine(
char *line_line) {
// <address> <line number> <source file id>
vector<char*> tokens;
@@ -444,7 +444,7 @@ SourceLineResolver::Line* SourceLineResolver::Module::ParseLine(
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>
// Skip "PUBLIC " prefix.
@@ -474,7 +474,7 @@ bool SourceLineResolver::Module::ParsePublicSymbol(char *public_line) {
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>
// <parameter_size> <saved_register_size> <local_size> <max_stack_size>
// <has_program_string> <program_string_OR_allocates_base_pointer>
@@ -554,7 +554,7 @@ bool SourceLineResolver::Module::ParseStackInfo(char *stack_info_line) {
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());
}
diff --git a/src/processor/source_line_resolver_unittest.cc b/src/processor/basic_source_line_resolver_unittest.cc
index 38de9e2c..8ad7183f 100644
--- a/src/processor/source_line_resolver_unittest.cc
+++ b/src/processor/basic_source_line_resolver_unittest.cc
@@ -29,7 +29,7 @@
#include <cstdio>
#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/stack_frame.h"
#include "processor/linked_ptr.h"
@@ -49,10 +49,10 @@
namespace {
using std::string;
+using google_airbag::BasicSourceLineResolver;
using google_airbag::CodeModule;
using google_airbag::linked_ptr;
using google_airbag::scoped_ptr;
-using google_airbag::SourceLineResolver;
using google_airbag::StackFrame;
using google_airbag::StackFrameInfo;
@@ -94,7 +94,7 @@ static bool RunTests() {
string testdata_dir = string(getenv("srcdir") ? getenv("srcdir") : ".") +
"/src/processor/testdata";
- SourceLineResolver resolver;
+ BasicSourceLineResolver resolver;
ASSERT_TRUE(resolver.LoadModule("module1", testdata_dir + "/module1.out"));
ASSERT_TRUE(resolver.HasModule("module1"));
ASSERT_TRUE(resolver.LoadModule("module2", testdata_dir + "/module2.out"));
diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc
index ab027e8a..dd4c7156 100644
--- a/src/processor/minidump_processor.cc
+++ b/src/processor/minidump_processor.cc
@@ -38,8 +38,9 @@
namespace google_airbag {
-MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier)
- : supplier_(supplier) {
+MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver)
+ : supplier_(supplier), resolver_(resolver) {
}
MinidumpProcessor::~MinidumpProcessor() {
@@ -164,7 +165,8 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
Stackwalker::StackwalkerForCPU(context,
thread_memory,
process_state->modules_,
- supplier_));
+ supplier_,
+ resolver_));
if (!stackwalker.get()) {
return PROCESS_ERROR;
}
diff --git a/src/processor/minidump_processor_unittest.cc b/src/processor/minidump_processor_unittest.cc
index 766c2a30..69a29965 100644
--- a/src/processor/minidump_processor_unittest.cc
+++ b/src/processor/minidump_processor_unittest.cc
@@ -31,6 +31,7 @@
// corresponding symbol file, and checks the stack frames for correctness.
#include <string>
+#include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/call_stack.h"
#include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h"
@@ -43,6 +44,7 @@
namespace {
using std::string;
+using google_airbag::BasicSourceLineResolver;
using google_airbag::CallStack;
using google_airbag::CodeModule;
using google_airbag::MinidumpProcessor;
@@ -93,7 +95,8 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile(
static bool RunTests() {
TestSymbolSupplier supplier;
- MinidumpProcessor processor(&supplier);
+ BasicSourceLineResolver resolver;
+ MinidumpProcessor processor(&supplier, &resolver);
string minidump_file = string(getenv("srcdir") ? getenv("srcdir") : ".") +
"/src/processor/testdata/minidump2.dmp";
diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc
index 3c55933d..2bd32d7a 100644
--- a/src/processor/minidump_stackwalk.cc
+++ b/src/processor/minidump_stackwalk.cc
@@ -36,6 +36,7 @@
#include <cstdlib>
#include <string>
+#include "google_airbag/processor/basic_source_line_resolver.h"
#include "google_airbag/processor/call_stack.h"
#include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h"
@@ -50,6 +51,7 @@
namespace {
using std::string;
+using google_airbag::BasicSourceLineResolver;
using google_airbag::CallStack;
using google_airbag::CodeModule;
using google_airbag::CodeModules;
@@ -192,7 +194,8 @@ static bool PrintMinidumpProcess(const string &minidump_file,
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.
ProcessState process_state;
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index edbe428a..e6a26bb9 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -41,11 +41,11 @@
#include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.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/symbol_supplier.h"
#include "processor/linked_ptr.h"
#include "processor/scoped_ptr.h"
-#include "processor/source_line_resolver.h"
#include "processor/stack_frame_info.h"
#include "processor/stackwalker_ppc.h"
#include "processor/stackwalker_x86.h"
@@ -54,14 +54,17 @@ namespace google_airbag {
Stackwalker::Stackwalker(MemoryRegion *memory, const CodeModules *modules,
- SymbolSupplier *supplier)
- : memory_(memory), modules_(modules), supplier_(supplier) {
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver)
+ : memory_(memory),
+ modules_(modules),
+ supplier_(supplier),
+ resolver_(resolver) {
}
bool Stackwalker::Walk(CallStack *stack) {
assert(stack);
- SourceLineResolver resolver;
stack->Clear();
// 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);
if (module) {
frame->module = module;
- if (!resolver.HasModule(frame->module->code_file()) && supplier_) {
+ if (resolver_ &&
+ !resolver_->HasModule(frame->module->code_file()) &&
+ supplier_) {
string symbol_file;
SymbolSupplier::SymbolResult symbol_result =
supplier_->GetSymbolFile(module, &symbol_file);
switch (symbol_result) {
case SymbolSupplier::FOUND:
- resolver.LoadModule(frame->module->code_file(), symbol_file);
+ resolver_->LoadModule(frame->module->code_file(), symbol_file);
break;
case SymbolSupplier::NOT_FOUND:
break; // nothing to do
@@ -103,7 +108,7 @@ bool Stackwalker::Walk(CallStack *stack) {
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
-Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context,
- MemoryRegion *memory,
- const CodeModules *modules,
- SymbolSupplier *supplier) {
+Stackwalker* Stackwalker::StackwalkerForCPU(
+ MinidumpContext *context,
+ MemoryRegion *memory,
+ const CodeModules *modules,
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver) {
Stackwalker *cpu_stackwalker = NULL;
u_int32_t cpu = context->GetContextCPU();
switch (cpu) {
case MD_CONTEXT_X86:
cpu_stackwalker = new StackwalkerX86(context->GetContextX86(),
- memory, modules, supplier);
+ memory, modules, supplier,
+ resolver);
break;
case MD_CONTEXT_PPC:
cpu_stackwalker = new StackwalkerPPC(context->GetContextPPC(),
- memory, modules, supplier);
+ memory, modules, supplier,
+ resolver);
break;
}
diff --git a/src/processor/stackwalker_ppc.cc b/src/processor/stackwalker_ppc.cc
index 49b62f8c..ff5243c6 100644
--- a/src/processor/stackwalker_ppc.cc
+++ b/src/processor/stackwalker_ppc.cc
@@ -45,8 +45,9 @@ namespace google_airbag {
StackwalkerPPC::StackwalkerPPC(const MDRawContextPPC *context,
MemoryRegion *memory,
const CodeModules *modules,
- SymbolSupplier *supplier)
- : Stackwalker(memory, modules, supplier),
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver)
+ : Stackwalker(memory, modules, supplier, resolver),
context_(context) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// This implementation only covers 32-bit ppc CPUs. The limits of the
diff --git a/src/processor/stackwalker_ppc.h b/src/processor/stackwalker_ppc.h
index bccc9dc2..9901f673 100644
--- a/src/processor/stackwalker_ppc.h
+++ b/src/processor/stackwalker_ppc.h
@@ -56,7 +56,8 @@ class StackwalkerPPC : public Stackwalker {
StackwalkerPPC(const MDRawContextPPC *context,
MemoryRegion *memory,
const CodeModules *modules,
- SymbolSupplier *supplier);
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver);
private:
// Implementation of Stackwalker, using ppc context (stack pointer in %r1,
diff --git a/src/processor/stackwalker_selftest.cc b/src/processor/stackwalker_selftest.cc
index 877a8f3d..e645dd98 100644
--- a/src/processor/stackwalker_selftest.cc
+++ b/src/processor/stackwalker_selftest.cc
@@ -217,6 +217,7 @@ static u_int32_t GetPC() {
static unsigned int CountCallerFrames() __attribute__((noinline));
static unsigned int CountCallerFrames() {
SelfMemoryRegion memory;
+ BasicSourceLineResolver resolver;
#if defined(__i386__)
MDRawContextX86 context = MDRawContextX86();
@@ -224,13 +225,15 @@ static unsigned int CountCallerFrames() {
context.ebp = GetEBP();
context.esp = GetESP();
- StackwalkerX86 stackwalker = StackwalkerX86(&context, &memory, NULL, NULL);
+ StackwalkerX86 stackwalker = StackwalkerX86(&context, &memory, NULL, NULL,
+ &resolver);
#elif defined(__ppc__)
MDRawContextPPC context = MDRawContextPPC();
context.srr0 = GetPC();
context.gpr[1] = GetSP();
- StackwalkerPPC stackwalker = StackwalkerPPC(&context, &memory, NULL, NULL);
+ StackwalkerPPC stackwalker = StackwalkerPPC(&context, &memory, NULL, NULL,
+ &resolver);
#endif // __i386__ || __ppc__
scoped_ptr<CallStack> stack(stackwalker.Walk());
diff --git a/src/processor/stackwalker_x86.cc b/src/processor/stackwalker_x86.cc
index 1e3390f5..0ee2fbd2 100644
--- a/src/processor/stackwalker_x86.cc
+++ b/src/processor/stackwalker_x86.cc
@@ -49,8 +49,9 @@ namespace google_airbag {
StackwalkerX86::StackwalkerX86(const MDRawContextX86 *context,
MemoryRegion *memory,
const CodeModules *modules,
- SymbolSupplier *supplier)
- : Stackwalker(memory, modules, supplier),
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver)
+ : Stackwalker(memory, modules, supplier, resolver),
context_(context) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// The x86 is a 32-bit CPU, the limits of the supplied stack are invalid.
diff --git a/src/processor/stackwalker_x86.h b/src/processor/stackwalker_x86.h
index fe2a7808..f53fc5f7 100644
--- a/src/processor/stackwalker_x86.h
+++ b/src/processor/stackwalker_x86.h
@@ -57,7 +57,8 @@ class StackwalkerX86 : public Stackwalker {
StackwalkerX86(const MDRawContextX86 *context,
MemoryRegion *memory,
const CodeModules *modules,
- SymbolSupplier *supplier);
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver);
private:
// Implementation of Stackwalker, using x86 context (%ebp, %esp, %eip) and