From c620ed8866cc90ccfa363daf98ce7061d076d598 Mon Sep 17 00:00:00 2001 From: Christian Biesinger Date: Tue, 25 Jun 2019 15:45:41 -0500 Subject: Add Objfile.lookup_{global,static}_symbol functions This is essentially the inverse of Symbol.objfile. This allows handling different symbols with the same name (but from different objfiles) and can also be faster if the objfile is known. gdb/ChangeLog: 2019-07-29 Christian Biesinger * NEWS: Mention new functions Objfile.lookup_{global,static}_symbol. * python/py-objfile.c (objfpy_lookup_global_symbol): New function. (objfpy_lookup_static_symbol): New function. (objfile_object_methods): Add new functions. gdb/doc/ChangeLog: 2019-07-29 Christian Biesinger * python.texi (Objfiles In Python): Document new functions Objfile.lookup_{global,static}_symbol. gdb/testsuite/ChangeLog: 2019-07-29 Christian Biesinger * gdb.python/py-objfile.c: Add global and static vars. * gdb.python/py-objfile.exp: Test new functions Objfile. lookup_global_symbol and lookup_static_symbol. --- gdb/doc/python.texi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gdb/doc/python.texi') diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 0346235..bbba519 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -4441,6 +4441,23 @@ searches then this function can be used to add a debug info file from a different place. @end defun +@defun Objfile.lookup_global_symbol (name @r{[}, domain@r{]}) +Search for a global symbol named @var{name} in this objfile. Optionally, the +search scope can be restricted with the @var{domain} argument. +The @var{domain} argument must be a domain constant defined in the @code{gdb} +module and described in @ref{Symbols In Python}. This function is similar to +@code{gdb.lookup_global_symbol}, except that the search is limited to this +objfile. + +The result is a @code{gdb.Symbol} object or @code{None} if the symbol +is not found. +@end defun + +@defun Objfile.lookup_static_symbol (name @r{[}, domain@r{]}) +Like @code{Objfile.lookup_global_symbol}, but searches for a global +symbol with static linkage named @var{name} in this objfile. +@end defun + @node Frames In Python @subsubsection Accessing inferior stack frames from Python -- cgit v1.1