[Nasm-bugs] [Bug 3392731] Line numbers go wrong in include files
noreply-nasm at dev.nasm.us
noreply-nasm at dev.nasm.us
Sun Dec 27 10:06:23 PST 2020
https://bugzilla.nasm.us/show_bug.cgi?id=3392731
scrouthtv at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |scrouthtv at gmail.com
--- Comment #1 from scrouthtv at gmail.com ---
Can confirm this using
```
nasm 2.15.05-1
binutils 2.35.1-1
gdb 10.1-4
gcc 10.2.0-4
```
on `Linux 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64
GNU/Linux`.
Attached three example files:
- singlefile.asm where everything works as expected
- samplefile.asm and samplefile.asm where I experience the issue OP reported
I compile and link it using
```
nasm -f elf -g -F dwarf somefile_test.asm
ld -m elf_i386 -o somefile_test.out somefile_test.o
```
And then debug my application using `gdb`:
```
gdb somefile_test.out
```
I now set a breakpoint in the imported file:
```
GNU gdb (GDB) 10.1
(gdb) b somefile.asm:5
Breakpoint 1 at 0x8049000: file somefile.asm, line 5.
(gdb) r
Starting program: /<bla>/somefile_test.out
Breakpoint , funca () at somefile.asm:5
5 mov ebx, 5
```
Now appearantly, the execution stopped at the correct position. The next line
to be executed would be 5, which is `mov ebx, 5`.
**However**, the last line should've been `mov eax, 5` which should have
already been executed. It was not:
```
(gdb) i r eax
eax 0x0 0
```
It gets even weirder:
```
(gdb) si
6 cmp eax, ebx
(gdb) i r eax ebx
eax 0x5 5
ebx 0x0 0
```
Now, `eax` is set, but `ebx` is not (yet).
If I execute the next line, it is set:
```
(gdb) si
7 je aisequal
(gdb) i r eax ebx
eax 0x5 5
ebx 0x5 5
```
However, I'd expect the program to jump to line 12 (aisequal) now, but it
doesn't:
```
(gdb) si
8 mov ecx, 13
```
On the next instruction, it suddenly goes to the right line:
```
(gdb) si
14 mov edx, 21
(gdb) i r eax ebx edx
eax 0x5 5
ebx 0x5 5
edx 0x0 0
```
And so on:
```
(gdb) si
15 ret
(gdb) i r eax ebx ecx edx
eax 0x5 5
ebx 0x5 5
ecx 0x11 17
edx 0x0 0
```
I don't have any experience beyond gdb so I can't add much more. The folks over
at gdb said this is an issue with nasm
https://sourceware.org/bugzilla/show_bug.cgi?id=27118
--
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.
More information about the Nasm-bugs
mailing list