5

I'm testing a library from a third party and it crashes. When I wanted to see the reason of the crash my gdb told me that there were no debugging symbols available

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb53ffb70 (LWP 3722)]
0x00172a89 in tsip_transac_send () from /usr/local/lib/libtinySIP.so.0

I issued bt full on the gdb console and I get a series of lines like below

#0  0x00172a89 in tsip_transac_send () from /usr/local/lib/libtinySIP.so.0
No symbol table info available

I recompiled the library after checking the CFLAGS in the Makefile. The values were fine all the time but I recompiled it anyway

CFLAGS = -g -O2

I ran the test again with the same luck, no debug symbols for the shared library.

What am I missing here?

I'm using Centos 6.0, and I installed the library in Opensuse before but I didn't have this problem. It probably has something to do with my Centos installation.

In case anyone cares, I'm testing Doubango's library for webrtc2sip.

EDIT: Debug symbols are being loaded properly

(gdb) info sharedlibrary
From        To          Syms Read   Shared Object Library
0x002fb830  0x0031339f  Yes (*)     /lib/ld-linux.so.2
0x00115040  0x00120028  Yes         /usr/local/lib/libtinySAK.so.0
0x00133f30  0x0018b378  Yes         /usr/local/lib/libtinySIP.so.0
0x001d8ac0  0x00201b98  Yes         /usr/local/lib/libtinyNET.so.0
0x00215dd0  0x0023f638  Yes         /usr/local/lib/libtinyDAV.so.0
0x0024eec0  0x00261728  Yes         /usr/local/lib/libtinyMEDIA.so.0
0x0026bb00  0x002774d8  Yes         /usr/local/lib/libtinyHTTP.so.0
0x002ae340  0x002b0358  Yes         /usr/local/lib/libtinyXCAP.so.0
0x002b3990  0x002b8d18  Yes         /usr/local/lib/libtinySMS.so.0
0x002be630  0x002c9388  Yes         /usr/local/lib/libtinyMSRP.so.0
0x002de240  0x002e8e18  Yes         /usr/local/lib/libtinySDP.so.0
0x00323060  0x00345778  Yes         /usr/local/lib/libtinyRTP.so.0
caruizdiaz
  • 163
  • 1
  • 2
  • 10
  • I suggest you run `file` on the library, to see if it was stripped when it was installed. – Hasturkun Feb 07 '13 at 15:31
  • /usr/local/lib/libtinySIP.so.0.0.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped – caruizdiaz Feb 07 '13 at 17:35
  • This is post maybe be helpful. -> [GDB says “no symbol table,” but nm shows file has debug symbols][1] [1]: http://stackoverflow.com/questions/19229882/gdb-says-no-symbol-table-but-nm-shows-file-has-debug-symbols – xjzhou Dec 30 '14 at 03:50

3 Answers3

3

Check file /usr/local/lib/libtinySIP.so.0. If it says stripped, check your lib's build process. It may invoke strip manually to strip the debugging symbols.

afflux
  • 151
  • 4
  • It is not stripped: /usr/local/lib/libtinySIP.so.0.0.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped – caruizdiaz Feb 07 '13 at 17:43
3

Well, it looks like it was a bug in gdb.

Centos 6 has the version 7.2-56.el6 precompiled in its repository. I updated (by compiling the sources) to the latest version of gdb and now it is working.

Thanks to all for your help.

caruizdiaz
  • 163
  • 1
  • 2
  • 10
  • 5
    Is this a known bug on the gdb bug tracker? Which version is it fixed in? Which versions is it a problem in? – danio Nov 13 '14 at 09:50
-3

It appears you have conflicting compilation flags. I'm not an expert but it looks like your -g flag (which is to generate debug symbols) is being mixed with -O2 flag (which is an optimization parameter).

Try using just -g and post the results.

Tyler Jandreau
  • 4,245
  • 1
  • 22
  • 47
  • I modified the Makefile to remove the -O2 but it is still used somehow. I then created a program that intentionally segfaults and I compliled it with "-g -O2" and I was able to debug throughout the source code. It seems like the -O2 is not causing the problem. – caruizdiaz Feb 07 '13 at 17:47
  • I managed to remove the -O2 optimization parameter. Still the same I'm afraid :( – caruizdiaz Feb 07 '13 at 17:58