GDB进行汇编级的调试

来源:互联网 发布:申请手机淘宝账号注册 编辑:程序博客网 时间:2024/04/28 14:55
gcc -S test.c
生成test.s文件
as -o test.o -gstabs test.s
生成test.o文件
gcc -o test -Wall test.o

gdb test


以下为man as得到到信息

--gen-debug
           Generate debugging information for each assembler source
           line using whichever debug format is preferred by the
           target.  This currently means either STABS, ECOFF or
           DWARF2.

       --gstabs
           Generate stabs debugging information for each assembler
           line.  This may help debugging assembler code, if the
           debugger can handle it.

       --gstabs+
           Generate stabs debugging information for each assembler
           line, with GNU extensions that probably only gdb can
           handle, and that could make other debuggers crash or
           refuse to read your program.  This may help debugging
           assembler code.  Currently the only GNU extension is the
           location of the current working directory at assembling
           time.