This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH 1/2] gdbhooks.py: use strip_typedefs to simplify matching type names
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Vladislav Ivanishin <vlad at ispras dot ru>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 01 Jul 2019 11:30:08 -0400
- Subject: Re: [PATCH 1/2] gdbhooks.py: use strip_typedefs to simplify matching type names
- References: <email@example.com>
On Mon, 2019-07-01 at 12:50 +0300, Vladislav Ivanishin wrote:
> GDB's Python API provides strip_typedefs method that can be
> for writing DRY code. Using it at least partially obviates the need
> the add_printer_for_types method we have in gdbhooks.py (it takes a
> of typenames to match and is usually used to deal with typedefs).
> I think, the code can be simplified further (there's still
> ['tree_node *', 'const tree_node *'], which is a little awkward) if
> deal with pointer types in a uniform fashion (I'll touch on this in
> description of the second patch). But that can be improved
> The gimple_statement_cond, etc. part has been dysfunctional for a
> (namely since gimple-classes-v2-option-3 branch was merged). I
> it to use the new classes' names. That seems to work (though it
> output much info anyway: pretty
> <gimple_phi 0x7ffff78c0200> vs.
> (gphi *) 0x7ffff78c0200
> in the raw version).
> I changed the name passed to pp.add_printer_for_types() for
> and friends -- so they all share the same name now -- but I don't
> believe the name is used in any context where it would matter.
IIRC there's a gdb command to tell you what the registered pretty-
printers are; I think the name is only ever used in that context (or
maybe for fine-grained control of pretty-printing) - and I don't know
of anyone who uses that. I don't think changing the name matters.
> This is just a clean up of gdbhooks.py. OK to commit?
The only area I wasn't sure about were the removal hunks relating to
machine modes: is that all covered now by the looking-through-typedefs?
Otherwise, looks good to me. I assume you've tested the patch by
debugging with it.