Options for Debugging Your Program or GCC

Options for Debugging Your Program or GCC

-g

  Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this debugging information. On most systems that use stabs format, -g enables use of extra debugging information that only GDB can use。

  优先使用当前平台格式的调试文件,会使用extension,extension会导致其它调试器失效。

-gdb

  Produce debugging information for use by GDB. This means to use the most expressive format available (DWARF 2, stabs, or the native format if neither of those are supported), including GDB extensions if at all possible. 

  优先使用友好(表达性好)的调试格式 (DWARF2、stabs), 会使用extension。

-gsplit-dwarf

  Separate as much dwarf debugging information as possible into a separate output file with the extension .dwo. This option allows the build system to avoid linking files with debug information. To be useful, this option requires a debugger capable of reading .dwo files. 

  把调试信息存储在另一个文件中,以.dwo为扩展名。这选项避免把debug information与文件链接在一起。

-gstabs

  Produce debugging information in stabs format (if that is supported), without GDB extensions.

  使用stab格式, 使用extension。

参考:http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Debugging-Options.html#Debugging-Options

原文地址:https://www.cnblogs.com/tekkaman/p/3472095.html