Improve some comments about msymbol handling

Message ID 20190930011538.114305-1-cbiesinger@google.com
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Sept. 30, 2019, 1:15 a.m. UTC
  This just clarifies some comments about the hashtables involved
in msymbols.

gdb/ChangeLog:

2019-09-29  Christian Biesinger  <cbiesinger@google.com>

	* minsyms.h (msymbol_hash): Document that this is a case-insensitive
	hash and why.
	* objfiles.h (struct objfile_per_bfd_storage) <demangled_names_hash,
	msymbol_hash, msymbol_demangled_hash>: Improve comments.
---
 gdb/minsyms.h  |  3 ++-
 gdb/objfiles.h | 14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)
  

Comments

Tom Tromey Sept. 30, 2019, 4:08 p.m. UTC | #1
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:

Christian> 2019-09-29  Christian Biesinger  <cbiesinger@google.com>

Christian> 	* minsyms.h (msymbol_hash): Document that this is a case-insensitive
Christian> 	hash and why.
Christian> 	* objfiles.h (struct objfile_per_bfd_storage) <demangled_names_hash,
Christian> 	msymbol_hash, msymbol_demangled_hash>: Improve comments.

Thank you.

Christian> +/* Compute a hash code for the string argument. Unlike htab_hash_string,

GNU style is two spaces after the period.

This is ok with that change.

Tom
  
Terekhov, Mikhail via Gdb-patches Sept. 30, 2019, 4:22 p.m. UTC | #2
On Mon, Sep 30, 2019 at 11:08 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> 2019-09-29  Christian Biesinger  <cbiesinger@google.com>
>
> Christian>      * minsyms.h (msymbol_hash): Document that this is a case-insensitive
> Christian>      hash and why.
> Christian>      * objfiles.h (struct objfile_per_bfd_storage) <demangled_names_hash,
> Christian>      msymbol_hash, msymbol_demangled_hash>: Improve comments.
>
> Thank you.
>
> Christian> +/* Compute a hash code for the string argument. Unlike htab_hash_string,
>
> GNU style is two spaces after the period.
>
> This is ok with that change.

Thanks, pushed with that fixed.

Christian
  

Patch

diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index bb43165620d..9f5043ef262 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -159,7 +159,8 @@  bool msymbol_is_function (struct objfile *objfile,
 			  minimal_symbol *minsym,
 			  CORE_ADDR *func_address_p = NULL);
 
-/* Compute a hash code for the string argument.  */
+/* Compute a hash code for the string argument. Unlike htab_hash_string,
+   this is a case-insensitive hash to support "set case-sensitive off".  */
 
 unsigned int msymbol_hash (const char *);
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 68d36d408e1..dbd06c01e26 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -258,10 +258,10 @@  struct objfile_per_bfd_storage
   struct gdbarch *gdbarch = NULL;
 
   /* Hash table for mapping symbol names to demangled names.  Each
-     entry in the hash table is actually two consecutive strings,
-     both null-terminated; the first one is a mangled or linkage
-     name, and the second is the demangled name or just a zero byte
-     if the name doesn't demangle.  */
+     entry in the hash table is a demangled_name_entry struct, storing the
+     language and two consecutive strings, both null-terminated; the first one
+     is a mangled or linkage name, and the second is the demangled name or just
+     a zero byte if the name doesn't demangle.  */
 
   htab_up demangled_names_hash;
 
@@ -305,12 +305,14 @@  struct objfile_per_bfd_storage
 
   bool minsyms_read : 1;
 
-  /* This is a hash table used to index the minimal symbols by name.  */
+  /* This is a hash table used to index the minimal symbols by (mangled)
+     name.  */
 
   minimal_symbol *msymbol_hash[MINIMAL_SYMBOL_HASH_SIZE] {};
 
   /* This hash table is used to index the minimal symbols by their
-     demangled names.  */
+     demangled names.  Uses a language-specific hash function via
+     search_name_hash.  */
 
   minimal_symbol *msymbol_demangled_hash[MINIMAL_SYMBOL_HASH_SIZE] {};