]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2004-01-26 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Mon, 26 Jan 2004 20:36:32 +0000 (20:36 +0000)
committerAndrew Cagney <cagney@redhat.com>
Mon, 26 Jan 2004 20:36:32 +0000 (20:36 +0000)
* dwarf2loc.c (dwarf_expr_frame_base): Use SYMBOL_OPS instead of
SYMBOL_LOCATION_FUNCS
(dwarf2_loclist_funcs, dwarf2_locexpr_funcs): Change type to
"struct symbol_ops".
* dwarf2loc.h (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Change
type to "struct symbol_ops".
* symtab.h (struct symbol_ops): Rename "struct location_funcs".
(struct symbol): Replace ".aux_value.loc.funcs" and
".aux_value.loc.baton" with ".ops" and ".aux_value.ptr".
(SYMBOL_OBJFILE): Delete macro.
(SYMBOL_LOCATION_FUNCS): Delete macro.
(SYMBOL_LOCATION_BATON): Update.
* dwarf2read.c (dwarf2_symbol_mark_computed): Set SYMBOL_OPS
intead of SYMBOL_LOCATION_FUNCS.
* ax-gdb.c (gen_var_ref): Ditto.
* printcmd.c (address_info): Ditto.
* findvar.c (read_var_value): Ditto.
(symbol_read_needs_frame): Ditto.

gdb/ChangeLog
gdb/ax-gdb.c
gdb/dwarf2loc.c
gdb/dwarf2loc.h
gdb/dwarf2read.c
gdb/findvar.c
gdb/printcmd.c
gdb/symtab.h

index 296dbc0f01ce85710466330502691be0125ccd1e..00ac4917420c32c7dba3673d2e9687c843a1decc 100644 (file)
@@ -1,3 +1,24 @@
+2004-01-26  Andrew Cagney  <cagney@redhat.com>
+
+       * dwarf2loc.c (dwarf_expr_frame_base): Use SYMBOL_OPS instead of
+       SYMBOL_LOCATION_FUNCS
+       (dwarf2_loclist_funcs, dwarf2_locexpr_funcs): Change type to
+       "struct symbol_ops".
+       * dwarf2loc.h (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Change
+       type to "struct symbol_ops".
+       * symtab.h (struct symbol_ops): Rename "struct location_funcs".
+       (struct symbol): Replace ".aux_value.loc.funcs" and
+       ".aux_value.loc.baton" with ".ops" and ".aux_value.ptr".
+       (SYMBOL_OBJFILE): Delete macro.
+       (SYMBOL_LOCATION_FUNCS): Delete macro.
+       (SYMBOL_LOCATION_BATON): Update.
+       * dwarf2read.c (dwarf2_symbol_mark_computed): Set SYMBOL_OPS
+       intead of SYMBOL_LOCATION_FUNCS.
+       * ax-gdb.c (gen_var_ref): Ditto.
+       * printcmd.c (address_info): Ditto.
+       * findvar.c (read_var_value): Ditto.
+       (symbol_read_needs_frame): Ditto.
+
 2004-01-26  Andrew Cagney  <cagney@redhat.com>
 
        * dwarf2read.c (read_func_scope): Document frame-base hack.
index cacf308f5fdc472ecdea7a0aa2ac1ad88a1d0641..d828895bf72f0c0e2cfdad25584565ec940333d7 100644 (file)
@@ -620,7 +620,12 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
 
     case LOC_COMPUTED:
     case LOC_COMPUTED_ARG:
-      (*SYMBOL_LOCATION_FUNCS (var)->tracepoint_var_ref) (var, ax, value);
+      /* FIXME: cagney/2004-01-26: It should be possible to
+        unconditionally call the SYMBOL_OPS method when available.
+        Unfortunatly DWARF 2 stores the frame-base (instead of the
+        function) location in a function's symbol.  Oops!  For the
+        moment enable this when/where applicable.  */
+      SYMBOL_OPS (var)->tracepoint_var_ref (var, ax, value);
       break;
 
     case LOC_OPTIMIZED_OUT:
index fac5c4ac1a1cee261e570a450bd12906faa8669d..ef333f7e77012d4c08ef1a1ce0f16031dacacdf0 100644 (file)
@@ -154,7 +154,7 @@ dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length)
 
   framefunc = get_frame_function (debaton->frame);
 
-  if (SYMBOL_LOCATION_FUNCS (framefunc) == &dwarf2_loclist_funcs)
+  if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
     {
       struct dwarf2_loclist_baton *symbaton;
       symbaton = SYMBOL_LOCATION_BATON (framefunc);
@@ -465,7 +465,7 @@ locexpr_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax,
 
 /* The set of location functions used with the DWARF-2 expression
    evaluator.  */
-struct location_funcs dwarf2_locexpr_funcs = {
+const struct symbol_ops dwarf2_locexpr_funcs = {
   locexpr_read_variable,
   locexpr_read_needs_frame,
   locexpr_describe_location,
@@ -537,7 +537,7 @@ loclist_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax,
 
 /* The set of location functions used with the DWARF-2 expression
    evaluator and location lists.  */
-struct location_funcs dwarf2_loclist_funcs = {
+const struct symbol_ops dwarf2_loclist_funcs = {
   loclist_read_variable,
   loclist_read_needs_frame,
   loclist_describe_location,
index 321cb037528019e85e3ba03a3a5861e42c6cd018..ce0a8ef0bed010985bebce253b36085379a82475 100644 (file)
@@ -21,6 +21,8 @@
 #if !defined (DWARF2LOC_H)
 #define DWARF2LOC_H
 
+struct symbol_ops;
+
 /* This header is private to the DWARF-2 reader.  It is shared between
    dwarf2read.c and dwarf2loc.c.  */
 
@@ -62,7 +64,7 @@ struct dwarf2_loclist_baton
   struct objfile *objfile;
 };
 
-extern struct location_funcs dwarf2_locexpr_funcs;
-extern struct location_funcs dwarf2_loclist_funcs;
+extern const struct symbol_ops dwarf2_locexpr_funcs;
+extern const struct symbol_ops dwarf2_loclist_funcs;
 
 #endif
index 3acbc583a30974eeb270a96aba6e9ce7dea7c0e3..d47f93ae8245463c9e31baca667b7a410e0332eb 100644 (file)
@@ -7974,7 +7974,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
        complaint (&symfile_complaints,
                   "Location list used without specifying the CU base address.");
 
-      SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_loclist_funcs;
+      SYMBOL_OPS (sym) = &dwarf2_loclist_funcs;
       SYMBOL_LOCATION_BATON (sym) = baton;
     }
   else
@@ -8003,7 +8003,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
          baton->data = NULL;
        }
       
-      SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs;
+      SYMBOL_OPS (sym) = &dwarf2_locexpr_funcs;
       SYMBOL_LOCATION_BATON (sym) = baton;
     }
 }
index 34b4a5b50e604e40f1e2fb7da23148e97485c8d2..397a56fd7c1094caa84042573f9d829d83d0ff13 100644 (file)
@@ -346,11 +346,12 @@ symbol_read_needs_frame (struct symbol *sym)
          we failed to consider one.  */
     case LOC_COMPUTED:
     case LOC_COMPUTED_ARG:
-      {
-       struct location_funcs *symfuncs = SYMBOL_LOCATION_FUNCS (sym);
-       return (symfuncs->read_needs_frame) (sym);
-      }
-      break;
+      /* FIXME: cagney/2004-01-26: It should be possible to
+        unconditionally call the SYMBOL_OPS method when available.
+        Unfortunatly DWARF 2 stores the frame-base (instead of the
+        function) location in a function's symbol.  Oops!  For the
+        moment enable this when/where applicable.  */
+      return SYMBOL_OPS (sym)->read_needs_frame (sym);
 
     case LOC_REGISTER:
     case LOC_ARG:
@@ -564,15 +565,14 @@ addresses have not been bound by the dynamic loader. Try again when executable i
 
     case LOC_COMPUTED:
     case LOC_COMPUTED_ARG:
-      {
-       struct location_funcs *funcs = SYMBOL_LOCATION_FUNCS (var);
-
-       if (frame == 0 && (funcs->read_needs_frame) (var))
-         return 0;
-       return (funcs->read_variable) (var, frame);
-
-      }
-      break;
+      /* FIXME: cagney/2004-01-26: It should be possible to
+        unconditionally call the SYMBOL_OPS method when available.
+        Unfortunatly DWARF 2 stores the frame-base (instead of the
+        function) location in a function's symbol.  Oops!  For the
+        moment enable this when/where applicable.  */
+      if (frame == 0 && SYMBOL_OPS (var)->read_needs_frame (var))
+       return 0;
+      return SYMBOL_OPS (var)->read_variable (var, frame);
 
     case LOC_UNRESOLVED:
       {
index 0502cf1cb2408bcc4d720228577e21549c1f6b3a..dba7bdd1b7f3e5e84c7b27213c8f21cc60d9eab2 100644 (file)
@@ -1141,7 +1141,12 @@ address_info (char *exp, int from_tty)
 
     case LOC_COMPUTED:
     case LOC_COMPUTED_ARG:
-      (SYMBOL_LOCATION_FUNCS (sym)->describe_location) (sym, gdb_stdout);
+      /* FIXME: cagney/2004-01-26: It should be possible to
+        unconditionally call the SYMBOL_OPS method when available.
+        Unfortunatly DWARF 2 stores the frame-base (instead of the
+        function) location in a function's symbol.  Oops!  For the
+        moment enable this when/where applicable.  */
+      SYMBOL_OPS (sym)->describe_location (sym, gdb_stdout);
       break;
 
     case LOC_REGISTER:
index 95813bdd3ef03dd4877b127967867a2bc0c757d8..c56c05366d37aa3412d30cee2a3b884a8ad37ef8 100644 (file)
@@ -546,21 +546,12 @@ enum address_class
   LOC_COMPUTED_ARG
 };
 
-/* A structure of function pointers describing the location of a
-   variable, structure member, or structure base class.
-
-   These functions' BATON arguments are generic data pointers, holding
-   whatever data the functions need --- the code which provides this
-   structure also provides the actual contents of the baton, and
-   decides its form.  However, there may be other rules about where
-   the baton data must be allocated; whoever is pointing to this
-   `struct location_funcs' object will know the rules.  For example,
-   when a symbol S's location is LOC_COMPUTED, then
-   SYMBOL_LOCATION_FUNCS(S) is pointing to a location_funcs structure,
-   and SYMBOL_LOCATION_BATON(S) is the baton, which must be allocated
-   on the same obstack as the symbol itself.  */
-
-struct location_funcs
+/* The methods needed to implement a symbol class.  These methods can
+   use the symbol's .aux_value for additional per-symbol information.
+
+   At present this is only used to implement location expressions.  */
+
+struct symbol_ops
 {
 
   /* Return the value of the variable SYMBOL, relative to the stack
@@ -608,6 +599,12 @@ struct symbol
   ENUM_BITFIELD(domain_enum_tag) domain : 6;
 
   /* Address class */
+  /* NOTE: cagney/2003-11-02: The fields "aclass" and "ops" contain
+     overlapping information.  By creating a per-aclass ops vector, or
+     using the aclass as an index into an ops table, the aclass and
+     ops fields can be merged.  The latter, for instance, would shave
+     32-bits from each symbol (relative to a symbol lookup, any table
+     index overhead would be in the noise).  */
 
   ENUM_BITFIELD(address_class) aclass : 6;
 
@@ -617,28 +614,30 @@ struct symbol
 
   unsigned short line;
 
-  /* Some symbols require an additional value to be recorded on a per-
-     symbol basis.  Stash those values here. */
+  /* Method's for symbol's of this class.  */
+  /* NOTE: cagney/2003-11-02: See comment above attached to "aclass".  */
+
+  const struct symbol_ops *ops;
+
+  /* Some symbols require additional information to be recorded on a
+     per- symbol basis.  Stash those values here. */
 
   union
   {
     /* Used by LOC_BASEREG and LOC_BASEREG_ARG.  */
     short basereg;
-
-    /* For a LOC_COMPUTED or LOC_COMPUTED_ARG symbol, this is the
-       baton and location_funcs structure to find its location.  For a
-       LOC_BLOCK symbol for a function in a compilation unit compiled
-       with DWARF 2 information, this is information used internally
-       by the DWARF 2 code --- specifically, the location expression
-       for the frame base for this function.  */
+    /* An arbitrary data pointer.  Note that this data must be
+       allocated using the same obstack as the symbol itself.  */
+    /* So far it is only used by LOC_COMPUTED and LOC_COMPUTED_ARG to
+       find the location location information.  For a LOC_BLOCK symbol
+       for a function in a compilation unit compiled with DWARF 2
+       information, this is information used internally by the DWARF 2
+       code --- specifically, the location expression for the frame
+       base for this function.  */
     /* FIXME drow/2003-02-21: For the LOC_BLOCK case, it might be better
        to add a magic symbol to the block containing this information,
        or to have a generic debug info annotation slot for symbols.  */
-    struct
-    {
-      void *baton;
-      struct location_funcs *funcs;
-    } loc;
+    void *ptr;
   }
   aux_value;
 
@@ -652,8 +651,8 @@ struct symbol
 #define SYMBOL_LINE(symbol)            (symbol)->line
 #define SYMBOL_BASEREG(symbol)         (symbol)->aux_value.basereg
 #define SYMBOL_OBJFILE(symbol)          (symbol)->aux_value.objfile
-#define SYMBOL_LOCATION_BATON(symbol)   (symbol)->aux_value.loc.baton
-#define SYMBOL_LOCATION_FUNCS(symbol)   (symbol)->aux_value.loc.funcs
+#define SYMBOL_OPS(symbol)              (symbol)->ops
+#define SYMBOL_LOCATION_BATON(symbol)   (symbol)->aux_value.ptr
 \f
 /* A partial_symbol records the name, domain, and address class of
    symbols whose types we have not parsed yet.  For functions, it also