How to disassemble a memory range with GDB?

前端 未结 8 679
故里飘歌
故里飘歌 2020-12-04 08:03

I\'m trying to disassemble a program to see a syscall assembly instruction (the INT instruction, I believe) and the handler with GDB and have written a little program (see b

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 08:46

    You don't have to use gdb. GCC will do it.

     gcc -S foo.c
    

    This will create foo.s which is the assembly.

    gcc -m32 -c -g -Wa,-a,-ad foo.c > foo.lst
    

    The above version will create a listing file that has both the C and the assembly generated by it. GCC FAQ

提交回复
热议问题