[PATCH] PR debug/45682 - wrong struct DIE nesting with -fdebug-types-section

Cary Coutant ccoutant@google.com
Fri Jan 6 00:06:00 GMT 2012


> In the example of the patch below, the DIE for the definition of the
> class 'Executor', when put in the type unit section is not put under
> the DIE for the 'thread' namespace.  Rather, it's put under the DIE
> for the global namespace.

I don't think this is the problem that PR 45682 is complaining about.
Given the test case in your patch, the type unit looks like this:

  type_unit
  + namespace ("thread")
  + + L1: class_type ("Executor", declaration)
  + class_type (specification: L1)

The definition DIE is *supposed* to appear at the outer level, with
the specification DIE pointing to the declaration, which provides its
context. This is the way it would have appeared in the comp unit DIE
before splitting it out into a type unit. (And what it would look like
with -fno-debug-types-section.)

What PR 45682 is complaining about is that the skeleton DIE left
behind for class Executor is not inside the namespace. That problem,
however, is only visible with the full test case provided in the PR.
There, the DIE structure in .debug_types is good, but the DIE
structure in .debug_info is wrong:

  compile_unit
  + namespace ("thread")
  + class_type ("Executor", declaration)
  + + L1: subprogram ("CurrentExecutor", external)
  + ...
  + subprogram (specification: L1)
  + ...

Here, the DIE for class_type Executor should be under the namespace
DIE, but isn't. I don't think your patch fixes that problem.

I think the real problem is that the skeleton declaration DIE for
class Executor is being inserted under the wrong DIE -- probably in
remove_child_or_replace_with_skeleton().

Thanks for looking at this, though! It's been on my TODO list for a
while, but had dropped below the fold, and I'd forgotten about it.

-cary



More information about the Gcc-patches mailing list