Bug 15338 - Assertion `dwarf2_per_objfile->ranges.readin' failed
Summary: Assertion `dwarf2_per_objfile->ranges.readin' failed
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 critical
Target Milestone: 7.7
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-04 08:44 UTC by Joshua Naismith
Modified: 2013-05-13 16:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
patch (514 bytes, patch)
2013-04-10 15:00 UTC, Tom Tromey
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Naismith 2013-04-04 08:44:57 UTC
This bug makes it impossible to debug crashes of ASAN instrumented binaries in Eclipse (gdb asserts on segfaults). It's present in 7.4 as well as the latest CVS revision.

Steps to reproduce:

1. Download and unpack https://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux64-asan/1365041687/firefox-23.0a1.en-US.linux-x86_64-asan.tar.bz2 (396 MB)
2. In shell, navigate to the directory and run:
gdb ./firefox-bin
3. In gdb shell, type "run" and press enter.
4. Wait for the browser to open.
5. In the browser, open https://bugzilla.mozilla.org/attachment.cgi?id=698225
In gdb, you should see:

Program received signal SIGSEGV, Segmentation fault.
0x00007fffecf22a5c in Length (this=<optimized out>) at ../../dist/include/nsTArray.h:353
353	../../dist/include/nsTArray.h: No such file or directory.

6. In gdb shell, type "info threads" and press enter. You should see:

  Id   Target Id         Frame 
  65   Thread 0x7fffa8be2700 (LWP 2185) "mozStorage #11" 
/build/buildd/gdb-7.4-2012.04/gdb/dwarf2read.c:6860: internal-error: dwarf2_record_block_ranges: Assertion `dwarf2_per_objfile->ranges.readin' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
Comment 1 Tom Tromey 2013-04-10 15:00:24 UTC
Created attachment 6975 [details]
patch

Please try this patch.

I didn't try your test case.
However, it seems that we can enter dwarf2_record_block_ranges
without first having called dwarf2_ranges_read, which is
the only spot that maps the section.
Changing dwarf2_record_block_ranges to map the section seems safe...
Comment 2 Joshua Naismith 2013-04-10 17:02:26 UTC
Thanks, Tom. I can't reproduce the problem with your patch applied.
Comment 3 Tom Tromey 2013-04-15 19:53:59 UTC
Is there any chance you could make a stack trace of the
crashing gdb?  Pedro asked for it for documentation purposes.
Comment 4 Joshua Naismith 2013-04-15 21:37:08 UTC
#0  0x00007ffff6d788a0 in read () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff6d0cff8 in _IO_file_underflow () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff6d0e03e in _IO_default_uflow () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff6d049cd in getc () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00000000005ec5b0 in defaulted_query (ctlstr=<optimized out>, defchar=0 '\000', args=<optimized out>) at /gdb/gdb/utils.c:1269
#5  0x00000000005ec76e in query (ctlstr=<optimized out>) at /gdb/gdb/utils.c:1373
#6  0x00000000005ec97e in internal_vproblem (ap=<optimized out>, fmt=<optimized out>, line=<optimized out>, file=<optimized out>, problem=0xacf540 <internal_error_problem>)
    at /gdb/gdb/utils.c:777
#7  internal_vproblem (problem=0xacf540 <internal_error_problem>, file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=<optimized out>) at /gdb/gdb/utils.c:709
#8  0x00000000005ecb09 in internal_verror (file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=<optimized out>) at /gdb/gdb/utils.c:833
#9  0x00000000005ecba2 in internal_error (file=<optimized out>, line=<optimized out>, string=<optimized out>) at /gdb/gdb/utils.c:843
#10 0x0000000000582932 in dwarf2_record_block_ranges (die=0x142ecc80, block=0x143b2530, baseaddr=140737332412416, cu=0x13fd1ac0) at /gdb/gdb/dwarf2read.c:10480
#11 0x00000000005882b6 in read_func_scope (cu=0x13fd1ac0, die=<optimized out>) at /gdb/gdb/dwarf2read.c:9712
#12 process_die (die=<optimized out>, cu=0x13fd1ac0) at /gdb/gdb/dwarf2read.c:7308
#13 0x0000000000589953 in read_lexical_block_scope (die=0x142ecc30, cu=0x13fd1ac0) at /gdb/gdb/dwarf2read.c:9773
#14 0x0000000000587c8b in process_die (die=0x142ecc30, cu=0x13fd1ac0) at /gdb/gdb/dwarf2read.c:7313
#15 0x000000000058744b in read_func_scope (cu=0x13fd1ac0, die=0x142eca50) at /gdb/gdb/dwarf2read.c:9668
#16 process_die (die=0x142eca50, cu=0x13fd1ac0) at /gdb/gdb/dwarf2read.c:7308
#17 0x0000000000587043 in read_file_scope (cu=0x13fd1ac0, die=0x142d2630) at /gdb/gdb/dwarf2read.c:8117
#18 process_die (die=0x142d2630, cu=0x13fd1ac0) at /gdb/gdb/dwarf2read.c:7301
#19 0x000000000058ba15 in process_full_comp_unit (pretend_language=<optimized out>, per_cu=<optimized out>) at /gdb/gdb/dwarf2read.c:7101
#20 process_queue () at /gdb/gdb/dwarf2read.c:6668
#21 dw2_do_instantiate_symtab (per_cu=<optimized out>) at /gdb/gdb/dwarf2read.c:2295
#22 0x000000000058ca17 in dwarf2_read_symtab (self=0x2f176d0, objfile=0xb92a8e0) at /gdb/gdb/dwarf2read.c:6557
#23 0x00000000004fe441 in psymtab_to_symtab (objfile=<optimized out>, pst=0x2f176d0) at /gdb/gdb/psymtab.c:779
#24 0x00000000004ff50b in find_pc_sect_symtab_from_partial (objfile=0xb92a8e0, msymbol=0x24ee778, pc=<optimized out>, section=0x0, warn_if_readin=1) at /gdb/gdb/psymtab.c:391
#25 0x00000000004fa5e9 in find_pc_sect_symtab (pc=140737332762159, section=0x0) at /gdb/gdb/symtab.c:2166
#26 0x00000000004f69c9 in call_site_for_pc (gdbarch=0xc500a0, pc=140737332762160) at /gdb/gdb/block.c:204
#27 0x000000000059eabb in call_site_find_chain_1 (callee_pc=140737349717184, caller_pc=140737332762160, gdbarch=0xc500a0) at /gdb/gdb/dwarf2loc.c:865
#28 call_site_find_chain (gdbarch=0xc500a0, caller_pc=140737332762160, callee_pc=140737349717380) at /gdb/gdb/dwarf2loc.c:976
#29 0x00000000005a4984 in dwarf2_tailcall_sniffer_first (this_frame=0xa488420, tailcall_cachep=0xa488510, entry_cfa_sp_offsetp=0x7fffffffdba8) at /gdb/gdb/dwarf2-frame-tailcall.c:392
#30 0x00000000005a392f in dwarf2_frame_cache (this_frame=0xa488420, this_cache=<optimized out>) at /gdb/gdb/dwarf2-frame.c:1236
#31 0x00000000005a3f43 in dwarf2_frame_sniffer (self=0x7687e0 <dwarf2_frame_unwind>, this_frame=0xa488420, this_cache=0xa488438) at /gdb/gdb/dwarf2-frame.c:1414
#32 0x00000000005f47c9 in frame_unwind_find_by_frame (this_frame=0xa488420, this_cache=0xa488438) at /gdb/gdb/frame-unwind.c:112
#33 0x00000000005f1731 in get_frame_type (frame=0xa488420) at /gdb/gdb/frame.c:2228
#34 0x00000000005242b8 in print_frame_info (frame=0xa488420, print_level=0, print_what=LOCATION, print_args=1) at /gdb/gdb/stack.c:767
#35 0x000000000052488e in print_stack_frame (frame=0xa488420, print_level=0, print_what=LOCATION) at /gdb/gdb/stack.c:166
#36 0x000000000052978b in print_thread_info (uiout=0xbfd1d0, requested_threads=0x0, pid=-1) at /gdb/gdb/thread.c:909
#37 0x00000000005e874a in execute_command (p=<optimized out>, from_tty=1) at /gdb/gdb/top.c:488
#38 0x00000000005330c5 in command_handler (command=0xafb6c0 "info threads") at /gdb/gdb/event-top.c:432
#39 0x0000000000533b2c in command_line_handler (rl=<optimized out>) at /gdb/gdb/event-top.c:630
#40 0x000000000062f2c9 in rl_callback_read_char () at /gdb/readline/callback.c:220
#41 0x0000000000533139 in rl_callback_read_char_wrapper (client_data=<optimized out>) at /gdb/gdb/event-top.c:164
#42 0x0000000000532333 in process_event () at /gdb/gdb/event-loop.c:342
#43 process_event () at /gdb/gdb/event-loop.c:314
#44 0x00000000005326f8 in gdb_do_one_event () at /gdb/gdb/event-loop.c:406
#45 0x0000000000532895 in start_event_loop () at /gdb/gdb/event-loop.c:431
#46 0x000000000052bcf3 in captured_command_loop (data=<optimized out>) at /gdb/gdb/main.c:259
#47 0x000000000052a8ab in catch_errors (func=0x52bce0 <captured_command_loop>, func_args=0x0, errstring=0x6eb6ca "", mask=6) at /gdb/gdb/exceptions.c:546
#48 0x000000000052c65e in captured_main (data=<optimized out>) at /gdb/gdb/main.c:1053
#49 0x000000000052a8ab in catch_errors (func=0x52bff0 <captured_main>, func_args=0x7fffffffe170, errstring=0x6eb6ca "", mask=6) at /gdb/gdb/exceptions.c:546
#50 0x000000000052d004 in gdb_main (args=<optimized out>) at /gdb/gdb/main.c:1062
#51 0x0000000000407f5e in main (argc=<optimized out>, argv=<optimized out>) at /gdb/gdb/gdb.c:34
Comment 5 Tom Tromey 2013-05-13 16:57:37 UTC
Fixed.