Re: [PATCH v3] Add Objfile.lookup_{global,static}_symbol functions

Eli Zaretskii
2019-07-27T07:52:31Z

> Date: Fri, 26 Jul 2019 19:30:56 -0500
> From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
> Cc: Christian Biesinger <cbiesinger@google.com>
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index cc1d58520d..d8fb4cfe7f 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -36,6 +36,9 @@
> ** gdb.Type has a new property 'objfile' which returns the objfile the
> type was defined in.
>
> + ** gdb.Objfile has new methods 'lookup_global_symbol' and
> + 'lookup_static_symbol' to lookup a symbol from this objfile only.
> +

This part is OK.

> +@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_global_symbol (name @r{[}, domain@r{]})

I guess you meant lookup_static_symbol here?

> +Search for a global symbol with static linkage 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

As the description of both methods is almost identical, I wonder
whether it wouldn't be better to have the second method be described
as "Like @code{lookup_global_symbol}, but ..." and tell the
differences between them.

Thanks.