From a8462bbf0bb1c2ef55c87d32bfde6d0a962de87c Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Tue, 30 Oct 2018 21:20:52 +0100 Subject: [PATCH] Fix regression 'info variables' does not show minimal symbols. 12615cba8411c8 Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables] introduced a regression that minimal symbols were not listed anymore, due to a wrong condition checking the absence of a type regexp in the loop scanning the minimal symbols. Instead, before entering the loop scanning the minimal symbols, check that we do not have a type regexp, as we will never match a minimal symbol with this type regexp. With the fix in this patch, for this part of the code, we basically go back to the GDB 8.2 logic, with just the addition of && !treg.has_value ()) to 'enter' in the minsym case. This should ensure that at least there is no regression compared to 8.2, when not using the new type matching argument, as there was no treg in 8.2. 2018-11-20 Philippe Waroquiers * symtab.c (search_symbols): Properly check absence of type regexp before entering the loop scanning the minimal symbols. --- gdb/ChangeLog | 5 +++++ gdb/symtab.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 067fb3db17..a04f498c92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-11-20 Philippe Waroquiers + + * symtab.c (search_symbols): Properly check absence of type regexp + before entering the loop scanning the minimal symbols. + 2018-11-20 John Darrington * s12z-tdep.c (s12z_extract_return_value): New function. diff --git a/gdb/symtab.c b/gdb/symtab.c index 2e9e6325ad..7a77bcfb18 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4544,9 +4544,12 @@ search_symbols (const char *regexp, enum search_domain kind, sort_search_symbols_remove_dups (&result); /* If there are no eyes, avoid all contact. I mean, if there are - no debug symbols, then add matching minsyms. */ + no debug symbols, then add matching minsyms. But if the user wants + to see symbols matching a type regexp, then never give a minimal symbol, + as we assume that a minimal symbol does not have a type. */ - if (found_misc || (nfiles == 0 && kind != FUNCTIONS_DOMAIN)) + if ((found_misc || (nfiles == 0 && kind != FUNCTIONS_DOMAIN)) + && !treg.has_value ()) { ALL_MSYMBOLS (objfile, msymbol) { @@ -4560,13 +4563,9 @@ search_symbols (const char *regexp, enum search_domain kind, || MSYMBOL_TYPE (msymbol) == ourtype3 || MSYMBOL_TYPE (msymbol) == ourtype4) { - /* If the user wants to see var matching a type regexp, - then never give a minimal symbol. */ - if (kind != VARIABLES_DOMAIN - && !treg.has_value () /* minimal symbol has never a type ???? */ - && (!preg.has_value () - || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0, - NULL, 0) == 0)) + if (!preg.has_value () + || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0, + NULL, 0) == 0) { /* For functions we can do a quick check of whether the symbol might be found via find_pc_symtab. */ -- 2.34.1