Search code examples
cdebug-information

What is Debug Info?


I am an intermediate C programmer who is learning his way around. I recently learned using GDB (forced to actually) and also am doing some code using Ptrace.
I was browsing through some code on ptrace and came across "DEBUG INFO".

I want to know what this means and when should I include this in my code?
What are debug info files?

I couldnt find much from google and wiki related to this. There is no wiki for that tag too. May be if you can point me to the right direction I can repay by writing one.


Solution

  • DEBUG_INFO you are referring to is probably just an option (and define) of linux kernel. Enabling it when configuring kernel tells compiler to include debug information in resulting binary. This debug information itself is just additional data, that allows debuggers (and other tools like strace, addr2line, gprof, ...) relate binary code it's executing to source it was compiled from (source lines, variable names, etc, etc). You can find more details on debug information in general starting at DWARF (popular debug data format).