aboutsummaryrefslogtreecommitdiff
path: root/acid
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-04-19 18:52:34 +0000
committerrsc <devnull@localhost>2004-04-19 18:52:34 +0000
commit7284df18a883c64721720276dac4f4540440e74c (patch)
tree24753607004ead79a235da7242e7fba95f721941 /acid
parentd9c2aa3a3366b60d5054c575801692579162a47f (diff)
downloadplan9port-7284df18a883c64721720276dac4f4540440e74c.tar.gz
plan9port-7284df18a883c64721720276dac4f4540440e74c.tar.bz2
plan9port-7284df18a883c64721720276dac4f4540440e74c.zip
bring them up-to-speed for current system.
Diffstat (limited to 'acid')
-rw-r--r--acid/38620
-rw-r--r--acid/port31
-rw-r--r--acid/thread69
3 files changed, 66 insertions, 54 deletions
diff --git a/acid/386 b/acid/386
index 252ece8e..bc045601 100644
--- a/acid/386
+++ b/acid/386
@@ -173,7 +173,7 @@ linkdebug()
}
defn
-acidmap()
+dynamicmap()
{
if systype == "linux" then {
local r, m, n;
@@ -192,19 +192,13 @@ acidmap()
}
}
}
+}
- local syms;
- local l;
-
- l = textfile();
- if l != {} then {
- syms = "acidtypes";
- while l != {} do {
- syms = syms + " " + ((head l)[0]);
- l = tail l;
- }
- includepipe(syms);
- }
+defn
+acidmap()
+{
+ dynamicmap();
+ acidtypes();
}
print(acidfile);
diff --git a/acid/port b/acid/port
index d0d9107d..1e494530 100644
--- a/acid/port
+++ b/acid/port
@@ -33,10 +33,10 @@ notelstk(addr)
_stk({"PC", pc, "SP", sp, linkreg(addr)}, 1);
}
-defn labstk(l) // trace from a label
-{
- _stk({"PC", *(l+4), "SP", *l, linkreg(0)}, 0);
-}
+// defn labstk(l) // trace from a label
+// {
+// _stk({"PC", *(l+4), "SP", *l, linkreg(0)}, 0);
+// }
defn params(param)
{
@@ -64,8 +64,11 @@ defn locals(l)
}
}
-defn _stkign(file)
+defn _stkign(frame)
{
+ local file;
+
+ file = pcfile(frame[0]);
s = stkignore;
while s do {
if regexp(head s, file) then
@@ -85,7 +88,7 @@ defn _stk(regs, dolocals)
stk = strace(regs);
if stkignore then {
- while stk && tail stk && _stkign((head tail stk)[1]) do
+ while stk && tail stk && _stkign(head tail stk) do
stk = tail stk;
}
@@ -595,5 +598,21 @@ defn spsrch(len)
}
}
+defn acidtypes()
+{
+ local syms;
+ local l;
+
+ l = textfile();
+ if l != {} then {
+ syms = "acidtypes";
+ while l != {} do {
+ syms = syms + " " + ((head l)[0]);
+ l = tail l;
+ }
+ includepipe(syms);
+ }
+}
+
progargs="";
print(acidfile);
diff --git a/acid/thread b/acid/thread
index ac4cce8a..1bc723ca 100644
--- a/acid/thread
+++ b/acid/thread
@@ -1,24 +1,29 @@
defn labpc(l)
{
- if objtype == "386" then
- return longjmp;
- return *(l+4);
+ complex Label l;
+
+ return l.pc;
}
-defn labsp(l)
+defn label(l)
{
- return *l;
+ complex Label l;
+
+ if objtype == "386" then
+ return {"PC", l.pc, "BX", l.bx, "SP", l.sp, "BP", l.bp, "SI", l.si, "DI", l.di};
+ return {};
}
+
defn labstk(l)
{
- _stk(labpc(l), labsp(l), 0, 0);
+ _stk(label(l), 0);
}
defn lablstk(l)
{
- _stk(labpc(l), labsp(l), 0, 1);
+ _stk(label(l), 1);
}
defn altfmt(A){
@@ -57,8 +62,8 @@ defn alt(A){
}
threadignsrc = {
- "^/sys/src/libc",
- "^/sys/src/libthread",
+ "plan9/src/libc",
+ "plan9/src/libthread",
};
defn fnname(a){
@@ -81,32 +86,24 @@ defn stkignore(s){
}
defn threadstkline(T){
- local stk, frame, pc, pc0, file, lastpc0, s, sym, i, stop;
+ local stk, frame, pc, pc0, file, s, sym, i, stop;
+
+ if T.state == Running then
+ stk = strace({});
+ else
+ stk = strace(label(T.sched));
- if T.state == Running then{
- pc = *PC;
- stk = strace(*PC, *SP, linkreg(0));
- }else{
- pc = labpc(T.sched);
- stk = strace(labpc(T.sched), labsp(T.sched), 0);
- }
- lastpc0 = 0;
- pc0 = 0;
stop = 0;
while stk && !stop do {
+ frame = head stk;
+ stk = tail stk;
+ pc = frame[2];
+ pc0 = frame[0];
file = pcfile(pc);
- if !regexp("^/sys/src/libc/", file)
- && !regexp("^/sys/src/libthread/", file)
+ if !regexp("plan9/src/libc/", file)
+ && !regexp("plan9/src/libthread/", file)
&& match(file, stkignore)==-1 then
stop = 1;
- else{
- lastpc0 = pc0;
- frame = head stk;
- stk = tail stk;
- nextframe = head stk;
- pc = frame[1];
- pc0 = nextframe[0];
- }
}
file = pcfile(pc);
s = file+":"+itoa(pcline(pc), "%d");
@@ -165,7 +162,7 @@ defn pthreads(P){
while T != 0 do{
print("\t");
thread(T);
- T = T.nextt;
+ T = (Thread)T.nextt;
}
setproc(mainpid);
}
@@ -173,6 +170,7 @@ defn pthreads(P){
defn threads(){
local P;
+ complex Pqueue _threadpq;
P = (Proc)_threadpq.$head;
while P != 0 do{
if P != (Proc)_threadpq.$head then print("\n");
@@ -184,6 +182,7 @@ defn threads(){
defn stacks(){
local P, mainpid;
+ stkprefix = "";
mainpid = pid;
P = (Proc)_threadpq.$head;
while P != 0 do{
@@ -195,7 +194,7 @@ defn stacks(){
// }
// print("threadstks(", P\X, ")\n");
threadstks(P);
- P = P.next;
+ P = (Proc)P.next;
print("\n");
}
setproc(mainpid);
@@ -219,7 +218,7 @@ defn stacksizes(){
}
sp = *(T.sched);
print(top-sp\D, "\n");
- T = T.nextt;
+ T = (Thread)T.nextt;
}
P = P.next;
}
@@ -240,8 +239,8 @@ defn threadstks(P){
stkprefix = pref+"\t\t";
ign = stkignore;
stkignore = {
- "^/sys/src/libthread/",
- "^/sys/src/libc/(386|arm|alpha|sparc|power|mips)/"
+ "plan9/src/libthread/",
+ "plan9/src/libc/(386|arm|alpha|sparc|power|mips)/"
};
setproc(P.pid);
Tq = (Tqueue)P.threads;
@@ -252,7 +251,7 @@ defn threadstks(P){
print("\t");
thread(T);
threadstk(T);
- T = T.nextt;
+ T = (Thread)T.nextt;
print("\n");
}
setproc(mainpid);