[v2,11/11] gdb: fix some comments in global_symbol_searcher

Message ID 20261001020952.698419-12-simon.marchi@polymtl.ca
State New
Headers
Series Cleanups in global_symbol_searcher |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply

Commit Message

Simon Marchi Oct. 1, 2026, 2:09 a.m. UTC
  From: Simon Marchi <simon.marchi@efficios.com>

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.

 - RESULTS_SET -> RESULT_SET

 - MAX_SEARCH_RESULTS -> M_MAX_SEARCH_RESULTS

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

Comments

Andrew Burgess Oct. 1, 2026, 3:56 p.m. UTC | #1
simon.marchi@polymtl.ca writes:

> From: Simon Marchi <simon.marchi@efficios.com>
>
> 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.
>
>  - RESULTS_SET -> RESULT_SET
>
>  - MAX_SEARCH_RESULTS -> M_MAX_SEARCH_RESULTS

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew
  
Simon Marchi Oct. 1, 2026, 5:47 p.m. UTC | #2
On 10/1/26 11:56 AM, Andrew Burgess wrote:
> simon.marchi@polymtl.ca writes:
> 
>> From: Simon Marchi <simon.marchi@efficios.com>
>>
>> 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.
>>
>>  - RESULTS_SET -> RESULT_SET
>>
>>  - MAX_SEARCH_RESULTS -> M_MAX_SEARCH_RESULTS
> 
> Approved-By: Andrew Burgess <aburgess@redhat.com>
> 
> Thanks,
> Andrew

Thanks for the reviews, I addressed your comments and pushed the series.

Simon
  

Patch

diff --git a/gdb/symtab.c b/gdb/symtab.c
index af748190ddd5..eb76cb83bdb4 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4942,7 +4942,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 117d3fb0134f..bd719af66697 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2613,8 +2613,8 @@  extern std::optional<compiled_regex> compile_symbol_search_regex
   (const char *regexp);
 
 /* 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:
@@ -2670,8 +2670,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
@@ -2711,12 +2711,12 @@  class global_symbol_searcher
 		       const std::optional<compiled_regex> &name_regex) const;
 
   /* Add symbols from symtabs in OBJFILE that match NAME_REGEX, and
-     TYPE_REGEX, and are of type M_KIND, to the results set RESULTS_SET.
+     TYPE_REGEX, and are of type M_KIND, to the results set RESULT_SET.
      Return false if we stop adding results early due to having already
      found too many results (based on M_MAX_SEARCH_RESULTS limit),
      otherwise return true.
      Returning true does not indicate that any results were added, just
-     that we didn't _not_ add a result due to reaching MAX_SEARCH_RESULTS.  */
+     that we didn't _not_ add a result due to reaching M_MAX_SEARCH_RESULTS.  */
   bool add_matching_symbols (objfile &objfile,
 			     const std::optional<compiled_regex> &name_regex,
 			     const std::optional<compiled_regex> &type_regex,
@@ -2727,7 +2727,7 @@  class global_symbol_searcher
      due to having already found too many results (based on max search
      results limit M_MAX_SEARCH_RESULTS), otherwise return true.  Returning
      true does not indicate that any results were added, just that we
-     didn't _not_ add a result due to reaching MAX_SEARCH_RESULTS.  */
+     didn't _not_ add a result due to reaching M_MAX_SEARCH_RESULTS.  */
   bool add_matching_msymbols (objfile &objfile,
 			      const std::optional<compiled_regex> &name_regex,
 			      std::vector<symbol_search> &results) const;