gdb/python: new Progspace.symbol_file attribute

Add a new Progspace.symbol_file attribute.  This attribute holds the
gdb.Objfile object that corresponds to Progspace.filename, or None if
there is no main symbol file currently set.

Currently, to get this gdb.Objfile, a user would need to use
Progspace.objfiles, and then search for the objfile with a name that
matches Progspace.filename -- which should work just fine, but having
direct access seems a little nicer.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Andrew Burgess
2023-09-07 11:18:16 +01:00
parent ce65386db6
commit 5ce85461a1
4 changed files with 54 additions and 0 deletions

View File

@@ -5078,6 +5078,23 @@ If there is no main symbol table currently loaded, then this attribute
will be @code{None}.
@end defvar
@defvar Progspace.symbol_file
The @code{gdb.Objfile} representing the main symbol file (from which
debug symbols have been loaded) for the @code{gdb.Progspace}. This is
the symbol file set by the @kbd{symbol-file} or @kbd{file} commands.
This will be the @code{gdb.Objfile} representing
@code{Progspace.filename} when @code{Progspace.filename} is not
@code{None}.
If there is no main symbol table currently loaded, then this attribute
will be @code{None}.
If the @code{Progspace} is invalid, i.e.@:, when
@code{Progspace.is_valid()} returns @code{False}, then attempting to
access this attribute will raise a @code{RuntimeError} exception.
@end defvar
@defvar Progspace.pretty_printers
The @code{pretty_printers} attribute is a list of functions. It is
used to look up pretty-printers. A @code{Value} is passed to each