Changes to fix bug with static variables within function scopes.
authorFred Fish <fnf@specifix.com>
Wed, 15 Jan 1992 06:42:32 +0000 (06:42 +0000)
committerFred Fish <fnf@specifix.com>
Wed, 15 Jan 1992 06:42:32 +0000 (06:42 +0000)
gdb/ChangeLog
gdb/dwarfread.c

index af85e1933cf3254b0a442f276d210ebfe56f3acb..ff9b7bc745d77101aa7bd04d077fd6bc7ef445a7 100644 (file)
@@ -1,3 +1,12 @@
+Tue Jan 14 22:34:00 1992  Fred Fish  (fnf at cygnus.com)
+
+       * dwarfread.c (locval):  Add offreg flag to indicate location
+       values that are computed off a base register.
+
+       * dwarfread.c (new_symbol):  Rework TAG_global_variable and
+       TAG_local_variable cases to account for static variables
+       within function scopes.
+
 Tue Jan 14 12:28:52 1992  Stu Grossman  (grossman at cygnus.com)
 
        * inflow.c:  remove #include <sys/dir.h>.  Not necessary, and
index 366149a7db38d1da087143e54841e309277a3877..b170ff74cd1a89aa00506bd20b67b430bcd4fbc1 100644 (file)
@@ -186,6 +186,7 @@ static char *dbbase;        /* Base pointer to dwarf info */
 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 */
 
 static CORE_ADDR baseaddr;     /* Add to each symbol value */
 
@@ -1737,6 +1738,7 @@ DEFUN(locval, (loc), char *loc)
   stacki = 0;
   stack[stacki] = 0;
   isreg = 0;
+  offreg = 0;
   for (loc += sizeof (short); loc < end; loc += sizeof (long))
     {
       switch (*loc++) {
@@ -1752,6 +1754,7 @@ DEFUN(locval, (loc), char *loc)
       case OP_BASEREG:
        /* push value of register (number) */
        /* Actually, we compute the value as if register has 0 */
+       offreg = 1;
        (void) memcpy (&regno, loc, sizeof (long));
        if (regno == R_FP)
          {
@@ -2443,30 +2446,26 @@ DEFUN(new_symbol, (dip), struct dieinfo *dip)
            }
          break;
        case TAG_global_variable:
-       case TAG_local_variable:
          if (dip -> at_location != NULL)
            {
              SYMBOL_VALUE (sym) = locval (dip -> at_location);
-           }
-         if (dip -> dietag == TAG_global_variable)
-           {
              add_symbol_to_list (sym, &global_symbols);
              SYMBOL_CLASS (sym) = LOC_STATIC;
              SYMBOL_VALUE (sym) += baseaddr;
            }
-         else
+         break;
+       case TAG_local_variable:
+         if (dip -> at_location != NULL)
            {
+             SYMBOL_VALUE (sym) = locval (dip -> at_location);
              add_symbol_to_list (sym, list_in_scope);
-             if (context_stack_depth > 0)
+             if (isreg)
+               {
+                 SYMBOL_CLASS (sym) = LOC_REGISTER;
+               }
+             else if (offreg)
                {
-                 if (isreg)
-                   {
-                     SYMBOL_CLASS (sym) = LOC_REGISTER;
-                   }
-                 else
-                   {
-                     SYMBOL_CLASS (sym) = LOC_LOCAL;
-                   }
+                 SYMBOL_CLASS (sym) = LOC_LOCAL;
                }
              else
                {
This page took 0.030492 seconds and 4 git commands to generate.