acid: avoid runtime error in thread library [rsc] --rw-rw-r-- M 1635703 glenda sys 6143 Feb 23 06:41 sys/lib/acid/thread /n/sourcesdump/2006/0223/plan9/sys/lib/acid/thread:72,78 - /n/sourcesdump/2006/0224/plan9/sys/lib/acid/thread:72,80 return sym[0]; s = tail s; } - return itoa(a, "%x"); + if a == {} then + return "{}"; + return itoa(a\X, "%x"); } stkignorelist = {}; /n/sourcesdump/2006/0223/plan9/sys/lib/acid/thread:82,88 - /n/sourcesdump/2006/0224/plan9/sys/lib/acid/thread:84,90 } defn threadstkline(T){ - local stk, frame, pc, pc0, file, lastpc0, s, sym, i, stop; + local ostk, stk, frame, pc, pc0, file, lastpc0, s, sym, i, stop; if T.state == Running then{ pc = *PC; /n/sourcesdump/2006/0223/plan9/sys/lib/acid/thread:91,99 - /n/sourcesdump/2006/0224/plan9/sys/lib/acid/thread:93,103 pc = labpc(T.sched); stk = strace(labpc(T.sched), labsp(T.sched), 0); } + firstpc = pc; lastpc0 = 0; pc0 = 0; stop = 0; + ostk = stk; while stk && !stop do { file = pcfile(pc); if !regexp("^/sys/src/libc/", file) /n/sourcesdump/2006/0223/plan9/sys/lib/acid/thread:100,106 - /n/sourcesdump/2006/0224/plan9/sys/lib/acid/thread:104,114 && !regexp("^/sys/src/libthread/", file) && match(file, stkignore)==-1 then stop = 1; - else{ + else if stk[0][1] == 0xfefefefe then { + pc = ostk[0][1]; + pc0 = ostk[1][0]; + stop = 1; + }else{ lastpc0 = pc0; frame = head stk; stk = tail stk;