Reputation: 5281
Why does GDB not go to the next machine instruction. In the gif below, I set the program counter to point to start (0x100020), which holds the cli
instruction. However, when I enter (gdb) stepi
, GDB does not go to the next instruction which is (0x100021) mov $0x104000,%esp
, but instead jumps to (0x100023).
Regardless of which instruction I start with, GDB does not jump to the next logical instruction, and instead jumps to a seemingly arbitrary location. Why is this?
Upvotes: 1
Views: 273
Reputation: 5281
32-bit ELF support isn't provided by WSL (yet).
See the following StackOverfow question.
Turns out WSL is the problem, my elf file is 32 bit.
EDIT
While the above is true, 32-bit elf debugging through GDB is possible in WSL if you use QEMU. In my case, GDB was behaving as above not because it was a 32-bit (as I was running the elf file through QEMU) but because the code produced by my assembler did not produce debugging information that GDB understood. I was using NASM and the -F dwarf
and -g
flags were needed to produce said debugging information.
Upvotes: 1