better unwinding for 386.

command-line extraction from core files on linux and freebsd.

move linux ureg into ureg386.h (used in many places).
This commit is contained in:
rsc 2004-12-25 22:03:28 +00:00
parent cdf1805191
commit 1cc215aaf9
13 changed files with 495 additions and 109 deletions

View file

@ -50,6 +50,23 @@ _delhdr(Fhdr *h)
h->next = nil;
}
Fhdr*
findhdr(char *name)
{
int len, plen;
Fhdr *p;
len = strlen(name);
for(p=fhdrlist; p; p=p->next){
plen = strlen(p->filename);
if(plen >= len)
if(strcmp(p->filename+plen-len, name) == 0)
if(plen == len || p->filename[plen-len-1] == '/')
return p;
}
return nil;
}
int
pc2file(ulong pc, char *file, uint nfile, ulong *line)
{
@ -354,14 +371,14 @@ findlsym(Symbol *s1, Loc loc, Symbol *s2)
}
int
unwindframe(Map *map, Regs *regs, ulong *next)
unwindframe(Map *map, Regs *regs, ulong *next, Symbol *sym)
{
Fhdr *p;
for(p=fhdrlist; p; p=p->next)
if(p->unwind && p->unwind(p, map, regs, next) >= 0)
if(p->unwind && p->unwind(p, map, regs, next, sym) >= 0)
return 0;
if(mach->unwind && mach->unwind(map, regs, next) >= 0)
if(mach->unwind && mach->unwind(map, regs, next, sym) >= 0)
return 0;
return -1;
}