This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

crash on invalid dwarf info


Hi,

I encountered a crash in GDB caused when trying to debug a program
with invalid Dwarf info. Before crashing, GDB emits a warning "Dwarf
Error: wrong version in compilation unit header (is 0, should be 2, 3,
or 4)" and dwarfdump has this to say:

??COMPILE_UNIT<header overall offset = 0>:
??<0>< ?218> ? ? ?DW_TAG_subprogram
??dwarfdump ERROR: ?ref formwith no ref?!: ?DW_DLE_ATTR_FORM_OFFSET_BAD (119)

I thought, before I spend time reducing a testcase, that I should
check whether there's any interest in fixing crash on invalid bugs. I
realize that it gets cumbersome to sanity check every little thing in
elf and dwarf, so it may not be worth filing a bug for it. Thoughts?

Here's the stack trace:

Program received signal SIGSEGV, Segmentation fault.
peek_die_abbrev (info_ptr=0x800057e68bb2 <Address 0x800057e68bb2 out
of bounds>, bytes_read=0x7fffffffca6c, cu=0x7fffffffcae0) at
../../src/gdb/dwarf2read.c:4120
4120 ?abbrev_number = read_unsigned_leb128 (abfd, info_ptr, bytes_read);
(top) bt
#0 ?peek_die_abbrev (info_ptr=0x800057e68bb2 <Address 0x800057e68bb2
out of bounds>, bytes_read=0x7fffffffca6c, cu=0x7fffffffcae0) at
../../src/gdb/dwarf2read.c:4120
#1 ?0x00000000005a1378 in load_partial_dies (abfd=<value optimized
out>, buffer=<value optimized out>, info_ptr=0x800057e68bb2 <Address
0x800057e68bb2 out of bounds>, building_psymtab=<value optimized out>,
cu=0x7fffffffcae0)
?? ?at ../../src/gdb/dwarf2read.c:8760
#2 ?0x00000000005a8277 in process_psymtab_comp_unit
(objfile=0x2a97dc0, this_cu=0x86aa900, buffer=0x7ffff5853740
"/\256\027", info_ptr=<value optimized out>, buffer_size=<value
optimized out>) at ../../src/gdb/dwarf2read.c:3297
#3 ?0x00000000005a8450 in dwarf2_build_psymtabs_hard
(objfile=0x2a97dc0) at ../../src/gdb/dwarf2read.c:3441
#4 ?dwarf2_build_psymtabs (objfile=0x2a97dc0) at ../../src/gdb/dwarf2read.c:2786
#5 ?0x00000000005a86b5 in dwarf2_initialize_objfile
(objfile=0x2a97dc0) at ../../src/gdb/dwarf2read.c:2770
#6 ?0x00000000004f4528 in elf_symfile_read (objfile=0x2a97dc0,
symfile_flags=<value optimized out>) at ../../src/gdb/elfread.c:891
#7 ?0x00000000005411bc in syms_from_objfile (objfile=0x2a97dc0,
addrs=0x8a3c4a0, offsets=0x0, num_offsets=0, add_flags=8) at
../../src/gdb/symfile.c:1030
#8 ?0x000000000054190b in symbol_file_add_with_addrs_or_offsets
(abfd=<value optimized out>, add_flags=8, addrs=<value optimized out>,
flags=2, num_offsets=<value optimized out>, offsets=<value optimized
out>)
?? ?at ../../src/gdb/symfile.c:1124
#9 ?0x000000000046e5d3 in solib_read_symbols (so=<value optimized
out>, flags=<value optimized out>) at ../../src/gdb/solib.c:650
#10 0x000000000046e83b in solib_add (pattern=0x0, from_tty=0,
target=<value optimized out>, readsyms=1) at ../../src/gdb/solib.c:956
#11 0x00000000005029cb in bpstat_what (bs=<value optimized out>) at
../../src/gdb/breakpoint.c:4675
#12 0x00000000005540f0 in handle_inferior_event (ecs=0x7fffffffd430)
at ../../src/gdb/infrun.c:4121
#13 0x0000000000556e69 in wait_for_inferior (treat_exec_as_sigtrap=0)
at ../../src/gdb/infrun.c:2592
#14 0x00000000005572df in proceed (addr=<value optimized out>,
siggnal=TARGET_SIGNAL_0, step=0) at ../../src/gdb/infrun.c:2118
#15 0x000000000054d041 in run_command_1 (args=0x0, from_tty=0,
tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:590
#16 0x00000000004602ed in execute_command (p=0xac3991 "", from_tty=1)
at ../../src/gdb/top.c:428
#17 0x0000000000567a28 in command_handler (command=0xac3990 "") at
../../src/gdb/event-top.c:499
#18 0x000000000056860c in command_line_handler (rl=<value optimized
out>) at ../../src/gdb/event-top.c:704
#19 0x000000000063b767 in rl_callback_read_char () at
../../src/readline/callback.c:205
#20 0x0000000000567a99 in rl_callback_read_char_wrapper
(client_data=0x800057e68bb2) at ../../src/gdb/event-top.c:177
#21 0x0000000000566498 in process_event () at ../../src/gdb/event-loop.c:402
#22 0x000000000056772a in gdb_do_one_event (data=<value optimized
out>) at ../../src/gdb/event-loop.c:467
#23 0x000000000056150b in catch_errors (func=<value optimized out>,
func_args=<value optimized out>, errstring=<value optimized out>,
mask=<value optimized out>) at ../../src/gdb/exceptions.c:521
#24 0x00000000004dbd80 in tui_command_loop (data=<value optimized
out>) at ../../src/gdb/tui/tui-interp.c:172
#25 0x0000000000456ab9 in captured_command_loop (data=0x800057e68bb2)
at ../../src/gdb/main.c:228
#26 0x000000000056150b in catch_errors (func=<value optimized out>,
func_args=<value optimized out>, errstring=<value optimized out>,
mask=<value optimized out>) at ../../src/gdb/exceptions.c:521
#27 0x0000000000457646 in captured_main (data=<value optimized out>)
at ../../src/gdb/main.c:933
#28 0x000000000056150b in catch_errors (func=<value optimized out>,
func_args=<value optimized out>, errstring=<value optimized out>,
mask=<value optimized out>) at ../../src/gdb/exceptions.c:521
#29 0x00000000004569f4 in gdb_main (args=0x7fffffffca6c) at
../../src/gdb/main.c:942
#30 0x00000000004569be in main (argc=<value optimized out>,
argv=0x7fffffffca6c) at ../../src/gdb/gdb.c:35

Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]