This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix gdb crash when setting breakpoint in assembler file compiled by ARM tool chain
- From: Andreas Kaufmann <Andreas dot Kaufmann at synopsys dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: Kai Schuetz <Kai dot Schuetz at synopsys dot com>
- Date: Mon, 8 Apr 2013 08:25:10 +0000
- Subject: [PATCH] Fix gdb crash when setting breakpoint in assembler file compiled by ARM tool chain
Hi!
Here is a patch to fix gdb crash when setting breakpoint in assembler file compiled by ARM tool chain. The detailed problem description and a test case (including elf-file) can be found here:
http://sourceware.org/bugzilla/show_bug.cgi?id=15343
The problem happens in dwarf2read.c file, process_full_comp_unit() function. Please see the following code:
static_block
= end_symtab_get_static_block (highpc + baseaddr, objfile, 0,
per_cu->imported_symtabs != NULL);
/* 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 function ' end_symtab_get_static_block()' returns NULL and then gdb crashes inside dwarf2_record_block_ranges() function.
First, I tried a patch proposed here:
http://sourceware.org/bugzilla/show_bug.cgi?id=14983
It fixed the crash, however, gdb still issued a lot of internal error messages.
It looks like gdb needs non-NULL 'symtab' in this case. The proposed patch forces creation of 'static_block' inside ' end_symtab_get_static_block'.
Andreas
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.755.2.1
diff -u -p -r1.755.2.1 dwarf2read.c
--- dwarf2read.c 1 Apr 2013 21:11:31 -0000 1.755.2.1
+++ dwarf2read.c 8 Apr 2013 07:00:07 -0000
@@ -7012,8 +7012,7 @@ process_full_comp_unit (struct dwarf2_pe
get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
static_block
- = end_symtab_get_static_block (highpc + baseaddr, objfile, 0,
- per_cu->imported_symtabs != NULL);
+ = end_symtab_get_static_block (highpc + baseaddr, objfile, 0, 1);
/* 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