diff options
author | Yit Phang Khoo <khooyp@sourceware.org> | 2012-08-22 19:15:15 +0000 |
---|---|---|
committer | Yit Phang Khoo <khooyp@sourceware.org> | 2012-08-22 19:15:15 +0000 |
commit | 8315665ec17eb95a2e12599d6dfb18aa45a12eb6 (patch) | |
tree | 549c15527aa765f01dfdb3d5a3ea637c02803993 /gdb/doc | |
parent | 1e2bee4f5f1bdeb8c5cadbecf9d0b92e60a8bd13 (diff) | |
download | gdb-8315665ec17eb95a2e12599d6dfb18aa45a12eb6.zip gdb-8315665ec17eb95a2e12599d6dfb18aa45a12eb6.tar.gz gdb-8315665ec17eb95a2e12599d6dfb18aa45a12eb6.tar.bz2 |
Add a new "python-interactive" command that starts a standard
Python interactive prompt with "pi" as alias, and add "py" as
an alias to "python".
* NEWS: Mention the new commands.
* doc/gdb.texinfo (Python Commands): Document the new
commands.
* python/python.c (eval_python_command): New function.
(python_interactive_command): For "python-interactive" with
arguments, call eval_python_command. For "python-interactive"
without arguments, call PyRun_InteractiveLoop.
(_initialize_python): Add "python-interactive" command with
"pi" as alias, and add "py" as an alias to "python".
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/gdb.texinfo | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 08ba92d..4410a47 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -22506,12 +22506,30 @@ automatically imported when @value{GDBN} starts. @cindex python commands @cindex commands to access python -@value{GDBN} provides one command for accessing the Python interpreter, +@value{GDBN} provides two commands for accessing the Python interpreter, and one related setting: @table @code +@kindex python-interactive +@kindex pi +@item python-interactive @r{[}@var{command}@r{]} +@itemx pi @r{[}@var{command}@r{]} +Without an argument, the @code{python-interactive} command can be used +to start an interactive Python prompt. + +Alternatively, a single-line Python command can be given as an +argument and evaluated. If the command is an expression, the result +will be printed; otherwise, nothing will be printed. For example: + +@smallexample +(@value{GDBP}) python-interactive 2 + 3 +5 +@end smallexample + @kindex python -@item python @r{[}@var{code}@r{]} +@kindex py +@item python @r{[}@var{command}@r{]} +@itemx py @r{[}@var{command}@r{]} The @code{python} command can be used to evaluate Python code. If given an argument, the @code{python} command will evaluate the |