mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
more debugging
This commit is contained in:
parent
9b4de09d41
commit
af89fc108d
3 changed files with 18 additions and 5 deletions
|
@ -13,7 +13,7 @@ iointerrupt(Ioproc *io)
|
|||
{
|
||||
if(!io->inuse)
|
||||
return;
|
||||
fprint(2, "bug: cannot iointerrupt yet\n");
|
||||
fprint(2, "bug: cannot iointerrupt %p yet\n", io);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -123,7 +123,8 @@ _iowrite(va_list *arg)
|
|||
long
|
||||
iowrite(Ioproc *io, int fd, void *a, long n)
|
||||
{
|
||||
return iocall(io, _iowrite, fd, a, n);
|
||||
n = iocall(io, _iowrite, fd, a, n);
|
||||
return n;
|
||||
}
|
||||
|
||||
static long
|
||||
|
|
|
@ -23,17 +23,29 @@ _threaddebug(char *fmt, ...)
|
|||
va_list arg;
|
||||
char buf[128];
|
||||
_Thread *t;
|
||||
char *p;
|
||||
static int fd = -1;
|
||||
|
||||
return;
|
||||
return;
|
||||
if(fd < 0){
|
||||
p = strrchr(argv0, '/');
|
||||
if(p)
|
||||
p++;
|
||||
else
|
||||
p = argv0;
|
||||
snprint(buf, sizeof buf, "/tmp/%s.tlog", p);
|
||||
if((fd = create(buf, OWRITE, 0666)) < 0)
|
||||
fd = open("/dev/null", OWRITE);
|
||||
}
|
||||
|
||||
va_start(arg, fmt);
|
||||
vsnprint(buf, sizeof buf, fmt, arg);
|
||||
va_end(arg);
|
||||
t = proc()->thread;
|
||||
if(t)
|
||||
fprint(2, "%d.%d: %s\n", getpid(), t->id, buf);
|
||||
fprint(fd, "%d.%d: %s\n", getpid(), t->id, buf);
|
||||
else
|
||||
fprint(2, "%d._: %s\n", getpid(), buf);
|
||||
fprint(fd, "%d._: %s\n", getpid(), buf);
|
||||
}
|
||||
|
||||
static _Thread*
|
||||
|
|
Loading…
Reference in a new issue