Trepan-Debuggers / remake

Enhanced GNU Make - tracing, error reporting, debugging, profiling and more
http://bashdb.sf.net/remake
GNU General Public License v3.0
796 stars 75 forks source link

Expand test to not use line number hack #151

Closed duncan-roe closed 1 year ago

duncan-roe commented 1 year ago

commit acfaa6f9 prevented subtracting 1 from unsigned zero floc.lineno after --debugger-stop=load had set b_debugger_goal. But --debugger-stop=full obeys that code as well, so simply test floc.lineno to be nonzero before subtracting. This doesn't affect autotools Makefiles but this generic Makefile displays it:

.PHONY: clean
SRCS = $(wildcard *.c)
PROG = $(shell basename $$PWD)
OBJ = $(SRCS:.c=.o)
CPPFLAGS = $(shell getconf LFS_CFLAGS 2>/dev/null)
CFLAGS := $(CFLAGS) -g3 -gdwarf-4 \
  -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes \
  -Wmissing-prototypes
$(PROG) : $(OBJ)
    $(CC) $^ -o $@ $(LIBS)
clean :
    rm -f *.o *.d $(PROG)

%.d: %.c
    $(CC) -MM -MT $(@:.d=.o) -MT $@ $(CPPFLAGS) $< -o $@
ifneq ($(MAKECMDGOALS),clean)
-include $(SRCS:.c=.d)
endif

Place this in a directory by itself with any random "hello world" program, remake --debugger-stop=full and step through.

duncan-roe commented 1 year ago

Hi Rocky,

I missed this before, it cropped up during a demo last night. Reproducer is in the git log in case anyone wants to figure out where the filename and line number get lost.

Cheers ... Duncan.

rocky commented 1 year ago

LGTM - thanks.