* DW_AT_specification: long ago GDB change
@ 2004-04-15 5:20 Jim Blandy
2004-04-15 13:52 ` Jason Merrill
0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2004-04-15 5:20 UTC (permalink / raw)
To: Jason Merrill; +Cc: gdb-patches
Back in 1999, you posted this patch:
http://sources.redhat.com/ml/gdb-patches/1999-q4/msg00325.html
Do you know why you tested for the presence of DW_AT_specification, as
well as DW_AT_declaration?
I can't think of a case where a die would be a declaration, but also
refer to a specification; since DW_AT_specification generally points
from definitions to previous declarations, I'd rather expect
specifications to point at declarations. And even if a declaration
did have a specification, it would still be a declaration.
Looking at the only code in gcc/dwarf2out.c that adds
DW_AT_specification attributes to dies supports this:
/* Add an AT_specification attribute to a DIE, and also make the back
pointer from the specification to the definition. */
static inline void
add_AT_specification (dw_die_ref die, dw_die_ref targ_die)
{
add_AT_die_ref (die, DW_AT_specification, targ_die);
if (targ_die->die_definition)
abort ();
targ_die->die_definition = die;
}
I guess if there were several declarations chained together,
eventually pointing to a definition, then the intermediate dies could
have both attributes. Does this happen?
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: DW_AT_specification: long ago GDB change
2004-04-15 5:20 DW_AT_specification: long ago GDB change Jim Blandy
@ 2004-04-15 13:52 ` Jason Merrill
2004-04-15 22:22 ` Jim Blandy
0 siblings, 1 reply; 5+ messages in thread
From: Jason Merrill @ 2004-04-15 13:52 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On 15 Apr 2004 00:17:23 -0500, Jim Blandy <jimb@redhat.com> wrote:
> Back in 1999, you posted this patch:
>
> http://sources.redhat.com/ml/gdb-patches/1999-q4/msg00325.html
>
> Do you know why you tested for the presence of DW_AT_specification, as
> well as DW_AT_declaration?
>
> I can't think of a case where a die would be a declaration, but also
> refer to a specification; since DW_AT_specification generally points
> from definitions to previous declarations, I'd rather expect
> specifications to point at declarations. And even if a declaration
> did have a specification, it would still be a declaration.
Yes. IIRC, the issue is that dwarf_attr looks through the
DW_AT_specification link, so it will find a DW_AT_declaration attribute in
the definition. Also looking for DW_AT_specification allows us to avoid
that false positive for the test.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: DW_AT_specification: long ago GDB change
2004-04-15 13:52 ` Jason Merrill
@ 2004-04-15 22:22 ` Jim Blandy
2004-04-16 12:49 ` Jason Merrill
0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2004-04-15 22:22 UTC (permalink / raw)
To: Jason Merrill; +Cc: gdb-patches
Jason Merrill <jason@redhat.com> writes:
> On 15 Apr 2004 00:17:23 -0500, Jim Blandy <jimb@redhat.com> wrote:
>
> > Back in 1999, you posted this patch:
> >
> > http://sources.redhat.com/ml/gdb-patches/1999-q4/msg00325.html
> >
> > Do you know why you tested for the presence of DW_AT_specification, as
> > well as DW_AT_declaration?
> >
> > I can't think of a case where a die would be a declaration, but also
> > refer to a specification; since DW_AT_specification generally points
> > from definitions to previous declarations, I'd rather expect
> > specifications to point at declarations. And even if a declaration
> > did have a specification, it would still be a declaration.
>
> Yes. IIRC, the issue is that dwarf_attr looks through the
> DW_AT_specification link, so it will find a DW_AT_declaration attribute in
> the definition. Also looking for DW_AT_specification allows us to avoid
> that false positive for the test.
You're right. Eeeew.
It's clearly wrong to follow DW_AT_specification and return the value
of the specification's DW_AT_declaration attribute. For most
attributes, though, that's the right behavior.
Here are the attributes I see that we shouldn't search for in dies
referenced by DW_AT_specification, but which are reasonable to look
for in dies referred to by DW_AT_abstract_origin:
- DW_AT_declaration
- DW_AT_decl_column
- DW_AT_decl_file
- DW_AT_decl_line
Here are attributes which apply only to a specific die, and should
never be searched for on any referenced DIE:
- DW_AT_sibling
I don't think that needs to be addressed; it's only relevant when
reading dies anyway.
I'll try to put together a patch for this.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: DW_AT_specification: long ago GDB change
2004-04-15 22:22 ` Jim Blandy
@ 2004-04-16 12:49 ` Jason Merrill
[not found] ` <20040416141520.GB9718@nevyn.them.org>
0 siblings, 1 reply; 5+ messages in thread
From: Jason Merrill @ 2004-04-16 12:49 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On 15 Apr 2004 17:19:17 -0500, Jim Blandy <jimb@redhat.com> wrote:
> Here are the attributes I see that we shouldn't search for in dies
> referenced by DW_AT_specification, but which are reasonable to look
> for in dies referred to by DW_AT_abstract_origin:
>
> - DW_AT_declaration
> - DW_AT_decl_column
> - DW_AT_decl_file
> - DW_AT_decl_line
I disagree about the other three; if the definition has different source
coordinates, it will have the attributes. If it doesn't, there's no reason
to emit them again, and we should look them up in the declaration.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-04-16 21:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-15 5:20 DW_AT_specification: long ago GDB change Jim Blandy
2004-04-15 13:52 ` Jason Merrill
2004-04-15 22:22 ` Jim Blandy
2004-04-16 12:49 ` Jason Merrill
[not found] ` <20040416141520.GB9718@nevyn.them.org>
2004-04-16 21:29 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox