diff options
author | Andreas Arnez <arnez@linux.vnet.ibm.com> | 2018-04-13 19:26:05 +0200 |
---|---|---|
committer | Andreas Arnez <arnez@linux.vnet.ibm.com> | 2018-04-13 19:26:05 +0200 |
commit | b744723f571815e6cee43df371c8e733e34e1edf (patch) | |
tree | d55bf29688834b9cf1e979b21a7ab463a4b5ab62 /gdb/doc/gdb.texinfo | |
parent | 4a4495d62d185bdae17ed6aae6ea8249ad07c799 (diff) | |
download | gdb-b744723f571815e6cee43df371c8e733e34e1edf.zip gdb-b744723f571815e6cee43df371c8e733e34e1edf.tar.gz gdb-b744723f571815e6cee43df371c8e733e34e1edf.tar.bz2 |
Show line numbers in output for "info var/func/type"
The GDB commands "info variables", "info functions", and "info types" show
the appropriate list of definitions matching the given pattern. They also
group them by source files. But no line numbers within these source files
are shown.
The line number information is particularly useful to the user when a
simple "grep" doesn't readily point to a definition. This is often the
case when the definition involves a macro, occurs within a namespace, or
when the identifier appears very frequently in the source file.
This patch enriches the printout of these commands by the line numbers and
adjusts affected test cases to the changed output where necessary. The
new output looks like this:
(gdb) i variables
All defined variables:
File foo.c:
3: const char * const foo;
1: int x;
The line number is followed by a colon and a tab character, which is then
followed by the symbol definition. If no line number is available, the
tab is printed out anyhow, so definitions line up.
gdb/ChangeLog:
* symtab.c (print_symbol_info): Precede the symbol definition by
the line number when available.
* NEWS: Advertise this enhancement.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Mention the fact that "info
variables/functions/types" show source files and line numbers.
gdb/testsuite/ChangeLog:
* gdb.ada/info_types.exp: Adjust expected output to the line
numbers now printed by "info var/func/type".
* gdb.base/completion.exp: Likewise.
* gdb.base/included.exp: Likewise.
* gdb.cp/cp-relocate.exp: Likewise.
* gdb.cp/cplusfuncs.exp: Likewise.
* gdb.cp/namespace.exp: Likewise.
* gdb.dwarf2/dw2-case-insensitive.exp: Likewise.
Diffstat (limited to 'gdb/doc/gdb.texinfo')
-rw-r--r-- | gdb/doc/gdb.texinfo | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 5a83619..28f083f 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -17585,7 +17585,7 @@ name is @code{value}. This command differs from @code{ptype} in two ways: first, like @code{whatis}, it does not print a detailed description; second, it -lists all source files where a type is defined. +lists all source files and line numbers where a type is defined. @kindex info type-printers @item info type-printers @@ -17663,24 +17663,29 @@ have already been read, and files whose symbols will be read when needed. @kindex info functions @item info functions Print the names and data types of all defined functions. +Similarly to @samp{info types}, this command groups its output by source +files and annotates each function definition with its source line +number. @item info functions @var{regexp} -Print the names and data types of all defined functions -whose names contain a match for regular expression @var{regexp}. -Thus, @samp{info fun step} finds all functions whose names -include @code{step}; @samp{info fun ^step} finds those whose names -start with @code{step}. If a function name contains characters -that conflict with the regular expression language (e.g.@: +Like @samp{info functions}, but only print the names and data types of +functions whose names contain a match for regular expression +@var{regexp}. Thus, @samp{info fun step} finds all functions whose +names include @code{step}; @samp{info fun ^step} finds those whose names +start with @code{step}. If a function name contains characters that +conflict with the regular expression language (e.g.@: @samp{operator*()}), they may be quoted with a backslash. @kindex info variables @item info variables Print the names and data types of all variables that are defined outside of functions (i.e.@: excluding local variables). +The printed variables are grouped by source files and annotated with +their respective source line numbers. @item info variables @var{regexp} -Print the names and data types of all variables (except for local -variables) whose names contain a match for regular expression +Like @kbd{info variables}, but only print the names and data types of +non-local variables whose names contain a match for regular expression @var{regexp}. @kindex info classes |