diff options
author | Tom Tromey <tromey@adacore.com> | 2023-05-01 13:53:59 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-05-24 06:16:10 -0600 |
commit | 3153113252f3b949a159439a17e88af8ff0dce30 (patch) | |
tree | d16ff13f418aa76f116561500da0d812a9536922 /gdb/doc/python.texi | |
parent | 2f328f5b92f1eba7fef3f49058a4cb4494f98833 (diff) | |
download | binutils-3153113252f3b949a159439a17e88af8ff0dce30.zip binutils-3153113252f3b949a159439a17e88af8ff0dce30.tar.gz binutils-3153113252f3b949a159439a17e88af8ff0dce30.tar.bz2 |
Add attributes and methods to gdb.Inferior
This adds two new attributes and three new methods to gdb.Inferior.
The attributes let Python code see the command-line arguments and the
name of "main". Argument setting is also supported.
The methods let Python code manipulate the inferior's environment
variables.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/doc/python.texi')
-rw-r--r-- | gdb/doc/python.texi | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 38f756e..69755e9 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -3451,10 +3451,30 @@ Boolean signaling whether the inferior was created using `attach', or started by @value{GDBN} itself. @end defvar +@defvar Inferior.main_name +A string holding the name of this inferior's ``main'' function, if it +can be determined. If the name of main is not known, this is +@code{None}. +@end defvar + @defvar Inferior.progspace The inferior's program space. @xref{Progspaces In Python}. @end defvar +@defvar Inferior.arguments +The inferior's command line arguments, if known. This corresponds to +the @code{set args} and @code{show args} commands. @xref{Arguments}. + +When accessed, the value is a string holding all the arguments. The +contents are quoted as they would be when passed to the shell. If +there are no arguments, the value is @code{None}. + +Either a string or a sequence of strings can be assigned to this +attribute. When a string is assigned, it is assumed to have any +necessary quoting for the shell; when a sequence is assigned, the +quoting is applied by @value{GDBN}. +@end defvar + A @code{gdb.Inferior} object has the following methods: @defun Inferior.is_valid () @@ -3522,6 +3542,30 @@ the same functionality, but use of @code{Inferior.thread_from_thread_handle} is deprecated. @end defun + +The environment that will be passed to the inferior can be changed +from Python by using the following methods. These methods only take +effect when the inferior is started -- they will not affect an +inferior that is already executing. + +@findex Inferior.clear_env +@defun Inferior.clear_env () +Clear the current environment variables that will be passed to this +inferior. +@end defun + +@findex Inferior.set_env +@defun Inferior.set_env (name, value) +Set the environment variable @var{name} to have the indicated value. +Both parameters must be strings. +@end defun + +@findex Inferior.unset_env +@defun Inferior.unset_env (name) +Unset the environment variable @var{name}. @var{name} must be a +string. +@end defun + @node Events In Python @subsubsection Events In Python @cindex inferior events in Python |