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

665
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,13 +93,13 @@ 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, " <<
@ -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,7 +196,7 @@ 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());
@ -212,8 +209,8 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
} }
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.
@ -221,14 +218,27 @@ MinidumpProcessor::ProcessResult MinidumpProcessor::Process(
// 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.

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;
} }