6 typedef struct LocRegs LocRegs;
16 locregrw(Regs *regs, char *name, ulong *val, int isr)
24 return lr->oldregs->rw(lr->oldregs, name, val, isr);
29 werrstr("saved registers are immutable");
35 stacktrace(Map *map, Regs *regs, Tracer trace)
45 * Allocate location arrays.
48 cur = malloc(mach->nwindreg*sizeof(cur[0]));
49 next = malloc(mach->nwindreg*sizeof(cur[0]));
50 if(cur==nil || next==nil)
54 * Initialize current registers using regs.
56 if(rget(regs, mach->pc, &pc) < 0){
57 werrstr("cannot fetch initial pc: %r");
61 for(i=0; i<mach->nwindreg; i++){
62 rname = mach->windreg[i];
63 if(rget(regs, rname, &v) < 0)
68 ipc = windindex(mach->pc);
71 /* set up cur[i]==next[i] for unwindframe */
72 memmove(next, cur, mach->nwindreg*sizeof(next[0]));
75 if(findsym(locaddr(pc), CTEXT, &s) < 0)
82 if((i = unwindframe(map, &lr.r, next, sp)) >= 0)
86 if((*trace)(map, &lr.r, pc, nextpc, sp, ++ret) <= 0)
91 if(strcmp(sp->name, "main") == 0
92 || strcmp(sp->name, "procscheduler") == 0
93 || strcmp(sp->name, "threadstart") == 0)
97 memmove(cur, next, mach->nwindreg*sizeof(cur[0]));
113 for(i=0; i<mach->nwindreg; i++)
114 if(strcmp(p[i], reg) == 0)
116 werrstr("%s is not a winding register", reg);
126 loc = malloc(mach->nwindreg*sizeof(loc[0]));
129 for(i=0; i<mach->nwindreg; i++){
131 loc[i].reg = mach->windreg[i];