Skip to content

Expand test to not use line number hack#151

Merged
rocky merged 1 commit intoTrepan-Debuggers:remake-4-3from
duncan-roe:hack_fix
Sep 5, 2023
Merged

Expand test to not use line number hack#151
rocky merged 1 commit intoTrepan-Debuggers:remake-4-3from
duncan-roe:hack_fix

Conversation

@duncan-roe
Copy link
Contributor

commit acfaa6f 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.

commit acfaa6f 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
Copy link
Contributor Author

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
Copy link
Collaborator

rocky commented Sep 5, 2023

LGTM - thanks.

@rocky rocky merged commit ae04b5f into Trepan-Debuggers:remake-4-3 Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants