This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/14998] New: GDB cannot handle pointer to member functionsbeing encoded with DW_TAG_ptr_to_member_type
- From: "dblaikie at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 07 Jan 2013 01:10:17 +0000
- Subject: [Bug c++/14998] New: GDB cannot handle pointer to member functionsbeing encoded with DW_TAG_ptr_to_member_type
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=14998
Bug #: 14998
Summary: GDB cannot handle pointer to member functions being
encoded with DW_TAG_ptr_to_member_type
Product: gdb
Version: 7.5
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: dblaikie@gmail.com
CC: echristo@gmail.com
Classification: Unclassified
In experimenting with adding support for encoding pointers to members
(functions and variables) in Clang I've prototyped support for encoding these
as DW_TAG_ptr_to_member_type. For member variables this works fine & appears to
be exactly as GCC (4.7) implements debug info.
For pointers to member functions GCC output (& GDB's (7.5) expectation) is a
completely different representation. It seems the member function pointer is
represented as a struct with two members:
1) a non-member function pointer of a type equivalent to the non-member type of
the member function pointer (ie: it includes the hidden initial 'this'
parameter, duly marked as artificial, though GCC doesn't always honor this in
places it seems it should)
2) a long int offset
I would like to encode member function pointers the same way member variable
pointers are encoded, using DW_TAG_ptr_to_member_type. It's simpler to
implement in Clang and the debug info is much smaller.
Also, if this was done, it might address a quirk in the way GDB prints out the
type of member function pointers. Given:
struct foo {
int bar(int, float) {
}
};
int (foo::*x)(int, float);
compiled with GCC and debugged in GDB, "ptype x" prints "type = int
(foo::*)(foo * const, int, float)", note the spurious first parameter ("foo
*const") which should not be displayed.
For now, with my experimental Clang output, GDB prints "int foo::*(int, float)"
(missing the extra "()" around "foo::*") and doesn't understand that the type
is a pointer to member function (so it doesn't print out the function name of
the pointers value when printing the pointer, it doesn't support calling the
member function pointer with the usual syntax, etc)
(Related Clang bug: http://llvm.org/bugs/show_bug.cgi?id=14759 )
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.