+2018-04-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * symtab.c (print_symbol_info): Precede the symbol definition by
+ the line number when available.
+ * NEWS: Advertise this enhancement.
+
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* NEWS (New options): announce set/show record btrace cpu.
*** Changes since GDB 8.1
+* The commands 'info variables/functions/types' now show the source line
+ numbers of symbol definitions when available.
+
* 'info proc' now works on running processes on FreeBSD systems and core
files created on FreeBSD systems.
+2018-04-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.texinfo (Symbols): Mention the fact that "info
+ variables/functions/types" show source files and line numbers.
+
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* gdb.texinfo: Document set/show record btrace cpu.
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
@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
fputs_filtered (":\n", gdb_stdout);
}
+ if (SYMBOL_LINE (sym) != 0)
+ printf_filtered ("%d:\t", SYMBOL_LINE (sym));
+ else
+ puts_filtered ("\t");
+
if (kind != TYPES_DOMAIN && block == STATIC_BLOCK)
printf_filtered ("static ");
+2018-04-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * 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.
+
2018-04-13 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/cpu.exp: New.
set eol "\[\r\n\]+"
gdb_test "info types new_integer_type" \
- "All types matching regular expression \"new_integer_type\":${eol}File .*info_types.c:${eol}int"
+ "All types matching regular expression \"new_integer_type\":${eol}File .*info_types.c:${eol}.*\tint"
-re "marker1.*$gdb_prompt " {
send_gdb "\n"
gdb_test_multiple "" "$test" {
- -re "All functions matching regular expression \"marker\":.*File.*break1.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long( int)?\\);.*$gdb_prompt $" {
+ -re "All functions matching regular expression \"marker\":.*File.*break1.c:.*\tint marker1\\((void|)\\);\r\n.*:\tint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long( int)?\\);.*$gdb_prompt $" {
pass "$test"
}
}
# We should report that integer comes from the header file.
if { $non_dwarf } { setup_xfail *-*-* }
-gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/${subdir}/${testfile}.h:\r\nint integer;"
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/${subdir}/${testfile}.h:\r\n.*\tint integer;"
set func1_name ""
set func2_name ""
gdb_test_multiple "info functions func<.>" "info functions" {
- -re "\r\nint (\[^\r\]*func<1>\[^\r]*);" {
+ -re "\tint (\[^\r\]*func<1>\[^\r]*);" {
set func1_name $expect_out(1,string)
exp_continue
}
- -re "\r\nint (\[^\r\]*func<2>\[^\r]*);" {
+ -re "\tint (\[^\r\]*func<2>\[^\r]*);" {
set func2_name $expect_out(1,string)
exp_continue
}
regsub {\\\(void\\\)} $demangled {\(\)} demangled
gdb_test "info function $name" \
- "File .*:\r\n(class|)${demangled}.*" \
+ "File .*:\t(class|)${demangled}.*" \
"info function for \"$name\""
}
setup_xfail hppa*-*-*11* CLLbs14869
gdb_test_multiple "info func xyzq" "info func xyzq" {
- -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
+ -re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
pass "info func xyzq"
}
- -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" {
+ -re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" {
pass "info func xyzq"
}
}
# The dot-leading symbol is for ppc64 function descriptors.
gdb_test "info functions fUnC_lang" \
- "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\nfoo FUNC_lang\\(void\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \
+ "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(void\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \
"regexp case-sensitive off"
gdb_test "p fuNC_lang" { = {foo \(void\)} 0x[0-9a-f]+ <FUNC_lang>}