[FYI] Use bool in require_partial_symbols

Message ID 20191124181336.9160-1-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Nov. 24, 2019, 6:13 p.m. UTC
  This changes require_partial_symbols to use bool as its parameter
type.

gdb/ChangeLog
2019-11-24  Tom Tromey  <tom@tromey.com>

	* symfile.c (read_symbols): Update.
	* psymtab.c (require_partial_symbols): Change type of "verbose" to
	bool.
	(psym_map_symtabs_matching_filename, find_pc_sect_psymtab)
	(psym_lookup_symbol, psym_find_last_source_symtab)
	(psym_forget_cached_source_info, psym_print_stats)
	(psym_expand_symtabs_for_function, psym_expand_all_symtabs)
	(psym_expand_symtabs_with_fullname, psym_map_symbol_filenames)
	(psym_map_matching_symbols, psym_expand_symtabs_matching)
	(psym_find_compunit_symtab_by_address)
	(maintenance_print_psymbols, maintenance_info_psymtabs)
	(maintenance_check_psymtabs): Update.
	* psymtab.h (require_partial_symbols): Change type of "verbose" to
	bool.

Change-Id: Iae87aa5e4590706bb9e90a33adb86f1fe0fbf3c7
---
 gdb/ChangeLog | 17 +++++++++++++++++
 gdb/psymtab.c | 34 +++++++++++++++++-----------------
 gdb/psymtab.h |  4 ++--
 gdb/symfile.c |  2 +-
 4 files changed, 37 insertions(+), 20 deletions(-)
  

Patch

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c3155007bbd..7074a32956a 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -94,7 +94,7 @@  psymtab_storage::allocate_psymtab ()
 /* See psymtab.h.  */
 
 psymtab_storage::partial_symtab_range
-require_partial_symbols (struct objfile *objfile, int verbose)
+require_partial_symbols (struct objfile *objfile, bool verbose)
 {
   if ((objfile->flags & OBJF_PSYMTABS_READ) == 0)
     {
@@ -161,7 +161,7 @@  psym_map_symtabs_matching_filename
 {
   const char *name_basename = lbasename (name);
 
-  for (partial_symtab *pst : require_partial_symbols (objfile, 1))
+  for (partial_symtab *pst : require_partial_symbols (objfile, true))
     {
       /* We can skip shared psymtabs here, because any file name will be
 	 attached to the unshared psymtab.  */
@@ -364,7 +364,7 @@  find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
      its CUs may be missing in PSYMTABS_ADDRMAP as they may be varying
      debug info type in single OBJFILE.  */
 
-  for (partial_symtab *pst : require_partial_symbols (objfile, 1))
+  for (partial_symtab *pst : require_partial_symbols (objfile, true))
     if (!pst->psymtabs_addrmap_supported
 	&& pc >= pst->text_low (objfile) && pc < pst->text_high (objfile))
       {
@@ -490,7 +490,7 @@  psym_lookup_symbol (struct objfile *objfile,
 
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
-  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+  for (partial_symtab *ps : require_partial_symbols (objfile, true))
     {
       if (!ps->readin && lookup_partial_symbol (objfile, ps, name,
 						psymtab_index, domain))
@@ -780,7 +780,7 @@  psym_find_last_source_symtab (struct objfile *ofp)
 {
   struct partial_symtab *cs_pst = NULL;
 
-  for (partial_symtab *ps : require_partial_symbols (ofp, 1))
+  for (partial_symtab *ps : require_partial_symbols (ofp, true))
     {
       const char *name = ps->filename;
       int len = strlen (name);
@@ -816,7 +816,7 @@  psym_find_last_source_symtab (struct objfile *ofp)
 static void
 psym_forget_cached_source_info (struct objfile *objfile)
 {
-  for (partial_symtab *pst : require_partial_symbols (objfile, 1))
+  for (partial_symtab *pst : require_partial_symbols (objfile, true))
     {
       if (pst->fullname != NULL)
 	{
@@ -1007,7 +1007,7 @@  psym_print_stats (struct objfile *objfile)
   int i;
 
   i = 0;
-  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+  for (partial_symtab *ps : require_partial_symbols (objfile, true))
     {
       if (ps->readin == 0)
 	i++;
@@ -1047,7 +1047,7 @@  static void
 psym_expand_symtabs_for_function (struct objfile *objfile,
 				  const char *func_name)
 {
-  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+  for (partial_symtab *ps : require_partial_symbols (objfile, true))
     {
       if (ps->readin)
 	continue;
@@ -1066,7 +1066,7 @@  psym_expand_symtabs_for_function (struct objfile *objfile,
 static void
 psym_expand_all_symtabs (struct objfile *objfile)
 {
-  for (partial_symtab *psymtab : require_partial_symbols (objfile, 1))
+  for (partial_symtab *psymtab : require_partial_symbols (objfile, true))
     psymtab_to_symtab (objfile, psymtab);
 }
 
@@ -1077,7 +1077,7 @@  static void
 psym_expand_symtabs_with_fullname (struct objfile *objfile,
 				   const char *fullname)
 {
-  for (partial_symtab *p : require_partial_symbols (objfile, 1))
+  for (partial_symtab *p : require_partial_symbols (objfile, true))
     {
       /* Anonymous psymtabs don't have a name of a source file.  */
       if (p->anonymous)
@@ -1100,7 +1100,7 @@  psym_map_symbol_filenames (struct objfile *objfile,
 			   symbol_filename_ftype *fun, void *data,
 			   int need_fullname)
 {
-  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+  for (partial_symtab *ps : require_partial_symbols (objfile, true))
     {
       const char *fullname;
 
@@ -1181,7 +1181,7 @@  psym_map_matching_symbols
 {
   const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
 
-  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+  for (partial_symtab *ps : require_partial_symbols (objfile, true))
     {
       QUIT;
       if (ps->readin
@@ -1312,7 +1312,7 @@  psym_expand_symtabs_matching
   lookup_name_info lookup_name = lookup_name_in.make_ignore_params ();
 
   /* Clear the search flags.  */
-  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+  for (partial_symtab *ps : require_partial_symbols (objfile, true))
     ps->searched_flag = PST_NOT_SEARCHED;
 
   for (partial_symtab *ps : objfile->psymtabs ())
@@ -1406,7 +1406,7 @@  psym_find_compunit_symtab_by_address (struct objfile *objfile,
     {
       std::set<CORE_ADDR> seen_addrs;
 
-      for (partial_symtab *pst : require_partial_symbols (objfile, 1))
+      for (partial_symtab *pst : require_partial_symbols (objfile, true))
 	{
 	  psym_fill_psymbol_map (objfile, pst,
 				 &seen_addrs,
@@ -1901,7 +1901,7 @@  maintenance_print_psymbols (const char *args, int from_tty)
 	}
       else
 	{
-	  for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+	  for (partial_symtab *ps : require_partial_symbols (objfile, true))
 	    {
 	      int print_for_source = 0;
 
@@ -1966,7 +1966,7 @@  maintenance_info_psymtabs (const char *regexp, int from_tty)
 	   actually find a symtab whose name matches.  */
 	int printed_objfile_start = 0;
 
-	for (partial_symtab *psymtab : require_partial_symbols (objfile, 1))
+	for (partial_symtab *psymtab : require_partial_symbols (objfile, true))
 	  {
 	    QUIT;
 
@@ -2072,7 +2072,7 @@  maintenance_check_psymtabs (const char *ignore, int from_tty)
   int length;
 
   for (objfile *objfile : current_program_space->objfiles ())
-    for (partial_symtab *ps : require_partial_symbols (objfile, 1))
+    for (partial_symtab *ps : require_partial_symbols (objfile, true))
       {
 	struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index 0ad2b49d9a5..a4ac35a7916 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -147,11 +147,11 @@  extern const struct quick_symbol_functions dwarf2_gdb_index_functions;
 extern const struct quick_symbol_functions dwarf2_debug_names_functions;
 
 /* Ensure that the partial symbols for OBJFILE have been loaded.  If
-   VERBOSE is non-zero, then this will print a message when symbols
+   VERBOSE is true, then this will print a message when symbols
    are loaded.  This function returns a range adapter suitable for
    iterating over the psymtabs of OBJFILE.  */
 
 extern psymtab_storage::partial_symtab_range require_partial_symbols
-    (struct objfile *objfile, int verbose);
+    (struct objfile *objfile, bool verbose);
 
 #endif /* PSYMTAB_H */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index e6b34bc6b79..aec07d7a7ab 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -809,7 +809,7 @@  read_symbols (struct objfile *objfile, symfile_add_flags add_flags)
 	}
     }
   if ((add_flags & SYMFILE_NO_READ) == 0)
-    require_partial_symbols (objfile, 0);
+    require_partial_symbols (objfile, false);
 }
 
 /* Initialize entry point information for this objfile.  */