various fixes
This commit is contained in:
parent
77fd60a177
commit
689be54125
3 changed files with 28 additions and 23 deletions
|
|
@ -28,7 +28,7 @@ void match(Node*, Node*);
|
||||||
void status(Node*, Node*);
|
void status(Node*, Node*);
|
||||||
void xkill(Node*,Node*);
|
void xkill(Node*,Node*);
|
||||||
void waitstop(Node*, Node*);
|
void waitstop(Node*, Node*);
|
||||||
void sysstop(Node*, Node*);
|
void waitsyscall(Node*, Node*);
|
||||||
void stop(Node*, Node*);
|
void stop(Node*, Node*);
|
||||||
void start(Node*, Node*);
|
void start(Node*, Node*);
|
||||||
void filepc(Node*, Node*);
|
void filepc(Node*, Node*);
|
||||||
|
|
@ -47,6 +47,7 @@ void stringn(Node*, Node*);
|
||||||
void xregister(Node*, Node*);
|
void xregister(Node*, Node*);
|
||||||
void refconst(Node*, Node*);
|
void refconst(Node*, Node*);
|
||||||
void dolook(Node*, Node*);
|
void dolook(Node*, Node*);
|
||||||
|
void step1(Node*, Node*);
|
||||||
|
|
||||||
typedef struct Btab Btab;
|
typedef struct Btab Btab;
|
||||||
struct Btab
|
struct Btab
|
||||||
|
|
@ -87,13 +88,14 @@ struct Btab
|
||||||
"start", start,
|
"start", start,
|
||||||
"startstop", startstop,
|
"startstop", startstop,
|
||||||
"status", status,
|
"status", status,
|
||||||
|
"step1", step1,
|
||||||
"stop", stop,
|
"stop", stop,
|
||||||
"strace", strace,
|
"strace", strace,
|
||||||
"stringn", stringn,
|
"stringn", stringn,
|
||||||
"sysstop", sysstop,
|
|
||||||
"textfile", textfile,
|
"textfile", textfile,
|
||||||
"var", dolook,
|
"var", dolook,
|
||||||
"waitstop", waitstop,
|
"waitstop", waitstop,
|
||||||
|
"waitsyscall", waitsyscall,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -220,6 +222,23 @@ newproc(Node *r, Node *args)
|
||||||
r->store.u.ival = nproc(argv);
|
r->store.u.ival = nproc(argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
step1(Node *r, Node *args)
|
||||||
|
{
|
||||||
|
Node res;
|
||||||
|
|
||||||
|
USED(r);
|
||||||
|
if(args == 0)
|
||||||
|
error("step1(pid): no pid");
|
||||||
|
expr(args, &res);
|
||||||
|
if(res.type != TINT)
|
||||||
|
error("step1(pid): arg type");
|
||||||
|
|
||||||
|
msg(res.store.u.ival, "step");
|
||||||
|
notes(res.store.u.ival);
|
||||||
|
dostop(res.store.u.ival);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
startstop(Node *r, Node *args)
|
startstop(Node *r, Node *args)
|
||||||
{
|
{
|
||||||
|
|
@ -256,16 +275,16 @@ waitstop(Node *r, Node *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sysstop(Node *r, Node *args)
|
waitsyscall(Node *r, Node *args)
|
||||||
{
|
{
|
||||||
Node res;
|
Node res;
|
||||||
|
|
||||||
USED(r);
|
USED(r);
|
||||||
if(args == 0)
|
if(args == 0)
|
||||||
error("waitstop(pid): no pid");
|
error("waitsyscall(pid): no pid");
|
||||||
expr(args, &res);
|
expr(args, &res);
|
||||||
if(res.type != TINT)
|
if(res.type != TINT)
|
||||||
error("waitstop(pid): arg type");
|
error("waitsycall(pid): arg type");
|
||||||
|
|
||||||
Bflush(bout);
|
Bflush(bout);
|
||||||
msg(res.store.u.ival, "sysstop");
|
msg(res.store.u.ival, "sysstop");
|
||||||
|
|
@ -471,7 +490,7 @@ funcbound(Node *r, Node *args)
|
||||||
error("fnbound(addr): arg type");
|
error("fnbound(addr): arg type");
|
||||||
|
|
||||||
n = fnbound(res.store.u.ival, bounds);
|
n = fnbound(res.store.u.ival, bounds);
|
||||||
if (n != 0) {
|
if (n >= 0) {
|
||||||
r->store.u.l = al(TINT);
|
r->store.u.l = al(TINT);
|
||||||
l = r->store.u.l;
|
l = r->store.u.l;
|
||||||
l->store.u.ival = bounds[0];
|
l->store.u.ival = bounds[0];
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ nproc(char **argv)
|
||||||
fatal("new: exec %s: %r");
|
fatal("new: exec %s: %r");
|
||||||
default:
|
default:
|
||||||
install(pid);
|
install(pid);
|
||||||
|
msg(pid, "attached");
|
||||||
msg(pid, "waitstop");
|
msg(pid, "waitstop");
|
||||||
notes(pid);
|
notes(pid);
|
||||||
sproc(pid);
|
sproc(pid);
|
||||||
|
|
@ -242,21 +243,6 @@ msg(int pid, char *msg)
|
||||||
char *
|
char *
|
||||||
getstatus(int pid)
|
getstatus(int pid)
|
||||||
{
|
{
|
||||||
int fd;
|
return "unknown";
|
||||||
char *p;
|
|
||||||
|
|
||||||
static char buf[128];
|
|
||||||
|
|
||||||
sprint(buf, "/proc/%d/status", pid);
|
|
||||||
fd = open(buf, OREAD);
|
|
||||||
if(fd < 0)
|
|
||||||
error("open %s: %r", buf);
|
|
||||||
read(fd, buf, sizeof(buf));
|
|
||||||
close(fd);
|
|
||||||
p = buf+56+12; /* Do better! */
|
|
||||||
while(*p == ' ')
|
|
||||||
p--;
|
|
||||||
p[1] = '\0';
|
|
||||||
return buf+56; /* ditto */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ addvarsym(Fhdr *fp)
|
||||||
Lsym *l;
|
Lsym *l;
|
||||||
String *file;
|
String *file;
|
||||||
ulong v;
|
ulong v;
|
||||||
char buf[1024];
|
char buf[65536]; /* Some of those C++ names are really big */
|
||||||
List *list, **tail, *tl;
|
List *list, **tail, *tl;
|
||||||
|
|
||||||
if(fp == nil)
|
if(fp == nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue