Bug 22480 - `ptype` returns `struct` for D classes
Summary: `ptype` returns `struct` for D classes
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: d (show other bugs)
Version: unknown
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-23 01:13 UTC by Basile B.
Modified: 2020-02-24 15:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Basile B. 2017-11-23 01:13:38 UTC
---
module runnable;
class A {}

void main()
{
    A a;
}
---

`ptype a`


gives

---
type = struct runnable.A {
    <no data fields>
} *
---

which means that there's not the hint required if we must

`print a`

or 

`print *a`

the later syntax is required for a class.
Comment 1 Tom Tromey 2020-02-24 15:17:42 UTC
I think the trailing '*' is probably the hint.

The D language implementation is somewhat incomplete in gdb.
It just uses the C type-printing code -- so what you get is what the
C language code in gdb thinks the type is.

Here it is a pointer to a structure, hence the trailing "*".

Enhancing the D language code is completely possible if you are
interested.  Right now it doesn't seem to be under active development.