commit - 5a2237bb22df7c8838e36aa5b19e7c0272061c8b
commit + 7b8a3f12c77354f8d8107d465e9fcd591acc64a0
blob - 8dbc1765dd506f488443d90b07fe4509493a24cd
blob + 195834d3894b921ca4d0fc0a3e3a191bf5cf741a
--- src/cmd/acid/builtin.c
+++ src/cmd/acid/builtin.c
na = 0;
flatten(av, args);
- if(na != 1 && na != 2)
- error("register(name[, threadid]): arg count");
+ if(na != 1/* && na != 2 */)
+ error("register(name): arg count");
expr(av[0], &res);
if(res.type != TSTRING)
- error("register(name[, threadid]): arg type: name should be string");
+ error("register(name): arg type: name should be string");
tid = 0;
if(na == 2){
expr(av[1], &resid);
switch(type){
case TREG:
if(res->u.reg.thread)
- Bprint(bout, "register(\"%s\", 0x%ux)", res->u.reg.name, res->u.reg.thread);
+ Bprint(bout, "register(\"%s\", %#ux)", res->u.reg.name, res->u.reg.thread);
else
Bprint(bout, "register(\"%s\")", res->u.reg.name);
return;
Bprint(bout, "%s", buf);
break;
case 'b':
- Bprint(bout, "%.2x", (int)res->u.ival&0xff);
+ Bprint(bout, "%#.2x", (int)res->u.ival&0xff);
break;
case 'X':
- Bprint(bout, "%.8lux", (ulong)res->u.ival);
+ Bprint(bout, "%#.8lux", (ulong)res->u.ival);
break;
case 'x':
- Bprint(bout, "%.4lux", (ulong)res->u.ival&0xffff);
+ Bprint(bout, "%#.4lux", (ulong)res->u.ival&0xffff);
break;
case 'W':
- Bprint(bout, "%.16llux", res->u.ival);
+ Bprint(bout, "%#.16llux", res->u.ival);
break;
case 'D':
Bprint(bout, "%d", (int)res->u.ival);
Bprint(bout, "%lld", res->u.ival);
break;
case 'Y':
- Bprint(bout, "%.16llux", res->u.ival);
+ Bprint(bout, "%#.16llux", res->u.ival);
break;
case 'o':
- Bprint(bout, "0%.11uo", (int)res->u.ival&0xffff);
+ Bprint(bout, "%#.11uo", (int)res->u.ival&0xffff);
break;
case 'O':
- Bprint(bout, "0%.6uo", (int)res->u.ival);
+ Bprint(bout, "%#.6uo", (int)res->u.ival);
break;
case 'q':
- Bprint(bout, "0%.11o", (short)(res->u.ival&0xffff));
+ Bprint(bout, "%#.11o", (short)(res->u.ival&0xffff));
break;
case 'Q':
- Bprint(bout, "0%.6o", (int)res->u.ival);
+ Bprint(bout, "%#.6o", (int)res->u.ival);
break;
case 'f':
case 'F':
blob - 822d7bb8b05842f219bba9eaf97fff51ca6f28a1
blob + 2330c43060052ee56cfcca88c014cd36a38b453c
--- src/cmd/acid/expr.c
+++ src/cmd/acid/expr.c
res->store.comt = l.store.comt;
break;
case TREG:
- indirreg(threadregs(l.store.u.reg.thread), l.store.u.reg.name, l.store.fmt, res);
+ indirreg(correg, l.store.u.reg.name, l.store.fmt, res);
res->store.comt = l.store.comt;
break;
case TCON:
case OINDM:
expr(lp->left, &aes);
if(aes.type == TREG)
- windirreg(threadregs(aes.store.u.reg.thread), aes.store.u.reg.name, n->right, res);
+ windirreg(correg, aes.store.u.reg.name, n->right, res);
else
windir(cormap, aes, n->right, res);
break;
werrstr("*%s: register %s not mapped", name, v->store.u.reg);
return -1;
}
- return rget(threadregs(v->store.u.reg.thread), v->store.u.reg.name, u);
+ return rget(correg, v->store.u.reg.name, u);
case TCON:
n = v->store.u.con;
if(n->op != OCONST || n->type != TINT){
blob - e885b01dc7c7feba6a73d275acadfcca1595aefa
blob + 9c9c026264a27e5ef2a2ade3d0ec70746d916609
--- src/cmd/acid/main.c
+++ src/cmd/acid/main.c
usage();
}ARGEND
- fmtinstall('x', xfmt);
fmtinstall('Z', Zfmt);
fmtinstall('L', locfmt);
Binit(&bioout, 1, OWRITE);
static int
attachfiles(int argc, char **argv)
{
- int fd;
volatile int pid;
- char *s, *t;
- int i, omode;
- Fhdr *hdr;
Lsym *l;
pid = 0;
interactive = 0;
+
if(setjmp(err))
return -1;
- /*
- * Unix and Plan 9 differ on what the right order of pid, text, and core is.
- * I never remember anyway. Let's just accept them in any order.
- */
- omode = wtflag ? ORDWR : OREAD;
- for(i=0; i<argc; i++){
- if(isnumeric(argv[i])){
- if(pid){
- fprint(2, "already have pid %d; ignoring pid %d\n", pid, argv[i]);
- continue;
- }
- if(corhdr){
- fprint(2, "already have core %s; ignoring pid %d\n", corfil, pid);
- continue;
- }
- pid = atoi(argv[i]);
- continue;
- }
- if((hdr = crackhdr(argv[i], omode)) == nil){
- fprint(2, "crackhdr %s: %r\n", argv[i]);
- if(argc == 1 && (fd = open(argv[i], omode)) > 0){
- fprint(2, "loading %s direct mapped\n", argv[i]);
- symmap = dumbmap(fd);
- cormap = dumbmap(fd);
- symfil = argv[i];
- corfil = argv[i];
- goto Run;
- }
- continue;
- }
- fprint(2, "%s: %s %s %s\n", argv[i], hdr->aname, hdr->mname, hdr->fname);
- if(hdr->ftype == FCORE){
- if(pid){
- fprint(2, "already have pid %d; ignoring core %s\n", pid, argv[i]);
- uncrackhdr(hdr);
- continue;
- }
- if(corhdr){
- fprint(2, "already have core %s; ignoring core %s\n", corfil, argv[i]);
- uncrackhdr(hdr);
- continue;
- }
- corhdr = hdr;
- corfil = argv[i];
- }else{
- if(symhdr){
- fprint(2, "already have text %s; ignoring text %s\n", symfil, argv[i]);
- uncrackhdr(hdr);
- continue;
- }
- symhdr = hdr;
- symfil = argv[i];
- }
- }
-
- if(symhdr==nil){
- symfil = "a.out";
- if(pid){
- if((s = proctextfile(pid)) != nil){
- fprint(2, "pid %d: text %s\n", pid, s);
- symfil = s;
- }
- }
- if(corhdr){
- /*
- * prog gives only the basename of the command,
- * so try the command line for a path.
- */
- if((s = strdup(corhdr->cmdline)) != nil){
- t = strchr(s, ' ');
- if(t)
- *t = 0;
- if((t = searchpath(s)) != nil){
- fprint(2, "core: text %s\n", t);
- symfil = t;
- }
- free(s);
- }
- }
-
- if((symhdr = crackhdr(symfil, omode)) == nil){
- fprint(2, "crackhdr %s: %r\n", symfil);
- symfil = nil;
- }else
- fprint(2, "%s: %s %s %s\n", symfil, symhdr->aname, symhdr->mname, symhdr->fname);
- }
-
- if(symhdr)
- symopen(symhdr);
-
- if(!mach)
- mach = machcpu;
-
- /*
- * Set up maps.
- */
- symmap = allocmap();
- cormap = allocmap();
- if(symmap == nil || cormap == nil)
- sysfatal("allocating maps: %r");
-
- if(symhdr){
- if(mapfile(symhdr, 0, symmap, nil) < 0)
- fprint(2, "mapping %s: %r\n", symfil);
- mapfile(symhdr, 0, cormap, nil);
- }
+ attachargs(argc, argv, wtflag?ORDWR:OREAD, 1);
-Run:
setstring("objtype", mach->name);
setstring("textfile", symfil);
setstring("systype", symhdr ? symhdr->aname : "");
l->v->type = TLIST;
l->v->store.u.l = nil;
- if(pid)
- sproc(pid);
+ if(corpid)
+ sproc(corpid);
if(corhdr)
setcore(corhdr);
varreg();
close(fd);
if(d1->qid.path != d2->qid.path || d1->qid.vers != d2->qid.vers || d1->qid.type != d2->qid.type){
- print("path %llux %llux vers %lud %lud type %d %d\n",
+ print("path %#llux %#llux vers %lud %lud type %d %d\n",
d1->qid.path, d2->qid.path, d1->qid.vers, d2->qid.vers, d1->qid.type, d2->qid.type);
print("warning: image does not match text for pid %d\n", pid);
}
}
return 1;
}
-
-int
-xfmt(Fmt *f)
-{
- f->flags ^= FmtSharp;
- return __ifmt(f);
-}