public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Change lookup_symbol's block_index parameter type to block_enum
@ 2019-09-07 16:06 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2019-09-07 16:06 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c7f839cbf08c397f3ab208054f11cfc1236ee143

commit c7f839cbf08c397f3ab208054f11cfc1236ee143
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Sat Sep 7 12:03:56 2019 -0400

    Change lookup_symbol's block_index parameter type to block_enum
    
    The only two values valid to pass to the block_index parameter of
    quick_symbol_functions::lookup_symbol are GLOBAL_BLOCK and STATIC_BLOCK,
    part of enum block_enum.  Change the type of that parameter to
    block_enum.
    
    Change also the block_index field of dw2_symtab_iterator in the same
    way..  This makes it consistent with dw2_debug_names_iterator, which
    already uses block_enum for its block_index field.
    
    This is a follow-up to this thread:
    
    https://sourceware.org/ml/gdb-patches/2019-08/msg00097.html
    
    gdb/ChangeLog:
    
    	* dwarf2read.c (struct dw2_symtab_iterator) <block_index>:
    	Change type to gdb::optional<block_enum>.
    	(dw2_symtab_iter_init): Change block_index parameter type
    	to gdb::optional<block_enum>.
    	(dw2_lookup_symbol): Change block_index parameter
    	type to block_enum.c
    	(dw2_debug_names_lookup_symbol): Likewise.
    	* psymtab.c (psym_lookup_symbol): Likewise.
    	* symfile-debug.c (debug_qf_lookup_symbol): Likewise.
    	* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
    	Likewise.

Diff:
---
 gdb/ChangeLog       | 14 ++++++++++++++
 gdb/dwarf2read.c    |  9 ++++-----
 gdb/psymtab.c       |  2 +-
 gdb/symfile-debug.c |  4 ++--
 gdb/symfile.h       |  3 ++-
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index acfc888..d5938be 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2019-09-07  Simon Marchi  <simon.marchi@efficios.com>
+
+	* dwarf2read.c (struct dw2_symtab_iterator) <block_index>:
+	Change type to gdb::optional<block_enum>.
+	(dw2_symtab_iter_init): Change block_index parameter type
+	to gdb::optional<block_enum>.
+	(dw2_lookup_symbol): Change block_index parameter
+	type to block_enum.c
+	(dw2_debug_names_lookup_symbol): Likewise.
+	* psymtab.c (psym_lookup_symbol): Likewise.
+	* symfile-debug.c (debug_qf_lookup_symbol): Likewise.
+	* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
+	Likewise.
+
 2019-09-06  Christian Biesinger  <cbiesinger@google.com>
 
 	* defs.h (relocate_gdb_directory): Change int to bool in
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index fb888da..69bb5bd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3883,7 +3883,7 @@ struct dw2_symtab_iterator
   struct dwarf2_per_objfile *dwarf2_per_objfile;
   /* If set, only look for symbols that match that block.  Valid values are
      GLOBAL_BLOCK and STATIC_BLOCK.  */
-  gdb::optional<int> block_index;
+  gdb::optional<block_enum> block_index;
   /* The kind of symbol we're looking for.  */
   domain_enum domain;
   /* The list of CUs from the index entry of the symbol,
@@ -3905,7 +3905,7 @@ struct dw2_symtab_iterator
 static void
 dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
 		      struct dwarf2_per_objfile *dwarf2_per_objfile,
-		      gdb::optional<int> block_index,
+		      gdb::optional<block_enum> block_index,
 		      domain_enum domain,
 		      const char *name)
 {
@@ -4018,7 +4018,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
 }
 
 static struct compunit_symtab *
-dw2_lookup_symbol (struct objfile *objfile, int block_index,
+dw2_lookup_symbol (struct objfile *objfile, block_enum block_index,
 		   const char *name, domain_enum domain)
 {
   struct compunit_symtab *stab_best = NULL;
@@ -6004,10 +6004,9 @@ dw2_debug_names_iterator::next ()
 }
 
 static struct compunit_symtab *
-dw2_debug_names_lookup_symbol (struct objfile *objfile, int block_index_int,
+dw2_debug_names_lookup_symbol (struct objfile *objfile, block_enum block_index,
 			       const char *name, domain_enum domain)
 {
-  const block_enum block_index = static_cast<block_enum> (block_index_int);
   struct dwarf2_per_objfile *dwarf2_per_objfile
     = get_dwarf2_per_objfile (objfile);
 
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 6f9bf72..70d04f8 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -479,7 +479,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
 
 static struct compunit_symtab *
 psym_lookup_symbol (struct objfile *objfile,
-		    int block_index, const char *name,
+		    block_enum block_index, const char *name,
 		    const domain_enum domain)
 {
   const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0);
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 0f9da66..c5b565f 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -140,8 +140,8 @@ debug_qf_map_symtabs_matching_filename
 }
 
 static struct compunit_symtab *
-debug_qf_lookup_symbol (struct objfile *objfile, int kind, const char *name,
-			domain_enum domain)
+debug_qf_lookup_symbol (struct objfile *objfile, block_enum kind,
+			const char *name, domain_enum domain)
 {
   const struct debug_sym_fns_data *debug_data
     = symfile_debug_objfile_data_key.get (objfile);
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 741b085..5e4d2f5 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -179,7 +179,8 @@ struct quick_symbol_functions
      contains !TYPE_OPAQUE symbol prefer its compunit.  If it contains
      only TYPE_OPAQUE symbol(s), return at least that compunit.  */
   struct compunit_symtab *(*lookup_symbol) (struct objfile *objfile,
-					    int block_index, const char *name,
+					    block_enum block_index,
+					    const char *name,
 					    domain_enum domain);
 
   /* Print statistics about any indices loaded for OBJFILE.  The


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-07 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-07 16:06 [binutils-gdb] Change lookup_symbol's block_index parameter type to block_enum Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).