public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove BLOCK_SUPERBLOCK macro
@ 2022-04-28  2:39 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-04-28  2:39 UTC (permalink / raw)
  To: gdb-cvs

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

commit f135fe728e2d0a6168a8445a50a6d63547c4db2f
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Fri Jan 28 11:41:38 2022 -0500

    gdb: remove BLOCK_SUPERBLOCK macro
    
    Replace with equivalent methods.
    
    Change-Id: I334a319909a50b5cc5570a45c38c70e10dc00630

Diff:
---
 gdb/ada-lang.c                    |  8 ++++----
 gdb/block.c                       | 40 +++++++++++++++++++--------------------
 gdb/block.h                       | 11 +++++++++--
 gdb/blockframe.c                  |  6 +++---
 gdb/buildsym.c                    |  4 ++--
 gdb/compile/compile-c-symbols.c   |  2 +-
 gdb/compile/compile-object-load.c |  4 ++--
 gdb/cp-namespace.c                |  4 ++--
 gdb/cp-support.c                  |  4 ++--
 gdb/d-namespace.c                 |  2 +-
 gdb/f-valprint.c                  |  2 +-
 gdb/findvar.c                     |  2 +-
 gdb/go-lang.c                     |  2 +-
 gdb/guile/scm-block.c             | 14 +++++++-------
 gdb/guile/scm-frame.c             |  2 +-
 gdb/inline-frame.c                |  8 ++++----
 gdb/jit.c                         | 11 ++++++-----
 gdb/linespec.c                    |  4 ++--
 gdb/mdebugread.c                  | 12 ++++++------
 gdb/mi/mi-cmd-stack.c             |  2 +-
 gdb/python/py-block.c             | 10 +++++-----
 gdb/python/py-frame.c             |  2 +-
 gdb/stack.c                       |  2 +-
 gdb/symmisc.c                     |  6 +++---
 gdb/symtab.c                      | 10 +++++-----
 gdb/tracepoint.c                  |  2 +-
 26 files changed, 92 insertions(+), 84 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index dfcaf12104a..c06dbc2f055 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5334,7 +5334,7 @@ ada_add_local_symbols (std::vector<struct block_symbol> &result,
       if (block->function () != nullptr && is_nonfunction (result))
 	return;
 
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 }
 
@@ -13040,7 +13040,7 @@ ada_add_exceptions_from_frame (compiled_regex *preg,
 	}
       if (block->function () != NULL)
 	break;
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 }
 
@@ -13662,9 +13662,9 @@ public:
     /* Search upwards from currently selected frame (so that we can
        complete on local vars.  */
 
-    for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+    for (b = get_selected_block (0); b != NULL; b = b->superblock ())
       {
-	if (!BLOCK_SUPERBLOCK (b))
+	if (!b->superblock ())
 	  surrounding_static_block = b;   /* For elmin of dups */
 
 	ALL_BLOCK_SYMBOLS (b, iter, sym)
diff --git a/gdb/block.c b/gdb/block.c
index b70b8e22a91..9c4ed260abb 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -82,7 +82,7 @@ contained_in (const struct block *a, const struct block *b,
 	 except if A was inlined.  */
       if (!allow_nested && a->function () != NULL && !block_inlined_p (a))
 	return false;
-      a = BLOCK_SUPERBLOCK (a);
+      a = a->superblock ();
     }
   while (a != NULL);
 
@@ -99,8 +99,8 @@ struct symbol *
 block_linkage_function (const struct block *bl)
 {
   while ((bl->function () == NULL || block_inlined_p (bl))
-	 && BLOCK_SUPERBLOCK (bl) != NULL)
-    bl = BLOCK_SUPERBLOCK (bl);
+	 && bl->superblock () != NULL)
+    bl = bl->superblock ();
 
   return bl->function ();
 }
@@ -113,8 +113,8 @@ block_linkage_function (const struct block *bl)
 struct symbol *
 block_containing_function (const struct block *bl)
 {
-  while (bl->function () == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
-    bl = BLOCK_SUPERBLOCK (bl);
+  while (bl->function () == NULL && bl->superblock () != NULL)
+    bl = bl->superblock ();
 
   return bl->function ();
 }
@@ -295,7 +295,7 @@ block_for_pc (CORE_ADDR pc)
 const char *
 block_scope (const struct block *block)
 {
-  for (; block != NULL; block = BLOCK_SUPERBLOCK (block))
+  for (; block != NULL; block = block->superblock ())
     {
       if (BLOCK_NAMESPACE (block) != NULL
 	  && BLOCK_NAMESPACE (block)->scope != NULL)
@@ -360,11 +360,11 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
 const struct block *
 block_static_block (const struct block *block)
 {
-  if (block == NULL || BLOCK_SUPERBLOCK (block) == NULL)
+  if (block == NULL || block->superblock () == NULL)
     return NULL;
 
-  while (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) != NULL)
-    block = BLOCK_SUPERBLOCK (block);
+  while (block->superblock ()->superblock () != NULL)
+    block = block->superblock ();
 
   return block;
 }
@@ -378,8 +378,8 @@ block_global_block (const struct block *block)
   if (block == NULL)
     return NULL;
 
-  while (BLOCK_SUPERBLOCK (block) != NULL)
-    block = BLOCK_SUPERBLOCK (block);
+  while (block->superblock () != NULL)
+    block = block->superblock ();
 
   return block;
 }
@@ -418,7 +418,7 @@ set_block_compunit_symtab (struct block *block, struct compunit_symtab *cu)
 {
   struct global_block *gb;
 
-  gdb_assert (BLOCK_SUPERBLOCK (block) == NULL);
+  gdb_assert (block->superblock () == NULL);
   gb = (struct global_block *) block;
   gdb_assert (gb->compunit_symtab == NULL);
   gb->compunit_symtab = cu;
@@ -446,7 +446,7 @@ get_block_compunit_symtab (const struct block *block)
 {
   struct global_block *gb;
 
-  gdb_assert (BLOCK_SUPERBLOCK (block) == NULL);
+  gdb_assert (block->superblock () == NULL);
   gb = (struct global_block *) block;
   gdb_assert (gb->compunit_symtab != NULL);
   return gb->compunit_symtab;
@@ -467,15 +467,15 @@ initialize_block_iterator (const struct block *block,
 
   iter->idx = -1;
 
-  if (BLOCK_SUPERBLOCK (block) == NULL)
+  if (block->superblock () == NULL)
     {
       which = GLOBAL_BLOCK;
       cu = get_block_compunit_symtab (block);
     }
-  else if (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+  else if (block->superblock ()->superblock () == NULL)
     {
       which = STATIC_BLOCK;
-      cu = get_block_compunit_symtab (BLOCK_SUPERBLOCK (block));
+      cu = get_block_compunit_symtab (block->superblock ());
     }
   else
     {
@@ -775,8 +775,8 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
   /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK.  */
-  gdb_assert (BLOCK_SUPERBLOCK (block) == NULL
-	      || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
+  gdb_assert (block->superblock () == NULL
+	      || block->superblock ()->superblock () == NULL);
 
   other = NULL;
   for (sym
@@ -838,8 +838,8 @@ block_find_symbol (const struct block *block, const char *name,
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
   /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK.  */
-  gdb_assert (BLOCK_SUPERBLOCK (block) == NULL
-	      || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
+  gdb_assert (block->superblock () == NULL
+	      || block->superblock ()->superblock () == NULL);
 
   ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym)
     {
diff --git a/gdb/block.h b/gdb/block.h
index 0330b6de4d2..a5f931e354e 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -114,6 +114,14 @@ struct block
   void set_function (symbol *function)
   { m_function = function; }
 
+  /* Return this block's superblock.  */
+  const block *superblock () const
+  { return m_superblock; }
+
+  /* Set this block's superblock.  */
+  void set_superblock (const block *superblock)
+  { m_superblock = superblock; }
+
   /* Addresses in the executable code that are in this block.  */
 
   CORE_ADDR m_start;
@@ -130,7 +138,7 @@ struct block
      case of C) is the STATIC_BLOCK.  The superblock of the
      STATIC_BLOCK is the GLOBAL_BLOCK.  */
 
-  const struct block *superblock;
+  const struct block *m_superblock;
 
   /* This is used to store the symbols in the block.  */
 
@@ -162,7 +170,6 @@ struct global_block
   struct compunit_symtab *compunit_symtab;
 };
 
-#define BLOCK_SUPERBLOCK(bl)	(bl)->superblock
 #define BLOCK_MULTIDICT(bl)	(bl)->multidict
 #define BLOCK_NAMESPACE(bl)	(bl)->namespace_info
 
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index aaf76953648..cfc4fd2fd70 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -75,7 +75,7 @@ get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block)
       if (block_inlined_p (bl))
 	inline_count--;
 
-      bl = BLOCK_SUPERBLOCK (bl);
+      bl = bl->superblock ();
       gdb_assert (bl != NULL);
     }
 
@@ -122,8 +122,8 @@ get_frame_function (struct frame_info *frame)
   if (bl == NULL)
     return NULL;
 
-  while (bl->function () == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
-    bl = BLOCK_SUPERBLOCK (bl);
+  while (bl->function () == NULL && bl->superblock () != NULL)
+    bl = bl->superblock ();
 
   return bl->function ();
 }
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index f761444fff4..5c5fc207d6e 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -331,7 +331,7 @@ buildsym_compunit::finish_block_internal
        pblock && pblock != old_blocks; 
        pblock = pblock->next)
     {
-      if (BLOCK_SUPERBLOCK (pblock->block) == NULL)
+      if (pblock->block->superblock () == NULL)
 	{
 	  /* Check to be sure the blocks are nested as we receive
 	     them.  If the compiler/assembler/linker work, this just
@@ -365,7 +365,7 @@ buildsym_compunit::finish_block_internal
 	      if (pblock->block->end () > block->end ())
 		pblock->block->set_end (block->end ());
 	    }
-	  BLOCK_SUPERBLOCK (pblock->block) = block;
+	  pblock->block->set_superblock (block);
 	}
       opblock = pblock;
     }
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 9e13d7650dd..4c30ae98c1c 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -647,7 +647,7 @@ generate_c_for_variable_locations (compile_instance *compiler,
 	 done.  */
       if (block->function () != NULL)
 	break;
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   return registers_used;
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 89a47859c22..2835f2d73d1 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -444,13 +444,13 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
       while (function_block != BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)
 	     && function_block != BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
 	{
-	  function_block = BLOCK_SUPERBLOCK (function_block);
+	  function_block = function_block->superblock ();
 	  function = function_block->function ();
 	  if (function != NULL)
 	    break;
 	}
       if (function != NULL
-	  && (BLOCK_SUPERBLOCK (function_block)
+	  && (function_block->superblock ()
 	      == BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))
 	  && symbol_matches_search_name (function, func_matcher))
 	break;
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index d84486e8bf7..e734effe7f0 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -547,7 +547,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
 	  struct type *context;
 	  std::string name_copy (function->natural_name ());
 	  const struct language_defn *lang = language_def (language_cplus);
-	  const struct block *parent = BLOCK_SUPERBLOCK (block);
+	  const struct block *parent = block->superblock ();
 	  struct symbol *sym;
 
 	  while (1)
@@ -615,7 +615,7 @@ cp_lookup_symbol_via_all_imports (const char *scope, const char *name,
       if (sym.symbol)
 	return sym;
 
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   return {};
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 78015d43fe8..14fad2d453f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1400,7 +1400,7 @@ add_symbol_overload_list_using (const char *func_name,
 
   for (block = get_selected_block (0);
        block != NULL;
-       block = BLOCK_SUPERBLOCK (block))
+       block = block->superblock ())
     for (current = block_using (block);
 	current != NULL;
 	current = current->next)
@@ -1451,7 +1451,7 @@ add_symbol_overload_list_qualified (const char *func_name,
   /* Search upwards from currently selected frame (so that we can
      complete on local vars.  */
 
-  for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+  for (b = get_selected_block (0); b != NULL; b = b->superblock ())
     add_symbol_overload_list_block (func_name, b, overload_list);
 
   surrounding_static_block = block_static_block (get_selected_block (0));
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index 07c22e0eae5..5af042abb11 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -491,7 +491,7 @@ d_lookup_symbol_module (const char *scope, const char *name,
       if (sym.symbol != NULL)
 	return sym;
 
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   return {};
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index f977d8cad96..6a3f83c2194 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -690,7 +690,7 @@ info_common_command (const char *comname, int from_tty)
 	 continue to its superblock, the block of per-file symbols.  */
       if (block->function ())
 	break;
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   if (!values_printed)
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 2e2b10bb625..bdc3d35c345 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -559,7 +559,7 @@ get_hosting_frame (struct symbol *var, const struct block *var_block,
       else
 	/* We must be in some function nested lexical block.  Just get the
 	   outer block: both must share the same frame.  */
-	frame_block = BLOCK_SUPERBLOCK (frame_block);
+	frame_block = frame_block->superblock ();
     }
 
   /* Old compilers may not provide a static link, or they may provide an
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index b4d85b06dd9..844f743e83d 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -433,7 +433,7 @@ go_block_package_name (const struct block *block)
 	  return NULL;
 	}
 
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   return NULL;
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 1683ed1ac8a..41954c70519 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -151,9 +151,9 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate)
 
   gdbscm_printf (port, "#<%s", block_smob_name);
 
-  if (BLOCK_SUPERBLOCK (b) == NULL)
+  if (b->superblock () == NULL)
     gdbscm_printf (port, " global");
-  else if (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (b)) == NULL)
+  else if (b->superblock ()->superblock () == NULL)
     gdbscm_printf (port, " static");
 
   if (b->function () != NULL)
@@ -421,7 +421,7 @@ gdbscm_block_superblock (SCM self)
   const struct block *block = b_smob->block;
   const struct block *super_block;
 
-  super_block = BLOCK_SUPERBLOCK (block);
+  super_block = block->superblock ();
 
   if (super_block)
     return bkscm_scm_from_block (super_block, b_smob->objfile);
@@ -456,7 +456,7 @@ gdbscm_block_static_block (SCM self)
   const struct block *block = b_smob->block;
   const struct block *static_block;
 
-  if (BLOCK_SUPERBLOCK (block) == NULL)
+  if (block->superblock () == NULL)
     return SCM_BOOL_F;
 
   static_block = block_static_block (block);
@@ -474,7 +474,7 @@ gdbscm_block_global_p (SCM self)
     = bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct block *block = b_smob->block;
 
-  return scm_from_bool (BLOCK_SUPERBLOCK (block) == NULL);
+  return scm_from_bool (block->superblock () == NULL);
 }
 
 /* (block-static? <gdb:block>) -> boolean
@@ -487,8 +487,8 @@ gdbscm_block_static_p (SCM self)
     = bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct block *block = b_smob->block;
 
-  if (BLOCK_SUPERBLOCK (block) != NULL
-      && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+  if (block->superblock () != NULL
+      && block->superblock ()->superblock () == NULL)
     return SCM_BOOL_T;
   return SCM_BOOL_F;
 }
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index f0de7c368f9..6bbb6f81d68 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -612,7 +612,7 @@ gdbscm_frame_block (SCM self)
 
   for (fn_block = block;
        fn_block != NULL && fn_block->function () == NULL;
-       fn_block = BLOCK_SUPERBLOCK (fn_block))
+       fn_block = fn_block->superblock ())
     continue;
 
   if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index 95cc80b7a1c..bd173a1d21b 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -226,14 +226,14 @@ inline_frame_sniffer (const struct frame_unwind *self,
      location.  */
   depth = 0;
   cur_block = frame_block;
-  while (BLOCK_SUPERBLOCK (cur_block))
+  while (cur_block->superblock ())
     {
       if (block_inlined_p (cur_block))
 	depth++;
       else if (cur_block->function () != NULL)
 	break;
 
-      cur_block = BLOCK_SUPERBLOCK (cur_block);
+      cur_block = cur_block->superblock ();
     }
 
   /* Check how many inlined functions already have frames.  */
@@ -356,7 +356,7 @@ skip_inline_frames (thread_info *thread, bpstat *stop_chain)
   if (frame_block != NULL)
     {
       cur_block = frame_block;
-      while (BLOCK_SUPERBLOCK (cur_block))
+      while (cur_block->superblock ())
 	{
 	  if (block_inlined_p (cur_block))
 	    {
@@ -380,7 +380,7 @@ skip_inline_frames (thread_info *thread, bpstat *stop_chain)
 	  else if (cur_block->function () != NULL)
 	    break;
 
-	  cur_block = BLOCK_SUPERBLOCK (cur_block);
+	  cur_block = cur_block->superblock ();
 	}
     }
 
diff --git a/gdb/jit.c b/gdb/jit.c
index 17dfdd9ef24..1283d2edc50 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -620,7 +620,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
 		   : allocate_block (&objfile->objfile_obstack));
       BLOCK_MULTIDICT (new_block)
 	= mdict_create_linear (&objfile->objfile_obstack, NULL);
-      BLOCK_SUPERBLOCK (new_block) = block_iter;
+      new_block->set_superblock (block_iter);
       block_iter = new_block;
 
       new_block->set_start (begin);
@@ -640,14 +640,15 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
 	{
 	  /* If the plugin specifically mentioned a parent block, we
 	     use that.  */
-	  BLOCK_SUPERBLOCK (gdb_block_iter.real_block) =
-	    gdb_block_iter.parent->real_block;
+	  gdb_block_iter.real_block->set_superblock
+	    (gdb_block_iter.parent->real_block);
+
 	}
       else
 	{
 	  /* And if not, we set a default parent block.  */
-	  BLOCK_SUPERBLOCK (gdb_block_iter.real_block) =
-	    BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+	  gdb_block_iter.real_block->set_superblock
+	    (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK));
 	}
     }
 }
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 90e4c813e4e..fd3fba871c5 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1234,7 +1234,7 @@ iterate_over_file_blocks
   for (block = BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
 				  STATIC_BLOCK);
        block != NULL;
-       block = BLOCK_SUPERBLOCK (block))
+       block = block->superblock ())
     current_language->iterate_over_symbols (block, name, domain, callback);
 }
 
@@ -3968,7 +3968,7 @@ find_label_symbols (struct linespec_state *self,
 
       for (;
 	   block && !block->function ();
-	   block = BLOCK_SUPERBLOCK (block))
+	   block = block->superblock ())
 	;
 
       if (!block)
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 87d2fb1d477..ddf3cd58253 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -800,7 +800,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       b->set_function (s);
       b->set_start (sh->value);
       b->set_end (sh->value);
-      BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
+      b->set_superblock (top_stack->cur_block);
       add_block (b, top_stack->cur_st);
 
       /* Not if we only have partial info.  */
@@ -1128,7 +1128,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       top_stack->blocktype = stBlock;
       b = new_block (NON_FUNCTION_BLOCK, psymtab_language);
       b->set_start (sh->value + top_stack->procadr);
-      BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
+      b->set_superblock (top_stack->cur_block);
       top_stack->cur_block = b;
       add_block (b, top_stack->cur_st);
       break;
@@ -1172,7 +1172,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 	    {
 	      struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i);
 
-	      if (BLOCK_SUPERBLOCK (b_bad) == cblock
+	      if (b_bad->superblock () == cblock
 		  && b_bad->start () == top_stack->procadr
 		  && b_bad->end () == top_stack->procadr)
 		{
@@ -4476,7 +4476,7 @@ mylookup_symbol (const char *name, const struct block *block,
 	return sym;
     }
 
-  block = BLOCK_SUPERBLOCK (block);
+  block = block->superblock ();
   if (block)
     return mylookup_symbol (name, block, domain, theclass);
   return 0;
@@ -4637,8 +4637,8 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
   bv = new_bvect (2);
   BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
   BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
-  BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
-    BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+  BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_superblock
+    (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
   cust->set_blockvector (bv);
 
   cust->set_debugformat ("ECOFF");
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 9ae64f092a8..0fe204dbc66 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -674,7 +674,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
       if (block->function ())
 	break;
       else
-	block = BLOCK_SUPERBLOCK (block);
+	block = block->superblock ();
     }
 }
 
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 7ab98687387..872fb89ba83 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -146,7 +146,7 @@ blpy_get_superblock (PyObject *self, void *closure)
 
   BLPY_REQUIRE_VALID (self, block);
 
-  super_block = BLOCK_SUPERBLOCK (block);
+  super_block = block->superblock ();
   if (super_block)
     return block_to_block_object (super_block, self_obj->objfile);
 
@@ -183,7 +183,7 @@ blpy_get_static_block (PyObject *self, void *closure)
 
   BLPY_REQUIRE_VALID (self, block);
 
-  if (BLOCK_SUPERBLOCK (block) == NULL)
+  if (block->superblock () == NULL)
     Py_RETURN_NONE;
 
   static_block = block_static_block (block);
@@ -201,7 +201,7 @@ blpy_is_global (PyObject *self, void *closure)
 
   BLPY_REQUIRE_VALID (self, block);
 
-  if (BLOCK_SUPERBLOCK (block))
+  if (block->superblock ())
     Py_RETURN_FALSE;
 
   Py_RETURN_TRUE;
@@ -217,8 +217,8 @@ blpy_is_static (PyObject *self, void *closure)
 
   BLPY_REQUIRE_VALID (self, block);
 
-  if (BLOCK_SUPERBLOCK (block) != NULL
-     && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
+  if (block->superblock () != NULL
+     && block->superblock ()->superblock () == NULL)
     Py_RETURN_TRUE;
 
   Py_RETURN_FALSE;
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index c4225c84aff..769e28c1a2c 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -293,7 +293,7 @@ frapy_block (PyObject *self, PyObject *args)
 
   for (fn_block = block;
        fn_block != NULL && fn_block->function () == NULL;
-       fn_block = BLOCK_SUPERBLOCK (fn_block))
+       fn_block = fn_block->superblock ())
     ;
 
   if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
diff --git a/gdb/stack.c b/gdb/stack.c
index 35726b71398..71d85985d18 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2275,7 +2275,7 @@ iterate_over_block_local_vars (const struct block *block,
 	 symbols.  */
       if (block->function ())
 	break;
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 }
 
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 1dd747d5386..e49322c2a84 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -287,9 +287,9 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
 	  gdb_printf (outfile, "%*sblock #%03d, object at %s",
 		      depth, "", i,
 		      host_address_to_string (b));
-	  if (BLOCK_SUPERBLOCK (b))
+	  if (b->superblock ())
 	    gdb_printf (outfile, " under %s",
-			host_address_to_string (BLOCK_SUPERBLOCK (b)));
+			host_address_to_string (b->superblock ()));
 	  /* drow/2002-07-10: We could save the total symbols count
 	     even if we're using a hashtable, but nothing else but this message
 	     wants it.  */
@@ -939,7 +939,7 @@ block_depth (const struct block *block)
 {
   int i = 0;
 
-  while ((block = BLOCK_SUPERBLOCK (block)) != NULL)
+  while ((block = block->superblock ()) != NULL)
     {
       i++;
     }
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 58a2033f1ff..63fa9ba3196 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2026,7 +2026,7 @@ lookup_language_this (const struct language_defn *lang,
 	}
       if (block->function ())
 	break;
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   if (symbol_lookup_debug > 1)
@@ -2229,7 +2229,7 @@ lookup_local_symbol (const char *name,
 
       if (block->function () != NULL && block_inlined_p (block))
 	break;
-      block = BLOCK_SUPERBLOCK (block);
+      block = block->superblock ();
     }
 
   /* We've reached the end of the function without finding a result.  */
@@ -4046,7 +4046,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
 	function_block = b;
       else if (b->function () != NULL)
 	break;
-      b = BLOCK_SUPERBLOCK (b);
+      b = b->superblock ();
     }
   if (function_block != NULL
       && function_block->function ()->line () != 0)
@@ -4145,7 +4145,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
 		  bl = NULL;
 		  break;
 		}
-	      bl = BLOCK_SUPERBLOCK (bl);
+	      bl = bl->superblock ();
 	    }
 	  if (bl != NULL)
 	    break;
@@ -6013,7 +6013,7 @@ default_collect_symbol_completion_matches_break_on
 	   are in scope for a nested function.  */
 	if (b->function () != NULL && block_inlined_p (b))
 	  break;
-	b = BLOCK_SUPERBLOCK (b);
+	b = b->superblock ();
       }
 
   /* Add fields from the file's types; symbols will be added below.  */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 76da71df038..64419436fd7 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2618,7 +2618,7 @@ info_scope_command (const char *args_in, int from_tty)
       if (block->function ())
 	break;
       else
-	block = BLOCK_SUPERBLOCK (block);
+	block = block->superblock ();
     }
   if (count <= 0)
     gdb_printf ("Scope for %s contains no locals or arguments.\n",


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

only message in thread, other threads:[~2022-04-28  2:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  2:39 [binutils-gdb] gdb: remove BLOCK_SUPERBLOCK macro 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).