diff mbox

[06/21] struct symtab split part 2: block.c block.h

Message ID 5464aa1d.0959460a.1224.fffffcb5@mx.google.com
State New
Headers show

Commit Message

Doug Evans Nov. 13, 2014, 12:53 p.m. UTC
This patch contains the changes to block.c, block.h.

Full ChangeLog: https://sourceware.org/ml/gdb-patches/2014-11/msg00233.html

2014-11-12  Doug Evans  <xdje42@gmail.com>

	* block.c (blockvector_for_pc_sect): Change "struct symtab *" argument
	to "struct compunit_symtab *".  All callers updated.
	(set_block_compunit_symtab): Renamed from set_block_symtab.  Change
	"struct symtab *" argument to "struct compunit_symtab *".
	All callers updated.
	(get_block_compunit_symtab): Renamed from get_block_symtab.  Change
	result to "struct compunit_symtab *".  All callers updated.
	(find_iterator_compunit_symtab): Renamed from find_iterator_symtab.
	Change result to "struct compunit_symtab *".  All callers updated.
	* block.h (struct global_block) <compunit_symtab>: Renamed from symtab.
	hange type to "struct compunit_symtab *".  All uses updated.
	(struct block_iterator) <d.compunit_symtab>: Renamed from "d.symtab".
	Change type to "struct compunit_symtab *".  All uses updated.
diff mbox

Patch

diff --git a/gdb/block.c b/gdb/block.c
index 83a091c..597d143 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -156,20 +156,21 @@  find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
 
 const struct blockvector *
 blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
-			 const struct block **pblock, struct symtab *symtab)
+			 const struct block **pblock,
+			 struct compunit_symtab *cust)
 {
   const struct blockvector *bl;
   struct block *b;
 
-  if (symtab == 0)		/* if no symtab specified by caller */
+  if (cust == NULL)
     {
       /* First search all symtabs for one whose file contains our pc */
-      symtab = find_pc_sect_symtab (pc, section);
-      if (symtab == 0)
+      cust = find_pc_sect_compunit_symtab (pc, section);
+      if (cust == NULL)
 	return 0;
     }
 
-  bl = SYMTAB_BLOCKVECTOR (symtab);
+  bl = COMPUNIT_BLOCKVECTOR (cust);
 
   /* Then search that symtab for the smallest block that wins.  */
   b = find_block_in_blockvector (bl, pc);
@@ -196,14 +197,14 @@  blockvector_contains_pc (const struct blockvector *bv, CORE_ADDR pc)
 struct call_site *
 call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  struct symtab *symtab;
+  struct compunit_symtab *cust;
   void **slot = NULL;
 
   /* -1 as tail call PC can be already after the compilation unit range.  */
-  symtab = find_pc_symtab (pc - 1);
+  cust = find_pc_compunit_symtab (pc - 1);
 
-  if (symtab != NULL && symtab->call_site_htab != NULL)
-    slot = htab_find_slot (symtab->call_site_htab, &pc, NO_INSERT);
+  if (cust != NULL && COMPUNIT_CALL_SITE_HTAB (cust) != NULL)
+    slot = htab_find_slot (COMPUNIT_CALL_SITE_HTAB (cust), &pc, NO_INSERT);
 
   if (slot == NULL)
     {
@@ -388,30 +389,30 @@  allocate_global_block (struct obstack *obstack)
   return &bl->block;
 }
 
-/* Set the symtab of the global block.  */
+/* Set the compunit of the global block.  */
 
 void
-set_block_symtab (struct block *block, struct symtab *symtab)
+set_block_compunit_symtab (struct block *block, struct compunit_symtab *cu)
 {
   struct global_block *gb;
 
   gdb_assert (BLOCK_SUPERBLOCK (block) == NULL);
   gb = (struct global_block *) block;
-  gdb_assert (gb->symtab == NULL);
-  gb->symtab = symtab;
+  gdb_assert (gb->compunit_symtab == NULL);
+  gb->compunit_symtab = cu;
 }
 
-/* Return the symtab of the global block.  */
+/* Return the compunit of the global block.  */
 
-static struct symtab *
-get_block_symtab (const struct block *block)
+static struct compunit_symtab *
+get_block_compunit_symtab (const struct block *block)
 {
   struct global_block *gb;
 
   gdb_assert (BLOCK_SUPERBLOCK (block) == NULL);
   gb = (struct global_block *) block;
-  gdb_assert (gb->symtab != NULL);
-  return gb->symtab;
+  gdb_assert (gb->compunit_symtab != NULL);
+  return gb->compunit_symtab;
 }
 
 
@@ -425,19 +426,19 @@  initialize_block_iterator (const struct block *block,
 			   struct block_iterator *iter)
 {
   enum block_enum which;
-  struct symtab *symtab;
+  struct compunit_symtab *cu;
 
   iter->idx = -1;
 
   if (BLOCK_SUPERBLOCK (block) == NULL)
     {
       which = GLOBAL_BLOCK;
-      symtab = get_block_symtab (block);
+      cu = get_block_compunit_symtab (block);
     }
   else if (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
     {
       which = STATIC_BLOCK;
-      symtab = get_block_symtab (BLOCK_SUPERBLOCK (block));
+      cu = get_block_compunit_symtab (BLOCK_SUPERBLOCK (block));
     }
   else
     {
@@ -450,14 +451,14 @@  initialize_block_iterator (const struct block *block,
 
   /* If this is an included symtab, find the canonical includer and
      use it instead.  */
-  while (symtab->user != NULL)
-    symtab = symtab->user;
+  while (cu->user != NULL)
+    cu = cu->user;
 
   /* Putting this check here simplifies the logic of the iterator
      functions.  If there are no included symtabs, we only need to
      search a single block, so we might as well just do that
      directly.  */
-  if (symtab->includes == NULL)
+  if (cu->includes == NULL)
     {
       iter->d.block = block;
       /* A signal value meaning that we're iterating over a single
@@ -466,20 +467,20 @@  initialize_block_iterator (const struct block *block,
     }
   else
     {
-      iter->d.symtab = symtab;
+      iter->d.compunit_symtab = cu;
       iter->which = which;
     }
 }
 
-/* A helper function that finds the current symtab over whose static
+/* A helper function that finds the current compunit over whose static
    or global block we should iterate.  */
 
-static struct symtab *
-find_iterator_symtab (struct block_iterator *iterator)
+static struct compunit_symtab *
+find_iterator_compunit_symtab (struct block_iterator *iterator)
 {
   if (iterator->idx == -1)
-    return iterator->d.symtab;
-  return iterator->d.symtab->includes[iterator->idx];
+    return iterator->d.compunit_symtab;
+  return iterator->d.compunit_symtab->includes[iterator->idx];
 }
 
 /* Perform a single step for a plain block iterator, iterating across
@@ -497,14 +498,15 @@  block_iterator_step (struct block_iterator *iterator, int first)
     {
       if (first)
 	{
-	  struct symtab *symtab = find_iterator_symtab (iterator);
+	  struct compunit_symtab *cust
+	    = find_iterator_compunit_symtab (iterator);
 	  const struct block *block;
 
 	  /* Iteration is complete.  */
-	  if (symtab == NULL)
+	  if (cust == NULL)
 	    return  NULL;
 
-	  block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab),
+	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
 				     iterator->which);
 	  sym = dict_iterator_first (BLOCK_DICT (block), &iterator->dict_iter);
 	}
@@ -563,14 +565,15 @@  block_iter_name_step (struct block_iterator *iterator, const char *name,
     {
       if (first)
 	{
-	  struct symtab *symtab = find_iterator_symtab (iterator);
+	  struct compunit_symtab *cust
+	    = find_iterator_compunit_symtab (iterator);
 	  const struct block *block;
 
 	  /* Iteration is complete.  */
-	  if (symtab == NULL)
+	  if (cust == NULL)
 	    return  NULL;
 
-	  block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab),
+	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
 				     iterator->which);
 	  sym = dict_iter_name_first (BLOCK_DICT (block), name,
 				      &iterator->dict_iter);
@@ -633,14 +636,15 @@  block_iter_match_step (struct block_iterator *iterator,
     {
       if (first)
 	{
-	  struct symtab *symtab = find_iterator_symtab (iterator);
+	  struct compunit_symtab *cust
+	    = find_iterator_compunit_symtab (iterator);
 	  const struct block *block;
 
 	  /* Iteration is complete.  */
-	  if (symtab == NULL)
+	  if (cust == NULL)
 	    return  NULL;
 
-	  block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab),
+	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
 				     iterator->which);
 	  sym = dict_iter_match_first (BLOCK_DICT (block), name,
 				       compare, &iterator->dict_iter);
diff --git a/gdb/block.h b/gdb/block.h
index 50a7919..bd358d6 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -25,7 +25,7 @@ 
 /* Opaque declarations.  */
 
 struct symbol;
-struct symtab;
+struct compunit_symtab;
 struct block_namespace_info;
 struct using_direct;
 struct obstack;
@@ -100,7 +100,7 @@  struct block
 };
 
 /* The global block is singled out so that we can provide a back-link
-   to the primary symtab.  */
+   to the compunit symtab.  */
 
 struct global_block
 {
@@ -108,10 +108,9 @@  struct global_block
 
   struct block block;
 
-  /* This holds a pointer to the primary symtab holding this
-     block.  */
+  /* This holds a pointer to the compunit symtab holding this block.  */
 
-  struct symtab *symtab;
+  struct compunit_symtab *compunit_symtab;
 };
 
 #define BLOCK_START(bl)		(bl)->startaddr
@@ -148,10 +147,9 @@  extern int contained_in (const struct block *, const struct block *);
 extern const struct blockvector *blockvector_for_pc (CORE_ADDR,
 					       const struct block **);
 
-extern const struct blockvector *blockvector_for_pc_sect (CORE_ADDR, 
-							  struct obj_section *,
-							  const struct block **,
-							  struct symtab *);
+extern const struct blockvector *
+  blockvector_for_pc_sect (CORE_ADDR, struct obj_section *,
+			   const struct block **, struct compunit_symtab *);
 
 extern int blockvector_contains_pc (const struct blockvector *bv, CORE_ADDR pc);
 
@@ -181,7 +179,8 @@  extern struct block *allocate_block (struct obstack *obstack);
 
 extern struct block *allocate_global_block (struct obstack *obstack);
 
-extern void set_block_symtab (struct block *, struct symtab *);
+extern void set_block_compunit_symtab (struct block *,
+				       struct compunit_symtab *);
 
 /* A block iterator.  This structure should be treated as though it
    were opaque; it is only defined here because we want to support
@@ -190,11 +189,11 @@  extern void set_block_symtab (struct block *, struct symtab *);
 struct block_iterator
 {
   /* If we're iterating over a single block, this holds the block.
-     Otherwise, it holds the canonical symtab.  */
+     Otherwise, it holds the canonical compunit.  */
 
   union
   {
-    struct symtab *symtab;
+    struct compunit_symtab *compunit_symtab;
     const struct block *block;
   } d;