This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Debug Methods in GDB Python
- From: Siva Chandra <sivachandra at google dot com>
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 16 Dec 2013 14:43:52 -0800
- Subject: Re: [PATCH] Debug Methods in GDB Python
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gxURLZn0bVH0ztDsyqNyNCNsEx-QkJa6OLd0o8u4Vv_Yg at mail dot gmail dot com> <CAGyQ6gxe2UiMFJs6LDBxetc9ZDuhHj5uc0HP0Pd=ebqNdJ-_Mg at mail dot gmail dot com> <m3wqjize2h dot fsf at sspiff dot org> <CAGyQ6gyoZdRdXr9PY-ZaO=X1z7v8uj2i_PSzLi-ZMnr=J0LvJQ at mail dot gmail dot com> <CAP9bCMTDjJ_ZEqhSbZAwGu8CswZJsLu7UrSL5JeY72bb9AO-qQ at mail dot gmail dot com> <CAGyQ6gycVe2-32djRDfYBWjGQ2LLwqzzR1q0iFBoW+zG5vttvg at mail dot gmail dot com> <CAP9bCMT0M9ZM+hiF9A0jKb125F+9a9b84+hp9mNkj7ek-a0T-w at mail dot gmail dot com>
On Mon, Dec 16, 2013 at 9:56 AM, Doug Evans <xdje42@gmail.com> wrote:
> Note that the grouping in the pretty-printer API is because one
> pretty-printer can pretty-print several objects, and the functionality
> is split into two steps: the lookup object returns a separate object
> which is then later used to do the printing, and the lookup can record
> in the returned pretty-printer-worker object whatever state it wants.
> In dm-v6 AFAICT lookup and functionality exist in the same object so
> that's not possible (e.g., the DebugMethod.match method returns
> True/False instead of, e.g., a debug-method-worker object).
>
> We could, I think(!), go with debug-methods as in v6, sans method
> groups, and later extend it if a more formal grouping is needed.
> I wonder, though, about the match method returning True/False vs the
> pretty-printer way of the lookup object returning an object that then
> does the printing.
> [In the debug method case the lookup method might want to return a
> list if the method is overloaded.]
> Unless there's a compelling reason to be different, I like
> "Consistency Is Good", so that's what I'm shooting for.
> [But if there is a compelling reason to be different, I'm not opposed
> to being different here.]
I do not have a compelling reason to be different here. I only have
couple of personal reasons for doing it that way:
1. <locus>.pretty_printers is actually not a list of pretty printers,
but a list of functions which return a pretty printer. I wanted
<locus>.debug_methods to be a list of actual debug methods.
2. Debug methods are queried for a match twice; Once for object type
and name match, next for argument type match. I wanted these to be
together instead of in separate places (as in, an object-method
matching function and a stateful worker object which does arg type
matching). But I agree that this makes the debug methods stateless
(almost! They do have a name and enabled flag.) for most cases.
I can modify and send a new patch if you feel debug methods should
parallel pretty printers here.
Thanks,
Siva Chandra