What is the difference between gcc -ggdb and gcc -g

前端 未结 5 1429
天命终不由人
天命终不由人 2020-12-04 09:15

When I use gcc to compile C programs I usually use -g to get some debug information into the elf file so that gdb can help me if needed.

However, I not

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 10:06

    -g and -ggdb are similar with some slight differences, I read this here:

    -g produces debugging information in the OS¹s native format (stabs, COFF, XCOFF, or DWARF 2).

    -ggdb produces debugging information specifically intended for gdb.

    -ggdb3 produces extra debugging information, for example: including macro definitions.

    -ggdb by itself without specifying the level defaults to -ggdb2 (i.e., gdb for level 2).

提交回复
热议问题