[RFC][PATCH][PR gdb/24154] Use real type for member functions with auto return type

Hannes Domani ssbssa@yahoo.de
Tue Apr 14 23:05:38 GMT 2020


 Am Mittwoch, 15. April 2020, 00:49:39 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> >> I tend to suspect we should handle this during DWARF reading.
> >> Without seeing the DWARF I'm not sure what's really going on though.
>
> Hannes> This is all of the DWARF info:
>
> For when you update the commit message, IMO the output of objdump is way
> more readable.
>
> Hannes> So the real type is in the definition die, while the class
> Hannes> member function die only has the auto type.
>
> It definitely seems better to handle this in the DWARF reader then.
> What do you think?

I don't really have a strong opinion where this should be handled.

Currently gdb shows the types like this:

(gdb) pt x
type = struct X<int> [with T = int] {
    T value;
  public:
    auto get(void);
}
(gdb) pt x.get
type = void (X<int> * const)
(gdb) pt X<int>::get
type = int (X<int> * const)

And with my current changes only x.get is different:

(gdb) pt x.get
type = int (X<int> * const)

And if I understand you correctly, when you say handle in the DWARF reader,
then I think it would also change the displayed return type in the struct:

 type = struct X<int> [with T = int] {
     T value;
   public:
-    auto get(void);
+    int get(void);
 }

If this is acceptable, it's fine for me.


Hannes


More information about the Gdb-patches mailing list