From: Tom Tromey <tromey@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Thiago Jung Bauermann <bauerman@br.ibm.com>,
drow@false.org, gdb-patches@sourceware.org
Subject: Re: [RFA][patch 1/9] Yet another respin of the patch with initial Python support
Date: Sat, 26 Jul 2008 17:04:00 -0000 [thread overview]
Message-ID: <m3prp0efvr.fsf@fleche.redhat.com> (raw)
In-Reply-To: <uwsj84wx5.fsf@gnu.org> (Eli Zaretskii's message of "Sat\, 26 Jul 2008 16\:06\:30 +0300")
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> Do I understand correctly that I need not review the doco patches you
Eli> posted prior to this? If there's something else I should review,
Eli> please point to the corresponding messages.
This is it.
>> + GDB now has support for scripting using Python. Whether this is
>> + available is determined at configure time; you can explicitly
>> + disable the support using --without-python.
Eli> Is --without-python a configure-time switch or a run-time switch? If
Eli> the former, I don't think it should be mentioned here. If the latter,
Eli> we should explicitly say it's a run-time switch.
Configure time. I changed the text to read:
* Python scripting
GDB now has support for scripting using Python. Whether this is
available is determined at configure time.
>> +python [code]
>> + Invoke python code.
Eli> Please say a few word about the form of [code]. Is it a string? if
Eli> so, should it be in quotes?
How about:
python [CODE]
Invoke CODE by passing it to the Python interpreter.
I can be as specific as you like here. I thought, though, that NEWS
was just a teaser and that users should read the manual for details.
>> + else if (p1 - p == 6 && !strncmp (p, "python", 6))
Eli> Can we avoid literal constants such as 6 here, and instead make it
Eli> dependent on the string "python"?
Here I just followed the existing code in that file.
>> else if (p1 - p == 10 && !strncmp (p, "loop_break", 10))
Eli> Ditto.
This is existing code. Please read that file, you'll see there are a
dozen cases like this. I don't mind fixing this, but I think it is
generally preferable to do cleanups in a separate patch. If you
disagree, let me know and I will go ahead and mash them together.
>> +* Python:: Scripting @value{GDBN} using Python.
Eli> I think this should not be a separate chapter, but rather a section of
Eli> the "Canned Sequences of Commands" chapter.
This is a drawback of the one-patch-at-a-time submission method.
Later patches, which we have not yet submitted, greatly expand this
chapter. In particular we add a bunch of subsections describing the
Python API.
>> +@node Python
>> +@chapter Scripting @value{GDBN} using Python
>> +@cindex Python
Eli> First, @cindex entries should begin with lower-case letters, to
Eli> produce deterministic results when index entries are sorted.
Ok. I fixed this. You might want to fix the other 121 occurrences ;)
>> + This feature is available only if
>> +@value{GDBN} was configured using @code{--with-python}.
Eli> Please use @option for switches, not @code.
Note there's another use of @code in this situation. I keep copying
the wrong examples :-(
>> +@value{GDBN} exposes a number of features to Python scripts.
Eli> This should end with a colon, and the list of the features should be a
Eli> @table.
I guess those aren't really features, they are more like generic
things that the python-in-gdb programmer ought to know.
So, I don't think a table makes sense, but I suppose the current text
is also misleading. What do you suggest?
>> +In particular, a @value{GDBN} @code{QUIT} exception is translated to a
>> +Python @code{KeyboardInterrupt} exception, and other @value{GDBN}
>> +exceptions are translated to Python @code{RuntimeError}s.
Eli> I think this is nowhere nearly as clear as it should be. Even to a C
Eli> hacker, "QUIT exception" is not sufficiently self-explanatory. Do you
Eli> mean SIGQUIT? then please say so.
Daniel or some other gdb maintainer will have to suggest something.
I don't know what else to call this. exceptions.h refers to "QUIT
event", but also the enum value is "RETURN_QUIT"... maybe the latter?
Eli> Will Python RuntimeError clear enough to casual GDB users who
Eli> want to use Python scripting, but are not experienced Python
Eli> programmers? I'm not sure.
People expecting to do this will have to read a Python manual.
There is no way around that.
Eli> And what about stating explicitly
Eli> which exceptions map to which Python RuntimeError.
It does say -- all the rest of them.
AFAICT gdb really only has quit exceptions and "the other kind".
Eli> Finally, "GDB exception" is itself a term that is not defined anywhere
Eli> in the manual. Strictly speaking, GDB being a C program does not have
Eli> any exception at all.
I guess that is true in some pedantic way, if you assume that only
languages that explicitly have a "throw" statement can have
exceptions. But, in practice it is manifestly untrue for gdb. gdb
uses exceptions everywhere, and discusses them in just those terms.
>> +At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
>> +@code{sys.stderr} to print using @value{GDBN}'s output-paging streams.
>> +A Python program which outputs to one of these streams may have its
>> +output interrupted by the user (@pxref{Screen Size}). In this
>> +situation, a Python @code{KeyboardInterrupt} exception is thrown.
Eli> Is there something here that whoever writes the Python program should
Eli> know to behave correctly? Does she need, for example, catch
Eli> KeyboardInterrupt and do something in the handler? If so, we should
Eli> state here what's needed.
Yes, Python programmers might want to know about this in some
circumstances. It just depends on what they are trying to accomplish.
I don't agree that we need to explain this. I don't think we should
try to explain Python programming in general. Instead, I think we
should explain the Python API and refer users to already existing
Python manuals.
>> +@value{GDBN} introduces a new Python module, named @code{gdb}. All
>> +methods and classes added by @value{GDBN} are placed in this module.
Eli> OK, but what does this mean for whoever writes Python extensions for
Eli> GDB? While at that, how about explaining why a command FOO is indexed
Eli> as gdb.FOO?
I thought it would be nice to index them both ways. Do you disagree?
Python programmers know what the module stuff means. We don't have to
explain that.
>> +Find the value of a @value{GDBN} setting.
Eli> "find" or "display"? If the former, why the name is "show"?
It mimics the CLI command name.
"find" would be weird, IMO. I'm open to other names.
>> + @var{variable} is a string
>> +naming the setting to look up; @var{variable} may contain spaces if the
>> +variable has a multi-part name. For example, @samp{print object} is a
>> +valid variable name.
Eli> So what signals the end of the name? Also, what exactly is a
Eli> "multi-part name"?
The point of this text is to say that you can invoke:
gdb.show("print object")
and get a sensible answer.
If you want to rephrase this somehow, that is fine by me.
>> +Print a string to @value{GDBN}'s paginated standard output stream.
>> +Ordinarily your program should not call this function directly; simply
>> +print to @code{sys.stdout} as usual.
Eli> So why is this command available, and why document it?
Completeness. It is visible in the module.
Tom
next prev parent reply other threads:[~2008-07-26 17:04 UTC|newest]
Thread overview: 147+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 15:59 [RFC][patch 0/9] Python support in GDB Thiago Jung Bauermann
2008-04-29 15:59 ` [RFC][patch 5/9] permit GDB commands implemented in Python Thiago Jung Bauermann
2008-04-29 15:59 ` [RFC][patch 3/9] export hooks mechanism to Python Thiago Jung Bauermann
2008-04-29 21:29 ` Tom Tromey
2008-04-30 18:27 ` Joel Brobecker
2008-04-30 21:30 ` Tom Tromey
2008-05-27 18:22 ` Tom Tromey
2008-04-30 18:29 ` Daniel Jacobowitz
2008-04-30 23:00 ` Tom Tromey
2008-05-29 7:55 ` Daniel Jacobowitz
2008-05-30 14:59 ` Tom Tromey
2008-06-15 22:53 ` Thiago Jung Bauermann
2008-06-15 22:58 ` Tom Tromey
2008-06-16 3:22 ` Daniel Jacobowitz
2008-06-17 18:13 ` Thiago Jung Bauermann
2008-06-17 22:20 ` Joel Brobecker
2008-06-23 17:58 ` Tom Tromey
2008-04-29 15:59 ` [RFC][patch 9/9] export threads " Thiago Jung Bauermann
2008-04-29 15:59 ` [RFC][patch 6/9] export frames " Thiago Jung Bauermann
2008-04-29 15:59 ` [RFC][patch 8/9] export symtab mechanism " Thiago Jung Bauermann
2008-04-29 16:08 ` [RFC][patch 7/9] export block and symbol " Thiago Jung Bauermann
2008-04-29 18:11 ` [RFC][patch 4/9] export breakpoints " Thiago Jung Bauermann
2008-04-29 18:15 ` [RFC][patch 1/9] initial Python support Thiago Jung Bauermann
2008-05-05 8:12 ` Thiago Jung Bauermann
2008-05-05 14:39 ` Daniel Jacobowitz
2008-05-05 14:46 ` Thiago Jung Bauermann
2008-05-05 16:50 ` Daniel Jacobowitz
2008-05-06 2:38 ` Thiago Jung Bauermann
2008-05-11 22:24 ` Thiago Jung Bauermann
2008-05-11 22:26 ` Daniel Jacobowitz
2008-05-12 20:33 ` Thiago Jung Bauermann
2008-05-12 20:39 ` Daniel Jacobowitz
2008-05-12 21:00 ` Thiago Jung Bauermann
2008-05-29 0:29 ` Daniel Jacobowitz
2008-05-30 13:07 ` Function syntax (Was: [RFC][patch 1/9] initial Python support) Tom Tromey
2008-06-08 15:24 ` Doug Evans
2008-06-08 15:32 ` Function syntax Tom Tromey
2008-06-08 18:21 ` Function syntax (Was: [RFC][patch 1/9] initial Python support) Daniel Jacobowitz
2008-06-09 13:48 ` Thiago Jung Bauermann
2008-06-09 18:43 ` Daniel Jacobowitz
2008-06-10 0:24 ` Function syntax Tom Tromey
2008-06-10 0:04 ` Tom Tromey
2008-06-11 0:04 ` Thiago Jung Bauermann
2008-06-10 0:00 ` Tom Tromey
2008-05-30 14:47 ` [RFC][patch 1/9] initial Python support Tom Tromey
2008-06-15 22:35 ` thiagoju
2008-06-23 17:36 ` Tom Tromey
2008-07-06 17:28 ` Tom Tromey
2008-07-08 4:12 ` Thiago Jung Bauermann
2008-07-15 7:38 ` [RFA] " Thiago Jung Bauermann
2008-07-15 17:19 ` Tom Tromey
2008-07-15 18:33 ` Thiago Jung Bauermann
2008-07-15 19:03 ` Tom Tromey
2008-07-16 7:14 ` Thiago Jung Bauermann
2008-07-16 14:39 ` Tom Tromey
2008-07-16 22:02 ` Thiago Jung Bauermann
2008-07-18 19:50 ` Daniel Jacobowitz
2008-07-18 23:24 ` Tom Tromey
2008-07-19 0:45 ` Daniel Jacobowitz
2008-07-19 19:50 ` [RFA] iRe: " Thiago Jung Bauermann
2008-07-19 21:13 ` Daniel Jacobowitz
2008-07-19 22:13 ` Thiago Jung Bauermann
2008-07-20 23:47 ` Thiago Jung Bauermann
2008-07-21 2:03 ` Daniel Jacobowitz
2008-07-23 17:46 ` [obvious] Wipe out CONFIG_INITS Thiago Jung Bauermann
2008-07-20 22:43 ` [RFA] Re: [RFC][patch 1/9] initial Python support Tom Tromey
2008-07-21 1:59 ` Daniel Jacobowitz
2008-07-21 15:29 ` [RFA][patch 1/9] Yet another respin of the patch with " Thiago Jung Bauermann
2008-07-21 16:47 ` Thiago Jung Bauermann
2008-07-26 13:07 ` Eli Zaretskii
2008-07-26 13:43 ` Daniel Jacobowitz
2008-07-26 14:02 ` Eli Zaretskii
2008-07-26 14:42 ` Daniel Jacobowitz
2008-07-26 17:06 ` Eli Zaretskii
2008-07-26 17:26 ` Tom Tromey
2008-07-26 19:21 ` Eli Zaretskii
2008-07-26 17:40 ` Daniel Jacobowitz
2008-07-26 17:10 ` Tom Tromey
2008-07-26 17:40 ` Eli Zaretskii
2008-07-26 18:00 ` Tom Tromey
2008-07-26 18:29 ` Eli Zaretskii
2008-07-26 18:45 ` Tom Tromey
2008-07-26 19:34 ` Eli Zaretskii
2008-07-30 14:59 ` Thiago Jung Bauermann
2008-07-30 17:57 ` Eli Zaretskii
2008-08-04 4:44 ` Thiago Jung Bauermann
2008-08-04 19:18 ` Eli Zaretskii
2008-08-05 3:42 ` Thiago Jung Bauermann
2008-07-26 17:04 ` Tom Tromey [this message]
2008-07-26 17:35 ` Daniel Jacobowitz
2008-07-26 17:42 ` Tom Tromey
2008-07-26 19:18 ` Eli Zaretskii
2008-08-04 2:52 ` Thiago Jung Bauermann
2008-08-04 3:22 ` Eli Zaretskii
2008-08-04 12:15 ` Daniel Jacobowitz
2008-08-04 19:50 ` Eli Zaretskii
2008-08-05 2:08 ` Daniel Jacobowitz
2008-08-05 2:41 ` Thiago Jung Bauermann
2008-08-05 3:32 ` Eli Zaretskii
2008-08-05 12:19 ` Daniel Jacobowitz
2008-08-05 18:10 ` Eli Zaretskii
2008-08-05 18:23 ` Daniel Jacobowitz
2008-08-05 18:50 ` Eli Zaretskii
2008-08-05 18:58 ` Daniel Jacobowitz
2008-07-26 19:20 ` Eli Zaretskii
2008-07-26 18:11 ` Eli Zaretskii
2008-07-26 18:30 ` Daniel Jacobowitz
2008-07-26 19:26 ` Eli Zaretskii
2008-08-01 20:04 ` Tom Tromey
2008-08-02 17:38 ` Daniel Jacobowitz
2008-08-02 17:50 ` Tom Tromey
2008-08-02 19:00 ` Eli Zaretskii
2008-08-05 4:19 ` Thiago Jung Bauermann
2008-08-05 18:14 ` Eli Zaretskii
2008-08-06 5:35 ` [RFA][patch 1/9] Initial Python support, patch du jour Thiago Jung Bauermann
2008-08-06 18:24 ` Eli Zaretskii
2008-08-06 19:53 ` Thiago Jung Bauermann
2008-08-04 4:44 ` [RFA][patch 1/9] Yet another respin of the patch with initial Python support Thiago Jung Bauermann
2008-08-04 19:22 ` Eli Zaretskii
2008-08-05 1:24 ` Thiago Jung Bauermann
2008-08-02 17:41 ` Daniel Jacobowitz
2008-08-02 19:02 ` Eli Zaretskii
2008-08-02 19:07 ` Daniel Jacobowitz
2008-07-15 18:01 ` [RFA] Re: [RFC][patch 1/9] " Thiago Jung Bauermann
2008-04-29 18:17 ` [RFC][patch 2/9] export values mechanism to Python Thiago Jung Bauermann
2008-05-29 1:23 ` Daniel Jacobowitz
2008-06-03 0:19 ` Tom Tromey
2008-06-03 13:04 ` Daniel Jacobowitz
2008-06-03 14:52 ` Tom Tromey
2008-07-07 6:03 ` Thiago Jung Bauermann
2008-07-07 23:44 ` Tom Tromey
2008-07-26 2:55 ` Daniel Jacobowitz
2008-07-26 17:17 ` Tom Tromey
2008-07-26 17:41 ` Daniel Jacobowitz
2008-07-30 3:01 ` Tom Tromey
2008-07-30 14:26 ` Thiago Jung Bauermann
2008-08-13 6:45 ` [python] acessing struct elements Thiago Jung Bauermann
2008-08-13 12:38 ` Daniel Jacobowitz
2008-08-13 20:38 ` Thiago Jung Bauermann
2008-08-17 20:16 ` Tom Tromey
2008-04-29 18:38 ` [RFC][patch 0/9] Python support in GDB Eli Zaretskii
2008-04-29 20:37 ` Thiago Jung Bauermann
2008-04-29 21:22 ` Tom Tromey
2008-04-30 7:54 ` Eli Zaretskii
2008-04-30 19:38 ` Thiago Jung Bauermann
2008-04-30 19:52 ` Eli Zaretskii
2008-05-02 18:30 ` Vladimir Prus
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=m3prp0efvr.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=bauerman@br.ibm.com \
--cc=drow@false.org \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/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