Search code examples
cgcccompilationshared-librariesdebug-symbols

Enabling debug symbols in shared library using GCC


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?


Solution

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