public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/8218] ptype claims destructors have arg
       [not found] <bug-8218-4717@http.sourceware.org/bugzilla/>
@ 2013-01-22 17:34 ` dblaikie at gmail dot com
  2013-01-22 18:05 ` tromey at redhat dot com
  2024-01-14 14:28 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 3+ messages in thread
From: dblaikie at gmail dot com @ 2013-01-22 17:34 UTC (permalink / raw)
  To: gdb-prs

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

David Blaikie <dblaikie at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dblaikie at gmail dot com

--- Comment #2 from David Blaikie <dblaikie at gmail dot com> 2013-01-22 17:34:20 UTC ---
This looks like a GCC bug, not a GDB bug.

Using llvm-dwarfdump, GCC's dwarf for the dtor looks like this:

0x00000051:     DW_TAG_subprogram [5] *
0x00000052:       DW_AT_external [DW_FORM_flag] (0x01)
0x00000053:       DW_AT_name [DW_FORM_string]   ("~C")
0x00000056:       DW_AT_decl_file [DW_FORM_data1]       (0x01)
0x00000057:       DW_AT_decl_line [DW_FORM_data1]       (0x03)
0x00000058:       DW_AT_declaration [DW_FORM_flag]      (0x01)
0x00000059:       DW_AT_object_pointer [DW_FORM_ref4]   (cu + 0x005d =>
{0x0000005d})

0x0000005d:       DW_TAG_formal_parameter [4]
0x0000005e:         DW_AT_type [DW_FORM_ref4]   (cu + 0x006b => {0x0000006b})
0x00000062:         DW_AT_artificial [DW_FORM_flag]     (0x01)

0x00000063:       DW_TAG_formal_parameter [4] 
0x00000064:         DW_AT_type [DW_FORM_ref4]   (cu + 0x0071 => {0x00000071})
0x00000068:         DW_AT_artificial [DW_FORM_flag]     (0x01)

0x00000069:       NULL  

0x0000006a:     NULL    

whereas Clang's dwarf looks like this:

0x00000086:     DW_TAG_subprogram [10] *
0x00000087:       DW_AT_accessibility [DW_FORM_data1]   (0x01)
0x00000088:       DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000049] =
"~C")
0x0000008c:       DW_AT_decl_file [DW_FORM_data1]       (0x01)
0x0000008d:       DW_AT_decl_line [DW_FORM_data1]       (0x03)
0x0000008e:       DW_AT_declaration [DW_FORM_flag_present]      (true)
0x0000008e:       DW_AT_external [DW_FORM_flag_present] (true)

0x0000008e:       DW_TAG_formal_parameter [9]
0x0000008f:         DW_AT_type [DW_FORM_ref4]   (cu + 0x006b => {0x0000006b})
0x00000093:         DW_AT_artificial [DW_FORM_flag_present]     (true)

0x00000093:       NULL  

0x00000094:     NULL

And GDB's output when given your example and compiled with Clang is:

(well I modified the example a bit: struct C { C() {} ~C() {} }; int main() { C
c; } (mostly I was curious whether "(void)" was the way GDB was printing things
generally or whether it would print the ctor as "()" instead)):

ptype C
type = struct C {
  public:
    C(void);
    ~C(void);
}

Shall we close this & open a GCC bug instead? (& change the kfail to an xfail
referencing the GCC bug - and add the correct pattern so Clang can pass this
test)

-- 
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] 3+ messages in thread

* [Bug c++/8218] ptype claims destructors have arg
       [not found] <bug-8218-4717@http.sourceware.org/bugzilla/>
  2013-01-22 17:34 ` [Bug c++/8218] ptype claims destructors have arg dblaikie at gmail dot com
@ 2013-01-22 18:05 ` tromey at redhat dot com
  2024-01-14 14:28 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 3+ messages in thread
From: tromey at redhat dot com @ 2013-01-22 18:05 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

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

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2013-01-22 18:05:34 UTC ---
(In reply to comment #2)

> 0x00000063:       DW_TAG_formal_parameter [4] 
> 0x00000064:         DW_AT_type [DW_FORM_ref4]   (cu + 0x0071 => {0x00000071})
> 0x00000068:         DW_AT_artificial [DW_FORM_flag]     (0x01)

> Shall we close this & open a GCC bug instead? (& change the kfail to an xfail
> referencing the GCC bug - and add the correct pattern so Clang can pass this
> test)

Arguably it is still a gdb bug since the parameter is marked artificial.
I think that gdb may be making an explicit choice here, though, since
c_type_print_args explicitly prints artificial arguments.

There is a GCC bug in this area:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37237
It may not seem related but if you read the comments, the gist
is that GCC is just emitting DWARF for one of the constructors,
whereas it should probably emit DWARF for all of them.

Adding a pattern for clang to pass seems fine to me.

-- 
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] 3+ messages in thread

* [Bug c++/8218] ptype claims destructors have arg
       [not found] <bug-8218-4717@http.sourceware.org/bugzilla/>
  2013-01-22 17:34 ` [Bug c++/8218] ptype claims destructors have arg dblaikie at gmail dot com
  2013-01-22 18:05 ` tromey at redhat dot com
@ 2024-01-14 14:28 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 3+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-14 14:28 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=8218

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |ssbssa at sourceware dot org

--- Comment #7 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Sourceware Commits from comment #5)
> The master branch has been updated by Keith Seitz <kseitz@sourceware.org>:
> 
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
> h=5f4d10850850cd95af5e95a16848c8c07a273d88
> 
> commit 5f4d10850850cd95af5e95a16848c8c07a273d88
> Author: Keith Seitz <keiths@redhat.com>
> Date:   Fri Mar 10 10:32:09 2017 -0800
> 
>     c++/8218: Destructors w/arguments.
>     
>     For a long time now, c++/8218 has noted that GDB is printing argument
> types
>     for destructors:
>     
>     (gdb) ptype A
>     type = class A {
>       public:
>         ~A(int);
>     }
>     
>     This happens because cp_type_print_method_args doesn't ignore artificial
>     arguments.  [It ignores the first `this' pointer because it simply skips
>     the first argument for any non-static function.]
>     
>     This patch fixes this:
>     
>     (gdb) ptype  A
>     type = class A {
>       public:
>         ~A();
>     }
>     
>     I've adjusted gdb.cp/templates.exp to account for this and added a new
>     passing regexp.
>     
>     gdb/ChangeLog
>     
>     	PR c++/8218
>     	* c-typeprint.c (cp_type_print_method_args): Skip artificial arguments.

Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-01-14 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-8218-4717@http.sourceware.org/bugzilla/>
2013-01-22 17:34 ` [Bug c++/8218] ptype claims destructors have arg dblaikie at gmail dot com
2013-01-22 18:05 ` tromey at redhat dot com
2024-01-14 14:28 ` ssbssa at sourceware dot 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).