简体   繁体   中英

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...

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!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM