Thread: About Debug
View Single Post
  #1 (permalink)  
Old March 6th, 2011, 08:00 AM
edisonewtong edisonewtong is offline
Registered User
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question About Debug

Dear Friend:
I am a chinese boy. My English is very poor.
<< Begbinning Linux Programming 3rd Edition >>
I have a question about debug when I read the 10th Chap. (10.2.4)

What's meaning of debug without re-compilation? (gcc -d) ????
I have read the gcc help doc.

-dletters information

-dA Annotate the assembler output with miscellaneous debugging

-dD Dump all macro definitions, at the end of preprocessing, in
addition to normal output.

-dH Produce a core dump whenever an error occurs.

-dm Print statistics on memory usage, at the end of the run, to
standard error.

-dp Annotate the assembler output with a comment indicating which
pattern and alternative was used. The length of each
instruction is also printed.

-dP Dump the RTL in the assembler output as a comment before each
instruction. Also turns on -dp annotation.

-dv For each of the other indicated dump files (-fdump-rtl-pass),
dump a representation of the control flow graph suitable for
viewing with VCG to file.pass.vcg.

-dx Just generate RTL for a function instead of compiling it.
Usually used with -fdump-rtl-expand.

-dy Dump debugging information during parsing, to standard error.

Here is a part of example code copied from the Page 361

if( debug ) {
sprintf(msg, ... );

I don't know how to make the above code work when after generate an application.

Can you give an example code ? Please Teach me step by step. Thanks for your help.