diff mbox

Use SYMBOL_OBJFILE more.

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

Commit Message

Doug Evans Nov. 8, 2014, 7:56 p.m. UTC
Hi.

This is just a cleanup patch to use SYMBOL_OBJFILE more.

Regression tested on amd64-linux.

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

	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
	SYMBOL_OBJFILE.
	* findvar.c (default_read_var_value): Ditto.
	* jv-lang.c (add_class_symtab_symbol): Ditto.
	* parse.c (operator_check_standard): Ditto.
	* printcmd.c (address_info): Ditto.
	* symtab.c (fixup_symbol_section): Ditto.
	* tracepoint.c (scope_info): Ditto.
	* valops.c (find_function_in_inferior): Ditto.
	* guile/scm-symbol.c (syscm_eq_symbol_smob): Ditto.
	* python/py-symbol.c (set_symbol): Ditto.

Comments

Yao Qi Nov. 13, 2014, 1:04 p.m. UTC | #1
Doug Evans <xdje42@gmail.com> writes:

> 2014-11-08  Doug Evans  <xdje42@gmail.com>
>
> 	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
> 	SYMBOL_OBJFILE.
> 	* findvar.c (default_read_var_value): Ditto.
> 	* jv-lang.c (add_class_symtab_symbol): Ditto.
> 	* parse.c (operator_check_standard): Ditto.
> 	* printcmd.c (address_info): Ditto.
> 	* symtab.c (fixup_symbol_section): Ditto.
> 	* tracepoint.c (scope_info): Ditto.
> 	* valops.c (find_function_in_inferior): Ditto.
> 	* guile/scm-symbol.c (syscm_eq_symbol_smob): Ditto.
> 	* python/py-symbol.c (set_symbol): Ditto.


> @@ -2813,7 +2813,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
>        pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
>        section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
>        name = SYMBOL_LINKAGE_NAME (sym);
> -      objfile = SYMBOL_SYMTAB (sym)->objfile;
> +      objfile = SYMBOL_OBJFILE (sym);
>      }
>    else
>      {

This change isn't mentioned in changelog entry.  Otherwise, it looks
good to me.
Doug Evans Nov. 18, 2014, 5:03 p.m. UTC | #2
On Thu, Nov 13, 2014 at 5:04 AM, Yao Qi <yao@codesourcery.com> wrote:
> Doug Evans <xdje42@gmail.com> writes:
>
>> 2014-11-08  Doug Evans  <xdje42@gmail.com>
>>
>>       * cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
>>       SYMBOL_OBJFILE.
>>       * findvar.c (default_read_var_value): Ditto.
>>       * jv-lang.c (add_class_symtab_symbol): Ditto.
>>       * parse.c (operator_check_standard): Ditto.
>>       * printcmd.c (address_info): Ditto.
>>       * symtab.c (fixup_symbol_section): Ditto.
>>       * tracepoint.c (scope_info): Ditto.
>>       * valops.c (find_function_in_inferior): Ditto.
>>       * guile/scm-symbol.c (syscm_eq_symbol_smob): Ditto.
>>       * python/py-symbol.c (set_symbol): Ditto.
>
>
>> @@ -2813,7 +2813,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
>>        pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
>>        section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
>>        name = SYMBOL_LINKAGE_NAME (sym);
>> -      objfile = SYMBOL_SYMTAB (sym)->objfile;
>> +      objfile = SYMBOL_OBJFILE (sym);
>>      }
>>    else
>>      {
>
> This change isn't mentioned in changelog entry.  Otherwise, it looks
> good to me.

Thanks.
Committed, with the fixed changelog entry.
diff mbox

Patch

diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 4366666..31075fe 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -473,7 +473,7 @@  cp_lookup_symbol_imports_or_template (const char *scope,
 	  struct cleanup *cleanups = make_cleanup (xfree, name_copy);
 	  const struct language_defn *lang = language_def (language_cplus);
 	  struct gdbarch *arch
-	    = get_objfile_arch (SYMBOL_SYMTAB (function)->objfile);
+	    = get_objfile_arch (SYMBOL_OBJFILE (function));
 	  const struct block *parent = BLOCK_SUPERBLOCK (block);
 
 	  while (1)
diff --git a/gdb/findvar.c b/gdb/findvar.c
index cb98b86..512c572 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -573,9 +573,9 @@  default_read_var_value (struct symbol *var, struct frame_info *frame)
 	lookup_data.name = SYMBOL_LINKAGE_NAME (var);
 
 	gdbarch_iterate_over_objfiles_in_search_order
-	  (get_objfile_arch (SYMBOL_SYMTAB (var)->objfile),
+	  (get_objfile_arch (SYMBOL_OBJFILE (var)),
 	   minsym_lookup_iterator_cb, &lookup_data,
-	   SYMBOL_SYMTAB (var)->objfile);
+	   SYMBOL_OBJFILE (var));
 	msym = lookup_data.result.minsym;
 
 	if (msym == NULL)
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 352451b..d80aa54 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -81,7 +81,7 @@  syscm_eq_symbol_smob (const void *ap, const void *bp)
 static htab_t
 syscm_objfile_symbol_map (struct symbol *symbol)
 {
-  struct objfile *objfile = SYMBOL_SYMTAB (symbol)->objfile;
+  struct objfile *objfile = SYMBOL_OBJFILE (symbol);
   htab_t htab = objfile_data (objfile, syscm_objfile_data_key);
 
   if (htab == NULL)
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 421e665..69e8c16 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -172,7 +172,7 @@  static void
 add_class_symtab_symbol (struct symbol *sym)
 {
   struct symtab *symtab
-    = get_java_class_symtab (get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile));
+    = get_java_class_symtab (get_objfile_arch (SYMBOL_OBJFILE (sym)));
   const struct blockvector *bv = BLOCKVECTOR (symtab);
 
   dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
diff --git a/gdb/parse.c b/gdb/parse.c
index 7a6c1ee..5540a79 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1809,7 +1809,7 @@  operator_check_standard (struct expression *exp, int pos,
 
 	/* Check objfile where the variable itself is placed.
 	   SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
-	if ((*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data))
+	if ((*objfile_func) (SYMBOL_OBJFILE (symbol), data))
 	  return 1;
 
 	/* Check objfile where is placed the code touching the variable.  */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index df44ff4..d13b610 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1252,7 +1252,7 @@  address_info (char *exp, int from_tty)
   printf_filtered ("\" is ");
   val = SYMBOL_VALUE (sym);
   section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
-  gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
+  gdbarch = get_objfile_arch (SYMBOL_OBJFILE (sym));
 
   if (SYMBOL_COMPUTED_OPS (sym) != NULL)
     {
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 716f93d8..caf0a74 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -292,12 +292,12 @@  set_symbol (symbol_object *obj, struct symbol *symbol)
   obj->prev = NULL;
   if (SYMBOL_SYMTAB (symbol))
     {
-      obj->next = objfile_data (SYMBOL_SYMTAB (symbol)->objfile,
+      obj->next = objfile_data (SYMBOL_OBJFILE (symbol),
 				sympy_objfile_data_key);
 
       if (obj->next)
 	obj->next->prev = obj;
-      set_objfile_data (SYMBOL_SYMTAB (symbol)->objfile,
+      set_objfile_data (SYMBOL_OBJFILE (symbol),
 			sympy_objfile_data_key, obj);
     }
   else
@@ -336,7 +336,7 @@  sympy_dealloc (PyObject *obj)
     sym_obj->prev->next = sym_obj->next;
   else if (sym_obj->symbol && SYMBOL_SYMTAB (sym_obj->symbol))
     {
-      set_objfile_data (SYMBOL_SYMTAB (sym_obj->symbol)->objfile,
+      set_objfile_data (SYMBOL_OBJFILE (sym_obj->symbol),
 			sympy_objfile_data_key, sym_obj->next);
     }
   if (sym_obj->next)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index df974bf..1790712 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1179,7 +1179,7 @@  fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
   gdb_assert (objfile || SYMBOL_SYMTAB (sym));
 
   if (objfile == NULL)
-    objfile = SYMBOL_SYMTAB (sym)->objfile;
+    objfile = SYMBOL_OBJFILE (sym);
 
   if (SYMBOL_OBJ_SECTION (objfile, sym))
     return sym;
@@ -2813,7 +2813,7 @@  skip_prologue_sal (struct symtab_and_line *sal)
       pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
       section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
       name = SYMBOL_LINKAGE_NAME (sym);
-      objfile = SYMBOL_SYMTAB (sym)->objfile;
+      objfile = SYMBOL_OBJFILE (sym);
     }
   else
     {
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index fc20063..b8ef2e1 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2739,7 +2739,7 @@  scope_info (char *args, int from_tty)
 	  if (symname == NULL || *symname == '\0')
 	    continue;		/* Probably botched, certainly useless.  */
 
-	  gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
+	  gdbarch = get_objfile_arch (SYMBOL_OBJFILE (sym));
 
 	  printf_filtered ("Symbol %s is ", symname);
 
diff --git a/gdb/valops.c b/gdb/valops.c
index 2a1db90..83a74b2 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -139,7 +139,7 @@  find_function_in_inferior (const char *name, struct objfile **objf_p)
 	}
 
       if (objf_p)
-	*objf_p = SYMBOL_SYMTAB (sym)->objfile;
+	*objf_p = SYMBOL_OBJFILE (sym);
 
       return value_of_variable (sym, NULL);
     }