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] dwarf2_physname


On Tue, Sep 01, 2009 at 04:17:56PM -0700, Michael Eager wrote:
> I think that this is a problem with how the template instantiation is
> described.

For your example DWARF:

> I think that there should be something like
>    DW_TAG_template_value_parameter
>      DW_AT_name : Foo
>      DW_AT_type : <int *>
> as a child of  of f<Foo>.

I believe DW_AT_name would be S here and not Foo - the name by which
the argument is known inside the instantiation.  It's representing Foo
that's a problem; it has to go in the DW_AT_const_value attribute.

Here's a trickier example:

template<const char *S> int f()
{
  return S[0];
}

template <int I> struct S {};

template<int I, const char *STR> int g(S<I + 1 + sizeof(STR)>*)
{
  return 0;
}

char Foo[3];
char Bar[3];

int main()
{
  return f<Foo>() + f<Bar>() + g<5, Foo>(0);
}

0000000000000000 W _Z1gILi5EXadL_Z3FooEEEiP1SIXplplT_Li1EszT0_EE
0000000000000000 W int g<5, &Foo>(S<((5)+(1))+(sizeof (&Foo))>*)

A patch that can't handle this may still be an improvement - but I'd
like to know how we're approaching this problem, and whether (A) the
lack of compilers generating adequate data, and (B) to the best of my
knowledge, the lack of DWARF constructs for such expressions, is
going to interfere with debugging of heavily templated programs.

-- 
Daniel Jacobowitz
CodeSourcery


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