debugging system libraries

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Jun 3 11:09:04 GMT 2005


On 2005-06-03 12:21, fandino <fandino at ng.fadesa.es> wrote:
> Hello,
>
> I run an application which segsfaults in the libpthread library and I
> wonder if it could be possible enable debuging info in this libraries.
>
> By now I added "-g" to the list the global compile flags but the symbols
> are stripped by the installation script.
>
> how could I get system libraries with symbols?
>
> thank you.
>
> (gdb) bt
> #0  0x282ec31b in pthread_testcancel () from /usr/lib/libpthread.so.1
> #1  0x282e4902 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
> #2  0x00000000 in ?? ()

The best way to build something with debugging support is to set
DEBUG_FLAGS in the environment (or make.conf):

	# cd /usr/src/lib/libedit
	# make cleandir
	# make cleandir
	# make obj
	# env DEBUG_FLAGS='-g' make all install

Setting DEBUG_FLAGS adds the value of DEBUG_FLAGS to any existing CFLAGS
and disables symbol stripping, all at the same time.  Look at bsd.lib.mk
under /usr/share/mk for the way DEBUG_FLAGS works.

- Giorgos



More information about the freebsd-questions mailing list