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: [RFA 2/4] dwarf2_physname


On Tue, Feb 02, 2010 at 03:23:44PM -0800, Keith Seitz wrote:
> To elaborate on #2:
> 
> Consider the following class:
> 
> class A
> {
> public:
>  static const int a_constant = 3;
> };
> 
> int
> main (int argc, char* argv[])
> {
>   return A::a_constant;
> }
> 
> Gcc will *NOT* output anything about A::a_constant *except* for a
> DW_TAG_variable describing it (DW_AT_name = "a_constant"). No
> DW_AT_specification (as I think there should be). In fact,
> DW_TAG_class_type for A is completely omitted. The only clue that gdb
> gets (either dwarf2_physname or CVS HEAD) is in
> DW_AT_MIPS_linkage_name. This is obviously a gcc bug.

It's not obvious that it's a bug.  I believe you need to declare the
constant again, outside of the class, for it to be really 'defined'.
This trips people up all the time.  (Including me, so don't trust me
too much.)  e.g. it won't have the correct external linkage it's
supposed to have.

> Or maybe I'm simply not answering your question? [A kind of
> forest/tree thing...]

You're right, we're talking past each other.

I don't doubt that what you've got is correctly identifying and
handling GCC's output.  But it does so by pattern matching on what GCC
currently emits, not by using tests that are sound according to the
standard.  So with some future GCC, or some other non-GCC compiler,
it will probably fall down.

I don't believe that most of GCC's uses of DW_AT_specification are
required by the standard.  And I don't think they're the only valid
uses of DW_AT_specification.  So keying off whether that attribute is
present is too 'fuzzy' for me.

I'm asking for you to either convince me that my assumptions in the
previous paragraph are incorrect, or to find some way that the
standard will support to answer the same query about the properties of
the DW_TAG_variable DIE.  For instance, should we find the DIE's
logical location the same way determine_prefix does (parent, or
specification's parent) and then draw some conclusion based on
the type of the logical parent?

-- 
Daniel Jacobowitz
CodeSourcery


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