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 12:37:35PM +0200, Jan Kratochvil wrote:
> 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	23 Jun 2006 10:28:44 -0000
> @@ -9324,7 +9324,9 @@ 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)
> +      /* DW_UNSND (attr) != 0 would produce non-zero bogus ->size & ->data */
> +      && dwarf2_per_objfile->loc_size)
>      {
>        struct dwarf2_loclist_baton *baton;
>  

The idea is definitely right - thanks!  The patch could be a bit
better:

- We really ought to check that it fits within .debug_loc while we're
here.
- Comment formatting - comments should end with a period and two
spaces.
- And I really can't figure out what what you mean by the comment.  Do
you mean "if we get here, and DW_UNSND (attr) != 0, and we hadn't added
the next condition, then we'd end up with bogus ->size"?
- Oh, and no ChangeLog

You've been submitting a lot of fixes recently; while most of them are
small, some are big enough to probably require a copyright assignment.
Have you got one, or shall I send you the forms?

-- 
Daniel Jacobowitz
CodeSourcery


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