Subject: Decoding illegal syscall crashes adb (#188) Index: bin/adb/opset.c 2.11BSD Description: Asking 'adb' to disassemble a 'trap' instruction which is outside the range used for system calls causes 'adb' to core dump. Also, when the 'fchdir(2)' syscall was added to the kernel (update #187) the systab[] table in adb did not have a corresponding change made. Repeat-By: adb adb> 0104666=i core dumped Use adb(1) to examine a program using the fchdir(2) call. Note the "illegal syscall" message. Fix: A range check was added - if the syscall number is out of bounds then the instruction is decoded using the numeric form instead of a symbolic syscall name. The change is almost trivial. An entry is added into the syscall table. Save the patch below to a file (/tmp/c), then: cd /usr/src/bin/adb patch < /tmp/c make make install make clean ========cut here *** /usr/src/bin/adb/opset.c.old Wed Jan 12 20:08:48 1994 --- /usr/src/bin/adb/opset.c Wed May 4 20:56:20 1994 *************** *** 141,147 **** "unlink", "execv", "chdir", ! NULL, /* 13 - old time */ "mknod", "chmod", "chown", --- 141,147 ---- "unlink", "execv", "chdir", ! "fchdir", "mknod", "chmod", "chown", *************** *** 290,295 **** --- 290,297 ---- "gldav", }; + #define NUMSYSCALLS (sizeof (systab) / sizeof (char *)) + char *regname[] = { "r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc"}; u_int type, space, incp; *************** *** 346,352 **** break; case SYS: ! if (systab[ins]) printf("%8t%s", systab[ins]); else printf("%8t%d", ins); --- 348,354 ---- break; case SYS: ! if (ins < NUMSYSCALLS && systab[ins]) printf("%8t%s", systab[ins]); else printf("%8t%d", ins);