0

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.

kidd0
  • 731
  • 2
  • 8
  • 25
  • I downloaded `strace` code from [here](http://sourceforge.net/projects/strace/files/strace/) but dint find any `DEBUG INFO` in `strace.c` . Which file are you refering? Can you paste a snippet here? – Pavan Manjunath Mar 29 '12 at 06:16
  • @PavanManjunath: I am sorry. It wasn't strace. It was a mistake. Sorry for wasting your time on that. I am looking for that code which had this. Please give me time. – kidd0 Mar 29 '12 at 06:22

3 Answers3

3

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).

dbrank0
  • 9,026
  • 2
  • 37
  • 55
  • I wrote a self answer which comes nowhere near this :) thanks and accepting :) +1!! – kidd0 Mar 29 '12 at 06:46
  • I think you mix a bit debug info with map file – Gabriel Jul 05 '18 at 10:14
  • Artix: Not that I'm aware of it. If I am please explain. – dbrank0 Jul 05 '18 at 11:23
  • [this IBM developer article](https://developer.ibm.com/technologies/systems/articles/au-dwarf-debug-format/) has a clear an concise explanation on the DWARF sections and common tags and attributes in those sections – brother-bilo May 07 '20 at 02:51
1

check for what is a core dump .you might get some directions.

Vijay
  • 65,327
  • 90
  • 227
  • 319
  • It would be nice to quote a relevant snippet here – nico Mar 29 '12 at 06:23
  • @peter: I didn't get the answer there but I came to know quite a few interesting facts. Thanks man :) – kidd0 Mar 29 '12 at 06:37
  • @peter: I want to post another answer with more links but want to site your example too. Is that going to be hijacking ?? – kidd0 Mar 29 '12 at 06:39
0

The whole credit goes to Peter for the answer. Initially I went through "What is core dump"
Then I came across the following link which actually tells the difference between

  1. Debug Build

  2. Release build

    which is: debug build includes debug information while a release built doesn't have these and is Optimized code. Also this answer can help you get more information.

Community
  • 1
  • 1
kidd0
  • 731
  • 2
  • 8
  • 25