From 0fe7935b333f7332ffd501dc45ff73ceec09b45f Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Mon, 28 Dec 2009 21:29:53 +0000 Subject: [PATCH] * NEWS: Document "info variables" change. * dwarf2read.c (new_symbol): Add file-scope external unresolved symbols to global_symbols. * symtab.c (search_symbols): Skip LOC_UNRESOLVED symbols. doc/ * gdb.texinfo (Symbols): "info variables" prints definitions, not declarations. --- gdb/ChangeLog | 7 +++++++ gdb/NEWS | 4 ++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 2 +- gdb/dwarf2read.c | 9 ++++++++- gdb/symtab.c | 5 ++++- 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a12ca6b..6ccb88b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2009-12-28 Daniel Jacobowitz + * NEWS: Document "info variables" change. + * dwarf2read.c (new_symbol): Add file-scope external unresolved + symbols to global_symbols. + * symtab.c (search_symbols): Skip LOC_UNRESOLVED symbols. + +2009-12-28 Daniel Jacobowitz + * defs.h (print_address_symbolic, build_address_symbolic): Update prototypes. * printcmd.c (print_address_symbolic): Take a gdbarch argument. diff --git a/gdb/NEWS b/gdb/NEWS index 9061dbf..8c0fd92 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -30,6 +30,10 @@ disassemble The disassemble command, when invoked with two arguments, now requires the arguments to be comma-separated. +info variables + The info variables command now displays variable definitions. Files + which only declare a variable are not shown. + * New commands (for set/show, see "New options" below) record save [] diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index aa6ab58..bd4d5d1 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-12-28 Daniel Jacobowitz + + * gdb.texinfo (Symbols): "info variables" prints definitions, not + declarations. + 2009-12-21 Vladimir Prus * gdb.texinfo (GDB/MI Miscellaneous Commands): Clarify that diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 40bbe07..308834f 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -12924,7 +12924,7 @@ that conflict with the regular expression language (e.g.@: @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} diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ffeaaf2..2205ef7 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -8463,8 +8463,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (attr2 && (DW_UNSND (attr2) != 0) && dwarf2_attr (die, DW_AT_type, cu) != NULL) { + struct pending **list_to_add; + + /* A variable with DW_AT_external is never static, but it + may be block-scoped. */ + list_to_add = (cu->list_in_scope == &file_symbols + ? &global_symbols : cu->list_in_scope); + SYMBOL_CLASS (sym) = LOC_UNRESOLVED; - add_symbol_to_list (sym, cu->list_in_scope); + add_symbol_to_list (sym, list_to_add); } else if (!die_is_declaration (die, cu)) { diff --git a/gdb/symtab.c b/gdb/symtab.c index 950be26..cba9e68 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3296,7 +3296,9 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], && ((regexp == NULL || re_exec (SYMBOL_NATURAL_NAME (*psym)) != 0) && ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (*psym) != LOC_TYPEDEF - && SYMBOL_CLASS (*psym) != LOC_BLOCK) + && SYMBOL_CLASS (*psym) != LOC_UNRESOLVED + && SYMBOL_CLASS (*psym) != LOC_BLOCK + && SYMBOL_CLASS (*psym) != LOC_CONST) || (kind == FUNCTIONS_DOMAIN && SYMBOL_CLASS (*psym) == LOC_BLOCK) || (kind == TYPES_DOMAIN && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)))) { @@ -3372,6 +3374,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], && ((regexp == NULL || re_exec (SYMBOL_NATURAL_NAME (sym)) != 0) && ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF + && SYMBOL_CLASS (sym) != LOC_UNRESOLVED && SYMBOL_CLASS (sym) != LOC_BLOCK && SYMBOL_CLASS (sym) != LOC_CONST) || (kind == FUNCTIONS_DOMAIN && SYMBOL_CLASS (sym) == LOC_BLOCK) -- 2.7.4