diff mbox

[3/5] struct symtab split part 1: SYMTAB_LINETABLE

Message ID m31tp9125d.fsf@sspiff.org
State New
Headers show

Commit Message

Doug Evans Nov. 12, 2014, 4:19 a.m. UTC
Hi.

This patch renames macro LINETABLE to SYMTAB_LINETABLE,
and has it used throughout.

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

	* symtab.h (SYMTAB_LINETABLE): Renamed from LINETABLE.  All uses
	updated.
diff mbox

Patch

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index d0f0ddc..d63b3b9 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1232,13 +1232,14 @@  end_symtab_with_blockvector (struct block *static_block,
       if (subfile->line_vector)
 	{
 	  /* Reallocate the line table on the symbol obstack.  */
-	  symtab->linetable = (struct linetable *)
+	  SYMTAB_LINETABLE (symtab) = (struct linetable *)
 	    obstack_alloc (&objfile->objfile_obstack, linetablesize);
-	  memcpy (symtab->linetable, subfile->line_vector, linetablesize);
+	  memcpy (SYMTAB_LINETABLE (symtab), subfile->line_vector,
+		  linetablesize);
 	}
       else
 	{
-	  symtab->linetable = NULL;
+	  SYMTAB_LINETABLE (symtab) = NULL;
 	}
       symtab->block_line_section = section;
       if (subfile->dirname)
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 365aa94..52d6a0f 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -417,15 +417,15 @@  gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
   /* Assume symtab is valid for whole PC range.  */
   symtab = find_pc_line_symtab (low);
 
-  if (symtab != NULL && symtab->linetable != NULL)
+  if (symtab != NULL && SYMTAB_LINETABLE (symtab) != NULL)
     {
       /* Convert the linetable to a bunch of my_line_entry's.  */
-      le = symtab->linetable->item;
-      nlines = symtab->linetable->nitems;
+      le = SYMTAB_LINETABLE (symtab)->item;
+      nlines = SYMTAB_LINETABLE (symtab)->nitems;
     }
 
   if (!(flags & DISASSEMBLY_SOURCE) || nlines <= 0
-      || symtab == NULL || symtab->linetable == NULL)
+      || symtab == NULL || SYMTAB_LINETABLE (symtab) == NULL)
     do_assembly_only (gdbarch, uiout, &di, low, high, how_many, flags, stb);
 
   else if (flags & DISASSEMBLY_SOURCE)
diff --git a/gdb/jit.c b/gdb/jit.c
index 4810018..1541e04 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -653,12 +653,13 @@  finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
       size_t size = ((stab->linetable->nitems - 1)
 		     * sizeof (struct linetable_entry)
 		     + sizeof (struct linetable));
-      LINETABLE (symtab) = obstack_alloc (&objfile->objfile_obstack, size);
-      memcpy (LINETABLE (symtab), stab->linetable, size);
+      SYMTAB_LINETABLE (symtab) = obstack_alloc (&objfile->objfile_obstack,
+						 size);
+      memcpy (SYMTAB_LINETABLE (symtab), stab->linetable, size);
     }
   else
     {
-      LINETABLE (symtab) = NULL;
+      SYMTAB_LINETABLE (symtab) = NULL;
     }
 
   blockvector_size = (sizeof (struct blockvector)
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 1d7c6ae..6a3b6dc 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4190,7 +4190,7 @@  psymtab_to_symtab_1 (struct objfile *objfile,
 
       psymtab_language = st->language;
 
-      lines = LINETABLE (st);
+      lines = SYMTAB_LINETABLE (st);
 
       /* Get a new lexical context.  */
 
@@ -4280,10 +4280,11 @@  psymtab_to_symtab_1 (struct objfile *objfile,
       size = lines->nitems;
       if (size > 1)
 	--size;
-      LINETABLE (st) = obstack_copy (&mdebugread_objfile->objfile_obstack,
-				     lines,
-				     (sizeof (struct linetable)
-				      + size * sizeof (lines->item)));
+      SYMTAB_LINETABLE (st)
+	= obstack_copy (&mdebugread_objfile->objfile_obstack,
+			lines,
+			(sizeof (struct linetable)
+			 + size * sizeof (lines->item)));
       xfree (lines);
 
       /* .. and our share of externals.
@@ -4731,7 +4732,7 @@  new_symtab (const char *name, int maxlines, struct objfile *objfile)
   struct symtab *s = allocate_symtab (name, objfile);
   struct blockvector *bv;
 
-  LINETABLE (s) = new_linetable (maxlines);
+  SYMTAB_LINETABLE (s) = new_linetable (maxlines);
 
   /* All symtabs must have at least two blocks.  */
   bv = new_bvect (2);
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index e1ef0c2..f03eb1e 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -52,12 +52,13 @@  mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
   gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
   cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines");
 
-  if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0)
-    for (i = 0; i < LINETABLE (s)->nitems; i++)
+  if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0)
+    for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++)
     {
       cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
-      ui_out_field_core_addr (uiout, "pc", gdbarch, LINETABLE (s)->item[i].pc);
-      ui_out_field_int (uiout, "line", LINETABLE (s)->item[i].line);
+      ui_out_field_core_addr (uiout, "pc", gdbarch,
+			      SYMTAB_LINETABLE (s)->item[i].pc);
+      ui_out_field_int (uiout, "line", SYMTAB_LINETABLE (s)->item[i].line);
       do_cleanups (cleanup_tuple);
     }
 
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index e8c1b97..00d267a 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -749,7 +749,7 @@  objfile_relocate1 (struct objfile *objfile,
       int i;
 
       /* First the line table.  */
-      l = LINETABLE (s);
+      l = SYMTAB_LINETABLE (s);
       if (l)
 	{
 	  for (i = 0; i < l->nitems; ++i)
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index bb82c8c..a890410 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -207,16 +207,16 @@  ltpy_has_line (PyObject *self, PyObject *args)
   if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
     return NULL;
 
-  if (LINETABLE (symtab) == NULL)
+  if (SYMTAB_LINETABLE (symtab) == NULL)
     {
       PyErr_SetString (PyExc_RuntimeError,
 		       _("Linetable information not found in symbol table"));
       return NULL;
     }
 
-  for (index = 0; index < LINETABLE (symtab)->nitems; index++)
+  for (index = 0; index < SYMTAB_LINETABLE (symtab)->nitems; index++)
     {
-      struct linetable_entry *item = &(symtab->linetable->item[index]);
+      struct linetable_entry *item = &(SYMTAB_LINETABLE (symtab)->item[index]);
       if (item->line == py_line)
 	  Py_RETURN_TRUE;
     }
@@ -240,7 +240,7 @@  ltpy_get_all_source_lines (PyObject *self, PyObject *args)
 
   LTPY_REQUIRE_VALID (self, symtab);
 
-  if (LINETABLE (symtab) == NULL)
+  if (SYMTAB_LINETABLE (symtab) == NULL)
     {
       PyErr_SetString (PyExc_RuntimeError,
 		       _("Linetable information not found in symbol table"));
@@ -251,9 +251,9 @@  ltpy_get_all_source_lines (PyObject *self, PyObject *args)
   if (source_dict == NULL)
     return NULL;
 
-  for (index = 0; index < LINETABLE (symtab)->nitems; index++)
+  for (index = 0; index < SYMTAB_LINETABLE (symtab)->nitems; index++)
     {
-      item = &(LINETABLE (symtab)->item[index]);
+      item = &(SYMTAB_LINETABLE (symtab)->item[index]);
 
       /* 0 is used to signify end of line table information.  Do not
 	 include in the source set. */
@@ -430,10 +430,10 @@  ltpy_iternext (PyObject *self)
 
   LTPY_REQUIRE_VALID (iter_obj->source, symtab);
 
-  if (iter_obj->current_index >= LINETABLE (symtab)->nitems)
+  if (iter_obj->current_index >= SYMTAB_LINETABLE (symtab)->nitems)
     goto stop_iteration;
 
-  item = &(LINETABLE (symtab)->item[iter_obj->current_index]);
+  item = &(SYMTAB_LINETABLE (symtab)->item[iter_obj->current_index]);
 
   /* Skip over internal entries such as 0.  0 signifies the end of
      line table data and is not useful to the API user.  */
@@ -442,9 +442,9 @@  ltpy_iternext (PyObject *self)
       iter_obj->current_index++;
 
       /* Exit if the internal value is the last item in the line table.  */
-      if (iter_obj->current_index >= symtab->linetable->nitems)
+      if (iter_obj->current_index >= SYMTAB_LINETABLE (symtab)->nitems)
 	goto stop_iteration;
-      item = &(symtab->linetable->item[iter_obj->current_index]);
+      item = &(SYMTAB_LINETABLE (symtab)->item[iter_obj->current_index]);
     }
 
   obj = build_linetable_entry (item->line, item->pc);
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 323ebd5..42e43fd 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -126,7 +126,7 @@  print_objfile_statistics (void)
     ALL_OBJFILE_SYMTABS (objfile, s)
       {
         i++;
-        if (s->linetable != NULL)
+        if (SYMTAB_LINETABLE (s) != NULL)
           linetables++;
         if (s->primary == 1)
           blockvectors++;
@@ -308,7 +308,7 @@  dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
 		    language_str (symtab->language));
 
   /* First print the line table.  */
-  l = LINETABLE (symtab);
+  l = SYMTAB_LINETABLE (symtab);
   if (l)
     {
       fprintf_filtered (outfile, "\nLine table:\n\n");
@@ -763,7 +763,8 @@  maintenance_info_symtabs (char *regexp, int from_tty)
 			       symtab->primary ? " (primary)" : "");
 	      printf_filtered ("	  "
 			       "linetable ((struct linetable *) %s)\n",
-			       host_address_to_string (symtab->linetable));
+			       host_address_to_string
+				 (SYMTAB_LINETABLE (symtab)));
 	      printf_filtered ("	  debugformat %s\n",
 			       symtab->debugformat);
 	      printf_filtered ("	}\n");
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5b00b1b..58aa6e9 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2329,7 +2329,7 @@  find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 	continue;
 
       /* Find the best line in this symtab.  */
-      l = LINETABLE (s);
+      l = SYMTAB_LINETABLE (s);
       if (!l)
 	continue;
       len = l->nitems;
@@ -2469,7 +2469,7 @@  find_line_symtab (struct symtab *symtab, int line,
   struct symtab *best_symtab;
 
   /* First try looking it up in the given symtab.  */
-  best_linetable = LINETABLE (symtab);
+  best_linetable = SYMTAB_LINETABLE (symtab);
   best_symtab = symtab;
   best_index = find_line_common (best_linetable, line, &exact, 0);
   if (best_index < 0 || !exact)
@@ -2511,7 +2511,7 @@  find_line_symtab (struct symtab *symtab, int line,
 	if (FILENAME_CMP (symtab_to_fullname (symtab),
 			  symtab_to_fullname (s)) != 0)
 	  continue;	
-	l = LINETABLE (s);
+	l = SYMTAB_LINETABLE (s);
 	ind = find_line_common (l, line, &exact, 0);
 	if (ind >= 0)
 	  {
@@ -2561,13 +2561,14 @@  find_pcs_for_symtab_line (struct symtab *symtab, int line,
       int was_exact;
       int idx;
 
-      idx = find_line_common (LINETABLE (symtab), line, &was_exact, start);
+      idx = find_line_common (SYMTAB_LINETABLE (symtab), line, &was_exact,
+			      start);
       if (idx < 0)
 	break;
 
       if (!was_exact)
 	{
-	  struct linetable_entry *item = &LINETABLE (symtab)->item[idx];
+	  struct linetable_entry *item = &SYMTAB_LINETABLE (symtab)->item[idx];
 
 	  if (*best_item == NULL || item->line < (*best_item)->line)
 	    *best_item = item;
@@ -2575,7 +2576,8 @@  find_pcs_for_symtab_line (struct symtab *symtab, int line,
 	  break;
 	}
 
-      VEC_safe_push (CORE_ADDR, result, LINETABLE (symtab)->item[idx].pc);
+      VEC_safe_push (CORE_ADDR, result,
+		     SYMTAB_LINETABLE (symtab)->item[idx].pc);
       start = idx + 1;
     }
 
@@ -2600,7 +2602,7 @@  find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
   symtab = find_line_symtab (symtab, line, &ind, NULL);
   if (symtab != NULL)
     {
-      l = LINETABLE (symtab);
+      l = SYMTAB_LINETABLE (symtab);
       *pc = l->item[ind].pc;
       return 1;
     }
@@ -2754,7 +2756,7 @@  skip_prologue_using_lineinfo (CORE_ADDR func_addr, struct symtab *symtab)
   int i;
 
   /* Give up if this symbol has no lineinfo table.  */
-  l = LINETABLE (symtab);
+  l = SYMTAB_LINETABLE (symtab);
   if (l == NULL)
     return func_addr;
 
@@ -2995,7 +2997,7 @@  skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
 	 do this.  */
       if (prologue_sal.symtab->language != language_asm)
 	{
-	  struct linetable *linetable = LINETABLE (prologue_sal.symtab);
+	  struct linetable *linetable = SYMTAB_LINETABLE (prologue_sal.symtab);
 	  int idx = 0;
 
 	  /* Skip any earlier lines, and any end-of-sequence marker
diff --git a/gdb/symtab.h b/gdb/symtab.h
index e545506..9a8c404 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -981,7 +981,7 @@  struct symtab
 };
 
 #define BLOCKVECTOR(symtab)	(symtab)->blockvector
-#define LINETABLE(symtab)	(symtab)->linetable
+#define SYMTAB_LINETABLE(symtab) ((symtab)->linetable)
 #define SYMTAB_OBJFILE(symtab)	((symtab)->objfile)
 #define SYMTAB_PSPACE(symtab)	(SYMTAB_OBJFILE (symtab)->pspace)
 #define SYMTAB_DIRNAME(symtab)	((symtab)->dirname)