* frame.h, symtab.h, findvar.c (read_var_value): Change basereg
authorJim Kingdon <jkingdon@engr.sgi.com>
Tue, 24 Aug 1993 21:38:24 +0000 (21:38 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Tue, 24 Aug 1993 21:38:24 +0000 (21:38 +0000)
support to use LOC_BASEREG rather than SYMBOL_BASEREG_VALID.
* dwarfread.c: Use LOC_BASEREG where appropriate.
* Various: Support LOC_BASEREG and LOC_BASEREG_ARG.

gdb/ChangeLog
gdb/c-exp.y
gdb/ch-exp.y
gdb/dwarfread.c
gdb/m2-exp.y
gdb/printcmd.c
gdb/symtab.c
gdb/symtab.h

index 3c95ef20a4a8630bec28e784ab58f88cb04fad88..7f42e8cbabed0b396177d08267965c3502ff6d7e 100644 (file)
@@ -4,7 +4,7 @@ Tue Aug 24 00:36:17 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * frame.h, symtab.h, findvar.c (read_var_value):  Change basereg
        support to use LOC_BASEREG rather than SYMBOL_BASEREG_VALID.
-       * dwarfread: Use LOC_BASEREG where appropriate.
+       * dwarfread.c: Use LOC_BASEREG where appropriate.
        * Various: Support LOC_BASEREG and LOC_BASEREG_ARG.
 
        * coffread.c (init_lineno, init_stringtab): Don't check whether
index 42e482b357d86e6bf21e297426e8da020ba3b4f5..0b19ed5f163b4df544783a77b003fdf047ead484 100644 (file)
@@ -667,6 +667,8 @@ variable:   name_not_typename
                                case LOC_REGPARM:
                                case LOC_LOCAL:
                                case LOC_LOCAL_ARG:
+                               case LOC_BASEREG:
+                               case LOC_BASEREG_ARG:
                                  if (innermost_block == 0 ||
                                      contained_in (block_found, 
                                                    innermost_block))
index 58b82ead562cc622261cfc607634de40d72f2033..895113329e37e2f801f7b8332c004ae383a9bf20 100644 (file)
@@ -1931,6 +1931,8 @@ yylex ()
              case LOC_REGPARM:
              case LOC_LOCAL:
              case LOC_LOCAL_ARG:
+             case LOC_BASEREG:
+             case LOC_BASEREG_ARG:
                if (innermost_block == NULL
                    || contained_in (block_found, innermost_block))
                  {
index ba00cd2f2e1030695125a5f8a2993e5f7b403217..076f17599087258ed2b259cd8fd4b1b65dfc3935 100644 (file)
@@ -21,9 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /*
 
-FIXME: Figure out how to get the frame pointer register number in the
-execution environment of the target.  Remove R_FP kludge
-
 FIXME: Do we need to generate dependencies in partial symtabs?
 (Perhaps we don't need to).
 
@@ -180,10 +177,6 @@ struct complaint not_row_major =
   "DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
 };
 
-#ifndef R_FP           /* FIXME */
-#define R_FP 14                /* Kludge to get frame pointer register number */
-#endif
-
 typedef unsigned int DIE_REF;  /* Reference to a DIE */
 
 #ifndef GCC_PRODUCER
@@ -332,7 +325,11 @@ static int dbsize; /* Size of dwarf info in bytes */
 static int dbroff;     /* Relative offset from start of .debug section */
 static char *lnbase;   /* Base pointer to line section */
 static int isreg;      /* Kludge to identify register variables */
-static int offreg;     /* Kludge to identify basereg references */
+/* Kludge to identify basereg references.  Nonzero if we have an offset
+   relative to a basereg.  */
+static int offreg;
+/* Which base register is it relative to?  */
+static int basereg;
 
 /* This value is added to each symbol value.  FIXME:  Generalize to 
    the section_offsets structure used by dbxread (once this is done,
@@ -2207,21 +2204,13 @@ locval (loc)
            break;
          case OP_BASEREG:
            /* push value of register (number) */
-           /* Actually, we compute the value as if register has 0 */
+           /* Actually, we compute the value as if register has 0, so the
+              value ends up being the offset from that register.  */
            offreg = 1;
-           regno = target_to_host (loc, loc_value_size, GET_UNSIGNED,
-                                   current_objfile);
+           basereg = target_to_host (loc, loc_value_size, GET_UNSIGNED,
+                                     current_objfile);
            loc += loc_value_size;
-           if (regno == R_FP)
-             {
-               stack[++stacki] = 0;
-             }
-           else
-             {
-               stack[++stacki] = 0;
-
-               complain (&basereg_not_handled, DIE_ID, DIE_NAME, regno);
-             }
+           stack[++stacki] = 0;
            break;
          case OP_ADDR:
            /* push address (relocated address) */
@@ -2988,7 +2977,8 @@ new_symbol (dip, objfile)
                }
              else if (offreg)
                {
-                 SYMBOL_CLASS (sym) = LOC_LOCAL;
+                 SYMBOL_CLASS (sym) = LOC_BASEREG;
+                 SYMBOL_BASEREG (sym) = basereg;
                }
              else
                {
@@ -3007,6 +2997,11 @@ new_symbol (dip, objfile)
            {
              SYMBOL_CLASS (sym) = LOC_REGPARM;
            }
+         else if (offreg)
+           {
+             SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
+             SYMBOL_BASEREG (sym) = basereg;
+           }
          else
            {
              SYMBOL_CLASS (sym) = LOC_ARG;
index b00af97d503c7a40eebadd9c21eabf5915cffbf7..1d7e80116f8b0821075d76f020cec3ddcae11fb4 100644 (file)
@@ -607,6 +607,8 @@ variable:   NAME
                                case LOC_REF_ARG:
                                case LOC_REGPARM:
                                case LOC_LOCAL_ARG:
+                               case LOC_BASEREG:
+                               case LOC_BASEREG_ARG:
                                  if (innermost_block == 0 ||
                                      contained_in (block_found,
                                                    innermost_block))
@@ -1119,6 +1121,8 @@ yylex ()
        case LOC_REGPARM:
        case LOC_LOCAL:
        case LOC_LOCAL_ARG:
+       case LOC_BASEREG:
+       case LOC_BASEREG_ARG:
        case LOC_CONST:
        case LOC_CONST_BYTES:
          return NAME;
index 79d136c10465d444378ce72704ce2c16447e5def..7409b3a3e4bfe9b517536b3170b756fd8d105fa6 100644 (file)
@@ -927,50 +927,36 @@ address_info (exp, from_tty)
       printf ("an argument in register %s", reg_names[val]);
       break;
 
-   case LOC_REGPARM_ADDR:
-     printf ("address of an argument in register %s", reg_names[val]);
-     break;
-      
+    case LOC_REGPARM_ADDR:
+      printf ("address of an argument in register %s", reg_names[val]);
+      break;
+
     case LOC_ARG:
-      if (SYMBOL_BASEREG_VALID (sym))
-       {
-         printf ("an argument at offset %ld from register %s",
-                 val, reg_names[basereg]);
-       }
-      else
-       {
-         printf ("an argument at offset %ld", val);
-       }
+      printf ("an argument at offset %ld", val);
       break;
 
     case LOC_LOCAL_ARG:
-      if (SYMBOL_BASEREG_VALID (sym))
-       {
-         printf ("an argument at offset %ld from register %s",
-                 val, reg_names[basereg]);
-       }
-      else
-       {
-         printf ("an argument at frame offset %ld", val);
-       }
+      printf ("an argument at frame offset %ld", val);
       break;
 
     case LOC_LOCAL:
-      if (SYMBOL_BASEREG_VALID (sym))
-       {
-         printf ("a local variable at offset %ld from register %s",
-                 val, reg_names[basereg]);
-       }
-      else
-       {
-         printf ("a local variable at frame offset %ld", val);
-       }
+      printf ("a local variable at frame offset %ld", val);
       break;
 
     case LOC_REF_ARG:
       printf ("a reference argument at offset %ld", val);
       break;
 
+    case LOC_BASEREG:
+      printf ("a variable at offset %ld from register %s",
+             val, reg_names[basereg]);
+      break;
+
+    case LOC_BASEREG_ARG:
+      printf ("an argument at offset %ld from register %s",
+             val, reg_names[basereg]);
+      break;
+
     case LOC_TYPEDEF:
       printf ("a typedef");
       break;
@@ -1494,6 +1480,8 @@ print_frame_args (func, fi, num, stream)
       case LOC_REGPARM:
       case LOC_REGPARM_ADDR:
       case LOC_LOCAL_ARG:
+      case LOC_BASEREG:
+      case LOC_BASEREG_ARG:
        break;
 
       /* Other types of symbols we just skip over.  */
index 38675d13ba9ebcafbdb98330ad3085e718c8180c..745b74c704895a79a52d084964ce43625b4dc426 100644 (file)
@@ -899,7 +899,8 @@ lookup_block_symbol (block, name, namespace)
                  SYMBOL_CLASS (sym) != LOC_LOCAL_ARG &&
                  SYMBOL_CLASS (sym) != LOC_REF_ARG &&
                  SYMBOL_CLASS (sym) != LOC_REGPARM &&
-                 SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR)
+                 SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR &&
+                 SYMBOL_CLASS (sym) != LOC_BASEREG_ARG)
                {
                  break;
                }
index 34bc099530a41390aedc2fa00224a87a45e9d80a..8ac697277f545578d9b84f1ad463aaf3c27fee69 100644 (file)
@@ -515,6 +515,22 @@ enum address_class
 
   LOC_LOCAL_ARG,
 
+  /* Value is at SYMBOL_VALUE offset from the current value of
+     register number SYMBOL_BASEREG.  This exists mainly for the same
+     things that LOC_LOCAL and LOC_ARG do; but we need to do this
+     instead because on 88k DWARF gives us the offset from the
+     frame/stack pointer, rather than the offset from the "canonical
+     frame address" used by COFF, stabs, etc., and we don't know how
+     to convert between these until we start examining prologues.
+
+     Note that LOC_BASEREG is much less general than a DWARF expression.  */
+
+  LOC_BASEREG,
+
+  /* Same as LOC_BASEREG but it is an argument.  */
+
+  LOC_BASEREG_ARG,
+
   /* The variable does not actually exist in the program.
      The value is ignored.  */
 
@@ -551,12 +567,8 @@ struct symbol
 
   union
     {
-      /* for OP_BASEREG in DWARF location specs */
-      struct
-       {
-         short regno_valid;    /* 0 == regno invalid; !0 == regno valid */
-         short regno;          /* base register number {0, 1, 2, ...} */
-       } basereg;
+      /* Used by LOC_BASEREG and LOC_BASEREG_ARG.  */
+      short basereg;
     }
   aux_value;
 
@@ -566,25 +578,7 @@ struct symbol
 #define SYMBOL_CLASS(symbol)           (symbol)->class
 #define SYMBOL_TYPE(symbol)            (symbol)->type
 #define SYMBOL_LINE(symbol)            (symbol)->line
-#define SYMBOL_BASEREG(symbol)         (symbol)->aux_value.basereg.regno
-
-/* If we want to do baseregs using this approach we should have a
-   LOC_BASEREG (and LOC_BASEREG_ARG) rather than changing the meaning
-   of LOC_LOCAL, LOC_ARG, etc. based on SYMBOL_BASEREG_VALID.  But
-   this approach provides just a small fraction of the expressiveness
-   of a DWARF location, so it does less than we might want.  On the
-   other hand, it may do more than we need; FRAME_LOCALS_ADDRESS,
-   LOC_REGPARM_ADDR, and similar things seem to handle most of the
-   cases which actually come up.  */
-
-#if 0
-/* This currently fails because some symbols are not being initialized
-   to zero on allocation, and no code is currently setting this value.  */
-#define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid
-#else
-#define SYMBOL_BASEREG_VALID(symbol) 0
-#endif
-
+#define SYMBOL_BASEREG(symbol)         (symbol)->aux_value.basereg
 \f
 /* A partial_symbol records the name, namespace, and address class of
    symbols whose types we have not parsed yet.  For functions, it also
This page took 0.041729 seconds and 4 git commands to generate.