diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-09-12 15:28:04 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-09-12 15:28:04 +0200 |
commit | ca2f1c07f2a6bb48582b990868976b45d3663605 (patch) | |
tree | 4684d0557809bc3a96c9dbe38fc5c17d9287c97c /sys/lib/acid | |
parent | fbf29fc6951da196b0ce155dd0af86c6d7fde7bf (diff) |
acid/kernel: for stacktraces, try to use context from error stack when process is not sleeping
when a process state has not been saved (Proc.mach != nil)
then the contents of Proc.sched should be considered invalid.
to approximate a stacktrace in this case, we use the error
stack and get a stacktrace from the last waserror() call.
Diffstat (limited to 'sys/lib/acid')
-rw-r--r-- | sys/lib/acid/kernel | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/lib/acid/kernel b/sys/lib/acid/kernel index 4cf57ba71..c6433b9da 100644 --- a/sys/lib/acid/kernel +++ b/sys/lib/acid/kernel @@ -271,12 +271,23 @@ defn procstksize(p) { defn procstk(p) { complex Proc p; + local l, n; if p.state != 0 then { // 0 is Dead + if p.mach == 0 then { + l = p.sched; + } else { + n = p.nerrlab; + if n == 0 then { + return 0; + } + l = p.errlab + (n-1)*sizeofLabel; + } + complex Label l; if objtype=="386" || objtype=="amd64" then - _stk(gotolabel, p.sched.sp, linkreg(0), 0); + _stk(gotolabel, l.sp, linkreg(0), 0); else - _stk(p.sched.pc, p.sched.sp, linkreg(0), 0); + _stk(l.pc, l.sp, linkreg(0), 0); } } |