better unwinding for 386.
command-line extraction from core files on linux and freebsd.
move linux ureg into ureg386.h (used in many places).
diff --git a/src/libmach/sym.c b/src/libmach/sym.c
index b734957..a5cf031 100644
--- a/src/libmach/sym.c
+++ b/src/libmach/sym.c
@@ -50,6 +50,23 @@
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 @@
}
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;
}