Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compiling glibc from source with debug symbols

I need to compile glibc from source with debug symbols .

  1. Where do i specify the '-g' option for this
  2. How do i later make a sample code link to this particular glibc rather than the one installed on my system?
like image 380
woodstok Avatar asked Apr 13 '12 09:04

woodstok


2 Answers

I need to compile glibc from source with debug symbols

You will have hard time compiling glibc without debug symbols. A default ./configure && make will have -g on compile line.

How do i later make a sample code link to this particular glibc rather than the one installed on my system?

This is somewhat tricky, and answered here.

like image 182
Employed Russian Avatar answered Sep 28 '22 09:09

Employed Russian


It is probably a matter of configure tricks. First, try configure --help and then, either configure --enable-debug or perhaps configure CC='gcc -g' or even configure CFLAGS='-g'

For your sample code, perhaps consider playing LD_LIBRARY_PATH or LD_PRELOAD tricks (assuming linking to dynamic library).

But be very careful, since the Glibc is the cornerstone of Gnu/Linux like systems.

like image 35
Basile Starynkevitch Avatar answered Sep 28 '22 08:09

Basile Starynkevitch