This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA/dwarf-2] Fix for the null record problem


Joel Brobecker <brobecker@gnat.com> writes:
> The patch is quite tiny, seems almost obvious, and Elena seemed happy
> with it. But it didn't get in because she asked that a testcase be added
> first (on Feb 19):
> <<
> the patch looks sensible, but I would like to see the testcase go in
> at the same time, or we'll forget.
> >>
> 
> The new testcase has been checked in now, so I was wondering if somebody
> had a moment to have a look at it, and confirm Elena's first review?

I think it looks fine; I've just one question before you commit.

As it stands, the code sets TYPE_FLAG_STUB if the type die has no
children, or if die_is_declaration (die, cu) is true.  Your patch
correctly ditches the first criterion; no problems there.

But it also modifies the second criterion as well, without comment.
In particular, die_is_declaration checks for both DW_AT_declaration
and DW_AT_specification, but your patch only tests for
DW_AT_declaration.  I think this is correct: in section 5.6.1, the
Dwarf 2 spec says that the definition of the type has a
DW_AT_specification attribute pointing to the declaration.  Since it's
the definition of the type that actually lists the fields,
DW_AT_specification should not cause GDB to mark the type as a stub.
Just the opposite: the referent of that attribute is the stub.

The following C++ code produces Dwarf 2 info where the definition of
struct s::t has a DW_AT_specification attribute, but GDB doesn't skip
it, and I don't really understand why:

    struct s {
      struct t;
      struct t *p;
    };

    struct s::t
    {
      int i;
    };

Have you followed all this through already?  What's going on here?


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