On Mon, 2019-07-01 at 12:50 +0300, Vladislav Ivanishin wrote:
> Hi!
> 
> GDB's Python API provides strip_typedefs method that can be
> instrumental
> for writing DRY code.  Using it at least partially obviates the need
> for
> the add_printer_for_types method we have in gdbhooks.py (it takes a
> list
> 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
> we
> deal with pointer types in a uniform fashion (I'll touch on this in
> the
> description of the second patch).  But that can be improved
> separately.
> 
> The gimple_statement_cond, etc. part has been dysfunctional for a
> while
> (namely since gimple-classes-v2-option-3 branch was merged).  I
> updated
> it to use the new classes' names.  That seems to work (though it
> doesn't
> 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
> scalar_mode
> 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.

Thanks
Dave

Reply via email to