Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand test to not use line number hack #151

Merged
merged 1 commit into from
Sep 5, 2023

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
1 check passed
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