Add more error information to minidump processing return code. Also added dependency on google test, and modified minidump processing unit tests to use google test

R=brdevmn
A=nealsid



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@343 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
nealsid 2009-05-29 00:53:02 +00:00
parent aaecb48b3b
commit b56cfa067a
9 changed files with 859 additions and 375 deletions

View File

@ -152,7 +152,14 @@ src_processor_contained_range_map_unittest_LDADD = \
src/processor/pathname_stripper.lo src/processor/pathname_stripper.lo
src_processor_minidump_processor_unittest_SOURCES = \ src_processor_minidump_processor_unittest_SOURCES = \
src/processor/minidump_processor_unittest.cc src/processor/minidump_processor_unittest.cc \
src/testing/gtest/src/gtest-all.cc \
src/testing/src/gmock-all.cc
src_processor_minidump_processor_unittest_CPPFLAGS = \
-I$(top_srcdir)/src/testing/include \
-I$(top_srcdir)/src/testing/gtest/include \
-I$(top_srcdir)/src/testing/gtest \
-I$(top_srcdir)/src/testing
src_processor_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/basic_source_line_resolver.lo \

View File

@ -147,8 +147,9 @@ src_processor_minidump_dump_OBJECTS = \
src_processor_minidump_dump_DEPENDENCIES = \ src_processor_minidump_dump_DEPENDENCIES = \
src/processor/basic_code_modules.lo src/processor/logging.lo \ src/processor/basic_code_modules.lo src/processor/logging.lo \
src/processor/minidump.lo src/processor/pathname_stripper.lo src/processor/minidump.lo src/processor/pathname_stripper.lo
am_src_processor_minidump_processor_unittest_OBJECTS = \ am_src_processor_minidump_processor_unittest_OBJECTS = src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.$(OBJEXT) \
src/processor/minidump_processor_unittest.$(OBJEXT) src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.$(OBJEXT) \
src/testing/src/src_processor_minidump_processor_unittest-gmock-all.$(OBJEXT)
src_processor_minidump_processor_unittest_OBJECTS = \ 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 = \
@ -471,7 +472,15 @@ src_processor_contained_range_map_unittest_LDADD = \
src/processor/pathname_stripper.lo src/processor/pathname_stripper.lo
src_processor_minidump_processor_unittest_SOURCES = \ src_processor_minidump_processor_unittest_SOURCES = \
src/processor/minidump_processor_unittest.cc src/processor/minidump_processor_unittest.cc \
src/testing/gtest/src/gtest-all.cc \
src/testing/src/gmock-all.cc
src_processor_minidump_processor_unittest_CPPFLAGS = \
-I$(top_srcdir)/src/testing/include \
-I$(top_srcdir)/src/testing/gtest/include \
-I$(top_srcdir)/src/testing/gtest \
-I$(top_srcdir)/src/testing
src_processor_minidump_processor_unittest_LDADD = \ src_processor_minidump_processor_unittest_LDADD = \
src/processor/basic_code_modules.lo \ src/processor/basic_code_modules.lo \
@ -871,9 +880,27 @@ src/processor/minidump_dump.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/minidump_dump$(EXEEXT): $(src_processor_minidump_dump_OBJECTS) $(src_processor_minidump_dump_DEPENDENCIES) src/processor/$(am__dirstamp) src/processor/minidump_dump$(EXEEXT): $(src_processor_minidump_dump_OBJECTS) $(src_processor_minidump_dump_DEPENDENCIES) src/processor/$(am__dirstamp)
@rm -f src/processor/minidump_dump$(EXEEXT) @rm -f src/processor/minidump_dump$(EXEEXT)
$(CXXLINK) $(src_processor_minidump_dump_OBJECTS) $(src_processor_minidump_dump_LDADD) $(LIBS) $(CXXLINK) $(src_processor_minidump_dump_OBJECTS) $(src_processor_minidump_dump_LDADD) $(LIBS)
src/processor/minidump_processor_unittest.$(OBJEXT): \ src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.$(OBJEXT): \
src/processor/$(am__dirstamp) \ src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp) src/processor/$(DEPDIR)/$(am__dirstamp)
src/testing/gtest/src/$(am__dirstamp):
@$(MKDIR_P) src/testing/gtest/src
@: > src/testing/gtest/src/$(am__dirstamp)
src/testing/gtest/src/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/testing/gtest/src/$(DEPDIR)
@: > src/testing/gtest/src/$(DEPDIR)/$(am__dirstamp)
src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.$(OBJEXT): \
src/testing/gtest/src/$(am__dirstamp) \
src/testing/gtest/src/$(DEPDIR)/$(am__dirstamp)
src/testing/src/$(am__dirstamp):
@$(MKDIR_P) src/testing/src
@: > src/testing/src/$(am__dirstamp)
src/testing/src/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/testing/src/$(DEPDIR)
@: > src/testing/src/$(DEPDIR)/$(am__dirstamp)
src/testing/src/src_processor_minidump_processor_unittest-gmock-all.$(OBJEXT): \
src/testing/src/$(am__dirstamp) \
src/testing/src/$(DEPDIR)/$(am__dirstamp)
src/processor/minidump_processor_unittest$(EXEEXT): $(src_processor_minidump_processor_unittest_OBJECTS) $(src_processor_minidump_processor_unittest_DEPENDENCIES) src/processor/$(am__dirstamp) src/processor/minidump_processor_unittest$(EXEEXT): $(src_processor_minidump_processor_unittest_OBJECTS) $(src_processor_minidump_processor_unittest_DEPENDENCIES) src/processor/$(am__dirstamp)
@rm -f src/processor/minidump_processor_unittest$(EXEEXT) @rm -f src/processor/minidump_processor_unittest$(EXEEXT)
$(CXXLINK) $(src_processor_minidump_processor_unittest_OBJECTS) $(src_processor_minidump_processor_unittest_LDADD) $(LIBS) $(CXXLINK) $(src_processor_minidump_processor_unittest_OBJECTS) $(src_processor_minidump_processor_unittest_LDADD) $(LIBS)
@ -926,7 +953,6 @@ mostlyclean-compile:
-rm -f src/processor/minidump_dump.$(OBJEXT) -rm -f src/processor/minidump_dump.$(OBJEXT)
-rm -f src/processor/minidump_processor.$(OBJEXT) -rm -f src/processor/minidump_processor.$(OBJEXT)
-rm -f src/processor/minidump_processor.lo -rm -f src/processor/minidump_processor.lo
-rm -f src/processor/minidump_processor_unittest.$(OBJEXT)
-rm -f src/processor/minidump_stackwalk.$(OBJEXT) -rm -f src/processor/minidump_stackwalk.$(OBJEXT)
-rm -f src/processor/pathname_stripper.$(OBJEXT) -rm -f src/processor/pathname_stripper.$(OBJEXT)
-rm -f src/processor/pathname_stripper.lo -rm -f src/processor/pathname_stripper.lo
@ -937,6 +963,7 @@ 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/src_processor_minidump_processor_unittest-minidump_processor_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_amd64.$(OBJEXT) -rm -f src/processor/stackwalker_amd64.$(OBJEXT)
@ -948,6 +975,8 @@ mostlyclean-compile:
-rm -f src/processor/stackwalker_sparc.lo -rm -f src/processor/stackwalker_sparc.lo
-rm -f src/processor/stackwalker_x86.$(OBJEXT) -rm -f src/processor/stackwalker_x86.$(OBJEXT)
-rm -f src/processor/stackwalker_x86.lo -rm -f src/processor/stackwalker_x86.lo
-rm -f src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.$(OBJEXT)
-rm -f src/testing/src/src_processor_minidump_processor_unittest-gmock-all.$(OBJEXT)
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@ -962,7 +991,6 @@ distclean-compile:
@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@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_dump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_dump.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_processor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_processor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_processor_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_stackwalk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/minidump_stackwalk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/pathname_stripper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/pathname_stripper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/pathname_stripper_unittest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/pathname_stripper_unittest.Po@am__quote@
@ -970,12 +998,15 @@ 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)/src_processor_minidump_processor_unittest-minidump_processor_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_amd64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_amd64.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@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_sparc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_sparc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_x86.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/processor/$(DEPDIR)/stackwalker_x86.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Po@am__quote@
.cc.o: .cc.o:
@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@ -1001,6 +1032,48 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.o: src/processor/minidump_processor_unittest.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.o -MD -MP -MF src/processor/$(DEPDIR)/src_processor_minidump_processor_unittest-minidump_processor_unittest.Tpo -c -o src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.o `test -f 'src/processor/minidump_processor_unittest.cc' || echo '$(srcdir)/'`src/processor/minidump_processor_unittest.cc
@am__fastdepCXX_TRUE@ mv -f src/processor/$(DEPDIR)/src_processor_minidump_processor_unittest-minidump_processor_unittest.Tpo src/processor/$(DEPDIR)/src_processor_minidump_processor_unittest-minidump_processor_unittest.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/processor/minidump_processor_unittest.cc' object='src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.o `test -f 'src/processor/minidump_processor_unittest.cc' || echo '$(srcdir)/'`src/processor/minidump_processor_unittest.cc
src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.obj: src/processor/minidump_processor_unittest.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.obj -MD -MP -MF src/processor/$(DEPDIR)/src_processor_minidump_processor_unittest-minidump_processor_unittest.Tpo -c -o src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.obj `if test -f 'src/processor/minidump_processor_unittest.cc'; then $(CYGPATH_W) 'src/processor/minidump_processor_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/minidump_processor_unittest.cc'; fi`
@am__fastdepCXX_TRUE@ mv -f src/processor/$(DEPDIR)/src_processor_minidump_processor_unittest-minidump_processor_unittest.Tpo src/processor/$(DEPDIR)/src_processor_minidump_processor_unittest-minidump_processor_unittest.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/processor/minidump_processor_unittest.cc' object='src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/processor/src_processor_minidump_processor_unittest-minidump_processor_unittest.obj `if test -f 'src/processor/minidump_processor_unittest.cc'; then $(CYGPATH_W) 'src/processor/minidump_processor_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/processor/minidump_processor_unittest.cc'; fi`
src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.o: src/testing/gtest/src/gtest-all.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.o -MD -MP -MF src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Tpo -c -o src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.o `test -f 'src/testing/gtest/src/gtest-all.cc' || echo '$(srcdir)/'`src/testing/gtest/src/gtest-all.cc
@am__fastdepCXX_TRUE@ mv -f src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Tpo src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/gtest/src/gtest-all.cc' object='src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.o `test -f 'src/testing/gtest/src/gtest-all.cc' || echo '$(srcdir)/'`src/testing/gtest/src/gtest-all.cc
src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.obj: src/testing/gtest/src/gtest-all.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.obj -MD -MP -MF src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Tpo -c -o src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.obj `if test -f 'src/testing/gtest/src/gtest-all.cc'; then $(CYGPATH_W) 'src/testing/gtest/src/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/gtest/src/gtest-all.cc'; fi`
@am__fastdepCXX_TRUE@ mv -f src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Tpo src/testing/gtest/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gtest-all.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/gtest/src/gtest-all.cc' object='src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/gtest/src/src_processor_minidump_processor_unittest-gtest-all.obj `if test -f 'src/testing/gtest/src/gtest-all.cc'; then $(CYGPATH_W) 'src/testing/gtest/src/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/gtest/src/gtest-all.cc'; fi`
src/testing/src/src_processor_minidump_processor_unittest-gmock-all.o: src/testing/src/gmock-all.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/src/src_processor_minidump_processor_unittest-gmock-all.o -MD -MP -MF src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Tpo -c -o src/testing/src/src_processor_minidump_processor_unittest-gmock-all.o `test -f 'src/testing/src/gmock-all.cc' || echo '$(srcdir)/'`src/testing/src/gmock-all.cc
@am__fastdepCXX_TRUE@ mv -f src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Tpo src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/src/gmock-all.cc' object='src/testing/src/src_processor_minidump_processor_unittest-gmock-all.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/src/src_processor_minidump_processor_unittest-gmock-all.o `test -f 'src/testing/src/gmock-all.cc' || echo '$(srcdir)/'`src/testing/src/gmock-all.cc
src/testing/src/src_processor_minidump_processor_unittest-gmock-all.obj: src/testing/src/gmock-all.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/testing/src/src_processor_minidump_processor_unittest-gmock-all.obj -MD -MP -MF src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Tpo -c -o src/testing/src/src_processor_minidump_processor_unittest-gmock-all.obj `if test -f 'src/testing/src/gmock-all.cc'; then $(CYGPATH_W) 'src/testing/src/gmock-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/src/gmock-all.cc'; fi`
@am__fastdepCXX_TRUE@ mv -f src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Tpo src/testing/src/$(DEPDIR)/src_processor_minidump_processor_unittest-gmock-all.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/testing/src/gmock-all.cc' object='src/testing/src/src_processor_minidump_processor_unittest-gmock-all.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_processor_minidump_processor_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/testing/src/src_processor_minidump_processor_unittest-gmock-all.obj `if test -f 'src/testing/src/gmock-all.cc'; then $(CYGPATH_W) 'src/testing/src/gmock-all.cc'; else $(CYGPATH_W) '$(srcdir)/src/testing/src/gmock-all.cc'; fi`
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@ -1309,6 +1382,10 @@ distclean-generic:
-rm -f src/$(am__dirstamp) -rm -f src/$(am__dirstamp)
-rm -f src/processor/$(DEPDIR)/$(am__dirstamp) -rm -f src/processor/$(DEPDIR)/$(am__dirstamp)
-rm -f src/processor/$(am__dirstamp) -rm -f src/processor/$(am__dirstamp)
-rm -f src/testing/gtest/src/$(DEPDIR)/$(am__dirstamp)
-rm -f src/testing/gtest/src/$(am__dirstamp)
-rm -f src/testing/src/$(DEPDIR)/$(am__dirstamp)
-rm -f src/testing/src/$(am__dirstamp)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -1321,7 +1398,7 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
distclean: distclean-am distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf src/processor/$(DEPDIR) -rm -rf src/processor/$(DEPDIR) src/testing/gtest/src/$(DEPDIR) src/testing/src/$(DEPDIR)
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags distclean-hdr distclean-libtool distclean-tags
@ -1357,7 +1434,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache -rm -rf $(top_srcdir)/autom4te.cache
-rm -rf src/processor/$(DEPDIR) -rm -rf src/processor/$(DEPDIR) src/testing/gtest/src/$(DEPDIR) src/testing/src/$(DEPDIR)
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic

755
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
// Copyright (c) 2009, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef BREAKPAD_GOOGLETEST_INCLUDES_H__
#define BREAKPAD_GOOGLETEST_INCLUDES_H__
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/include/gmock/gmock.h"
#endif // BREAKPAD_GOOGLETEST_INCLUDES_H__

View File

@ -336,7 +336,9 @@ class MinidumpThreadList : public MinidumpStream {
} }
static u_int32_t max_threads() { return max_threads_; } static u_int32_t max_threads() { return max_threads_; }
unsigned int thread_count() const { return valid_ ? thread_count_ : 0; } unsigned int thread_count() const {
return valid_ ? thread_count_ : 0;
}
// Sequential access to threads. // Sequential access to threads.
MinidumpThread* GetThreadAtIndex(unsigned int index) const; MinidumpThread* GetThreadAtIndex(unsigned int index) const;
@ -755,8 +757,11 @@ class Minidump {
// path is the pathname of a file containing the minidump. // path is the pathname of a file containing the minidump.
explicit Minidump(const string& path); explicit Minidump(const string& path);
~Minidump(); virtual ~Minidump();
virtual string path() const {
return path_;
}
static void set_max_streams(u_int32_t max_streams) { static void set_max_streams(u_int32_t max_streams) {
max_streams_ = max_streams; max_streams_ = max_streams;
} }
@ -767,19 +772,19 @@ class Minidump {
} }
static u_int32_t max_string_length() { return max_string_length_; } static u_int32_t max_string_length() { return max_string_length_; }
const MDRawHeader* header() const { return valid_ ? &header_ : NULL; } virtual const MDRawHeader* header() const { return valid_ ? &header_ : NULL; }
// Reads the minidump file's header and top-level stream directory. // Reads the minidump file's header and top-level stream directory.
// The minidump is expected to be positioned at the beginning of the // The minidump is expected to be positioned at the beginning of the
// header. Read() sets up the stream list and map, and validates the // header. Read() sets up the stream list and map, and validates the
// Minidump object. // Minidump object.
bool Read(); virtual bool Read();
// The next set of methods are stubs that call GetStream. They exist to // The next set of methods are stubs that call GetStream. They exist to
// force code generation of the templatized API within the module, and // force code generation of the templatized API within the module, and
// to avoid exposing an ugly API (GetStream needs to accept a garbage // to avoid exposing an ugly API (GetStream needs to accept a garbage
// parameter). // parameter).
MinidumpThreadList* GetThreadList(); virtual MinidumpThreadList* GetThreadList();
MinidumpModuleList* GetModuleList(); MinidumpModuleList* GetModuleList();
MinidumpMemoryList* GetMemoryList(); MinidumpMemoryList* GetMemoryList();
MinidumpException* GetException(); MinidumpException* GetException();

View File

@ -30,6 +30,7 @@
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__ #ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__ #define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
#include <cassert>
#include <string> #include <string>
#include "google_breakpad/common/breakpad_types.h" #include "google_breakpad/common/breakpad_types.h"
@ -42,16 +43,53 @@ class ProcessState;
class SourceLineResolverInterface; class SourceLineResolverInterface;
class SymbolSupplier; class SymbolSupplier;
class SystemInfo; class SystemInfo;
// Return type for Process()
enum ProcessResult {
PROCESS_OK, // The minidump was
// processed
// successfully.
PROCESS_ERROR_MINIDUMP_NOT_FOUND, // The minidump file
// was not found.
PROCESS_ERROR_NO_MINIDUMP_HEADER, // The minidump file
// had no header
PROCESS_ERROR_NO_THREAD_LIST, // The minidump file
// had no thread list.
PROCESS_ERROR_GETTING_THREAD, // There was an error
// getting one
// thread's data from
// the minidump.
PROCESS_ERROR_GETTING_THREAD_ID, // There was an error
// getting a thread id
// from the thread's
// data.
PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than
// one requesting
// thread.
PROCESS_ERROR_NO_MEMORY_FOR_THREAD, // A thread had no
// memory region.
PROCESS_ERROR_NO_STACKWALKER_FOR_THREAD, // We couldn't
// determine the
// StackWalker to walk
// the minidump's
// threads.
PROCESS_SYMBOL_SUPPLIER_INTERRUPTED // The minidump
// processing was
// interrupted by the
// SymbolSupplier(not
// fatal)
};
class MinidumpProcessor { class MinidumpProcessor {
public: public:
// Return type for Process()
enum ProcessResult {
PROCESS_OK, // the minidump was processed successfully
PROCESS_ERROR, // there was an error processing the minidump
PROCESS_INTERRUPTED // processing was interrupted by the SymbolSupplier
};
// 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.
MinidumpProcessor(SymbolSupplier *supplier, MinidumpProcessor(SymbolSupplier *supplier,
@ -62,6 +100,10 @@ class MinidumpProcessor {
ProcessResult Process(const string &minidump_file, ProcessResult Process(const string &minidump_file,
ProcessState *process_state); ProcessState *process_state);
// Processes the minidump structure and fills process_state with the
// result.
ProcessResult Process(Minidump *minidump,
ProcessState *process_state);
// Populates the cpu_* fields of the |info| parameter with textual // Populates the cpu_* fields of the |info| parameter with textual
// representations of the CPU type that the minidump in |dump| was // representations of the CPU type that the minidump in |dump| was
// produced on. Returns false if this information is not available in // produced on. Returns false if this information is not available in
@ -84,6 +126,21 @@ class MinidumpProcessor {
// was caused by a memory access violation. // was caused by a memory access violation.
static string GetCrashReason(Minidump *dump, u_int64_t *address); static string GetCrashReason(Minidump *dump, u_int64_t *address);
// This function returns true if the passed-in error code is
// something unrecoverable(i.e. retry should not happen). For
// instance, if the minidump is corrupt, then it makes no sense to
// retry as we won't be able to glean additional information.
// However, as an example of the other case, the symbol supplier can
// return an error code indicating it was 'interrupted', which can
// happen of the symbols are fetched from a remote store, and a
// retry might be successful later on.
// You should not call this method with PROCESS_OK! Test for
// that separately before calling this.
static bool IsErrorUnrecoverable(ProcessResult p) {
assert(p != PROCESS_OK);
return (p != PROCESS_SYMBOL_SUPPLIER_INTERRUPTED);
}
private: private:
SymbolSupplier *supplier_; SymbolSupplier *supplier_;
SourceLineResolverInterface *resolver_; SourceLineResolverInterface *resolver_;

View File

@ -47,48 +47,45 @@ MinidumpProcessor::MinidumpProcessor(SymbolSupplier *supplier,
MinidumpProcessor::~MinidumpProcessor() { MinidumpProcessor::~MinidumpProcessor() {
} }
MinidumpProcessor::ProcessResult MinidumpProcessor::Process( ProcessResult MinidumpProcessor::Process(
const string &minidump_file, ProcessState *process_state) { Minidump *dump, ProcessState *process_state) {
BPLOG(INFO) << "Processing minidump in file " << minidump_file; assert(dump);
assert(process_state);
Minidump dump(minidump_file);
if (!dump.Read()) {
BPLOG(ERROR) << "Minidump " << minidump_file << " could not be read";
return PROCESS_ERROR;
}
process_state->Clear(); process_state->Clear();
const MDRawHeader *header = dump.header(); const MDRawHeader *header = dump->header();
BPLOG_IF(ERROR, !header) << "Minidump " << minidump_file << " has no header"; if (!header) {
assert(header); BPLOG(ERROR) << "Minidump " << dump->path() << " has no header";
return PROCESS_ERROR_NO_MINIDUMP_HEADER;
}
process_state->time_date_stamp_ = header->time_date_stamp; process_state->time_date_stamp_ = header->time_date_stamp;
bool has_cpu_info = GetCPUInfo(&dump, &process_state->system_info_); bool has_cpu_info = GetCPUInfo(dump, &process_state->system_info_);
bool has_os_info = GetOSInfo(&dump, &process_state->system_info_); bool has_os_info = GetOSInfo(dump, &process_state->system_info_);
u_int32_t dump_thread_id = 0; u_int32_t dump_thread_id = 0;
bool has_dump_thread = false; bool has_dump_thread = false;
u_int32_t requesting_thread_id = 0; u_int32_t requesting_thread_id = 0;
bool has_requesting_thread = false; bool has_requesting_thread = false;
MinidumpBreakpadInfo *breakpad_info = dump.GetBreakpadInfo(); MinidumpBreakpadInfo *breakpad_info = dump->GetBreakpadInfo();
if (breakpad_info) { if (breakpad_info) {
has_dump_thread = breakpad_info->GetDumpThreadID(&dump_thread_id); has_dump_thread = breakpad_info->GetDumpThreadID(&dump_thread_id);
has_requesting_thread = has_requesting_thread =
breakpad_info->GetRequestingThreadID(&requesting_thread_id); breakpad_info->GetRequestingThreadID(&requesting_thread_id);
} }
MinidumpException *exception = dump.GetException(); MinidumpException *exception = dump->GetException();
if (exception) { if (exception) {
process_state->crashed_ = true; process_state->crashed_ = true;
has_requesting_thread = exception->GetThreadID(&requesting_thread_id); has_requesting_thread = exception->GetThreadID(&requesting_thread_id);
process_state->crash_reason_ = GetCrashReason( process_state->crash_reason_ = GetCrashReason(
&dump, &process_state->crash_address_); dump, &process_state->crash_address_);
} }
MinidumpModuleList *module_list = dump.GetModuleList(); MinidumpModuleList *module_list = dump->GetModuleList();
// Put a copy of the module list into ProcessState object. This is not // Put a copy of the module list into ProcessState object. This is not
// necessarily a MinidumpModuleList, but it adheres to the CodeModules // necessarily a MinidumpModuleList, but it adheres to the CodeModules
@ -96,21 +93,21 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
if (module_list) if (module_list)
process_state->modules_ = module_list->Copy(); process_state->modules_ = module_list->Copy();
MinidumpThreadList *threads = dump.GetThreadList(); MinidumpThreadList *threads = dump->GetThreadList();
if (!threads) { if (!threads) {
BPLOG(ERROR) << "Minidump " << minidump_file << " has no thread list"; BPLOG(ERROR) << "Minidump " << dump->path() << " has no thread list";
return PROCESS_ERROR; return PROCESS_ERROR_NO_THREAD_LIST;
} }
BPLOG(INFO) << "Minidump " << minidump_file << " has " << BPLOG(INFO) << "Minidump " << dump->path() << " has " <<
(has_cpu_info ? "" : "no ") << "CPU info, " << (has_cpu_info ? "" : "no ") << "CPU info, " <<
(has_os_info ? "" : "no ") << "OS info, " << (has_os_info ? "" : "no ") << "OS info, " <<
(breakpad_info != NULL ? "" : "no ") << "Breakpad info, " << (breakpad_info != NULL ? "" : "no ") << "Breakpad info, " <<
(exception != NULL ? "" : "no ") << "exception, " << (exception != NULL ? "" : "no ") << "exception, " <<
(module_list != NULL ? "" : "no ") << "module list, " << (module_list != NULL ? "" : "no ") << "module list, " <<
(threads != NULL ? "" : "no ") << "thread list, " << (threads != NULL ? "" : "no ") << "thread list, " <<
(has_dump_thread ? "" : "no ") << "dump thread, and " << (has_dump_thread ? "" : "no ") << "dump thread, and " <<
(has_requesting_thread ? "" : "no ") << "requesting thread"; (has_requesting_thread ? "" : "no ") << "requesting thread";
bool interrupted = false; bool interrupted = false;
bool found_requesting_thread = false; bool found_requesting_thread = false;
@ -121,18 +118,18 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
char thread_string_buffer[64]; char thread_string_buffer[64];
snprintf(thread_string_buffer, sizeof(thread_string_buffer), "%d/%d", snprintf(thread_string_buffer, sizeof(thread_string_buffer), "%d/%d",
thread_index, thread_count); thread_index, thread_count);
string thread_string = minidump_file + ":" + thread_string_buffer; string thread_string = dump->path() + ":" + thread_string_buffer;
MinidumpThread *thread = threads->GetThreadAtIndex(thread_index); MinidumpThread *thread = threads->GetThreadAtIndex(thread_index);
if (!thread) { if (!thread) {
BPLOG(ERROR) << "Could not get thread for " << thread_string; BPLOG(ERROR) << "Could not get thread for " << thread_string;
return PROCESS_ERROR; return PROCESS_ERROR_GETTING_THREAD;
} }
u_int32_t thread_id; u_int32_t thread_id;
if (!thread->GetThreadID(&thread_id)) { if (!thread->GetThreadID(&thread_id)) {
BPLOG(ERROR) << "Could not get thread ID for " << thread_string; BPLOG(ERROR) << "Could not get thread ID for " << thread_string;
return PROCESS_ERROR; return PROCESS_ERROR_GETTING_THREAD_ID;
} }
thread_string += " id " + HexString(thread_id); thread_string += " id " + HexString(thread_id);
@ -152,7 +149,7 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
if (found_requesting_thread) { if (found_requesting_thread) {
// There can't be more than one requesting thread. // There can't be more than one requesting thread.
BPLOG(ERROR) << "Duplicate requesting thread: " << thread_string; BPLOG(ERROR) << "Duplicate requesting thread: " << thread_string;
return PROCESS_ERROR; return PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS;
} }
// Use processed_state->threads_.size() instead of thread_index. // Use processed_state->threads_.size() instead of thread_index.
@ -179,7 +176,7 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
MinidumpMemoryRegion *thread_memory = thread->GetMemory(); MinidumpMemoryRegion *thread_memory = thread->GetMemory();
if (!thread_memory) { if (!thread_memory) {
BPLOG(ERROR) << "No memory region for " << thread_string; BPLOG(ERROR) << "No memory region for " << thread_string;
return PROCESS_ERROR; return PROCESS_ERROR_NO_MEMORY_FOR_THREAD;
} }
// Use process_state->modules_ instead of module_list, because the // Use process_state->modules_ instead of module_list, because the
@ -199,36 +196,49 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
resolver_)); resolver_));
if (!stackwalker.get()) { if (!stackwalker.get()) {
BPLOG(ERROR) << "No stackwalker for " << thread_string; BPLOG(ERROR) << "No stackwalker for " << thread_string;
return PROCESS_ERROR; return PROCESS_ERROR_NO_STACKWALKER_FOR_THREAD;
} }
scoped_ptr<CallStack> stack(new CallStack()); scoped_ptr<CallStack> stack(new CallStack());
if (!stackwalker->Walk(stack.get())) { if (!stackwalker->Walk(stack.get())) {
BPLOG(INFO) << "Stackwalker interrupt (missing symbols?) at " << BPLOG(INFO) << "Stackwalker interrupt (missing symbols?) at " <<
thread_string; thread_string;
interrupted = true; interrupted = true;
} }
process_state->threads_.push_back(stack.release()); process_state->threads_.push_back(stack.release());
} }
if (interrupted) { if (interrupted) {
BPLOG(INFO) << "Processing interrupted for " << minidump_file; BPLOG(INFO) << "Processing interrupted for " << dump->path();
return PROCESS_INTERRUPTED; return PROCESS_SYMBOL_SUPPLIER_INTERRUPTED;
} }
// If a requesting thread was indicated, it must be present. // If a requesting thread was indicated, it must be present.
if (has_requesting_thread && !found_requesting_thread) { if (has_requesting_thread && !found_requesting_thread) {
// Don't mark as an error, but invalidate the requesting thread // Don't mark as an error, but invalidate the requesting thread
BPLOG(ERROR) << "Minidump indicated requesting thread " << BPLOG(ERROR) << "Minidump indicated requesting thread " <<
HexString(requesting_thread_id) << ", not found in " << HexString(requesting_thread_id) << ", not found in " <<
minidump_file; dump->path();
process_state->requesting_thread_ = -1; process_state->requesting_thread_ = -1;
} }
BPLOG(INFO) << "Processed " << minidump_file; BPLOG(INFO) << "Processed " << dump->path();
return PROCESS_OK; return PROCESS_OK;
} }
ProcessResult MinidumpProcessor::Process(
const string &minidump_file, ProcessState *process_state) {
BPLOG(INFO) << "Processing minidump in file " << minidump_file;
Minidump dump(minidump_file);
if (!dump.Read()) {
BPLOG(ERROR) << "Minidump " << dump.path() << " could not be read";
return PROCESS_ERROR_MINIDUMP_NOT_FOUND;
}
return Process(&dump, process_state);
}
// Returns the MDRawSystemInfo from a minidump, or NULL if system info is // Returns the MDRawSystemInfo from a minidump, or NULL if system info is
// not available from the minidump. If system_info is non-NULL, it is used // not available from the minidump. If system_info is non-NULL, it is used
// to pass back the MinidumpSystemInfo object. // to pass back the MinidumpSystemInfo object.
@ -260,7 +270,7 @@ bool MinidumpProcessor::GetCPUInfo(Minidump *dump, SystemInfo *info) {
switch (raw_system_info->processor_architecture) { switch (raw_system_info->processor_architecture) {
case MD_CPU_ARCHITECTURE_X86: case MD_CPU_ARCHITECTURE_X86:
case MD_CPU_ARCHITECTURE_AMD64: { case MD_CPU_ARCHITECTURE_AMD64: {
if (raw_system_info->processor_architecture == if (raw_system_info->processor_architecture ==
MD_CPU_ARCHITECTURE_X86) MD_CPU_ARCHITECTURE_X86)
info->cpu = "x86"; info->cpu = "x86";
else else
@ -861,118 +871,118 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) {
break; break;
case MD_EXCEPTION_CODE_SOL_SIGQUIT: case MD_EXCEPTION_CODE_SOL_SIGQUIT:
reason = "SIGQUIT"; reason = "SIGQUIT";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGILL: case MD_EXCEPTION_CODE_SOL_SIGILL:
reason = "SIGILL"; reason = "SIGILL";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGTRAP: case MD_EXCEPTION_CODE_SOL_SIGTRAP:
reason = "SIGTRAP"; reason = "SIGTRAP";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGIOT: case MD_EXCEPTION_CODE_SOL_SIGIOT:
reason = "SIGIOT | SIGABRT"; reason = "SIGIOT | SIGABRT";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGEMT: case MD_EXCEPTION_CODE_SOL_SIGEMT:
reason = "SIGEMT"; reason = "SIGEMT";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGFPE: case MD_EXCEPTION_CODE_SOL_SIGFPE:
reason = "SIGFPE"; reason = "SIGFPE";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGKILL: case MD_EXCEPTION_CODE_SOL_SIGKILL:
reason = "SIGKILL"; reason = "SIGKILL";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGBUS: case MD_EXCEPTION_CODE_SOL_SIGBUS:
reason = "SIGBUS"; reason = "SIGBUS";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGSEGV: case MD_EXCEPTION_CODE_SOL_SIGSEGV:
reason = "SIGSEGV"; reason = "SIGSEGV";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGSYS: case MD_EXCEPTION_CODE_SOL_SIGSYS:
reason = "SIGSYS"; reason = "SIGSYS";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGPIPE: case MD_EXCEPTION_CODE_SOL_SIGPIPE:
reason = "SIGPIPE"; reason = "SIGPIPE";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGALRM: case MD_EXCEPTION_CODE_SOL_SIGALRM:
reason = "SIGALRM"; reason = "SIGALRM";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGTERM: case MD_EXCEPTION_CODE_SOL_SIGTERM:
reason = "SIGTERM"; reason = "SIGTERM";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGUSR1: case MD_EXCEPTION_CODE_SOL_SIGUSR1:
reason = "SIGUSR1"; reason = "SIGUSR1";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGUSR2: case MD_EXCEPTION_CODE_SOL_SIGUSR2:
reason = "SIGUSR2"; reason = "SIGUSR2";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGCLD: case MD_EXCEPTION_CODE_SOL_SIGCLD:
reason = "SIGCLD | SIGCHLD"; reason = "SIGCLD | SIGCHLD";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGPWR: case MD_EXCEPTION_CODE_SOL_SIGPWR:
reason = "SIGPWR"; reason = "SIGPWR";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGWINCH: case MD_EXCEPTION_CODE_SOL_SIGWINCH:
reason = "SIGWINCH"; reason = "SIGWINCH";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGURG: case MD_EXCEPTION_CODE_SOL_SIGURG:
reason = "SIGURG"; reason = "SIGURG";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGPOLL: case MD_EXCEPTION_CODE_SOL_SIGPOLL:
reason = "SIGPOLL | SIGIO"; reason = "SIGPOLL | SIGIO";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGSTOP: case MD_EXCEPTION_CODE_SOL_SIGSTOP:
reason = "SIGSTOP"; reason = "SIGSTOP";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGTSTP: case MD_EXCEPTION_CODE_SOL_SIGTSTP:
reason = "SIGTSTP"; reason = "SIGTSTP";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGCONT: case MD_EXCEPTION_CODE_SOL_SIGCONT:
reason = "SIGCONT"; reason = "SIGCONT";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGTTIN: case MD_EXCEPTION_CODE_SOL_SIGTTIN:
reason = "SIGTTIN"; reason = "SIGTTIN";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGTTOU: case MD_EXCEPTION_CODE_SOL_SIGTTOU:
reason = "SIGTTOU"; reason = "SIGTTOU";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGVTALRM: case MD_EXCEPTION_CODE_SOL_SIGVTALRM:
reason = "SIGVTALRM"; reason = "SIGVTALRM";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGPROF: case MD_EXCEPTION_CODE_SOL_SIGPROF:
reason = "SIGPROF"; reason = "SIGPROF";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGXCPU: case MD_EXCEPTION_CODE_SOL_SIGXCPU:
reason = "SIGXCPU"; reason = "SIGXCPU";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGXFSZ: case MD_EXCEPTION_CODE_SOL_SIGXFSZ:
reason = "SIGXFSZ"; reason = "SIGXFSZ";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGWAITING: case MD_EXCEPTION_CODE_SOL_SIGWAITING:
reason = "SIGWAITING"; reason = "SIGWAITING";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGLWP: case MD_EXCEPTION_CODE_SOL_SIGLWP:
reason = "SIGLWP"; reason = "SIGLWP";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGFREEZE: case MD_EXCEPTION_CODE_SOL_SIGFREEZE:
reason = "SIGFREEZE"; reason = "SIGFREEZE";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGTHAW: case MD_EXCEPTION_CODE_SOL_SIGTHAW:
reason = "SIGTHAW"; reason = "SIGTHAW";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGCANCEL: case MD_EXCEPTION_CODE_SOL_SIGCANCEL:
reason = "SIGCANCEL"; reason = "SIGCANCEL";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGLOST: case MD_EXCEPTION_CODE_SOL_SIGLOST:
reason = "SIGLOST"; reason = "SIGLOST";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGXRES: case MD_EXCEPTION_CODE_SOL_SIGXRES:
reason = "SIGXRES"; reason = "SIGXRES";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGJVM1: case MD_EXCEPTION_CODE_SOL_SIGJVM1:
reason = "SIGJVM1"; reason = "SIGJVM1";
break; break;
case MD_EXCEPTION_CODE_SOL_SIGJVM2: case MD_EXCEPTION_CODE_SOL_SIGJVM2:
reason = "SIGJVM2"; reason = "SIGJVM2";
break; break;
default: default:
BPLOG(INFO) << "Unknown exception reason " << reason; BPLOG(INFO) << "Unknown exception reason " << reason;
break; break;

View File

@ -34,10 +34,12 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include "breakpad_googletest_includes.h"
#include "google_breakpad/processor/basic_source_line_resolver.h" #include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h" #include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_module.h" #include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h" #include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/minidump.h"
#include "google_breakpad/processor/minidump_processor.h" #include "google_breakpad/processor/minidump_processor.h"
#include "google_breakpad/processor/process_state.h" #include "google_breakpad/processor/process_state.h"
#include "google_breakpad/processor/stack_frame.h" #include "google_breakpad/processor/stack_frame.h"
@ -45,17 +47,34 @@
#include "processor/logging.h" #include "processor/logging.h"
#include "processor/scoped_ptr.h" #include "processor/scoped_ptr.h"
namespace google_breakpad {
class MockMinidump : public Minidump {
public:
MockMinidump() : Minidump("") {
}
MOCK_METHOD0(Read,bool());
MOCK_CONST_METHOD0(path, string());
MOCK_CONST_METHOD0(header,const MDRawHeader*());
MOCK_METHOD0(GetThreadList,MinidumpThreadList*());
};
}
namespace { namespace {
using std::string;
using google_breakpad::BasicSourceLineResolver; using google_breakpad::BasicSourceLineResolver;
using google_breakpad::CallStack; using google_breakpad::CallStack;
using google_breakpad::CodeModule; using google_breakpad::CodeModule;
using google_breakpad::MinidumpProcessor; using google_breakpad::MinidumpProcessor;
using google_breakpad::MinidumpThreadList;
using google_breakpad::MinidumpThread;
using google_breakpad::MockMinidump;
using google_breakpad::ProcessState; using google_breakpad::ProcessState;
using google_breakpad::scoped_ptr; using google_breakpad::scoped_ptr;
using google_breakpad::SymbolSupplier; using google_breakpad::SymbolSupplier;
using google_breakpad::SystemInfo; using google_breakpad::SystemInfo;
using std::string;
using ::testing::Return;
static const char *kSystemInfoOS = "Windows NT"; static const char *kSystemInfoOS = "Windows NT";
static const char *kSystemInfoOSShort = "windows"; static const char *kSystemInfoOSShort = "windows";
@ -64,17 +83,6 @@ static const char *kSystemInfoCPU = "x86";
static const char *kSystemInfoCPUInfo = static const char *kSystemInfoCPUInfo =
"GenuineIntel family 6 model 13 stepping 8"; "GenuineIntel family 6 model 13 stepping 8";
#define ASSERT_TRUE(cond) \
if (!(cond)) { \
fprintf(stderr, "FAILED: %s at %s:%d\n", #cond, __FILE__, __LINE__); \
return false; \
}
#define ASSERT_FALSE(cond) ASSERT_TRUE(!(cond))
#define ASSERT_EQ(e1, e2) ASSERT_TRUE((e1) == (e2))
// Use ASSERT_*_ABORT in functions that can't return a boolean.
#define ASSERT_TRUE_ABORT(cond) \ #define ASSERT_TRUE_ABORT(cond) \
if (!(cond)) { \ if (!(cond)) { \
fprintf(stderr, "FAILED: %s at %s:%d\n", #cond, __FILE__, __LINE__); \ fprintf(stderr, "FAILED: %s at %s:%d\n", #cond, __FILE__, __LINE__); \
@ -147,7 +155,38 @@ SymbolSupplier::SymbolResult TestSymbolSupplier::GetSymbolFile(
return s; return s;
} }
static bool RunTests() {
class MinidumpProcessorTest : public ::testing::Test {
};
TEST_F(MinidumpProcessorTest, TestCorruptMinidumps) {
MockMinidump dump;
TestSymbolSupplier supplier;
BasicSourceLineResolver resolver;
MinidumpProcessor processor(&supplier, &resolver);
ProcessState state;
EXPECT_EQ(processor.Process("nonexistant minidump", &state),
google_breakpad::PROCESS_ERROR_MINIDUMP_NOT_FOUND);
EXPECT_CALL(dump, path()).WillRepeatedly(Return("mock minidump"));
EXPECT_CALL(dump, Read()).WillRepeatedly(Return(true));
MDRawHeader fakeHeader;
fakeHeader.time_date_stamp = 0;
EXPECT_CALL(dump, header()).WillOnce(Return((MDRawHeader*)NULL)).
WillRepeatedly(Return(&fakeHeader));
EXPECT_EQ(processor.Process(&dump, &state),
google_breakpad::PROCESS_ERROR_NO_MINIDUMP_HEADER);
EXPECT_CALL(dump, GetThreadList()).
WillOnce(Return((MinidumpThreadList*)NULL));
EXPECT_EQ(processor.Process(&dump, &state),
google_breakpad::PROCESS_ERROR_NO_THREAD_LIST);
}
TEST_F(MinidumpProcessorTest, TestBasicProcessing) {
TestSymbolSupplier supplier; TestSymbolSupplier supplier;
BasicSourceLineResolver resolver; BasicSourceLineResolver resolver;
MinidumpProcessor processor(&supplier, &resolver); MinidumpProcessor processor(&supplier, &resolver);
@ -157,7 +196,7 @@ static bool RunTests() {
ProcessState state; ProcessState state;
ASSERT_EQ(processor.Process(minidump_file, &state), ASSERT_EQ(processor.Process(minidump_file, &state),
MinidumpProcessor::PROCESS_OK); google_breakpad::PROCESS_OK);
ASSERT_EQ(state.system_info()->os, kSystemInfoOS); ASSERT_EQ(state.system_info()->os, kSystemInfoOS);
ASSERT_EQ(state.system_info()->os_short, kSystemInfoOSShort); ASSERT_EQ(state.system_info()->os_short, kSystemInfoOSShort);
ASSERT_EQ(state.system_info()->os_version, kSystemInfoOSVersion); ASSERT_EQ(state.system_info()->os_version, kSystemInfoOSVersion);
@ -221,19 +260,13 @@ static bool RunTests() {
state.Clear(); state.Clear();
supplier.set_interrupt(true); supplier.set_interrupt(true);
ASSERT_EQ(processor.Process(minidump_file, &state), ASSERT_EQ(processor.Process(minidump_file, &state),
MinidumpProcessor::PROCESS_INTERRUPTED); google_breakpad::PROCESS_SYMBOL_SUPPLIER_INTERRUPTED
);
return true;
} }
} // namespace } // namespace
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
BPLOG_INIT(&argc, &argv); BPLOG_INIT(&argc, &argv);
::testing::InitGoogleTest(&argc, argv);
if (!RunTests()) { return RUN_ALL_TESTS();
return 1;
}
return 0;
} }

View File

@ -447,7 +447,7 @@ static bool PrintMinidumpProcess(const string &minidump_file,
// Process the minidump. // Process the minidump.
ProcessState process_state; ProcessState process_state;
if (minidump_processor.Process(minidump_file, &process_state) != if (minidump_processor.Process(minidump_file, &process_state) !=
MinidumpProcessor::PROCESS_OK) { google_breakpad::PROCESS_OK) {
BPLOG(ERROR) << "MinidumpProcessor::Process failed"; BPLOG(ERROR) << "MinidumpProcessor::Process failed";
return false; return false;
} }