Re: [RFA/doco] Improve doc on how to execute a Python script from GDB.

Eli Zaretskii
2010-01-19T21:43:08Z

> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Joel Brobecker <brobecker@adacore.com>
> Date: Tue, 19 Jan 2010 19:07:59 +0400
>
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (File Options): Adjust the documentation of this
> switch to refer to the "source" command rather than partially
> duplicating some of the relevant information.
> (Extending GDB): Introduce and document the set/show script-extension
> setting.
> (Command Files): Add note explaining that the "source" command
> is also used to evalute scripts written in other languages.
> Remove the short slightly incorrect reference to sourcing Python
> scripts.
> (Python Commands): Document how to execute a Python script from GDB.
>
> I hope that this patch is going to improve the documentation, because
> I ended up spending a lot of time working on it :-(.

Thanks, I appreciate the effort.

> +Execute commands from file @var{file}. The contents of this file is
> +evaluated exactly as if it was evaluated using the @code{source} command.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"exactly as the @code{source} command would."

> +To facilitate the use of these extensions, @value{GDBN} is capable
> +of evaluating the contents of a file. When doing so, @value{GDBN}
> +can recognize which scripting language is being used by exploiting
> +the filename extension. ^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^

"by looking at the filename extension" is simpler and more clear, I
think.

> +are always treated as a @value{GDBN} Command Files.

Please move here the xref to where Command Files are described, which
you have later. It should be where the term is first used.

> To control how GDB
> +evaluates these files, the following setting can be used:

Avoid passive tense:

You can control how @value{GDBN} evaluates these files with the
following setting:

> +The script name must end with @samp{.py} and GDB must be configured
^^^
@value{GDBN}

> +@item python execfile ("script-name")
> +This method is based on the @code{execfile} Python built-in function,
> +and thus is always available.

"always" as in "when Python is compiled in", right?

Thanks again for working on this.