Init
This commit is contained in:
12
sys/kadb/Makefile
Normal file
12
sys/kadb/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# @(#)Makefile 1.1 94/10/31 SMI
|
||||
#
|
||||
|
||||
ARCH:sh = arch -k
|
||||
|
||||
#
|
||||
# All the real work gets done in ./$(ARCH), and that's where the targets
|
||||
# wind up. This makefile just gets us there.
|
||||
#
|
||||
kadb all lint install install_h clean tags depend:
|
||||
cd $(ARCH); $(MAKE) $(MFLAGS) $@
|
||||
122
sys/kadb/common/Makefile.com
Normal file
122
sys/kadb/common/Makefile.com
Normal file
@@ -0,0 +1,122 @@
|
||||
#
|
||||
# @(#)Makefile.com 1.1 94/10/31 SMI
|
||||
#
|
||||
# Common makefile for all versions of kadb
|
||||
#
|
||||
# The work gets done in the sys/kadb/$(ARCH) directory. We assume the
|
||||
# Makefile in that directory has already defined $(ARCH) and $(MACH).
|
||||
#
|
||||
|
||||
INSTALLDIR= ${DESTDIR}/usr/stand
|
||||
SYSDIR= ../..
|
||||
COMDIR= ../common
|
||||
ARCHHDR= ${SYSDIR}/${ARCH}
|
||||
ADIR= ${SYSDIR}/${ARCH}/debug
|
||||
AOBJ= ${ADIR}/debug.o
|
||||
ATAGS= (cd ${ADIR}; ${MAKE} -e tags.list | sed -e 's,../../,${SYSDIR}/,g')
|
||||
ASTAGS= (cd ${ADIR}; ${MAKE} -e stags.list | sed -e 's,../../,${SYSDIR}/,g')
|
||||
RELOC= (cd ${ADIR}; ${MAKE} -e reloc)
|
||||
DDIR= ${SYSDIR}/../lang/adb
|
||||
DHDR= ${DDIR}/common
|
||||
MACDIR= ${SYSDIR}/adb
|
||||
MACLIST=`cd ${MACDIR}; ${MAKE} -e maclist`
|
||||
BOOT= ${SYSDIR}/boot
|
||||
LIBBOOT=${BOOT}/${ARCH}/libkadb.a
|
||||
|
||||
LIBPROM= ${SYSDIR}/${ARCH}/libprom.a
|
||||
LIBPROMSRCDIR= ${BOOT}/lib/${ARCH}
|
||||
|
||||
LIBSA= ${BOOT}/lib/${ARCH}/libsadb.a
|
||||
CPPINCS= -I. -I${COMDIR} -I${SYSDIR} -I${ARCHHDR} -I${DHDR} -I${DDIR}/${MACH}
|
||||
CPPOPTS= -DKADB -D${ARCH} ${CPPINCS}
|
||||
COPTS= -O
|
||||
CFLAGS= ${COPTS} ${CPPOPTS}
|
||||
|
||||
GREP= egrep
|
||||
|
||||
LIBS= ${LIBBOOT} ${LIBSA} ${ARCHLIBS} -lc
|
||||
|
||||
HFILES= ${COMDIR}/pf.h
|
||||
|
||||
CFILES= ${COMDIR}/kadb.c ${COMDIR}/genpf.c
|
||||
|
||||
OBJ= kadb.o
|
||||
|
||||
all: kadb
|
||||
|
||||
kadb: ukadb.o pf.o
|
||||
${RELOC} > reloc
|
||||
${LD} -N -T `cat reloc` -e _start -Bstatic -o $@ ukadb.o pf.o -lc
|
||||
${RM} reloc
|
||||
|
||||
# ukadb.o is the a.out for all of kadb except the macro file pf.o,
|
||||
# this makes it is easier to drop in different set of macros.
|
||||
ukadb.o: ${AOBJ} ${OBJ} adb.o ${LIBBOOT} ${LIBSA} ${ARCHLIBS}
|
||||
${LD} -r -o $@ ${AOBJ} ${OBJ} adb.o ${LIBS}
|
||||
|
||||
adb.o: FRC
|
||||
@ ${RM} $@
|
||||
ln -s ${DDIR}/${MACH}/kadb/kadb.o $@
|
||||
cd ${DDIR}/${MACH}/kadb; ${MAKE} -e ${MFLAGS} kadb.o
|
||||
|
||||
${LIBBOOT} ${LIBSA} ${AOBJ}: FRC
|
||||
cd $(@D); ${MAKE} -e ${MFLAGS} $(@F)
|
||||
|
||||
${LIBPROM}: FRC
|
||||
cd $(LIBPROMSRCDIR); ${MAKE} -e ${MFLAGS}
|
||||
|
||||
# don't strip to make patching `ndbootdev' and `vmunix' variables easier
|
||||
install: kadb
|
||||
install kadb ${INSTALLDIR}
|
||||
|
||||
tags: FRC
|
||||
${ATAGS} > tags.list
|
||||
echo ${DDIR}/${MACH}/*.[ch] > adbtags.list
|
||||
ctags ${HFILES} ${CFILES} `cat tags.list` \
|
||||
${BOOT}/${ARCH}/*.[ch] ${BOOT}/os/*.[ch] \
|
||||
${BOOT}/lib/${ARCH}/*.[ch] ${BOOT}/lib/common/*.[ch] \
|
||||
`cat adbtags.list` ${DDIR}/common/*.[ch]
|
||||
${ASTAGS} > stags.list
|
||||
$(GREP) 'ENTRY2*\(' `cat stags.list` \
|
||||
${BOOT}/${ARCH}/*.s ${BOOT}/lib/${ARCH}/*.s \
|
||||
${BOOT}/${MACH}/*.s ${BOOT}/lib/${MACH}/*.s | sed \
|
||||
-e 's|^\(.*\):\(.*ENTRY(\)\(.*\)\().*\)|\3 \1 /^\2\3\4$$/|' \
|
||||
-e 's|^\(.*\):\(.*ENTRY2(\)\(.*\),\(.*\)\().*\)|\3 \1 /^\2\3,\4\5$$/\
|
||||
\4 \1 /^\2\3,\4\5$$/|' >> tags; \
|
||||
sort -u -o tags tags
|
||||
${RM} tags.list adbtags.list stags.list
|
||||
|
||||
clean:
|
||||
${RM} a.out *.o genpf pf.c errs tags.list tags reloc
|
||||
@ cd ${ADIR}; ${MAKE} -e ${MFLAGS} clean
|
||||
|
||||
FRC:
|
||||
|
||||
genpf: ${COMDIR}/genpf.c
|
||||
cc -o $@ ${COMDIR}/genpf.c
|
||||
|
||||
pf.c: genpf
|
||||
cd ${MACDIR}; ${MAKE} -e ${MFLAGS}
|
||||
genpf ${MACLIST}
|
||||
|
||||
pf.o: pf.c
|
||||
${CC} -c ${CFLAGS} -DKERNEL $<
|
||||
|
||||
kadb.o: ${COMDIR}/kadb.c
|
||||
${CC} -c ${CFLAGS} ${COMDIR}/kadb.c
|
||||
|
||||
depend: ${CFILES} ${HFILES}
|
||||
${RM} makedep
|
||||
for i in ${CFILES}; do \
|
||||
(${CC} -M ${CPPOPTS} $$i >> makedep); done
|
||||
@echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
|
||||
@echo '$$r makedep' >>eddep
|
||||
@echo 'w Makefile' >>eddep
|
||||
@${RM} Makefile.bak
|
||||
@mv Makefile Makefile.bak
|
||||
@ed - Makefile.bak < eddep
|
||||
@if [ ! -w Makefile.bak ]; then \
|
||||
chmod -w Makefile; \
|
||||
fi
|
||||
@${RM} eddep makedep
|
||||
|
||||
146
sys/kadb/common/genpf.c
Normal file
146
sys/kadb/common/genpf.c
Normal file
@@ -0,0 +1,146 @@
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)genpf.c 1.1 94/10/31 Copyr 1985 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "pf.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define MAXENTRY 512
|
||||
char *entry[MAXENTRY];
|
||||
|
||||
char *myname;
|
||||
char *dir = ".";
|
||||
char *strsav(), *rindex(), *strcpy();
|
||||
FILE *pfout;
|
||||
int lastent = 0;
|
||||
|
||||
#define PF "pf.c"
|
||||
|
||||
main(argc, argv)
|
||||
char *argv[];
|
||||
{
|
||||
|
||||
myname = argv[0];
|
||||
argv++; argc--;
|
||||
if (argc > 1 && strcmp(*argv, "-d") == 0) {
|
||||
argv++; argc--;
|
||||
if (argc > 2) {
|
||||
dir = strsav(*argv);
|
||||
argv++; argc--;
|
||||
} else {
|
||||
usage();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
if (argc <= 0) {
|
||||
usage();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
if ((pfout = fopen(PF, "w")) == NULL) {
|
||||
perror(PF);
|
||||
exit(4);
|
||||
}
|
||||
if (chdir(dir) == -1) {
|
||||
perror(dir);
|
||||
exit(4);
|
||||
}
|
||||
pf_prologue();
|
||||
while (argc > 0) {
|
||||
process_file(*argv);
|
||||
argv++; argc--;
|
||||
}
|
||||
pf_epilogue();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
char *
|
||||
strsav(s)
|
||||
char *s;
|
||||
{
|
||||
extern char *malloc();
|
||||
char *m;
|
||||
|
||||
if ((m = malloc(strlen(s) + 1)) == NULL) {
|
||||
error("no memory");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
(void) strcpy(m, s);
|
||||
return (m);
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s [-d dir] file ...\n", myname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
error(s, a1, a2, a3, a4)
|
||||
char *s;
|
||||
{
|
||||
|
||||
fprintf(stderr, s, a1, a2, a3, a4);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
pf_prologue()
|
||||
{
|
||||
|
||||
fprintf(pfout, "#include \"pf.h\"\n");
|
||||
}
|
||||
|
||||
process_file(name)
|
||||
char *name;
|
||||
{
|
||||
#define MAXLINE 256
|
||||
register FILE *f;
|
||||
register char *pname, *s;
|
||||
char buf[MAXLINE];
|
||||
|
||||
if ((f = fopen(name, "r")) == NULL) {
|
||||
perror(name);
|
||||
return;
|
||||
}
|
||||
pname = rindex(name, '/');
|
||||
if (pname == NULL)
|
||||
pname = name;
|
||||
else
|
||||
pname++;
|
||||
/*
|
||||
* Convert all '.' in file name to '_'
|
||||
*/
|
||||
while ((s = rindex(pname, '.')) != NULL)
|
||||
*s = '_';
|
||||
fprintf(pfout, "\nchar %s_NAME[] = \"%s\";\nchar %s_STRING[] = \n\"",
|
||||
pname, pname, pname);
|
||||
while (fgets(buf, MAXLINE, f) != NULL) {
|
||||
for (s = buf; *s; s++) {
|
||||
if (*s == '"')
|
||||
putc('\\', pfout);
|
||||
else if (*s == '\n')
|
||||
fprintf(pfout, "\\n\\");
|
||||
putc(*s, pfout);
|
||||
}
|
||||
}
|
||||
fprintf(pfout, "\";\n");
|
||||
entry[lastent++] = strsav(pname);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
pf_epilogue()
|
||||
{
|
||||
register int i;
|
||||
|
||||
fprintf(pfout, "\nstruct pseudo_file pf[] = {\n");
|
||||
for (i = 0; i < lastent; i++)
|
||||
fprintf(pfout, "\t{ %s_NAME, %s_STRING },\n",
|
||||
entry[i], entry[i]);
|
||||
fprintf(pfout, "};\n\nint npf = %d;\n", lastent);
|
||||
fclose(pfout);
|
||||
}
|
||||
438
sys/kadb/common/kadb.c
Normal file
438
sys/kadb/common/kadb.c
Normal file
@@ -0,0 +1,438 @@
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)kadb.c 1.1 94/10/31";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 1986 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* kadb - support glue for kadb
|
||||
*/
|
||||
|
||||
/*
|
||||
* These include files come from the adb source directory.
|
||||
*/
|
||||
#include "adb.h"
|
||||
#include "symtab.h"
|
||||
|
||||
#include "pf.h"
|
||||
#include <debug/debugger.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#define reset() _longjmp(abort_jmp, 1)
|
||||
|
||||
int infile;
|
||||
int eof;
|
||||
char **environ; /* hack- needed for libc setlocale call
|
||||
|
||||
int wtflag = 2; /* pretend we opened for r/w */
|
||||
int debugging = 0; /* patchable value */
|
||||
int dottysync = 1; /* call monitor's initgetkey() routine */
|
||||
int foundu = 0; /* found uarea */
|
||||
struct user *uunix; /* address of uarea */
|
||||
int print_cpu_done = 0; /* Only need for MP, but kadb makes it tough */
|
||||
|
||||
char myname_default[] = "kadb"; /* default name for debugger */
|
||||
|
||||
#define MAC_FD 0x80
|
||||
|
||||
debuginit(fd, exec, name)
|
||||
int fd;
|
||||
struct exec *exec;
|
||||
char *name;
|
||||
{
|
||||
char *s, *index();
|
||||
|
||||
s = index(name, '/'); /* used to be a ')', in 4c code, WHY? */
|
||||
if (s)
|
||||
s++;
|
||||
else
|
||||
s = name;
|
||||
|
||||
symfil = malloc(strlen(s) + 1);
|
||||
if (symfil)
|
||||
strcpy(symfil, s);
|
||||
else {
|
||||
printf("malloc failed\n");
|
||||
symfil = "-";
|
||||
}
|
||||
corfil = "-";
|
||||
fsym = fd; /* set fd for source file */
|
||||
fcor = -1;
|
||||
|
||||
filhdr = *exec; /* structure assignment */
|
||||
|
||||
setsym();
|
||||
setvar();
|
||||
pid = 0xface; /* fake pid as the process is `alive' */
|
||||
|
||||
(void) lookup("_uunix");
|
||||
if (cursym != 0) {
|
||||
foundu = 1;
|
||||
uunix = (struct user *) cursym->s_value;
|
||||
}
|
||||
}
|
||||
|
||||
static jmp_buf jb;
|
||||
|
||||
debugcmd()
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
/*
|
||||
* The next block of code is for first time through only so
|
||||
* that when we are first entered everything looks good.
|
||||
*/
|
||||
bpwait(PTRACE_CONT);
|
||||
if (reg->r_pc != 0) {
|
||||
_printf("stopped at%16t"); /* use adb printf */
|
||||
printpc();
|
||||
}
|
||||
|
||||
abort_jmp = jb;
|
||||
(void) _setjmp(jb);
|
||||
if (executing)
|
||||
delbp();
|
||||
executing = 0;
|
||||
for (;;) {
|
||||
killbuf();
|
||||
if (errflg) {
|
||||
printf("%s\n", errflg);
|
||||
errflg = 0;
|
||||
}
|
||||
if (interrupted) {
|
||||
interrupted = 0;
|
||||
lastcom = 0;
|
||||
printf("\n");
|
||||
doreset();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
if ((infile & MAC_FD) == 0)
|
||||
printf("%s> ", myname);
|
||||
lp = 0; (void) rdc(); lp--;
|
||||
if (eof) {
|
||||
if (infile) {
|
||||
iclose(-1, 0);
|
||||
eof = 0;
|
||||
reset();
|
||||
/*NOTREACHED*/
|
||||
} else
|
||||
printf("eof?");
|
||||
}
|
||||
(void) command((char *)0, lastcom);
|
||||
if (lp && lastc!='\n')
|
||||
error("newline expected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chkerr()
|
||||
{
|
||||
|
||||
if (errflg || interrupted)
|
||||
error(errflg);
|
||||
}
|
||||
|
||||
doreset()
|
||||
{
|
||||
|
||||
iclose(0, 1);
|
||||
oclose();
|
||||
reset();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
error(n)
|
||||
char *n;
|
||||
{
|
||||
|
||||
errflg = n;
|
||||
doreset();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
|
||||
#define NMACFILES 10 /* number of max open macro files */
|
||||
|
||||
struct open_file {
|
||||
struct pseudo_file *of_f;
|
||||
char *of_pos;
|
||||
} filetab[NMACFILES];
|
||||
|
||||
static
|
||||
getfileslot()
|
||||
{
|
||||
register struct open_file *fp;
|
||||
|
||||
for (fp = filetab; fp < &filetab[NMACFILES]; fp++) {
|
||||
if (fp->of_f == NULL)
|
||||
return (fp - filetab);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
_open(path, flags, mode)
|
||||
char *path;
|
||||
int flags, mode;
|
||||
{
|
||||
register struct pseudo_file *pfp;
|
||||
register int fd;
|
||||
register char *name, *s;
|
||||
extern char *rindex();
|
||||
|
||||
tryabort(1);
|
||||
if (flags != O_RDONLY) {
|
||||
errno = EROFS;
|
||||
return (-1);
|
||||
}
|
||||
/* find open file slot */
|
||||
if ((fd = getfileslot()) == -1) {
|
||||
errno = EMFILE;
|
||||
return (-1);
|
||||
}
|
||||
/*
|
||||
* Scan ahead in the path past any directories
|
||||
* and convert all '.' in file name to '_'.
|
||||
*/
|
||||
name = rindex(path, '/');
|
||||
if (name == NULL)
|
||||
name = path;
|
||||
else
|
||||
name++;
|
||||
while ((s = rindex(path, '.')) != NULL)
|
||||
*s = '_';
|
||||
/* try to find "file" in pseudo file list */
|
||||
for (pfp = pf; pfp < &pf[npf]; pfp++) {
|
||||
if (strcmp(name, pfp->pf_name) == 0)
|
||||
break;
|
||||
}
|
||||
if (pfp >= &pf[npf]) {
|
||||
errno = ENOENT;
|
||||
return (-1);
|
||||
}
|
||||
filetab[fd].of_f = pfp;
|
||||
filetab[fd].of_pos = pfp->pf_string;
|
||||
return (fd | MAC_FD);
|
||||
}
|
||||
|
||||
_lseek(d, offset, whence)
|
||||
int d, offset, whence;
|
||||
{
|
||||
register char *se;
|
||||
register int r;
|
||||
register struct pseudo_file *pfp;
|
||||
char *pos;
|
||||
|
||||
tryabort(1);
|
||||
if (d & MAC_FD) {
|
||||
d &= ~MAC_FD;
|
||||
if ((pfp = filetab[d].of_f) == NULL) {
|
||||
r = -1;
|
||||
errno = EBADF;
|
||||
goto out;
|
||||
}
|
||||
se = pfp->pf_string + strlen(pfp->pf_string);
|
||||
switch (whence) {
|
||||
case L_SET:
|
||||
pos = pfp->pf_string + offset;
|
||||
break;
|
||||
case L_INCR:
|
||||
pos = filetab[d].of_pos + offset;
|
||||
break;
|
||||
case L_XTND:
|
||||
pos = se + offset;
|
||||
break;
|
||||
default:
|
||||
r = -1;
|
||||
errno = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (pos < pfp->pf_string || pos > se) {
|
||||
r = -1;
|
||||
errno = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
filetab[d].of_pos = pos;
|
||||
r = filetab[d].of_pos - pfp->pf_string;
|
||||
} else {
|
||||
r = lseek(d, offset, whence);
|
||||
if (r == -1)
|
||||
errno = EINVAL;
|
||||
}
|
||||
out:
|
||||
return (r);
|
||||
}
|
||||
|
||||
_read(d, buf, nbytes)
|
||||
int d, nbytes;
|
||||
char *buf;
|
||||
{
|
||||
static char line[LINEBUFSZ];
|
||||
static char *p;
|
||||
register struct pseudo_file *pfp;
|
||||
register struct open_file *ofp;
|
||||
register char *s, *t;
|
||||
register int r;
|
||||
|
||||
if (d & MAC_FD) {
|
||||
d &= ~MAC_FD;
|
||||
ofp = &filetab[d];
|
||||
if ((pfp = ofp->of_f) == NULL || ofp->of_pos == NULL) {
|
||||
r = -1;
|
||||
errno = EBADF;
|
||||
goto out;
|
||||
}
|
||||
for (r = 0, t = buf, s = ofp->of_pos; *s && r < nbytes; r++) {
|
||||
if (*s == '\n')
|
||||
tryabort(1);
|
||||
*t++ = *s++;
|
||||
}
|
||||
ofp->of_pos = s;
|
||||
} else if (d != 0) {
|
||||
tryabort(1);
|
||||
r = read(d, buf, nbytes);
|
||||
if (r == -1)
|
||||
errno = EFAULT;
|
||||
} else {
|
||||
/*
|
||||
* Reading from stdin (keyboard).
|
||||
* Call gets() to read buffer (thus providing
|
||||
* erase, kill, and interrupt functions), then
|
||||
* return the characters as needed from buffer.
|
||||
*/
|
||||
for (r = 0; r < nbytes; ) {
|
||||
if (p == NULL)
|
||||
gets(p = line);
|
||||
else
|
||||
tryabort(1);
|
||||
if (*p == '\0') {
|
||||
buf[r++] = '\n';
|
||||
p = NULL;
|
||||
break;
|
||||
} else
|
||||
buf[r++] = *p++;
|
||||
}
|
||||
}
|
||||
out:
|
||||
return (r);
|
||||
}
|
||||
|
||||
int max_write = 20;
|
||||
|
||||
_write(d, buf, nbytes)
|
||||
int d, nbytes;
|
||||
char *buf;
|
||||
{
|
||||
register int r, e, sz;
|
||||
|
||||
if (d & MAC_FD) {
|
||||
r = -1;
|
||||
errno = EBADF;
|
||||
} else {
|
||||
for (r = 0; r < nbytes; r += e) {
|
||||
sz = nbytes - r;
|
||||
if (sz > max_write)
|
||||
sz = max_write;
|
||||
trypause();
|
||||
(void) putchar(*(buf+r));
|
||||
e = 1;
|
||||
if (e == -1) {
|
||||
r = -1;
|
||||
errno = EFAULT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
_close(d)
|
||||
int d;
|
||||
{
|
||||
int r;
|
||||
|
||||
tryabort(1);
|
||||
if (d & MAC_FD) {
|
||||
d &= ~MAC_FD;
|
||||
if (filetab[d].of_f == NULL) {
|
||||
r = -1;
|
||||
} else {
|
||||
filetab[d].of_f = NULL;
|
||||
filetab[d].of_pos = NULL;
|
||||
}
|
||||
return (0);
|
||||
} else {
|
||||
r = close(d);
|
||||
}
|
||||
if (r == -1)
|
||||
errno = EBADF;
|
||||
return (r);
|
||||
}
|
||||
|
||||
creat(path, mode)
|
||||
char *path;
|
||||
{
|
||||
|
||||
return (_open(path, O_RDWR | O_CREAT | O_TRUNC, mode));
|
||||
}
|
||||
|
||||
#define NCOL 5
|
||||
#define SIZECOL 16
|
||||
|
||||
printmacros()
|
||||
{
|
||||
register struct pseudo_file *pfp;
|
||||
register int j, i = 0;
|
||||
|
||||
for (pfp = pf; pfp < &pf[npf]; pfp++) {
|
||||
/*
|
||||
* Don't print out macro names with '_' in
|
||||
* them as they are normally secondary macros
|
||||
* called by the "primary" macros.
|
||||
*/
|
||||
if (index(pfp->pf_name, '_') == NULL) {
|
||||
printf("%s", pfp->pf_name);
|
||||
if ((++i % NCOL) == 0)
|
||||
printf("\n");
|
||||
else for (j = strlen(pfp->pf_name); j < SIZECOL; j++) {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine is an attempt to resync the tty (to avoid getting
|
||||
* into repeat mode when it shouldn't be). Because of a bug
|
||||
* in the sun2 PROM when dealing w/ certain devices, we skip
|
||||
* calling initgetkey() if dottysync is not set.
|
||||
* Because v_initgetkey doesn't even exist in the Open Boot Proms,
|
||||
* we skip it then, too.
|
||||
*/
|
||||
ttysync()
|
||||
{
|
||||
#ifndef OPENPROMS
|
||||
if (dottysync)
|
||||
(*romp->v_initgetkey)();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Stubs from ttycontrol.c
|
||||
*/
|
||||
newsubtty()
|
||||
{
|
||||
}
|
||||
|
||||
subtty()
|
||||
{
|
||||
}
|
||||
|
||||
adbtty()
|
||||
{
|
||||
}
|
||||
15
sys/kadb/common/pf.h
Normal file
15
sys/kadb/common/pf.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/* @(#)pf.h 1.1 94/10/31 SMI */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
struct pseudo_file {
|
||||
char *pf_name; /* name of the psuedo file */
|
||||
char *pf_string; /* start of body of psuedo file */
|
||||
};
|
||||
|
||||
#ifdef KADB
|
||||
extern struct pseudo_file pf[];
|
||||
extern int npf;
|
||||
#endif
|
||||
146
sys/kadb/genpf.c
Normal file
146
sys/kadb/genpf.c
Normal file
@@ -0,0 +1,146 @@
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)genpf.c 1.1 94/10/31 Copyr 1985 Sun Micro";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "pf.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define MAXENTRY 512
|
||||
char *entry[MAXENTRY];
|
||||
|
||||
char *myname;
|
||||
char *dir = ".";
|
||||
char *strsav(), *rindex(), *strcpy();
|
||||
FILE *pfout;
|
||||
int lastent = 0;
|
||||
|
||||
#define PF "pf.c"
|
||||
|
||||
main(argc, argv)
|
||||
char *argv[];
|
||||
{
|
||||
|
||||
myname = argv[0];
|
||||
argv++; argc--;
|
||||
if (argc > 1 && strcmp(*argv, "-d") == 0) {
|
||||
argv++; argc--;
|
||||
if (argc > 2) {
|
||||
dir = strsav(*argv);
|
||||
argv++; argc--;
|
||||
} else {
|
||||
usage();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
if (argc <= 0) {
|
||||
usage();
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
if ((pfout = fopen(PF, "w")) == NULL) {
|
||||
perror(PF);
|
||||
exit(4);
|
||||
}
|
||||
if (chdir(dir) == -1) {
|
||||
perror(dir);
|
||||
exit(4);
|
||||
}
|
||||
pf_prologue();
|
||||
while (argc > 0) {
|
||||
process_file(*argv);
|
||||
argv++; argc--;
|
||||
}
|
||||
pf_epilogue();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
char *
|
||||
strsav(s)
|
||||
char *s;
|
||||
{
|
||||
extern char *malloc();
|
||||
char *m;
|
||||
|
||||
if ((m = malloc(strlen(s) + 1)) == NULL) {
|
||||
error("no memory");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
(void) strcpy(m, s);
|
||||
return (m);
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s [-d dir] file ...\n", myname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
error(s, a1, a2, a3, a4)
|
||||
char *s;
|
||||
{
|
||||
|
||||
fprintf(stderr, s, a1, a2, a3, a4);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
pf_prologue()
|
||||
{
|
||||
|
||||
fprintf(pfout, "#include \"pf.h\"\n");
|
||||
}
|
||||
|
||||
process_file(name)
|
||||
char *name;
|
||||
{
|
||||
#define MAXLINE 256
|
||||
register FILE *f;
|
||||
register char *pname, *s;
|
||||
char buf[MAXLINE];
|
||||
|
||||
if ((f = fopen(name, "r")) == NULL) {
|
||||
perror(name);
|
||||
return;
|
||||
}
|
||||
pname = rindex(name, '/');
|
||||
if (pname == NULL)
|
||||
pname = name;
|
||||
else
|
||||
pname++;
|
||||
/*
|
||||
* Convert all '.' in file name to '_'
|
||||
*/
|
||||
while ((s = rindex(pname, '.')) != NULL)
|
||||
*s = '_';
|
||||
fprintf(pfout, "\nchar %s_NAME[] = \"%s\";\nchar %s_STRING[] = \n\"",
|
||||
pname, pname, pname);
|
||||
while (fgets(buf, MAXLINE, f) != NULL) {
|
||||
for (s = buf; *s; s++) {
|
||||
if (*s == '"')
|
||||
putc('\\', pfout);
|
||||
else if (*s == '\n')
|
||||
fprintf(pfout, "\\n\\");
|
||||
putc(*s, pfout);
|
||||
}
|
||||
}
|
||||
fprintf(pfout, "\";\n");
|
||||
entry[lastent++] = strsav(pname);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
pf_epilogue()
|
||||
{
|
||||
register int i;
|
||||
|
||||
fprintf(pfout, "\nstruct pseudo_file pf[] = {\n");
|
||||
for (i = 0; i < lastent; i++)
|
||||
fprintf(pfout, "\t{ %s_NAME, %s_STRING },\n",
|
||||
entry[i], entry[i]);
|
||||
fprintf(pfout, "};\n\nint npf = %d;\n", lastent);
|
||||
fclose(pfout);
|
||||
}
|
||||
15
sys/kadb/pf.h
Normal file
15
sys/kadb/pf.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/* @(#)pf.h 1.1 94/10/31 SMI */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
struct pseudo_file {
|
||||
char *pf_name; /* name of the psuedo file */
|
||||
char *pf_string; /* start of body of psuedo file */
|
||||
};
|
||||
|
||||
#ifdef KADB
|
||||
extern struct pseudo_file pf[];
|
||||
extern int npf;
|
||||
#endif
|
||||
54
sys/kadb/sun4/Makefile
Normal file
54
sys/kadb/sun4/Makefile
Normal file
@@ -0,0 +1,54 @@
|
||||
# @(#)Makefile 1.1 94/10/31 SMI
|
||||
#
|
||||
# Arch-specific kadb makefile
|
||||
#
|
||||
ARCH = sun4
|
||||
MACH= sparc
|
||||
|
||||
include ../common/Makefile.com
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
|
||||
kadb.o: ../common/kadb.c
|
||||
kadb.o: ../../../lang/adb/common/adb.h
|
||||
kadb.o: ../../sun4/a.out.h
|
||||
kadb.o: ../../sys/exec.h
|
||||
kadb.o: /usr/include/stab.h
|
||||
kadb.o: ../../sys/param.h
|
||||
kadb.o: ../../sun4/machine/param.h
|
||||
kadb.o: ../../sys/signal.h
|
||||
kadb.o: ../../vm/faultcode.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/sysmacros.h
|
||||
kadb.o: ../../sys/dir.h
|
||||
kadb.o: ../../sun4/machine/psl.h
|
||||
kadb.o: ../../sun4/machine/pte.h
|
||||
kadb.o: /usr/include/vfork.h
|
||||
kadb.o: ../../sys/core.h
|
||||
kadb.o: ../../sys/exec.h
|
||||
kadb.o: ../../sun4/machine/reg.h
|
||||
kadb.o: /usr/include/ctype.h
|
||||
kadb.o: ../../../lang/adb/common/../sparc/sparc.h
|
||||
kadb.o: ../../sys/vmparam.h
|
||||
kadb.o: ../../sun4/machine/vmparam.h
|
||||
kadb.o: ../../sun4/machine/param.h
|
||||
kadb.o: ../../sun4/machine/mmu.h
|
||||
kadb.o: ../../debug/debug.h
|
||||
kadb.o: ../../mon/sunromvec.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../../lang/adb/common/process.h
|
||||
kadb.o: ../../../lang/adb/common/symtab.h
|
||||
kadb.o: ../common/pf.h
|
||||
kadb.o: ../../debug/debugger.h
|
||||
kadb.o: ../../sun4/setjmp.h
|
||||
kadb.o: ../../debug/debug.h
|
||||
kadb.o: ../../sys/errno.h
|
||||
kadb.o: ../../sys/file.h
|
||||
kadb.o: ../../sys/fcntlcom.h
|
||||
kadb.o: ../../sys/ptrace.h
|
||||
kadb.o: ../../sun4/machine/cpu.h
|
||||
kadb.o: ../../mon/sunromvec.h
|
||||
genpf.o: ../common/genpf.c
|
||||
genpf.o: ../common/pf.h
|
||||
genpf.o: /usr/include/stdio.h
|
||||
genpf.o: /usr/include/ctype.h
|
||||
60
sys/kadb/sun4c/Makefile
Normal file
60
sys/kadb/sun4c/Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
# @(#)Makefile 1.1 94/10/31 SMI
|
||||
#
|
||||
# Arch-specific kadb makefile
|
||||
#
|
||||
ARCH = sun4c
|
||||
MACH= sparc
|
||||
ARCHLIBS=${LIBPROM}
|
||||
|
||||
include ../common/Makefile.com
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
|
||||
kadb.o: ../common/kadb.c
|
||||
kadb.o: ../../../lang/adb/common/adb.h
|
||||
kadb.o: ../../sun4c/a.out.h
|
||||
kadb.o: ../../sys/exec.h
|
||||
kadb.o: /usr/include/stab.h
|
||||
kadb.o: ../../sys/param.h
|
||||
kadb.o: ../../sun4c/machine/param.h
|
||||
kadb.o: ../../sys/signal.h
|
||||
kadb.o: ../../vm/faultcode.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/sysmacros.h
|
||||
kadb.o: ../../sys/dir.h
|
||||
kadb.o: ../../sun4c/machine/psl.h
|
||||
kadb.o: ../../sun4c/machine/pte.h
|
||||
kadb.o: /usr/include/vfork.h
|
||||
kadb.o: ../../sys/core.h
|
||||
kadb.o: ../../sys/exec.h
|
||||
kadb.o: ../../sun4c/machine/reg.h
|
||||
kadb.o: /usr/include/ctype.h
|
||||
kadb.o: ../../../lang/adb/common/../sparc/sparc.h
|
||||
kadb.o: ../../sys/vmparam.h
|
||||
kadb.o: ../../sun4c/machine/vmparam.h
|
||||
kadb.o: ../../sun4c/machine/param.h
|
||||
kadb.o: ../../sun4c/machine/mmu.h
|
||||
kadb.o: ../../debug/debug.h
|
||||
kadb.o: ../../mon/sunromvec.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/param.h
|
||||
kadb.o: ../../mon/openprom.h
|
||||
kadb.o: ../../sun4c/machine/romvec.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../../lang/adb/common/process.h
|
||||
kadb.o: ../../../lang/adb/common/symtab.h
|
||||
kadb.o: ../common/pf.h
|
||||
kadb.o: ../../debug/debugger.h
|
||||
kadb.o: /usr/include/setjmp.h
|
||||
kadb.o: /usr/include/machine/setjmp.h
|
||||
kadb.o: ../../debug/debug.h
|
||||
kadb.o: ../../sys/errno.h
|
||||
kadb.o: ../../sys/file.h
|
||||
kadb.o: ../../sys/fcntlcom.h
|
||||
kadb.o: ../../sys/ptrace.h
|
||||
kadb.o: ../../sun4c/machine/cpu.h
|
||||
kadb.o: ../../mon/sunromvec.h
|
||||
genpf.o: ../common/genpf.c
|
||||
genpf.o: ../common/pf.h
|
||||
genpf.o: /usr/include/stdio.h
|
||||
genpf.o: /usr/include/ctype.h
|
||||
68
sys/kadb/sun4m/Makefile
Normal file
68
sys/kadb/sun4m/Makefile
Normal file
@@ -0,0 +1,68 @@
|
||||
# @(#)Makefile 1.1 10/31/94 SMI
|
||||
#
|
||||
# Arch-specific kadb makefile
|
||||
#
|
||||
ARCH = sun4m
|
||||
MACH= sparc
|
||||
ARCHLIBS=${LIBPROM}
|
||||
|
||||
include ../common/Makefile.com
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
|
||||
kadb.o: ../common/kadb.c
|
||||
kadb.o: ../../../lang/adb/common/adb.h
|
||||
kadb.o: ../../sun4m/a.out.h
|
||||
kadb.o: ../../sys/exec.h
|
||||
kadb.o: /usr/include/stab.h
|
||||
kadb.o: ../../sys/param.h
|
||||
kadb.o: ../../sun4m/machine/param.h
|
||||
kadb.o: ../../sys/signal.h
|
||||
kadb.o: ../../vm/faultcode.h
|
||||
kadb.o: ../../sys/stdtypes.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/stdtypes.h
|
||||
kadb.o: ../../sys/sysmacros.h
|
||||
kadb.o: ../../sys/dir.h
|
||||
kadb.o: ../../sun4m/machine/psl.h
|
||||
kadb.o: ../../sun4m/machine/pte.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: /usr/include/vfork.h
|
||||
kadb.o: ../../sys/core.h
|
||||
kadb.o: ../../sys/exec.h
|
||||
kadb.o: ../../sun4m/machine/reg.h
|
||||
kadb.o: /usr/include/ctype.h
|
||||
kadb.o: /usr/include/malloc.h
|
||||
kadb.o: ../../../lang/adb/common/../sparc/sparc.h
|
||||
kadb.o: ../../sys/vmparam.h
|
||||
kadb.o: ../../sun4m/machine/vmparam.h
|
||||
kadb.o: ../../sun4m/machine/param.h
|
||||
kadb.o: ../../sun4m/machine/mmu.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../../lang/adb/common/process.h
|
||||
kadb.o: ../../../lang/adb/common/symtab.h
|
||||
kadb.o: ../common/pf.h
|
||||
kadb.o: ../../debug/debugger.h
|
||||
kadb.o: /usr/include/setjmp.h
|
||||
kadb.o: /usr/include/machine/setjmp.h
|
||||
kadb.o: ../../debug/debug.h
|
||||
kadb.o: ../../mon/sunromvec.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/param.h
|
||||
kadb.o: ../../mon/openprom.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sun4m/machine/romvec.h
|
||||
kadb.o: ../../sys/errno.h
|
||||
kadb.o: ../../sys/file.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/fcntlcom.h
|
||||
kadb.o: ../../sys/stdtypes.h
|
||||
kadb.o: ../../sys/stat.h
|
||||
kadb.o: ../../sys/types.h
|
||||
kadb.o: ../../sys/ptrace.h
|
||||
kadb.o: ../../sun4m/machine/cpu.h
|
||||
kadb.o: ../../mon/sunromvec.h
|
||||
genpf.o: ../common/genpf.c
|
||||
genpf.o: ../common/pf.h
|
||||
genpf.o: /usr/include/stdio.h
|
||||
genpf.o: /usr/include/ctype.h
|
||||
Reference in New Issue
Block a user