debugger.mk, defs-cpp.mk: CORE_DUMPER was misdetected for valgrind vgcore files

gdb --core=vgcore.123 doesn't output a usable executable path with "was
generated by ...".  This commit make make gdb fall back to using $(EXE_PATH) as
the executable with valgrind core files.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-07-13 17:14:38 +00:00
commit 7d7a75c389
2 changed files with 14 additions and 7 deletions

View file

@ -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

View file

@ -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