public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14160] New: function field's "physname" is wrong
@ 2012-05-24 14:56 tromey at redhat dot com
  2012-05-24 15:06 ` [Bug c++/14160] " qiyao at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-05-24 14:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

             Bug #: 14160
           Summary: function field's "physname" is wrong
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: tromey@redhat.com
    Classification: Unclassified


The physname field for a fn_field is supposed to hold
the mangled name.
Various code in gdb assumes this; e.g., passes the name to
is_constructor_name.
However, this field is set incorrectly, e.g.:

(top-gdb) p f
$159 = (struct fn_field *) 0x1e11860
(top-gdb) p f.physname
$160 = 0x1e162f0 "WithConstructor<int>::WithConstructor(int)"

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/14160] function field's "physname" is wrong
  2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
@ 2012-05-24 15:06 ` qiyao at gcc dot gnu.org
  2012-05-24 15:38 ` keiths at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: qiyao at gcc dot gnu.org @ 2012-05-24 15:06 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyao at gcc dot gnu.org

--- Comment #1 from Yao Qi <qiyao at gcc dot gnu.org> 2012-05-24 15:06:23 UTC ---
(In reply to comment #0)
> The physname field for a fn_field is supposed to hold
> the mangled name.

I noticed this problem yesterday.  Looks field 'physname' is set by the return
value of dwarf2_physname, which returns canonicalized string, instead of
mangled name.

> Various code in gdb assumes this; e.g., passes the name to
> is_constructor_name.

Yeah, the bottom part of gnu-v3-abi.c:gnuv3_pass_by_reference is affected by
this problem.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/14160] function field's "physname" is wrong
  2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
  2012-05-24 15:06 ` [Bug c++/14160] " qiyao at gcc dot gnu.org
@ 2012-05-24 15:38 ` keiths at redhat dot com
  2012-05-24 16:00 ` tromey at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: keiths at redhat dot com @ 2012-05-24 15:38 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com

--- Comment #2 from Keith Seitz <keiths at redhat dot com> 2012-05-24 15:38:14 UTC ---
That's only half the story, unfortunately. Yes, half of gdb assumes that this
field (and gsymbols) hold the mangled name. The other half assumes otherwise.
With the dwarf2_physname change, we ended up swapping one for the other.

Clearly it is time to reintroduce the actual linkage name (that would also fix
print demangled bug) and sort out these two halves.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/14160] function field's "physname" is wrong
  2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
  2012-05-24 15:06 ` [Bug c++/14160] " qiyao at gcc dot gnu.org
  2012-05-24 15:38 ` keiths at redhat dot com
@ 2012-05-24 16:00 ` tromey at redhat dot com
  2012-05-25 20:07 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-05-24 16:00 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2012-05-24 16:00:11 UTC ---
Fixing this and some other physname fallout would be good.
However, I wonder if there is a better way in this case.
Like, can we make "is constructor" an attribute on the function field,
and not resort to checking the mangled name?
cp-abi.h says this would be cleaner; not sure why it wasn't done this
way in the first place.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/14160] function field's "physname" is wrong
  2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
                   ` (2 preceding siblings ...)
  2012-05-24 16:00 ` tromey at redhat dot com
@ 2012-05-25 20:07 ` tromey at redhat dot com
  2012-06-05 20:49 ` tromey at redhat dot com
  2012-12-14 20:33 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-05-25 20:07 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |10050

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/14160] function field's "physname" is wrong
  2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
                   ` (3 preceding siblings ...)
  2012-05-25 20:07 ` tromey at redhat dot com
@ 2012-06-05 20:49 ` tromey at redhat dot com
  2012-12-14 20:33 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-06-05 20:49 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

--- Comment #4 from Tom Tromey <tromey at redhat dot com> 2012-06-05 20:49:21 UTC ---
Adding a bit to fn_field and updating it from dwarf2read was pretty easy.
I haven't tried to remove is_constructor_name, though.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/14160] function field's "physname" is wrong
  2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
                   ` (4 preceding siblings ...)
  2012-06-05 20:49 ` tromey at redhat dot com
@ 2012-12-14 20:33 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-12-14 20:33 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14160

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-12-14 20:33:39 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    tromey@sourceware.org    2012-12-14 20:33:30

Modified files:
    gdb            : ChangeLog c-typeprint.c dwarf2read.c gdbtypes.h 
                     gnu-v3-abi.c jv-typeprint.c 
    gdb/testsuite  : ChangeLog 
    gdb/testsuite/gdb.cp: templates.exp 

Log message:
    Partial fix for PR c++/14160:
    * c-typeprint.c (c_type_print_base): Use TYPE_FN_FIELD_CONSTRUCTOR.
    * dwarf2read.c (dwarf2_is_constructor): New function.
    (dwarf2_add_member_fn): Use it.
    * gnu-v3-abi.c (gnuv3_pass_by_reference): Use
    TYPE_FN_FIELD_CONSTRUCTOR.
    * jv-typeprint.c (java_type_print_base): Use
    TYPE_FN_FIELD_CONSTRUCTOR.
    * gdbtypes.h (struct fn_field) <is_constructor>: New field.
    <dummy>: Shrink.
    (TYPE_FN_FIELD_CONSTRUCTOR): New macro.
    testsuite
    * gdb.cp/templates.exp (test_ptype_of_templates): Update kfails.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14925&r2=1.14926
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-typeprint.c.diff?cvsroot=src&r1=1.87&r2=1.88
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.722&r2=1.723
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.h.diff?cvsroot=src&r1=1.176&r2=1.177
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gnu-v3-abi.c.diff?cvsroot=src&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/jv-typeprint.c.diff?cvsroot=src&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3490&r2=1.3491
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/templates.exp.diff?cvsroot=src&r1=1.37&r2=1.38

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-12-14 20:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-24 14:56 [Bug c++/14160] New: function field's "physname" is wrong tromey at redhat dot com
2012-05-24 15:06 ` [Bug c++/14160] " qiyao at gcc dot gnu.org
2012-05-24 15:38 ` keiths at redhat dot com
2012-05-24 16:00 ` tromey at redhat dot com
2012-05-25 20:07 ` tromey at redhat dot com
2012-06-05 20:49 ` tromey at redhat dot com
2012-12-14 20:33 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).