[9/9] gdb: fix some comments in global_symbol_searcher

Message ID 20260929194119.155169-10-simon.marchi@efficios.com
State New
Headers
Series Cleanups in global_symbol_searcher |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed

Commit Message

Simon Marchi Sept. 29, 2026, 7:39 p.m. UTC
  Fix a few comments in and around global_symbol_searcher:

 - The comment of global_symbol_searcher::m_exclude_minsyms refers to
   M_SYMBOL_REGEXP, which does not (or no longer) exist.  It means
   M_SYMBOL_NAME_REGEXP.

 - The comment in global_symbol_searcher::add_matching_msymbols refers
   to find_pc_symtab, which does not exist anymore.  The code calls
   find_compunit_symtab_for_pc.

 - The comment of global_symbol_searcher calls it a structure, but it
   is a class.

Change-Id: I0ec18651688406bb525752a53b9558096a798aef
---
 gdb/symtab.c | 2 +-
 gdb/symtab.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Rohr, Stephan Sept. 30, 2026, 2:01 p.m. UTC | #1
We could fix the comment regarding "RESULTS_SET" I mentioned in
patch #8 feedback in this patch.  In the same comment in symtab.h for methods
"add_matching_symbols" and "add_matching_msymbols" we also have
"MAX_SEARCH_RESULTS" vs. "M_MAX_SEARCH_RESULTS".  Which one is correct?
We could use this patch for proper alignment.

> -----Original Message-----
> From: Simon Marchi <simon.marchi@efficios.com>
> Sent: Tuesday, 29 September 2026 21:40
> To: gdb-patches@sourceware.org
> Cc: Simon Marchi <simon.marchi@efficios.com>
> Subject: [PATCH 9/9] gdb: fix some comments in global_symbol_searcher
> 
> Fix a few comments in and around global_symbol_searcher:
> 
>  - The comment of global_symbol_searcher::m_exclude_minsyms refers to
>    M_SYMBOL_REGEXP, which does not (or no longer) exist.  It means
>    M_SYMBOL_NAME_REGEXP.
> 
>  - The comment in global_symbol_searcher::add_matching_msymbols refers
>    to find_pc_symtab, which does not exist anymore.  The code calls
>    find_compunit_symtab_for_pc.
> 
>  - The comment of global_symbol_searcher calls it a structure, but it
>    is a class.
> 
> Change-Id: I0ec18651688406bb525752a53b9558096a798aef
> ---
>  gdb/symtab.c | 2 +-
>  gdb/symtab.h | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index 10a794004d33..611815a568d6 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -4944,7 +4944,7 @@
> global_symbol_searcher::add_matching_msymbols
>  	continue;
> 
>        /* For functions we can do a quick check of whether the
> -	 symbol might be found via find_pc_symtab.  */
> +	 symbol might be found via find_compunit_symtab_for_pc.  */
>        if (m_kind == symbol_search_kind::FUNCTION
>  	  && (find_compunit_symtab_for_pc
>  	      (msymbol->value_address (objfile)) != NULL))
> diff --git a/gdb/symtab.h b/gdb/symtab.h
> index e382b64b427c..1d92907fce2c 100644
> --- a/gdb/symtab.h
> +++ b/gdb/symtab.h
> @@ -2604,8 +2604,8 @@ enum class symbol_search_kind
>  };
> 
>  /* In order to search for global symbols of a particular kind matching
> -   particular regular expressions, create an instance of this structure and
> -   call the SEARCH member function.  */
> +   particular regular expressions, create an instance of this class and call
> +   the SEARCH member function.  */
>  class global_symbol_searcher
>  {
>  public:
> @@ -2661,8 +2661,8 @@ class global_symbol_searcher
>    /* Regular expression to match against the symbol type.  */
>    const char *m_symbol_type_regexp = nullptr;
> 
> -  /* When this flag is false then minsyms that match M_SYMBOL_REGEXP will
> -     be included in the results, otherwise they are excluded.  */
> +  /* When this flag is false then minsyms that match
> M_SYMBOL_NAME_REGEXP
> +     will be included in the results, otherwise they are excluded.  */
>    bool m_exclude_minsyms = false;
> 
>    /* Maximum number of search results.  We currently impose a hard limit
> --
> 2.55.0

________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
  
Simon Marchi Oct. 1, 2026, 1:38 a.m. UTC | #2
On 2026-09-30 10:01, Rohr, Stephan wrote:
> We could fix the comment regarding "RESULTS_SET" I mentioned in
> patch #8 feedback in this patch.  In the same comment in symtab.h for methods
> "add_matching_symbols" and "add_matching_msymbols" we also have
> "MAX_SEARCH_RESULTS" vs. "M_MAX_SEARCH_RESULTS".  Which one is correct?
> We could use this patch for proper alignment.

Ok, I included the RESULT_SET fix in this patch.

It would be M_MAX_SEARCH_RESULTS nowadays.

Simon
  

Patch

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 10a794004d33..611815a568d6 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4944,7 +4944,7 @@  global_symbol_searcher::add_matching_msymbols
 	continue;
 
       /* For functions we can do a quick check of whether the
-	 symbol might be found via find_pc_symtab.  */
+	 symbol might be found via find_compunit_symtab_for_pc.  */
       if (m_kind == symbol_search_kind::FUNCTION
 	  && (find_compunit_symtab_for_pc
 	      (msymbol->value_address (objfile)) != NULL))
diff --git a/gdb/symtab.h b/gdb/symtab.h
index e382b64b427c..1d92907fce2c 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2604,8 +2604,8 @@  enum class symbol_search_kind
 };
 
 /* In order to search for global symbols of a particular kind matching
-   particular regular expressions, create an instance of this structure and
-   call the SEARCH member function.  */
+   particular regular expressions, create an instance of this class and call
+   the SEARCH member function.  */
 class global_symbol_searcher
 {
 public:
@@ -2661,8 +2661,8 @@  class global_symbol_searcher
   /* Regular expression to match against the symbol type.  */
   const char *m_symbol_type_regexp = nullptr;
 
-  /* When this flag is false then minsyms that match M_SYMBOL_REGEXP will
-     be included in the results, otherwise they are excluded.  */
+  /* When this flag is false then minsyms that match M_SYMBOL_NAME_REGEXP
+     will be included in the results, otherwise they are excluded.  */
   bool m_exclude_minsyms = false;
 
   /* Maximum number of search results.  We currently impose a hard limit