This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: dwarflint versus linkage_name attributes
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Tue, 05 Apr 2011 11:08:16 +0200
- Subject: Re: dwarflint versus linkage_name attributes
On Mon, 2011-04-04 at 22:30 +0200, Dodji Seketeli wrote:
> Roland McGrath <roland@hack.frob.com> writes:
> >> So this was breaking GDB because it wouldn't figure easily the
> >> relationship between the constructor (which name is, e.g, 't') and the
> >> anonymous struct which name is, well, anonymous. So adding the linkage
> >> name attribute [which value is 't'] was the easier way [from GDB's
> >> standpoint] to help fix the issue.
> >
> > This is so that GDB can figure out how to call the constructor to evaluate
> > an expression that constructs an object of this type by performing an
> > inferior call?
>
> That [though I am not sure if GDB supports the evaluation of "new t"
> yet], or "break t::t".
>
> But even without going that far, GDB was crashing while reading the
> symbol table because it was confused by seeing a typedef (named 't')
> which underlying type was anonymous, with a constructor named 't'.
I must admit I am still confused. So lets try an actual example (the one
from the bug report):
class C {
public:
C() {}
~C() {}
};
typedef struct {
C m;
} t;
typedef t s;
s v;
Which generates the following dwarf for g++ -gdwarf-3 (latest gcc trunk
version):
[ 7a] structure_type
byte_size (data1) 1
decl_file (data1) 1
decl_line (data1) 6
MIPS_linkage_name (string) "1t"
sibling (ref4) [ bb]
[ 85] member
name (string) "m"
decl_file (data1) 1
decl_line (data1) 7
type (ref4) [ 31]
data_member_location (data1) 0
[ 8f] subprogram
name (string) "t"
artificial (flag) Yes
declaration (flag) Yes
object_pointer (ref4) [ 9c]
sibling (ref4) [ a3]
[ 9c] formal_parameter
type (ref4) [ 165]
artificial (flag) Yes
[ a3] subprogram
name (string) "~t"
artificial (flag) Yes
declaration (flag) Yes
object_pointer (ref4) [ ad]
[ ad] formal_parameter
type (ref4) [ 165]
artificial (flag) Yes
[ b3] formal_parameter
type (ref4) [ 73]
artificial (flag) Yes
[ bb] typedef
name (string) "t"
decl_file (data1) 1
decl_line (data1) 8
type (ref4) [ 7a]
[ c4] typedef
name (string) "s"
decl_file (data1) 1
decl_line (data1) 9
type (ref4) [ bb]
So the first question is, how do I demangle this "1t"? Is that just a
temporary name given to the anonymous struct?
Second question is how is gdb actually using this? Why is the
linkage_name on the structure_type, and not on the member and/or
subprogram children?
Thanks,
Mark