From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: Python and structured output from breakpoint_ops
Date: Fri, 07 Oct 2011 16:04:00 -0000 [thread overview]
Message-ID: <201110071704.27691.pedro@codesourcery.com> (raw)
In-Reply-To: <m3hb3kerow.fsf@fleche.redhat.com>
On Friday 07 October 2011 16:39:59, Tom Tromey wrote:
> Phil> So again we are limited to a string and a constant. I guess we could,
> Phil> if the user passed a list within a list, call ui_out_list there. But to
> Phil> me, you will only ever want this output on one line (in fact, it may be
> Phil> a requirement, I am not to sure).
>
> I don't think it has to be.
>
> Phil> There seems to be more room to maneuver with print_mention, and
> Phil> print_one_detail. They are currently implemented as pure strings. But
> Phil> again, both I believe (and really, I want) to be implemented as a single
> Phil> string. print_mention is called when a breakpoint is created. Is there
> Phil> an example of what kind of structured output we could use here?
>
> I think I was hoping that we could unify some of the print methods. It
> seems strange to have 4 different method to print more or less the same
> basic information.
I still think we should cleanup the breakpoint printing machinery before
exporting it to python. These methods were not converted to
breakpoint_ops yet. By only considering a single string, you're leaving
out breakpoints with multiple locations. And those will become even more
important with Tom's linespec/multi-location rework.
> This might mean constraining the output a little bit in order to provide
> a simpler API. I think that would be good, but that is just my opinion;
> however, if it turned out to be too limiting we could always extend the
> options later.
>
> Even if all the methods can't be unified it seems that at least
> print_one and print_one_detail could be.
>
> Phil> print_one_detail is an optional detail line below each entry for "info
> Phil> breakpoints". This has to be limited to a single line, to remain
> Phil> constant with "info breakpoints" output.
>
> It seems like it could have multiple lines, just nothing does this yet.
Yeah. Random catchpoints are likely to want it.
> This is a good example of where structured output is useful: right now
> the code has to know how to format the continuation lines (e.g., start
> with a tab) -- but it seems like it would be better not to bake this
> into Python scripts everywhere, in case we want to change the "info
> break" formatting in the future. Some kind of structured result would
> let us do this.
Yeah. I'd like that direction. It'd allow for more smarter column/cell
wrapping too.
> Phil> In fact, if you look at the mi command -break-list, it just maps
> Phil> to info break and captures that output. Maybe that conversation
> Phil> is what Jan was talking about when there is an explicit mention
> Phil> that any field change has to be made by Vlad?
The thing is that the fields that are output aren't constrained at all
by the "address" / "what" columns you see in the CLI. Look at all
the "ui_out_*" calls. It seems quite reasonable to me to be able to
output random fields from python too, so you could implement new
breakpoint/catchpoints in python and forward whatever necessary info
to the frontend through MI.
--
Pedro Alves
next prev parent reply other threads:[~2011-10-07 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 15:16 Tom Tromey
2011-10-07 15:40 ` Tom Tromey
2011-10-07 16:04 ` Pedro Alves [this message]
2011-10-10 9:22 ` Phil Muldoon
2011-10-10 18:47 ` Pedro Alves
2011-10-10 9:14 ` Phil Muldoon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201110071704.27691.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox