This is the mail archive of the gdb-patches@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]

Re: [patch] Fix gdb crash on some missing ELF debug info


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;
 


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