Fix bug with 0 based indexing into the operator table being
authorRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Thu, 12 May 1983 23:52:07 +0000 (15:52 -0800)
committerRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Thu, 12 May 1983 23:52:07 +0000 (15:52 -0800)
mistaken as non existant operator byte.

SCCS-vsn: old/adb/adb.vax/opset.c 4.4

usr/src/old/adb/adb.vax/opset.c

index f14d3fe..445ce66 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)opset.c 4.3 %G%";
+static char sccsid[] = "@(#)opset.c 4.4 %G%";
 #endif lint
 /*
  *     UNIX debugger
 #endif lint
 /*
  *     UNIX debugger
@@ -80,7 +80,7 @@ extern        int     ty_nbyte[];
 extern int     ty_nlg[];
 extern char    *ty_string[];
 
 extern int     ty_nlg[];
 extern char    *ty_string[];
 
-short ioptab[3][256];  /* two level index by opcode into insttab */
+short ioptab[3][256];  /* two level 1-based index by opcode into insttab */
 
 int mapescbyte(byte)
        u_char  byte;
 
 int mapescbyte(byte)
        u_char  byte;
@@ -101,7 +101,7 @@ mkioptab()
                mapchar = mapescbyte(p->eopcode);
                if (ioptab[mapchar][p->popcode])
                        continue;
                mapchar = mapescbyte(p->eopcode);
                if (ioptab[mapchar][p->popcode])
                        continue;
-               ioptab[mapchar][p->popcode] = p - insttab;
+               ioptab[mapchar][p->popcode] = (p - insttab) + 1;
        }
 }
 
        }
 }
 
@@ -179,7 +179,7 @@ printins(fmt, Idsp, ins)
                printf("<undefined operator byte>: %x", ins);
                goto ret;
        }
                printf("<undefined operator byte>: %x", ins);
                goto ret;
        }
-       ip = &insttab[ioptab[mapchar][ins]];
+       ip = &insttab[ioptab[mapchar][ins] - 1];
        printf("%s\t", ip->iname);
 
        for (ap = ip->argtype, argno = 0; argno < ip->nargs; argno++, ap++) {
        printf("%s\t", ip->iname);
 
        for (ap = ip->argtype, argno = 0; argno < ip->nargs; argno++, ap++) {