diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 20:52:35 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 20:52:35 +0000 |
| commit | 46439007cf417cbd9ac8049bb4122c890097a0fa (patch) | |
| tree | 6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /lib/acid/rdebug | |
| parent | 37da2899f40661e3e9631e497da8dc59b971cbd0 (diff) | |
20060303-partial
Diffstat (limited to 'lib/acid/rdebug')
| -rw-r--r-- | lib/acid/rdebug | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/lib/acid/rdebug b/lib/acid/rdebug new file mode 100644 index 00000000..be8c45f9 --- /dev/null +++ b/lib/acid/rdebug @@ -0,0 +1,116 @@ +// Acid remote debug (using devdbg.c) + +defn step() +{ + local ur; + local addrs; + local id; + local l; + local b; + local bl; + local sl; + + complex Proc proc; + ur = proc.dbgreg; + if ur == 0 then + error("step: process not in breakpoint trap"); + complex Ureg ur; + + // + // stop all kprocs that could potentially hit this breakpoint + // make a list of all the breakpoints at this address + // + bl = {}; + sl = {}; + l = bpl; + while l do { + b = head l; + if b[2] == ur.pc then { + if status(b[1]) != "Stopped" then { + stop(b[1]); + sl = append sl, b[1]; + } + bl = append bl, b; + } + l = tail l; + } + + // + // delete all the breakpoints at this address + // + if bl then { + l = bl; + while l do { + b = head l; + _bpconddel(b[0]); + l = tail l; + } + } + + // + // single step to the following address + // + addrs = follow(ur.pc); + id = bpset(addrs[0]); + startstop(pid); + bpdel(id); + + // + // restore all the breakpoints at this address + // + if bl then { + l = bl; + while l do { + b = head l; + _bpcondset(b[0], b[1], b[2], b[3]); + l = tail l; + } + } + + // + // restart all kprocs that could potentially hit this breakpoint + // + if sl then { + l = sl; + while l do { + start(head l); + l = tail l; + } + } +} + +defn pstop(pid) +{ + local l; + local pc; + local ur; + + if nopstop then + return {}; + + complex Proc proc; + ur = proc.dbgreg; + complex Ureg ur; + pc = ur.pc; + + if _breakid != -1 then { + print("break ", _breakid\d, ": pid "); + _breakid = -1; + } + print(pid,": ", status(pid), "\t"); + + print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n"); + + if notes then { + if notes[0] != "sys: breakpoint" then { + print("Notes pending:\n"); + l = notes; + while l do { + print("\t", head l, "\n"); + l = tail l; + } + } + } +} + +print("$ROOT/lib/acid/rdebug"); |
