gdb/1935: Gdb aborts if set solib-search-path is called after core file is loaded

prw@ceiriog1.demon.co.uk prw@ceiriog1.demon.co.uk
Tue May 3 11:08:00 GMT 2005


>Number:         1935
>Category:       gdb
>Synopsis:       Gdb aborts if set solib-search-path is called after core file is loaded
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue May 03 11:08:04 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     Peter Wainwright
>Release:        GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
>Organization:
>Environment:
Fedora Core 3, i686
>Description:
Gdb aborts if set solib-search-path is called after a
core file is loaded, since it attempts to reopen BFDs
which have been deleted.
>How-To-Repeat:
Environment: Fedora Core 3, i686.
GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".

When using DDD to open core dumps "ddd <exe-name> <core-name>",
gdb aborts here:

 445 FILE *
 446 bfd_cache_lookup_worker (bfd *abfd)
 447 {
........
 463   else
 464     {
 465       if (bfd_open_file (abfd) == NULL
 466           || abfd->where != (unsigned long) abfd->where
 467           || real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
 468         abort ();
 469     }

In bfd_open_file we find:

(gdb) print abfd->filename
$5 = 0x83fa598 "P®1\b(\200F\blinux.so.2"

Yuk!  The filename has become corrupted!

This BFD corrresponds to /lib/ld-linux.so.2; it is opened, but then
deleted here:

(gdb) i s
#0  0x00592470 in _int_free () from /lib/tls/libc.so.6
#1  0x00592afa in free () from /lib/tls/libc.so.6
#2  0x080810ef in mfree (md=0x0, ptr=0x8402c60) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/utils.c:1012
#3  0x08081208 in xmfree (md=0x0, ptr=0x65880c) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/utils.c:1111
#4  0x08081259 in xfree (ptr=0x8402c60) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/utils.c:1146
#5  0x080889e0 in free_so (so=0x656ff4) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:333
#6  0x080890fa in clear_solib () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:821
#7  0x08089128 in do_clear_solib (dummy=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:831
#8  0x0808917e in no_shared_libraries (ignored=0x0, from_tty=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:914
#9  0x08089192 in reload_shared_libraries (ignored=0x0, from_tty=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:920
#10 0x080a6ece in do_cfunc (c=0x65880c, args=0x0, from_tty=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/cli/cli-decode.c:57
#11 0x080ac619 in do_setshow_command (arg=0x81d55d7 "", from_tty=0, c=0x826bfe0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/cli/cli-setshow.c:346
#12 0x0807eec7 in execute_command (p=0x82647c6 "", from_tty=1) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:738
#13 0x080f80e3 in command_handler (command=0x82647b0 "set solib-search-path ") at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:500
#14 0x080f8793 in command_line_handler (rl=0x8c48658 "@\205Ä\b\001") at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:793
#15 0x081b71d5 in rl_callback_read_char () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/readline/callback.c:123
#16 0x080f79f3 in rl_callback_read_char_wrapper (client_data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:166
#17 0x080f7fc3 in stdin_event_handler (error=0, client_data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:416
#18 0x080f735e in handle_file_event (event_file_desc=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-loop.c:721
#19 0x080f6e28 in process_event () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-loop.c:334
#20 0x080f6e71 in gdb_do_one_event (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-loop.c:371
#21 0x0807ebcd in do_catch_errors (uiout=0x8291da8, data=0x65880c) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:524
#22 0x0807ea22 in catcher (func=0x807ebbf <do_catch_errors>, func_uiout=0x8291da8, func_args=0xbfffdb80, func_val=0xbfffdb78, func_caught=0xbfffdb7c, errstring=0x65880c "", gdberrmsg=0x0, mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:431
#23 0x0807ec05 in catch_errors (func=0x65880c <main_arena+12>, func_args=0x65880c, errstring=0x81d55d7 "", mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:536
#24 0x080b3771 in tui_command_loop (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/tui/tui-interp.c:150
#25 0x080f5126 in current_interp_command_loop () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/interps.c:277
#26 0x0807aa53 in captured_command_loop (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/main.c:97
#27 0x0807ebcd in do_catch_errors (uiout=0x8291da8, data=0x65880c) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:524
#28 0x0807ea22 in catcher (func=0x807ebbf <do_catch_errors>, func_uiout=0x8291da8, func_args=0xbfffdd20, func_val=0xbfffdd18, func_caught=0xbfffdd1c, errstring=0x65880c "", gdberrmsg=0x0, mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:431
#29 0x0807ec05 in catch_errors (func=0x65880c <main_arena+12>, func_args=0x65880c, errstring=0x81d55d7 "", mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:536
#30 0x0807b71f in captured_main (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/main.c:807
#31 0x0807ebcd in do_catch_errors (uiout=0x8243fe0, data=0x65880c) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:524
#32 0x0807ea22 in catcher (func=0x807ebbf <do_catch_errors>, func_uiout=0x8243fe0, func_args=0xbfffdfd0, func_val=0xbfffdfc8, func_caught=0xbfffdfcc, errstring=0x65880c "", gdberrmsg=0x0, mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:431
#33 0x0807ec05 in catch_errors (func=0x65880c <main_arena+12>, func_args=0x65880c, errstring=0x81d55d7 "", mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:536
#34 0x0807b747 in gdb_main (args=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/main.c:816
#35 0x0807aa40 in main (argc=6653964, argv=0x65880c) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/gdb.c:35

The trouble seems to be that DDD is issuing a command "set
solib-search-path", which causes all the loaded SOs to be deleted.  If
you do this while debugging a normal executable target, it seems that
the SOs are reloaded properly.  If you do it AFTER loading a core
file, you get a fatal error.  DDD is not really the problem here, you
can get the same effect executing the command directly from ddd after
loading a core file.

(gdb) set solib-search-path
warning: cannot close "shared object read from target memory": File in wrong format
BFD: BFD 20040607 20040606 internal error, aborting at /usr/src/build/475318-i386/BUILD/gdb+dejagnu-20040607/bfd/cache.c line 468 in bfd_cache_lookup_worker

BFD: Please report this bug.

There are still references to the deleted BFDs and these are being
accessed by xfer_memory:

(gdb) i s
#0  0x0055b566 in exit () from /lib/tls/libc.so.6
#1  0x081cc7d8 in xexit (code=1) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/libiberty/xexit.c:52
#2  0x08164606 in _bfd_abort (file=0xa <Address 0xa out of bounds>, line=6653844, fn=0xa <Address 0xa out of bounds>) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/bfd/bfd.c:709
#3  0x0819e6bf in bfd_cache_lookup_worker (abfd=0x840bb70) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/bfd/cache.c:468
#4  0x0819e184 in cache_bseek (abfd=0xa, offset=77584, whence=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/bfd/cache.c:57
#5  0x08164fa5 in bfd_seek (abfd=0x840bb70, position=warning: Unhandled dwarf expresion opcode DW_OP_piece
77584, direction=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/bfd/bfdio.c:339
#6  0x08165f7b in _bfd_generic_get_section_contents (abfd=0x840bb70, section=0x8438904, location=0xbfffd3b8, offset=warning: Unhandled dwarf expresion opcode DW_OP_piece
3568, count=4) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/bfd/libbfd.c:704
#7  0x0816793c in bfd_get_section_contents (abfd=0x840bb70, section=0x8438904, location=0xbfffd3b8, offset=3568, count=4) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/bfd/section.c:1374
#8  0x0807bf93 in xfer_memory (memaddr=5418768, myaddr=0xbfffd3b8 "ÈÓÿ¿ S\213\bxµ,\b@\231$\b\bÔÿ¿?\236\b\b\021¯R", len=4, write=0, attrib=0x824d4f4, target=0x8263600) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/exec.c:487
#9  0x0810a7f0 in do_xfer_memory (memaddr=5418768, myaddr=0xbfffd3b8 "ÈÓÿ¿ S\213\bxµ,\b@\231$\b\bÔÿ¿?\236\b\b\021¯R", len=4, write=0, attrib=0x824d4f4) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/target.c:920
#10 0x0810a906 in target_xfer_memory (memaddr=5418768, myaddr=0xbfffd3b8 "ÈÓÿ¿ S\213\bxµ,\b@\231$\b\bÔÿ¿?\236\b\b\021¯R", len=4, write=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/target.c:991
#11 0x0810a642 in target_read_string (memaddr=5418769, string=0xbfffd3f0, len=511, errnop=0xbfffd3f4) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/target.c:786
#12 0x08089e3f in svr4_current_sos () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib-svr4.c:929
#13 0x08088b4e in update_solib_list (from_tty=0, target=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:430
#14 0x08088db6 in solib_add (pattern=0x0, from_tty=0, target=0x0, readsyms=1) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:617
#15 0x080891a2 in reload_shared_libraries (ignored=0x0, from_tty=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/solib.c:921
#16 0x080a6ece in do_cfunc (c=0xa, args=0x0, from_tty=0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/cli/cli-decode.c:57
#17 0x080ac619 in do_setshow_command (arg=0x81d55d7 "", from_tty=0, c=0x826bfe0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/cli/cli-setshow.c:346
#18 0x0807eec7 in execute_command (p=0x82647c6 "", from_tty=1) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:738
#19 0x080f80e3 in command_handler (command=0x82647b0 "set solib-search-path ") at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:500
#20 0x080f8793 in command_line_handler (rl=0x8c48658 "@\205Ä\b\001") at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:793
#21 0x081b71d5 in rl_callback_read_char () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/readline/callback.c:123
#22 0x080f79f3 in rl_callback_read_char_wrapper (client_data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:166
#23 0x080f7fc3 in stdin_event_handler (error=0, client_data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-top.c:416
#24 0x080f735e in handle_file_event (event_file_desc=6653844) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-loop.c:721
#25 0x080f6e28 in process_event () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-loop.c:334
#26 0x080f6e71 in gdb_do_one_event (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/event-loop.c:371
#27 0x0807ebcd in do_catch_errors (uiout=0x8291da8, data=0xa) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:524
#28 0x0807ea22 in catcher (func=0x807ebbf <do_catch_errors>, func_uiout=0x8291da8, func_args=0xbfffdb80, func_val=0xbfffdb78, func_caught=0xbfffdb7c, errstring=0xa <Address 0xa out of bounds>, gdberrmsg=0x0, mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:431
#29 0x0807ec05 in catch_errors (func=0xa, func_args=0xa, errstring=0x81d55d7 "", mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:536
#30 0x080b3771 in tui_command_loop (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/tui/tui-interp.c:150
#31 0x080f5126 in current_interp_command_loop () at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/interps.c:277
#32 0x0807aa53 in captured_command_loop (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/main.c:97
#33 0x0807ebcd in do_catch_errors (uiout=0x8291da8, data=0xa) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:524
#34 0x0807ea22 in catcher (func=0x807ebbf <do_catch_errors>, func_uiout=0x8291da8, func_args=0xbfffdd20, func_val=0xbfffdd18, func_caught=0xbfffdd1c, errstring=0xa <Address 0xa out of bounds>, gdberrmsg=0x0, mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:431
#35 0x0807ec05 in catch_errors (func=0xa, func_args=0xa, errstring=0x81d55d7 "", mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:536
#36 0x0807b71f in captured_main (data=0x0) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/main.c:807
#37 0x0807ebcd in do_catch_errors (uiout=0x8243fe0, data=0xa) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:524
#38 0x0807ea22 in catcher (func=0x807ebbf <do_catch_errors>, func_uiout=0x8243fe0, func_args=0xbfffdfd0, func_val=0xbfffdfc8, func_caught=0xbfffdfcc, errstring=0xa <Address 0xa out of bounds>, gdberrmsg=0x0, mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:431
#39 0x0807ec05 in catch_errors (func=0xa, func_args=0xa, errstring=0x81d55d7 "", mask=6) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/top.c:536
#40 0x0807b747 in gdb_main (args=0x658794) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/main.c:816
#41 0x0807aa40 in main (argc=10, argv=0xa) at /usr/src/redhat/BUILD/gdb+dejagnu-20040607/gdb/gdb.c:35
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list