change to use attach functions.

$a means switch thread in core dumps.
(maybe that should be $A now?).
This commit is contained in:
rsc 2005-01-23 22:48:54 +00:00
parent 4f2ac1b76b
commit b030a6c390
5 changed files with 35 additions and 97 deletions

View file

@ -27,18 +27,29 @@ setsym(void)
void
setcor(void)
{
unmapproc(cormap);
unmapfile(corhdr, cormap);
free(correg);
correg = nil;
static int mapped;
if (pid > 0) {
if (mapproc(pid, cormap, &correg) < 0)
dprint("mapproc %d: %r\n", pid);
} else {
if (corhdr) {
if (corhdr) {
if (!mapped) {
if (mapfile(corhdr, 0, cormap, &correg) < 0)
dprint("mapfile %s: %r\n", corfil);
mapped = 1;
}
free(correg);
if (pid == 0 && corhdr->nthread > 0)
pid = corhdr->thread[0].id;
correg = coreregs(corhdr, pid);
if(correg == nil)
dprint("no such pid in core dump\n");
} else {
unmapproc(cormap);
unmapfile(corhdr, cormap);
free(correg);
correg = nil;
if (pid > 0) {
if (mapproc(pid, cormap, &correg) < 0)
dprint("mapproc %d: %r\n", pid);
} else
dprint("no core image\n");
}
@ -137,7 +148,7 @@ void
attachprocess(void)
{
if (!adrflg) {
dprint("used pid$a\n");
dprint("usage: pid$a\n");
return;
}
pid = adrval;