File: dwarf2read.c Function: process_full_comp_unit Original: static_block = end_symtab_get_static_block (highpc + baseaddr, objfile, 0); /* If the comp unit has DW_AT_ranges, it may have discontiguous ranges. Also, DW_AT_ranges may record ranges not belonging to any child DIEs (such as virtual method tables). Record the ranges in STATIC_BLOCK's addrmap to help ensure it has an accurate map of pc values belonging to this comp unit. */ dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu); symtab = end_symtab_from_static_block (static_block, objfile, SECT_OFF_TEXT (objfile), 0); The pointer static_block can be NULL while iterating through the symbols. this will cause a crash of GDB. I have this patched by: static_block = end_symtab_get_static_block (highpc + baseaddr, objfile, 0); /* If the comp unit has DW_AT_ranges, it may have discontiguous ranges. Also, DW_AT_ranges may record ranges not belonging to any child DIEs (such as virtual method tables). Record the ranges in STATIC_BLOCK's addrmap to help ensure it has an accurate map of pc values belonging to this comp unit. */ // NOTE (Gerard#1#): Bug fix!!!!!! symtab = NULL; if(static_block ) { dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu); symtab = end_symtab_from_static_block (static_block, objfile, SECT_OFF_TEXT (objfile), 0); }
It would be useful to know how to trigger the bug.
The bug can be triggered if you take an ARM build and load a file created with the RealView compiler from ELF. I could send you such file but you also need another patch to solve another bug in the same file which takes care of the path separators, a bug which is for ages in GDB. The previous versions always go right because the NULL_POINTER was tested and now it is used without test which will give a crash instantly if I try to set a breakpoint. The 7.5.1 version is, with the modifications I did, working fine. Regards Gerard
The bug can be triggered if you take an ARM build and load a file created with the RealView compiler from ARM. I could send you such file but you also need another patch to solve another bug in the same file which takes care of the path separators, a bug which is for ages in GDB. The previous versions always go right because the NULL_POINTER was tested and now it is used without test which will give a crash instantly if I try to set a breakpoint. The 7.5.1 version is, with the modifications I did, working fine. Regards Gerard
(In reply to comment #3) > The bug can be triggered if you take an ARM build and load a file created with > the RealView compiler from ARM. > > I could send you such file but you also need another patch to solve another bug > in the same file which takes care of the path separators, a bug which is for > ages in GDB. If you could attach a small one, that would be helpful. I am mostly concerned about how to write a regression test for this. So I'd want to inspect the DWARF to see what is confusing gdb. Could you please file the path separator thing, plus your patch, as a separate bug?
*** Bug 15325 has been marked as a duplicate of this bug. ***
*** Bug 15343 has been marked as a duplicate of this bug. ***
There is a patch pending: http://sourceware.org/ml/gdb-patches/2013-04/msg00171.html
CVSROOT: /cvs/src Module name: src Changes by: tromey@sourceware.org 2013-04-25 16:25:37 Modified files: gdb : ChangeLog dwarf2read.c gdb/testsuite : ChangeLog Added files: gdb/testsuite/gdb.dwarf2: nostaticblock.exp Log message: PR corefiles/14983: * dwarf2read.c (process_full_comp_unit): Always create a static block. gdb/testsuite * gdb.dwarf2/nostaticblock.exp: New file. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15474&r2=1.15475 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.788&r2=1.789 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3638&r2=1.3639 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/nostaticblock.exp.diff?cvsroot=src&r1=NONE&r2=1.1
Fix checked in.