This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix gdb crash on some missing ELF debug info
- From: Daniel Jacobowitz <drow at false dot org>
- To: Jan Kratochvil <lace at jankratochvil dot net>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 12 Jul 2006 17:15:33 -0400
- Subject: Re: [patch] Fix gdb crash on some missing ELF debug info
- References: <20060623103735.GA28356@host0.dyn.jankratochvil.net> <20060623123913.GB16879@nevyn.them.org> <20060623130732.GA28950@host0.dyn.jankratochvil.net>
On Fri, Jun 23, 2006 at 03:07:32PM +0200, Jan Kratochvil wrote:
> 2006-06-23 Jan Kratochvil <lace@jankratochvil.net>
>
> * dwarf2read.c (dwarf2_symbol_mark_computed): Fixed later crash
> on location list reference if the ".debug_loc" section is missing.
I've committed this very similar patch (clearer comment). Thanks!
--
Daniel Jacobowitz
CodeSourcery
2006-07-12 Daniel Jacobowitz <dan@codesourcery.com>
* dwarf2read.c (dwarf2_symbol_mark_computed): Handle corrupted
or missing location list information. Suggested by Jan
Kratochvil <lace@jankratochvil.net>.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.199
diff -u -p -r1.199 dwarf2read.c
--- dwarf2read.c 14 Jun 2006 15:06:35 -0000 1.199
+++ dwarf2read.c 12 Jul 2006 21:13:13 -0000
@@ -9324,7 +9324,11 @@ static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
- if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ if ((attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ /* ".debug_loc" may not exist at all, or the offset may be outside
+ the section. If so, fall through to the complaint in the
+ other branch. */
+ && DW_UNSND (attr) < dwarf2_per_objfile->loc_size)
{
struct dwarf2_loclist_baton *baton;