top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Debuggable gcc compiler

+1 vote
39 views

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?

posted Aug 14, 2013 by Naveena Garg

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

My approach: Close to the wiki entry without editing the Make Files.

My script:

export BOOT_FLAGS='-O0 -g3'
export STAGE1_FLAGS='-O0 -g'
export CXX_FLAGS='-g3 -O0'

../gcc/configure
make
make install-gcc
answer Aug 14, 2013 by Sonu Jindal
Similar Questions
+1 vote

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?

0 votes

Can I use gcc as well as java compiler on a single desktop?

0 votes

I am looking for detailed description of optimization flags that are provided by GCC compiler ?

+1 vote

I need some help in understanding why my GCC didn't consider this an issue. I have a function that was constructing a path to a daemon program based on the location of the shared object file where this code is. Something similar to this:

namespace {
 std::string ConstructPath()
 {
 int lastSlash(0);
 std::string pathVar;
 Dl_info dl_info;
 memset(

 if((dladdr((void*)ConstructPath, 
 }

 pathVar = dl_info.dli_fname;
 lastSlash = pathVar.find_last_of('/');
 if(std::string::npos == lastSlash)
 {
 // no slashes given ... must be that *.so
 // is in the current directory
 pathVar = "mydaemond";
 }
 else
 {
 pathVar.erase(pathVar.begin() + (lastSlash + 1), pathVar.end());
 pathVar.append("mydaemond");
 }

 // first check if we can find the daemon
 {
 // introducing sub-scope to ensure the file object is closed
 std::ifstream test(pathVar.c_str());
 if(!test.good())
 {
 throw std::runtime_error("cannot find mydaemond");
 }
 }

 // *** the below statement wasn't there originally, the
 // *** function simply exited after the forced-scope block above,
 // *** however, the function *did* have the return type
 return pathVar;
 }
}

My comments above the final return statement illustrate what my question is about. Why wasn't this a problem? There was no return statement and yet, the code compiled fine. I'm using GCC 4.4.4 on CentOS 6.2. Is this just a problem with the 4.4.4 compiler that was fixed? I'm betting there's some subtlety in C++ here that I'm not yet aware of and I'd like to be schooled.

+1 vote

In general, how a C language written program is converted into a binary by a C compiler ?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...