top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to generate line number debug information using GCC

+1 vote
380 views

I would like to improve the build speed of a large project. The opt build is compiled with -O2 -g. I noticed that without -g, compilation becomes faster, about 10-20%. The resulting binary has enough information to analyze crashes, except for the line numbers. Is there a way to include line number information but nothing else?

According to [http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html], line numbers are produced only at level 2 (i.e. -g2 or the default of -g) or above. But according to [http://gcc.gnu.org/wiki/DebugFission], line numbers are only a fraction of the debug information (1%). So for me it would be best to have -g0 or -g1 but with line numbers. Is this possible?

posted Jul 28, 2013 by Luv Kumar

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

So far I've been editing some makefile in order to get a debuggable compiler. I tried the instructions at

http://gcc.gnu.org/wiki/DebuggingGCC

I did

cd myobjdir
../gcc4/configure --prefix=/my/disk/usr/hgreving/sysroot_4_8_1 --program-prefix=special- --program-suffix=-4.8.1 
make STAGE1_CFLAGS="-g -O0" all-stage1
make install

I am getting this error:

/bin/sh: line 0: cd: ./fixincludes: No such file or directory
make[1]: *** [install-fixincludes] Error 1
make[1]: Leaving directory `/my/disk/usr/hgreving/myobjdir'

Is there something very obvious that I am doing wrong?

+1 vote

My index.php file is compiled correctly when I use one of my PHP executables outside Apache, but fails when I ask Apache to serve it (and fails leaving a blank error log unfortunately). So I'm trying to understand how and where the two PHP compilations start behaving differently.

With my outside-Apache PHP executable, I only need to edit the php.ini file to use xdebug and get first-class debugging. I have no idea how to do the parallel analysis with Apache however. AFAIK, there is no PHP executable inside Apache, just a shared library likeat /libexec/apache2/libphp5.so, and I do not know how to debug that. Does Apache have a php.ini file also? My current system is Mac El Capitan by the way.

+1 vote

How can we debug the Android framework Java code? i know how I can debug the c/c++ code with the help of GDB server etc, but I searched a lot on Google but did not get the solution, currently i am totally relying on Logs but I really need something to Debug the java code inside framework and etc?
please give me some pointers or some details about debugging AOSP framework java code?

...