Re: [RFC PATCH 0/3] Pretty-printing for errno

Pedro Alves
2017-06-29T17:02:20Z

On 06/29/2017 05:53 PM, Pedro Alves wrote:

> however, we'd need to still make "whatis" strip one level of
> typedefs when the argument is a type, somehow, because we now
> get this:
>
> (gdb) whatis zzz
> type = zzz

I suspect we can do that by making "whatis" look at the top of
the expression tree, see if it's an OP_TYPE:

(gdb) set debug expression 1
(gdb) whatis (zzz)0
...
Dump of expression @ 0x1bc6af0, after conversion to prefix form:
Expression: `(zzz) 0'
Language c, 8 elements, 16 bytes each.

0 UNOP_CAST_TYPE (
1 OP_TYPE Type @0x18e7920 (zzz))
4 OP_LONG Type @0x19a6650 (int), value 0 (0x0)
type = zzz
(gdb) whatis zzz
...
Dump of expression @ 0x1bc87b0, after conversion to prefix form:
Expression: `zzz'
Language c, 3 elements, 16 bytes each.

0 OP_TYPE Type @0x18e7920 (zzz)
type = zzz
(gdb) whatis z
...
Dump of expression @ 0x1bc6af0, after conversion to prefix form:
Expression: `z'
Language c, 4 elements, 16 bytes each.

0 OP_VAR_VALUE Block @0x19e8ee0, symbol @0x19e8e10 (z)
type = zzz
(gdb)

There may be a helper for this already somewhere. I've never dug
that much deeply into this area of the code.

Thanks,
Pedro Alves