Re: [PATCH] Replace the block_found global with explicit data-flow

Luis Machado
2015-08-01T16:04:12Z

On 08/01/2015 06:35 AM, Pierre-Marie de Rodat wrote:
> On 08/01/2015 11:08 AM, Pierre-Marie de Rodat wrote:
> gdb/
>
> * alpha-mdebug-tdep.c (find_proc_desc): Update call to
> lookup_symbol.
> * ft32-tdep.c (ft32_skip_prologue): Likewise.
> * moxie-tdep.c (moxie_skip_prologue): Likewise.
> * mt-tdep.c (mt_skip_prologue): Likewise.
> * xstormy16-tdep.c (xstormy16_skip_prologue): Likewise.
> ---
> gdb/ChangeLog | 9 +++++++++
> gdb/alpha-mdebug-tdep.c | 3 ++-
> gdb/ft32-tdep.c | 2 +-
> gdb/moxie-tdep.c | 2 +-
> gdb/mt-tdep.c | 2 +-
> gdb/xstormy16-tdep.c | 2 +-
> 6 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index e8c04c0..a62415f 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,14 @@
> 2015-08-01 Pierre-Marie de Rodat<derodat@adacore.com>
>
> + * alpha-mdebug-tdep.c (find_proc_desc): Update call to
> + lookup_symbol.
> + * ft32-tdep.c (ft32_skip_prologue): Likewise.
> + * moxie-tdep.c (moxie_skip_prologue): Likewise.
> + * mt-tdep.c (mt_skip_prologue): Likewise.
> + * xstormy16-tdep.c (xstormy16_skip_prologue): Likewise.
> +
> +2015-08-01 Pierre-Marie de Rodat<derodat@adacore.com>
> +
> * ada-exp.y (write_object_renaming): Replace struct
> ada_symbol_info with struct block_symbol. Update field
> references accordingly.
> diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
> index 2f58c64..a8a511b 100644
> --- a/gdb/alpha-mdebug-tdep.c
> +++ b/gdb/alpha-mdebug-tdep.c
> @@ -107,7 +107,8 @@ find_proc_desc (CORE_ADDR pc)
> symbol reading. */
> sym = NULL;
> else
> - sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0);
> + sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN,
> + 0).symbol;
> }

It is probably a matter of personal taste, but i find it easier and
cleaner to get the result of lookup_symbol (...) assigned to a variable
and then have the code access its 'symbol' field as opposed to chaining
things like the above.

The current codebase doesn't show many occurrences like the above.