]> Git Repo - binutils.git/commitdiff
gdb: remove SYMBOL_LINE macro
authorSimon Marchi <[email protected]>
Fri, 28 Jan 2022 03:39:50 +0000 (22:39 -0500)
committerSimon Marchi <[email protected]>
Sun, 6 Feb 2022 21:03:47 +0000 (16:03 -0500)
Add a getter and a setter for a symbol's line.  Remove the corresponding macro
and adjust all callers.

Change-Id: I229f2b8fcf938c07975f641361313a8761fad9a5

13 files changed:
gdb/ada-lang.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-cplus-symbols.c
gdb/compile/compile-cplus-types.c
gdb/dwarf2/read.c
gdb/frame.c
gdb/guile/scm-symbol.c
gdb/linespec.c
gdb/mi/mi-symbol-cmds.c
gdb/python/py-symbol.c
gdb/stabsread.c
gdb/symtab.c
gdb/symtab.h

index fbeb176d5668152d12c5fae4ac8e9e8792c9c386..0dd83cda8e5a30eae1c43c4e0930eada7f80c467 100644 (file)
@@ -3355,14 +3355,14 @@ See set/show multiple-symbol."));
          if (syms[i].symbol->is_objfile_owned ())
            symtab = symbol_symtab (syms[i].symbol);
 
-         if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL)
+         if (syms[i].symbol->line () != 0 && symtab != NULL)
            {
              printf_filtered ("[%d] ", i + first_choice);
              ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
                                          &type_print_raw_options);
              printf_filtered (_(" at %s:%d\n"),
                               symtab_to_filename_for_display (symtab),
-                              SYMBOL_LINE (syms[i].symbol));
+                              syms[i].symbol->line ());
            }
          else if (is_enumeral
                   && syms[i].symbol->type ()->name () != NULL)
index 4f7a5b22da51251cd8cd90f4506c4f1eeeb12b32..bb156024ffa11386907e387ec6fd0c731da5d073 100644 (file)
@@ -58,7 +58,7 @@ convert_one_symbol (compile_c_instance *context,
 {
   gcc_type sym_type;
   const char *filename = symbol_symtab (sym.symbol)->filename;
-  unsigned short line = SYMBOL_LINE (sym.symbol);
+  unsigned short line = sym.symbol->line ();
 
   context->error_symbol_once (sym.symbol);
 
index 7cf5703dc71d5024eb39814edab2e040564ae882..33febaccdfd8871d210f43b5b33a7b0945b39fef 100644 (file)
@@ -49,7 +49,7 @@ convert_one_symbol (compile_cplus_instance *instance,
   /* Squash compiler warning.  */
   gcc_type sym_type = 0;
   const char *filename = symbol_symtab (sym.symbol)->filename;
-  unsigned short line = SYMBOL_LINE (sym.symbol);
+  unsigned short line = sym.symbol->line ();
 
   instance->error_symbol_once (sym.symbol);
 
index 1987996698653ff0e149ad5ed89e60bf90f578d9..f0ac05f4f2aa24c4a57f526f0d063798834e66c9 100644 (file)
@@ -626,7 +626,7 @@ compile_cplus_convert_struct_or_union_members
                    continue;
                  }
                const char *filename = symbol_symtab (sym.symbol)->filename;
-               unsigned int line = SYMBOL_LINE (sym.symbol);
+               unsigned int line = sym.symbol->line ();
 
                physaddr = SYMBOL_VALUE_ADDRESS (sym.symbol);
                instance->plugin ().build_decl
@@ -765,7 +765,7 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance,
            }
 
          const char *filename = symbol_symtab (sym.symbol)->filename;
-         unsigned int line = SYMBOL_LINE (sym.symbol);
+         unsigned int line = sym.symbol->line ();
          CORE_ADDR address = BLOCK_START (SYMBOL_BLOCK_VALUE (sym.symbol));
          const char *kind;
 
index 3a22bcdd43d85c106b62ffa0ae668b73e8a64d72..c063e7baa2b5cf75411b41ffaebd673cefa90890 100644 (file)
@@ -21727,7 +21727,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
                          inlined_func ? DW_AT_call_line : DW_AT_decl_line,
                          cu);
       if (attr != nullptr)
-       SYMBOL_LINE (sym) = attr->constant_value (0);
+       sym->set_line (attr->constant_value (0));
 
       attr = dwarf2_attr (die,
                          inlined_func ? DW_AT_call_file : DW_AT_decl_file,
index 6e2f6b245a255f71605a7a2caacb072c99bae406..ce95cf8343bc172d8242cda21e931fb02c211da0 100644 (file)
@@ -2699,10 +2699,10 @@ find_frame_sal (frame_info *frame)
       gdb_assert (sym);
 
       symtab_and_line sal;
-      if (SYMBOL_LINE (sym) != 0)
+      if (sym->line () != 0)
        {
          sal.symtab = symbol_symtab (sym);
-         sal.line = SYMBOL_LINE (sym);
+         sal.line = sym->line ();
        }
       else
        /* If the symbol does not have a location, we don't know where
index 4c28603fa63674660ed58c69dd984d5e6d2ef82f..dbe19865d4e2da6d09ed2764ced90fe21cf20981 100644 (file)
@@ -510,7 +510,7 @@ gdbscm_symbol_line (SCM self)
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
 
-  return scm_from_int (SYMBOL_LINE (symbol));
+  return scm_from_int (symbol->line ());
 }
 
 /* (symbol-value <gdb:symbol> [#:frame <gdb:frame>]) -> <gdb:value>
index a8ae5943811a7c311b23b4ef60485efe216949cd..9e21df76efad13bbf0c8ee59d0225af1c72293b6 100644 (file)
@@ -4451,7 +4451,7 @@ symbol_to_sal (struct symtab_and_line *result,
          *result = {};
          result->symtab = symbol_symtab (sym);
          result->symbol = sym;
-         result->line = SYMBOL_LINE (sym);
+         result->line = sym->line ();
          result->pc = SYMBOL_VALUE_ADDRESS (sym);
          result->pspace = result->symtab->pspace ();
          result->explicit_pc = 1;
@@ -4461,13 +4461,13 @@ symbol_to_sal (struct symtab_and_line *result,
        {
          /* Nothing.  */
        }
-      else if (SYMBOL_LINE (sym) != 0)
+      else if (sym->line () != 0)
        {
          /* We know its line number.  */
          *result = {};
          result->symtab = symbol_symtab (sym);
          result->symbol = sym;
-         result->line = SYMBOL_LINE (sym);
+         result->line = sym->line ();
          result->pc = SYMBOL_VALUE_ADDRESS (sym);
          result->pspace = result->symtab->pspace ();
          return 1;
index 6ed26d69269d63cb3834c8ab0701be9a796c5342..1b08854296c0e753944c2918ac2c3083f6eb6f8a 100644 (file)
@@ -74,8 +74,8 @@ output_debug_symbol (ui_out *uiout, enum search_domain kind,
 {
   ui_out_emit_tuple tuple_emitter (uiout, NULL);
 
-  if (SYMBOL_LINE (sym) != 0)
-    uiout->field_unsigned ("line", SYMBOL_LINE (sym));
+  if (sym->line () != 0)
+    uiout->field_unsigned ("line", sym->line ());
   uiout->field_string ("name", sym->print_name ());
 
   if (kind == FUNCTIONS_DOMAIN || kind == VARIABLES_DOMAIN)
index 747da481a1bf7bc17394fceb22ef06456a9788dd..819a51f7e4147ea23c41a1feff4a9e844649a3ed 100644 (file)
@@ -221,7 +221,7 @@ sympy_line (PyObject *self, void *closure)
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  return gdb_py_object_from_longest (SYMBOL_LINE (symbol)).release ();
+  return gdb_py_object_from_longest (symbol->line ()).release ();
 }
 
 /* Implementation of gdb.Symbol.is_valid (self) -> Boolean.
index d3a1ae99069155ca0dc1e39c547d86839e3d0cfa..c6821f893cbdbe1d7621c1bb8a8fca5443048310 100644 (file)
@@ -693,11 +693,11 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
     {
       /* GCC 2.x puts the line number in desc.  SunOS apparently puts in the
         number of bytes occupied by a type or object, which we ignore.  */
-      SYMBOL_LINE (sym) = desc;
+      sym->set_line (desc);
     }
   else
     {
-      SYMBOL_LINE (sym) = 0;   /* unknown */
+      sym->set_line (0);       /* unknown */
     }
 
   sym->set_language (get_current_subfile ()->language,
index 8da86b61359568244f10507de4277de56e1739d2..1a39372aad02be4c0cc8f19a9ef24ae04ab46095 100644 (file)
@@ -3987,9 +3987,9 @@ skip_prologue_sal (struct symtab_and_line *sal)
       b = BLOCK_SUPERBLOCK (b);
     }
   if (function_block != NULL
-      && SYMBOL_LINE (BLOCK_FUNCTION (function_block)) != 0)
+      && BLOCK_FUNCTION (function_block)->line () != 0)
     {
-      sal->line = SYMBOL_LINE (BLOCK_FUNCTION (function_block));
+      sal->line = BLOCK_FUNCTION (function_block)->line ();
       sal->symtab = symbol_symtab (BLOCK_FUNCTION (function_block));
     }
 }
@@ -4850,7 +4850,7 @@ global_symbol_searcher::add_matching_symbols
                              && sym->domain () != MODULE_DOMAIN)
                          || (kind == MODULES_DOMAIN
                              && sym->domain () == MODULE_DOMAIN
-                             && SYMBOL_LINE (sym) != 0))))
+                             && sym->line () != 0))))
                {
                  if (result_set->size () < m_max_search_results)
                    {
@@ -5098,8 +5098,8 @@ print_symbol_info (enum search_domain kind,
                                          s_filename));
        }
 
-      if (SYMBOL_LINE (sym) != 0)
-       printf_filtered ("%d:\t", SYMBOL_LINE (sym));
+      if (sym->line () != 0)
+       printf_filtered ("%d:\t", sym->line ());
       else
        puts_filtered ("\t");
     }
index 3486803cca8e679dd03b6c69c28795d0301cbaeb..d12eee6e9d8c8d3fdeec7606474ddef7ee9d1bc7 100644 (file)
@@ -1213,6 +1213,16 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
     m_type = type;
   }
 
+  unsigned short line () const
+  {
+    return m_line;
+  }
+
+  void set_line (unsigned short line)
+  {
+    m_line = line;
+  }
+
   /* Data type of value */
 
   struct type *m_type = nullptr;
@@ -1280,7 +1290,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
      to debug files longer than 64K lines?  What about machine
      generated programs?  */
 
-  unsigned short line = 0;
+  unsigned short m_line = 0;
 
   /* An arbitrary data pointer, allowing symbol readers to record
      additional information on a per-symbol basis.  Note that this data
@@ -1315,7 +1325,6 @@ struct block_symbol
 /* Note: There is no accessor macro for symbol.owner because it is
    "private".  */
 
-#define SYMBOL_LINE(symbol)            (symbol)->line
 #define SYMBOL_COMPUTED_OPS(symbol)    ((symbol)->impl ().ops_computed)
 #define SYMBOL_BLOCK_OPS(symbol)       ((symbol)->impl ().ops_block)
 #define SYMBOL_REGISTER_OPS(symbol)    ((symbol)->impl ().ops_register)
This page took 0.095028 seconds and 4 git commands to generate.