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?
When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g.
Enabling debug symbolsChoose Project > Properties > QNX C/C++ Project. In the Build Variants tab, expand the listings for all architectural variants that you want to build. Check the debug boxes for all variants that you want to debug. Click OK to confirm the settings and exit the properties window.
To add additional symbols you might use add-symbol-file . The add-symbol-file command reads additional symbol table information from the file filename. You would use this command when filename has been dynamically loaded (by some other means) into the program that is running.
You need to use -g
for all the steps (compiling your source files and linking).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With