1

I'm writing code in both C and x86 Assembly with NASM.

I'm using gdb to compile (with gdb-dashboard, if that's important). When I try to set a breakpoint with b foo.asm:5 I get a No line 5 in file "foo.asm" Make breakpoint pending on future shared library load? (y or [n]).

gdb was working fine until a updated Ubuntu a couple days ago. Breakpoints work fine for the file in C.

I've been using Google Shell to debug my code. Using the exact same tools and the very same files, it works like it's supposed to. I've tried restarting my computer. I've tried reinstalling NASM and GDB.

I'm using the following Makefile to compile:

AS      := nasm
ASFLAGS := -f elf64 -F DWARF -g -Wall

CC      := gcc
CFLAGS  := -Wall -Wextra -pedantic -g

TARGET  := main

.PHONY: all
 all: $(TARGET)

foo.o: foo.asm
    $(AS) $(ASFLAGS) $<

main.o: main.c
    $(CC) $(CFLAGS) -c $< -o $@

$(TARGET): main.o foo.o
    $(CC) $(CFLAGS) $^ -o $@

.PHONY: clean
clean:
    rm -rf *.o $(TARGET)

What is the problem, and how can I solve it?

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
BrKo14
  • 31
  • 8
  • 2
    I wonder if this is related: https://stackoverflow.com/questions/72694342/gdb-does-not-load-source-lines-from-nasm/73515239#73515239 – Michael Petch Sep 21 '22 at 12:38
  • @MichaelPetch I'm not sure how to install that? – BrKo14 Sep 21 '22 at 13:01
  • In this case download https://github.com/iglosiggio/nasm/releases/download/nasm-2.15.05-2/nasm_2.15.05-2_amd64.deb and then do `sudo apt install nasm_2.15.05-2_amd64.deb` – Michael Petch Sep 21 '22 at 13:08
  • Or you could do `sudo dpkg -i nasm_2.15.05-2_amd64.deb` – Michael Petch Sep 21 '22 at 13:18
  • If you aren't using a Debian based system (like Ubuntu) you'd have to download the source, apply the patch and install it manually. – Michael Petch Sep 21 '22 at 13:26
  • Even if line number breakpoints don't work, in the case of assembly it is pretty easy to work around. You can `disassemble` the code in question, and since you wrote in assembly in the first place, you should be able to easily identify the instruction you want to break on. Then you can set the breakpoint by explicitly giving the address of that instruction. Or, edit your assembly source to temporarily put a label on the line where you want to break, then set a breakpoint on that label. – Nate Eldredge Sep 21 '22 at 14:20

0 Answers0