summaryrefslogtreecommitdiffstats
path: root/src/Makefile.housekeeping
diff options
context:
space:
mode:
authorStefan Hajnoczi2010-02-05 23:15:18 +0100
committerMarty Connor2010-03-04 17:38:29 +0100
commit6a6f26f74da733862832d5ea79e2776d84d0a78d (patch)
tree93da82d748796c8b821af7bec42847358ef16289 /src/Makefile.housekeeping
parent[build] Disable ccache for embedded.o (diff)
downloadipxe-6a6f26f74da733862832d5ea79e2776d84d0a78d.tar.gz
ipxe-6a6f26f74da733862832d5ea79e2776d84d0a78d.tar.xz
ipxe-6a6f26f74da733862832d5ea79e2776d84d0a78d.zip
[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 <stefanha@gmail.com> Signed-off-by: Marty Connor <mdc@etherboot.org>
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r--src/Makefile.housekeeping29
1 files changed, 29 insertions, 0 deletions
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 := <invalid>
+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