Enabling debug symbols in shared library using GCC

Alphaneo picture Alphaneo · May 15, 2009 · Viewed 23.1k times · Source

I am creating a shared library using gcc and suspect that there may be some memory leaks from the shared library. To debug, I need to enable debug symbols when creating the shared library.

To build, I am using gcc -g ... (-g is for enabling debug information)

But the library (*.so file) size is not changing for both -g, and without -g. Besides, I am not getting any useful information from tools like VALGRIND.

Can anyone point me the mistake?

Answer

lothar picture lothar · May 15, 2009

You need to use -g for all the steps (compiling your source files and linking).