Re: [0/4] RFC: add DWARF index support

Paul Pluzhnikov
2010-07-22T04:28:35Z

On Tue, Jul 13, 2010 at 1:42 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
>
> Tom> This patch series adds support for a DWARF index to gdb.

I am seeing crashes in code which appears to have been committed in this patch:

(top) r
warning: no loadable sections found in added symbol-file
/usr/lib/debug/lib/ld-2.7.so
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
GNU gdb (GDB) 7.2.50.20100722-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/google/fortuneseeker...done.
(gdb) b eventmanager::TaskInfo::GetThreadState

Program received signal SIGSEGV, Segmentation fault.
0x0000000000582ce5 in process_full_comp_unit (per_cu=0x2c9c640) at
../../src/gdb/dwarf2read.c:4106
4106 baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
(top) p objfile
$9 = (struct objfile *) 0x0
(top) p *per_cu
$10 = {offset = 603943, length = 425, queued = 1, load_all_dies = 0,
from_debug_types = 1, cu = 0x47cec30, type_hash = 0x0, objfile = 0x0,
v = {psymtab = 0x2710fe0, quick = 0x2710fe0}}

I've briefly perused dwarf2read.c, and didn't find a place that
insures that per_cu->objfile is initialized :-(

Clues appreciated.

(top) bt
#0 0x0000000000582ce5 in process_full_comp_unit (per_cu=0x2c9c640)
at ../../src/gdb/dwarf2read.c:4106
#1 0x00000000005828a7 in process_queue (objfile=0xd09a40)
at ../../src/gdb/dwarf2read.c:3943

... Note: objfile here is not NULL, and is the "fortuneseeker"
executable I am debugging...

#2 0x000000000057d6c6 in dw2_do_instantiate_symtab (
objfile=0xd09a40, per_cu=0x2c9c640)
at ../../src/gdb/dwarf2read.c:1582
#3 0x0000000000582aaf in psymtab_to_symtab_1 (pst=0x2710fe0)
at ../../src/gdb/dwarf2read.c:4019
#4 0x0000000000582775 in dwarf2_psymtab_to_symtab (pst=0x2710fe0)
at ../../src/gdb/dwarf2read.c:3900
#5 0x000000000050f8e6 in psymtab_to_symtab (pst=0x2710fe0)
at ../../src/gdb/psymtab.c:531
#6 0x000000000050f59b in lookup_symbol_aux_psymtabs (
objfile=0xd09a40, block_index=0,
name=0x7fffffffd020 "eventmanager::TaskInfo",
domain=STRUCT_DOMAIN) at ../../src/gdb/psymtab.c:418
#7 0x0000000000508c60 in lookup_symbol_aux_quick (objfile=0xd09a40,
kind=0, name=0x7fffffffd020 "eventmanager::TaskInfo",
domain=STRUCT_DOMAIN) at ../../src/gdb/symtab.c:1387
#8 0x0000000000508e9d in lookup_symbol_global (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN) at ../../src/gdb/symtab.c:1505
#9 0x00000000006081b2 in lookup_symbol_file (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN, anonymous_namespace=0)
at ../../src/gdb/cp-namespace.c:528
#10 0x0000000000607ba6 in cp_lookup_symbol_in_namespace (
namespace=0x7fffffffce40 "",
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN) at ../../src/gdb/cp-namespace.c:261
#11 0x000000000060810e in lookup_namespace_scope (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN, scope=0x7779c9 "", scope_len=0)
at ../../src/gdb/cp-namespace.c:495
#12 0x0000000000607b2c in cp_lookup_symbol_nonlocal (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN) at ../../src/gdb/cp-namespace.c:243
#13 0x0000000000508762 in lookup_symbol_aux (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN, language=language_cplus,
is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:1170
#14 0x0000000000508537 in lookup_symbol_in_language (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN, lang=language_cplus,
is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:1077
#15 0x000000000050859a in lookup_symbol (
name=0x7fffffffd020 "eventmanager::TaskInfo", block=0x0,
domain=STRUCT_DOMAIN, is_a_field_of_this=0x0)
at ../../src/gdb/symtab.c:1091
#16 0x000000000051d53e in lookup_prefix_sym (argptr=0x7fffffffd4c0,
p=0xb4422a "GetThreadState") at ../../src/gdb/linespec.c:1522
#17 0x000000000051cc48 in decode_compound (argptr=0x7fffffffd4c0,
funfirstline=1, canonical=0x7fffffffd588,
saved_arg=0xb44212 "eventmanager::TaskInfo::GetThreadState",
p=0xb44238 "", not_found_ptr=0x7fffffffd5b4)
at ../../src/gdb/linespec.c:1337
#18 0x000000000051bd16 in decode_line_1 (argptr=0x7fffffffd4c0,
funfirstline=1, default_symtab=0x0, default_line=0,
canonical=0x7fffffffd588, not_found_ptr=0x7fffffffd5b4)
at ../../src/gdb/linespec.c:800
#19 0x00000000004d28d2 in parse_breakpoint_sals (
address=0x7fffffffd4c0, sals=0x7fffffffd540,
addr_string=0x7fffffffd588, not_found_ptr=0x7fffffffd5b4)
at ../../src/gdb/breakpoint.c:7250
#20 0x00000000004d2b29 in do_captured_parse_breakpoint (ui=0xcdc7f0,
data=0x7fffffffd510) at ../../src/gdb/breakpoint.c:7320
#21 0x000000000053b5d1 in catch_exception (uiout=0xcdc7f0,
func=0x4d2aed <do_captured_parse_breakpoint>,
func_args=0x7fffffffd510, mask=6)
at ../../src/gdb/exceptions.c:468
#22 0x00000000004d32a4 in create_breakpoint (gdbarch=0xcf5e20,
arg=0xb4422a "GetThreadState", cond_string=0x0, thread=0,
parse_condition_and_thread=1, tempflag=0,
type_wanted=bp_breakpoint, ignore_count=0,
pending_break_support=AUTO_BOOLEAN_AUTO, ops=0x0, from_tty=0,
enabled=1) at ../../src/gdb/breakpoint.c:7502
#23 0x00000000004d39ef in break_command_1 (
arg=0xb44212 "eventmanager::TaskInfo::GetThreadState", flag=0,
from_tty=0) at ../../src/gdb/breakpoint.c:7723
#24 0x00000000004d3b83 in break_command (
arg=0xb44212 "eventmanager::TaskInfo::GetThreadState",
from_tty=0) at ../../src/gdb/breakpoint.c:7795
#25 0x000000000048d460 in do_cfunc (c=0xb87870,
args=0xb44212 "eventmanager::TaskInfo::GetThreadState",
from_tty=0) at ../../src/gdb/cli/cli-decode.c:67
#26 0x0000000000490306 in cmd_func (cmd=0xb87870,
args=0xb44212 "eventmanager::TaskInfo::GetThreadState",
from_tty=0) at ../../src/gdb/cli/cli-decode.c:1771
#27 0x0000000000412d86 in execute_command (p=0xb44237 "e",
from_tty=1) at ../../src/gdb/top.c:422
#28 0x00000000005430b7 in command_handler (
command=0xb44210 "b eventmanager::TaskInfo::GetThreadState")
at ../../src/gdb/event-top.c:498
#29 0x000000000054365b in command_line_handler (
rl=0xbbc4e0 " \257\326") at ../../src/gdb/event-top.c:702
#30 0x000000000064da01 in rl_callback_read_char ()
at ../../src/readline/callback.c:205
#31 0x0000000000542711 in rl_callback_read_char_wrapper (
client_data=0x0) at ../../src/gdb/event-top.c:178
#32 0x0000000000542fb0 in stdin_event_handler (error=0,
client_data=0x0) at ../../src/gdb/event-top.c:433
#33 0x00000000005417a1 in handle_file_event (data=...)
at ../../src/gdb/event-loop.c:817
#34 0x0000000000540e0d in process_event ()
at ../../src/gdb/event-loop.c:399
#35 0x0000000000540eed in gdb_do_one_event (data=0x0)
at ../../src/gdb/event-loop.c:464
#36 0x000000000053b77f in catch_errors (
func=0x540e22 <gdb_do_one_event>, func_args=0x0,
errstring=0x75ad6f "", mask=6) at ../../src/gdb/exceptions.c:518
#37 0x00000000004a39ff in tui_command_loop (data=0x0)
at ../../src/gdb/tui/tui-interp.c:171
#38 0x000000000053bf27 in current_interp_command_loop ()
at ../../src/gdb/interps.c:291
#39 0x0000000000408cd7 in captured_command_loop (data=0x0)
at ../../src/gdb/main.c:227
#40 0x000000000053b77f in catch_errors (
func=0x408cc6 <captured_command_loop>, func_args=0x0,
errstring=0x737f3f "", mask=6) at ../../src/gdb/exceptions.c:518
#41 0x0000000000409c02 in captured_main (data=0x7fffffffdb80)
at ../../src/gdb/main.c:910
#42 0x000000000053b77f in catch_errors (
func=0x408d09 <captured_main>, func_args=0x7fffffffdb80,
errstring=0x737f3f "", mask=6) at ../../src/gdb/exceptions.c:518
#43 0x0000000000409c35 in gdb_main (args=0x7fffffffdb80)
at ../../src/gdb/main.c:919
#44 0x0000000000408a20 in main (argc=2, argv=0x7fffffffdc88)
at ../../src/gdb/gdb.c:34

--
Paul Pluzhnikov