Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* infinite loop processing siblings - dwarf2reader - dwarf 3 debug
@ 2009-10-25  4:24 Jason Richards
  2009-10-26 21:13 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Richards @ 2009-10-25  4:24 UTC (permalink / raw)
  To: gdb-patches

I encountered a problem where GDB gets stuck in an infinite loop processing
dwarf 3 debug information.  Turns out the producer has placed a
sibling attribute
in a die in a comp unit which references a previous die in the comp unit.
"locate_pdi_sibling" first checks for the presence of this sibling and
returns it
instead of scanning forward past the children (there are children
present in this die).

It seams to me the appropriate fix for this problem is to change
"locate_pdi_sibling"
to first return the location past the children, before returning
sibling information, which
fixes this particular problem.

Is there something I am not thinking about?


Regards-
Jason Richards


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: infinite loop processing siblings - dwarf2reader - dwarf 3 debug
  2009-10-25  4:24 infinite loop processing siblings - dwarf2reader - dwarf 3 debug Jason Richards
@ 2009-10-26 21:13 ` Tom Tromey
  2009-10-26 21:50   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-10-26 21:13 UTC (permalink / raw)
  To: Jason Richards; +Cc: gdb-patches

>>>>> "Jason" == Jason Richards <jsn.richards@gmail.com> writes:

Jason> I encountered a problem where GDB gets stuck in an infinite loop
Jason> processing dwarf 3 debug information.  Turns out the producer has
Jason> placed a sibling attribute in a die in a comp unit which
Jason> references a previous die in the comp unit.

This does not sound like valid DWARF to me.  Section 1.9 makes it sound
as though the only valid value is the DIE's next sibling.

Jason> It seams to me the appropriate fix for this problem is to change
Jason> "locate_pdi_sibling" to first return the location past the
Jason> children, before returning sibling information, which fixes this
Jason> particular problem.

Jason> Is there something I am not thinking about?

I don't know why the code is the way it is; I assume for performance but
I have not looked into it at all.

How about also rejecting a DW_AT_sibling that points to an earlier DIE?

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: infinite loop processing siblings - dwarf2reader - dwarf 3  debug
  2009-10-26 21:13 ` Tom Tromey
@ 2009-10-26 21:50   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2009-10-26 21:50 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Jason Richards, gdb-patches

 On Mon, Oct 26, 2009 at 03:13:41PM -0600, Tom Tromey wrote:
> >>>>> "Jason" == Jason Richards <jsn.richards@gmail.com> writes:
> 
> Jason> I encountered a problem where GDB gets stuck in an infinite loop
> Jason> processing dwarf 3 debug information.  Turns out the producer has
> Jason> placed a sibling attribute in a die in a comp unit which
> Jason> references a previous die in the comp unit.
> 
> This does not sound like valid DWARF to me.  Section 1.9 makes it sound
> as though the only valid value is the DIE's next sibling.

That's right.  What is this producer?

> Jason> It seams to me the appropriate fix for this problem is to change
> Jason> "locate_pdi_sibling" to first return the location past the
> Jason> children, before returning sibling information, which fixes this
> Jason> particular problem.
> 
> Jason> Is there something I am not thinking about?
> 
> I don't know why the code is the way it is; I assume for performance but
> I have not looked into it at all.

You are correct.  This optimization is the point of DW_AT_sibling, in
fact.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-26 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-25  4:24 infinite loop processing siblings - dwarf2reader - dwarf 3 debug Jason Richards
2009-10-26 21:13 ` Tom Tromey
2009-10-26 21:50   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox