Re: RFC: Skip declarations in "info variables"

Eli Zaretskii
2009-11-14T09:36:08Z

> Date: Fri, 13 Nov 2009 16:44:48 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> The second problem is that integer is listed twice. Jan pointed me to
> GCC PR 37982; the file has a declaration and definition for the
> variable if it is referenced (only a definition, otherwise).
> I don't think we should display the declaration. So I've changed
> search_symbols not to display variables of class LOC_UNRESOLVED, and
> updated the documentation to match. While this is a change of
> behavior, I don't think it's problematic.

To decide whether or not this is a Good Thing, we need to answer a
question: What is the purpose of "info variables"? More specifically,
what are the main use-cases for using it? Can people please share
their experience with this command?

Without that, I'm not sure we are not removing a potentially useful
behavior.

Alternatively, we could add a new `info' command, or a variant of
"info variables", that would show the declared variables as well.
Then we don't need to worry about the possibility of removing useful
functionality.

> Index: src/gdb/doc/gdb.texinfo
> ===================================================================
> --- src.orig/gdb/doc/gdb.texinfo 2009-11-13 16:28:20.000000000 -0500
> +++ src/gdb/doc/gdb.texinfo 2009-11-13 16:28:43.000000000 -0500
> @@ -12920,7 +12920,7 @@ that conflict with the regular expressio
>
> @kindex info variables
> @item info variables
> -Print the names and data types of all variables that are declared
> +Print the names and data types of all variables that are defined
> outside of functions (i.e.@: excluding local variables).
>
> @item info variables @var{regexp}

This is an almost mechanical change, so okay. But I think we need a
NEWS entry about the behavior change.