better handling of failed setproc

This commit is contained in:
rsc 2005-02-11 19:44:37 +00:00
parent 4999080d5b
commit 783aadbdcd

View file

@ -14,6 +14,7 @@ sproc(int xpid)
{ {
Lsym *s; Lsym *s;
int i; int i;
Regs *regs;
if(symmap == 0) if(symmap == 0)
error("no map"); error("no map");
@ -22,11 +23,11 @@ sproc(int xpid)
return; return;
if(corhdr){ if(corhdr){
free(correg); regs = coreregs(corhdr, xpid);
correg = nil; if(regs == nil)
correg = coreregs(corhdr, xpid);
if(correg == nil)
error("no such pid in core dump"); error("no such pid in core dump");
free(correg);
correg = regs;
}else{ }else{
/* XXX should only change register set here if cormap already mapped */ /* XXX should only change register set here if cormap already mapped */
if(xpid <= 0) if(xpid <= 0)
@ -35,6 +36,8 @@ sproc(int xpid)
unmapfile(corhdr, cormap); unmapfile(corhdr, cormap);
free(correg); free(correg);
correg = nil; correg = nil;
pid = -1;
corpid = -1;
if(mapproc(xpid, cormap, &correg) < 0) if(mapproc(xpid, cormap, &correg) < 0)
error("setproc %d: %r", xpid); error("setproc %d: %r", xpid);