debugginggcceclipse-cdtdebug-information

my debug build under linux gcc is missing symbol information for some of them


I have forked a C project on Github that use autotools. After having built it with debug options, following William Pursell's post, I cannot step inside some functions. The debugger says: "no debug info".

Here is my build process:

$ ./autogen.sh
$ mkdir Debug
$ cd Debug
$ ../configure --prefix=/Debug CPPFLAGS=-DDEBUG CFLAGS="-O0 -g3 -Wall"
$ make
$ make check

For information, the source tree has two levels of folders: perfo/, src/, src/core/, src/utils/, tests/, etc.

When I debug tests/xxx, I have the symbols for functions in tests/xxx.c, but not the ones inside src/core/global.c for example.

From the information here, I have tried to check the object files, but they look like they have the same debug info properties.

$ readelf -WS tests/reqrep.o | grep debug_info
  [ 6] .debug_info       PROGBITS        0000000000000000 00118a 000735 00      0   0  1
  [ 7] .rela.debug_info  RELA            0000000000000000 00d5d0 000d20 18     25   6  8
$ readelf -WS src/core/global.o | grep debug_info
  [ 6] .debug_info       PROGBITS        0000000000000000 002d87 002360 00      0   0  1
  [ 7] .rela.debug_info  RELA            0000000000000000 01ccb8 003180 18     25   6  8

I am debugging with Eclipse CDT. The debug build profile is identical. For example, if I rebuild from scratch via the console, Eclipse CDT does not rebuild when debugging because it is up to date. Of course, I have tried to debug both from a console build and from an Eclipse build. The Debug configuration looks al-right : application = Debug/tests/.libs/reqrep, use of GDB (DSF) with non stop mode, build configuration is Debug, Source look-up path is default.

Any idea please ?


Solution

  • As explained by n.m. , the solution is to add the LD_LIBRARY_PATH environment variable inside the debug configuration, set to the path where the library is built.

    enter image description here