diff --git a/make/debugger.mk b/make/debugger.mk index abdbef81..202cd343 100644 --- a/make/debugger.mk +++ b/make/debugger.mk @@ -1,6 +1,15 @@ +CORE_IGNORE := $(wildcard *.intern-state*) +CORE_VG ?= $(firstword $(filter-out $(CORE_IGNORE),$(wildcard vgcore vgcore.*))) +CORE_REGULAR ?= $(firstword $(filter-out $(CORE_IGNORE),$(wildcard core core.*))) +CORE ?= $(firstword $(CORE_VG) $(CORE_REGULAR)) + ifneq ($(CORE),) - CORE_DUMPER = $(shell echo -e "quit" | $(DEBUGGER) --core=$(CORE) 2>&1 | \ + ifneq ($(CORE),$(CORE_VG)) # trick doesn't work on valgrind cores + CORE_DUMPER = $(shell echo -e "quit" | $(DEBUGGER) --core=$(CORE) 2>&1 | \ $(SED) '/Core was generated/ !d; s/Core was generated by `//; s/ .*//') + else + CORE_DUMPER = $(EXE_PATH) + endif else ifeq ($(CORE_DUMPER),) CORE_DUMPER = $(EXE_PATH) endif @@ -11,24 +20,24 @@ all: gdb ddd: ifneq ($(CORE),) - $@ --core=$(firstword $(CORE)) --args $(CORE_DUMPER) $(EXE_ARGS) + $@ --core=$(CORE) --args $(CORE_DUMPER) $(EXE_ARGS) else $@ --args $(CORE_DUMPER) $(EXE_ARGS) endif lldb: ifneq ($(CORE),) - $@ --core $(firstword $(CORE)) -f $(CORE_DUMPER) -- $(EXE_ARGS) + $@ --core $(CORE) -f $(CORE_DUMPER) -- $(EXE_ARGS) else $@ -f $(CORE_DUMPER) -- $(EXE_ARGS) endif kdbg: - $@ $(CORE_DUMPER) $(firstword $(CORE)) -a "$(EXE_ARGS)" + $@ $(CORE_DUMPER) $(CORE) -a "$(EXE_ARGS)" cgdb: ifneq ($(CORE),) - $@ -- --core=$(firstword $(CORE)) --args $(CORE_DUMPER) $(EXE_ARGS) + $@ -- --core=$(CORE) --args $(CORE_DUMPER) $(EXE_ARGS) else $@ -- --args $(CORE_DUMPER) $(EXE_ARGS) endif diff --git a/make/defs-cpp.mk b/make/defs-cpp.mk index 91dd3655..d983f7da 100644 --- a/make/defs-cpp.mk +++ b/make/defs-cpp.mk @@ -472,8 +472,6 @@ ALL_C += $(LOCAL_C) $(PREREQ_CPP) ALL_CPP += $(LOCAL_CPP) $(PREREQ_CPP) ALL_CSRC += $(LOCAL_CSRC) $(PREREQ_CSRC) -CORE += $(filter-out $(wildcard *.intern-state*),$(wildcard core core.* vgcore vgcore.*)) - ifeq ($(USE_QT),true) include $(JWBDIR)/make/qtversion.mk include $(JWBDIR)/make/qt-defs.mk