core dump loading symbols

Fergal Daly fergal@esatclear.ie
Fri Jun 11 13:04:00 GMT 2004


Hi,

I filed a bug yesterday relating to gdb dumping core when reading the
symbols from my .so. I thought I might have a go at tracking down the
problem. So, I've managed to step all the way through gdb's symbol loading
code until just before the segfault. It's at

linker.c:1794

if I try to step again I get

0x001bfe43 in __underflow () from /lib/tls/libc.so.6

which seems to be the problem although I don't know what is underflowing in
this code

1789                      abort ();
1790                    }
1791
1792                  /* Ignore a redefinition of an absolute symbol to the
1793                     same value; it's harmless.  */
1794                  if (h->type == bfd_link_hash_defined
1795                      && bfd_is_abs_section (msec)
1796                      && bfd_is_abs_section (section)
1797                      && value == mval)
1798                    break;

Any advice? A full stacktrace is below.

I notice gdb is compiled with -O2 and I couldn't see any easy way of turning
that off? Is it possible or does it need -O2?

Fergal

#0  _bfd_generic_link_add_one_symbol (info=0xfef84460, abfd=0xa25c318, 
    name=0xf6aeb9b2 "@System@ChDir", flags=171183376, section=0xa2a71ac, 
    value=2368, string=0x0, copy=0, collect=0, hashp=0xfef84368)
    at ../../bfd/linker.c:1794
#1  0x0819c425 in generic_link_add_symbol_list (abfd=0xa25c318, 
    info=0xfef84460, symbol_count=171183376, symbols=0xa4123c8, collect=0)
    at ../../bfd/linker.c:1293
#2  0x0819be61 in generic_link_add_object_symbols (abfd=0xa25c318, 
    info=0xfef84460, collect=0) at ../../bfd/linker.c:797
#3  0x0819be29 in generic_link_add_symbols (abfd=0xa2a71ac, info=0xfef84460, 
    collect=2324) at ../../bfd/linker.c:766
#4  0x0819bd9f in _bfd_generic_link_add_symbols (abfd=0xa25c318, 
    info=0xfef84460) at ../../bfd/linker.c:726
#5  0x08164f3f in bfd_simple_get_relocated_section_contents (abfd=0xa25c318, 
    sec=0xa2a78e4, outbuf=0xf62d3008 "", symbol_table=0x0)
    at ../../bfd/simple.c:212
#6  0x080e128b in symfile_relocate_debug_section (abfd=0xa25c318, 
    sectp=0xa2a78e4, buf=0x0) at ../../gdb/symfile.c:3522
#7  0x08113ebd in elfstab_build_psymtabs (objfile=0xa3269d0, mainline=0, 
    stabsect=0xa2a78e4, stabstroffset=7694048, stabstrsize=5250665)
    at ../../gdb/dbxread.c:3448
#8  0x081177b3 in elf_symfile_read (objfile=0xa3269d0, mainline=0)
    at ../../gdb/elfread.c:572
#9  0x080de2b8 in syms_from_objfile (objfile=0xa3269d0, addrs=0xa079ac8, 
    offsets=0xa2c39ac, num_offsets=0, mainline=0, verbo=1)
    at ../../gdb/symfile.c:713
#10 0x080de6a9 in symbol_file_add_with_addrs_or_offsets (abfd=0x1, from_tty=1, 
    addrs=0xa079ac8, offsets=0x0, num_offsets=0, mainline=0, flags=8)
    at ../../gdb/symfile.c:829
#11 0x080de8d6 in symbol_file_add_from_bfd (abfd=0xa25c318, from_tty=1, 
    addrs=0xa079ac8, mainline=0, flags=8) at ../../gdb/symfile.c:923
#12 0x08088637 in symbol_add_stub (arg=0xa0775b0) at ../../gdb/solib.c:362
#13 0x0807e612 in do_catch_errors (uiout=0xa047cd8, data=0xa340d10)
    at ../../gdb/top.c:524
#14 0x0807e500 in catcher (
    func=0x807e604 <do_catch_errors at ../../gdb/top.c:522>, 
    func_uiout=0xa047cd8, func_args=0xfef84840, func_val=0xfef84838, 
    func_caught=0xfef8483c, errstring=0xa340d10 "", gdberrmsg=0x0, mask=6)
    at ../../gdb/top.c:431
#15 0x0807e64a in catch_errors (func=0xa340d10, func_args=0xa340d10, 
    errstring=0x81c81e0 "Error while reading shared library symbols:\n", 
    mask=6) at ../../gdb/top.c:536
#16 0x08088915 in solib_add (pattern=0x0, from_tty=1, target=0x82597c0, 
    readsyms=1) at ../../gdb/solib.c:589
#17 0x080e8ac8 in attach_command (args=0xfefcd68d "28319", from_tty=1)
    at ../../gdb/infcmd.c:1897
#18 0x0807e66d in do_captured_command (data=0xa340d10) at ../../gdb/top.c:554
#19 0x0807e612 in do_catch_errors (uiout=0xa047cd8, data=0xa340d10)
    at ../../gdb/top.c:524
#20 0x0807e500 in catcher (
    func=0x807e604 <do_catch_errors at ../../gdb/top.c:522>, 
    func_uiout=0xa047cd8, func_args=0xfef84a10, func_val=0xfef84a08, 
    func_caught=0xfef84a0c, errstring=0xa340d10 "", gdberrmsg=0x0, mask=6)
    at ../../gdb/top.c:431
#21 0x0807e64a in catch_errors (func=0xa340d10, func_args=0xa340d10, 
    errstring=0x81cbf38 "", mask=6) at ../../gdb/top.c:536
#22 0x0807e6ae in catch_command_errors (command=0xa340d10, arg=0xa340d10 "", 
    from_tty=171183376, mask=6) at ../../gdb/top.c:574
#23 0x0807af12 in captured_main (data=0x0) at ../../gdb/main.c:684
#24 0x0807e612 in do_catch_errors (uiout=0x823a1c0, data=0xa340d10)
    at ../../gdb/top.c:524
#25 0x0807e500 in catcher (
    func=0x807e604 <do_catch_errors at ../../gdb/top.c:522>, 
    func_uiout=0x823a1c0, func_args=0xfef84ce0, func_val=0xfef84cd8, 
    func_caught=0xfef84cdc, errstring=0xa340d10 "", gdberrmsg=0x0, mask=6)
    at ../../gdb/top.c:431
#26 0x0807e64a in catch_errors (func=0xa340d10, func_args=0xa340d10, 
    errstring=0x81cbf38 "", mask=6) at ../../gdb/top.c:536
#27 0x0807b377 in gdb_main (args=0xa2a71ac) at ../../gdb/main.c:814
#28 0x0807a70b in main (argc=171183376, argv=0xa340d10) at ../../gdb/gdb.c:35



More information about the Gdb mailing list