From 6a6f26f74da733862832d5ea79e2776d84d0a78d Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 5 Feb 2010 22:15:18 +0000 Subject: [fnrec] Add function recorder for debugging The function recorder is a crash and hang debugging tool. It logs each function call into a memory buffer while gPXE runs. After the machine is reset, and if the contents of memory have not been overwritten, gPXE will detect the memory buffer and print out its contents. This allows developers to see a trace of the last functions called before a crash or hang. The util/fnrec.sh script can be used to convert the function addresses back into symbol names. To build with fnrec: make FNREC=1 Signed-off-by: Stefan Hajnoczi Signed-off-by: Marty Connor --- src/Makefile.housekeeping | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/Makefile.housekeeping') diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 8ba7e441..7e7ad762 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -375,6 +375,35 @@ CFLAGS += -Werror ASFLAGS += --fatal-warnings endif +# Function trace recorder state in the last build. This is needed +# in order to correctly rebuild whenever the function recorder is +# enabled/disabled. +# +FNREC_STATE := $(BIN)/.fnrec.state +ifeq ($(wildcard $(FNREC_STATE)),) +FNREC_STATE_OLD := +else +FNREC_STATE_OLD := $(shell cat $(FNREC_STATE)) +endif +ifeq ($(FNREC_STATE_OLD),$(FNREC)) +$(FNREC_STATE) : +else +$(FNREC_STATE) : clean +$(shell $(ECHO) "$(FNREC)" > $(FNREC_STATE)) +endif + +VERYCLEANUP += $(FNREC_STATE) +MAKEDEPS += $(FNREC_STATE) + +ifeq ($(FNREC),1) +# Enabling -finstrument-functions affects gcc's analysis and leads to spurious +# warnings about use of uninitialised variables. +# +CFLAGS += -Wno-uninitialized +CFLAGS += -finstrument-functions +CFLAGS += -finstrument-functions-exclude-file-list=core/fnrec.c +endif + # compiler.h is needed for our linking and debugging system # CFLAGS += -include compiler.h -- cgit v1.2.3-55-g7522