Goodies
Goodies

Reputation: 4681

Debug Compiled NASM Files with GDB

I have files I've written in NASM. Specifically a TCP Bind shell that is not working and I'm looking to debug.

How can I go about doing this:

SECTION .text
       global _start
_start:
       ; stuff ...
       ; stuff ...

I'm running a x64 bit machine and I've writtn it in x86 ASM. Now, I compiled it with the following.

nasm -elf32 -o temp.o file.asm
ld -s -m elf_i386 -o bind temp.o

Then:

gdb bind

When I search for disassemble X there are no frames. How can I disassemble it and show the ESP and registers? Set breakpoints...

Upvotes: 0

Views: 696

Answers (1)

Frank Kotler
Frank Kotler

Reputation: 3119

Okay, consider it an "answer"...

You left out a lowercase 'f' in your post. An uppercase 'F' selects debug info format. -F dwarf may help. A nop right after the _start: label may help. Oh, and no -s switch to ld!!!

Upvotes: 2

Related Questions