[ES40-developers] Patch: Backtrace fix
Status: Alpha
Brought to you by:
iamcamiel
From: Brian W. <bdw...@in...> - 2008-02-21 13:56:03
|
This patch make a few changes to the backtrace functionality: * adds the -rdynamic LD flag if DEBUG_BACKTRACE is specified. This allows all non-static function names to appear in the backtrace. * catch SIGUSR1 to trigger the backtracer if es40 seems to have hung. * use _exit() to really really quit when a SIGSEGV is caught. Index: Makefile =================================================================== RCS file: /cvsroot/es40/es40/src/Makefile,v retrieving revision 1.26 diff -u -w -r1.26 Makefile --- Makefile 20 Feb 2008 21:02:50 -0000 1.26 +++ Makefile 21 Feb 2008 13:47:38 -0000 @@ -135,6 +135,7 @@ # -DDEBUG_PIC Turn on Programmable Interrupt Controller debugging # -DDEBUG_LPT Turn on debugging for LPT Port # -DDEBUG_BACKTRACE Turn on backtrace dump on SIGSEGV +# -DDEBUG_USB Turn on debugging for USB controller # CDEBUGFLAGS = -g -DHIDE_COUNTER -DDEBUG_BACKTRACE @@ -172,6 +173,11 @@ LDOPTIONFLAGS += -g endif +ifneq ($(findstring "-DDEBUG_BACKTRACE",$(CDEBUGFLAGS)),"") +LDOPTIONFLAGS += -rdynamic +endif + + CFLAGS = -I. -I.. \ $(CDEBUGFLAGS) $(CTUNINGFLAGS) $(OPTIONS) $(COPTIONFLAGS) LDFLAGS = $(LDOPTIONFLAGS) @@ -265,4 +271,3 @@ $(DEPEND) -o.do -a -- $(IDB_CFLAGS) -- $(SRCS) clean: rm -f es40 es40_idb es40_lss es40_lsm *.o *.do *.mao *.slo *.trc gui/*.o gui/*.mao gui/*.slo gui/*.do - Index: AlphaSim.cpp =================================================================== RCS file: /cvsroot/es40/es40/src/AlphaSim.cpp,v retrieving revision 1.40 diff -u -w -r1.40 AlphaSim.cpp --- AlphaSim.cpp 7 Feb 2008 20:33:26 -0000 1.40 +++ AlphaSim.cpp 21 Feb 2008 13:47:38 -0000 @@ -211,7 +211,7 @@ printf("%3d %s\n",nptrs-i, strings[i]); } free(strings); - exit(1); + if(signum==SIGSEGV) _exit(1); } #else @@ -255,6 +255,7 @@ #ifdef HAS_BACKTRACE signal(SIGSEGV, &segv_handler); + signal(SIGUSR1, &segv_handler); #endif try |