From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14218 invoked by alias); 7 Jan 2013 01:10:20 -0000 Received: (qmail 14189 invoked by uid 48); 7 Jan 2013 01:10:18 -0000 From: "dblaikie at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug c++/14998] New: GDB cannot handle pointer to member functions being encoded with DW_TAG_ptr_to_member_type Date: Mon, 07 Jan 2013 01:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dblaikie at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2013-q1/txt/msg00016.txt.bz2 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.