diff options
author | Christian Biesinger <cbiesinger@google.com> | 2019-07-30 11:04:37 -0500 |
---|---|---|
committer | Christian Biesinger <cbiesinger@google.com> | 2019-07-30 11:04:37 -0500 |
commit | 2906593ffecef89f8d64e0f1ca21494be71d0ebd (patch) | |
tree | 8749c60aa8e9da72303e4be797345492dc3018a7 /gdb/doc | |
parent | Add missing changelog entry (diff) | |
download | binutils-gdb-2906593ffecef89f8d64e0f1ca21494be71d0ebd.tar.gz binutils-gdb-2906593ffecef89f8d64e0f1ca21494be71d0ebd.tar.bz2 binutils-gdb-2906593ffecef89f8d64e0f1ca21494be71d0ebd.zip |
[PR/24474] Add gdb.lookup_static_symbol to the python API
Similar to lookup_global_symbol, except that it checks the
STATIC_SCOPE.
gdb/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
PR/24474: Add a function to lookup static variables.
* NEWS: Mention this new function.
* python/py-symbol.c (gdbpy_lookup_static_symbol): New function.
* python/python-internal.h (gdbpy_lookup_static_symbol): New function.
* python/python.c (python_GdbMethods): Add new function.
gdb/doc/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* python.texi (Symbols In Python): Document new function
gdb.lookup_static_symbol.
gdb/testsuite/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-symbol.c: Add a static variable and one in an anonymous
namespace.
* gdb.python/py-symbol.exp: Test gdb.lookup_static_symbol.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/python.texi | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 9b91b998bdd..e469b6057d7 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2019-07-30 Christian Biesinger <cbiesinger@google.com> + + * python.texi (Symbols In Python): Document new function + gdb.lookup_static_symbol. + 2019-07-29 Christian Biesinger <cbiesinger@google.com> * python.texi (Objfiles In Python): Document new functions diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index bbba519ffc0..3fdccd5e435 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -4847,6 +4847,25 @@ The result is a @code{gdb.Symbol} object or @code{None} if the symbol is not found. @end defun +@findex gdb.lookup_static_symbol +@defun gdb.lookup_static_symbol (name @r{[}, domain@r{]}) +This function searches for a global symbol with static linkage by name. +The search scope can be restricted to by the domain argument. + +@var{name} is the name of the symbol. It must be a string. +The optional @var{domain} argument restricts the search to the domain type. +The @var{domain} argument must be a domain constant defined in the @code{gdb} +module and described later in this chapter. + +The result is a @code{gdb.Symbol} object or @code{None} if the symbol +is not found. + +Note that this function will not find function-scoped static variables. To look +up such variables, iterate over the variables of the function's +@code{gdb.Block} and check that @code{block.addr_class} is +@code{gdb.SYMBOL_LOC_STATIC}. +@end defun + A @code{gdb.Symbol} object has the following attributes: @defvar Symbol.type |