diff options
author | rsc <devnull@localhost> | 2004-04-21 20:04:34 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-21 20:04:34 +0000 |
commit | f21f37f219965af3980ba50bac429658d19615d1 (patch) | |
tree | a5333905a9e573956106623e582ae071d9d860dd /src/libmach | |
parent | 4a64a77bd3c08809a1cfb4c5a76c2efbd33b1d7b (diff) | |
download | plan9port-f21f37f219965af3980ba50bac429658d19615d1.tar.gz plan9port-f21f37f219965af3980ba50bac429658d19615d1.tar.bz2 plan9port-f21f37f219965af3980ba50bac429658d19615d1.zip |
add registers to stack trace
Diffstat (limited to 'src/libmach')
-rw-r--r-- | src/libmach/localaddr.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libmach/localaddr.c b/src/libmach/localaddr.c index 1b1dea73..800c0f66 100644 --- a/src/libmach/localaddr.c +++ b/src/libmach/localaddr.c @@ -14,6 +14,7 @@ static struct { Loc l; char *fn; char *var; + char *reg; } rock; static int @@ -28,6 +29,13 @@ ltrace(Map *map, Regs *regs, ulong pc, ulong nextpc, Symbol *sym, int depth) if(sym==nil || strcmp(sym->name, rock.fn) != 0) return ++rock.nframe < 40; + if(rock.reg){ + if(rget(regs, rock.reg, &v) < 0) + return 0; + rock.l = locconst(v); + rock.found = 1; + return 0; + } if(lookuplsym(sym, rock.var, &s1) < 0) return 0; if(locsimplify(map, regs, s1.loc, &rock.l) < 0) @@ -43,10 +51,18 @@ ltrace(Map *map, Regs *regs, ulong pc, ulong nextpc, Symbol *sym, int depth) int localaddr(Map *map, Regs *regs, char *fn, char *var, ulong *val) { + Regdesc *rp; + rock.found = 0; rock.nframe = 0; rock.fn = fn; - rock.var = var; + rock.reg = nil; + rock.var = nil; + for(rp=mach->reglist; rp->name; rp++) + if(strcmp(rp->name, var) == 0) + rock.reg = rp->name; + if(!rock.reg) + rock.var = var; stacktrace(map, regs, ltrace); if(rock.found){ *val = rock.l.addr; |