bring them up-to-speed for current system.
This commit is contained in:
parent
d9c2aa3a33
commit
7284df18a8
3 changed files with 66 additions and 54 deletions
20
acid/386
20
acid/386
|
|
@ -173,7 +173,7 @@ linkdebug()
|
||||||
}
|
}
|
||||||
|
|
||||||
defn
|
defn
|
||||||
acidmap()
|
dynamicmap()
|
||||||
{
|
{
|
||||||
if systype == "linux" then {
|
if systype == "linux" then {
|
||||||
local r, m, n;
|
local r, m, n;
|
||||||
|
|
@ -192,19 +192,13 @@ acidmap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
local syms;
|
defn
|
||||||
local l;
|
acidmap()
|
||||||
|
{
|
||||||
l = textfile();
|
dynamicmap();
|
||||||
if l != {} then {
|
acidtypes();
|
||||||
syms = "acidtypes";
|
|
||||||
while l != {} do {
|
|
||||||
syms = syms + " " + ((head l)[0]);
|
|
||||||
l = tail l;
|
|
||||||
}
|
|
||||||
includepipe(syms);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print(acidfile);
|
print(acidfile);
|
||||||
|
|
|
||||||
31
acid/port
31
acid/port
|
|
@ -33,10 +33,10 @@ notelstk(addr)
|
||||||
_stk({"PC", pc, "SP", sp, linkreg(addr)}, 1);
|
_stk({"PC", pc, "SP", sp, linkreg(addr)}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
defn labstk(l) // trace from a label
|
// defn labstk(l) // trace from a label
|
||||||
{
|
// {
|
||||||
_stk({"PC", *(l+4), "SP", *l, linkreg(0)}, 0);
|
// _stk({"PC", *(l+4), "SP", *l, linkreg(0)}, 0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
defn params(param)
|
defn params(param)
|
||||||
{
|
{
|
||||||
|
|
@ -64,8 +64,11 @@ defn locals(l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defn _stkign(file)
|
defn _stkign(frame)
|
||||||
{
|
{
|
||||||
|
local file;
|
||||||
|
|
||||||
|
file = pcfile(frame[0]);
|
||||||
s = stkignore;
|
s = stkignore;
|
||||||
while s do {
|
while s do {
|
||||||
if regexp(head s, file) then
|
if regexp(head s, file) then
|
||||||
|
|
@ -85,7 +88,7 @@ defn _stk(regs, dolocals)
|
||||||
|
|
||||||
stk = strace(regs);
|
stk = strace(regs);
|
||||||
if stkignore then {
|
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;
|
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="";
|
progargs="";
|
||||||
print(acidfile);
|
print(acidfile);
|
||||||
|
|
|
||||||
69
acid/thread
69
acid/thread
|
|
@ -1,24 +1,29 @@
|
||||||
|
|
||||||
defn labpc(l)
|
defn labpc(l)
|
||||||
{
|
{
|
||||||
if objtype == "386" then
|
complex Label l;
|
||||||
return longjmp;
|
|
||||||
return *(l+4);
|
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)
|
defn labstk(l)
|
||||||
{
|
{
|
||||||
_stk(labpc(l), labsp(l), 0, 0);
|
_stk(label(l), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
defn lablstk(l)
|
defn lablstk(l)
|
||||||
{
|
{
|
||||||
_stk(labpc(l), labsp(l), 0, 1);
|
_stk(label(l), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
defn altfmt(A){
|
defn altfmt(A){
|
||||||
|
|
@ -57,8 +62,8 @@ defn alt(A){
|
||||||
}
|
}
|
||||||
|
|
||||||
threadignsrc = {
|
threadignsrc = {
|
||||||
"^/sys/src/libc",
|
"plan9/src/libc",
|
||||||
"^/sys/src/libthread",
|
"plan9/src/libthread",
|
||||||
};
|
};
|
||||||
|
|
||||||
defn fnname(a){
|
defn fnname(a){
|
||||||
|
|
@ -81,32 +86,24 @@ defn stkignore(s){
|
||||||
}
|
}
|
||||||
|
|
||||||
defn threadstkline(T){
|
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;
|
stop = 0;
|
||||||
while stk && !stop do {
|
while stk && !stop do {
|
||||||
|
frame = head stk;
|
||||||
|
stk = tail stk;
|
||||||
|
pc = frame[2];
|
||||||
|
pc0 = frame[0];
|
||||||
file = pcfile(pc);
|
file = pcfile(pc);
|
||||||
if !regexp("^/sys/src/libc/", file)
|
if !regexp("plan9/src/libc/", file)
|
||||||
&& !regexp("^/sys/src/libthread/", file)
|
&& !regexp("plan9/src/libthread/", file)
|
||||||
&& match(file, stkignore)==-1 then
|
&& match(file, stkignore)==-1 then
|
||||||
stop = 1;
|
stop = 1;
|
||||||
else{
|
|
||||||
lastpc0 = pc0;
|
|
||||||
frame = head stk;
|
|
||||||
stk = tail stk;
|
|
||||||
nextframe = head stk;
|
|
||||||
pc = frame[1];
|
|
||||||
pc0 = nextframe[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
file = pcfile(pc);
|
file = pcfile(pc);
|
||||||
s = file+":"+itoa(pcline(pc), "%d");
|
s = file+":"+itoa(pcline(pc), "%d");
|
||||||
|
|
@ -165,7 +162,7 @@ defn pthreads(P){
|
||||||
while T != 0 do{
|
while T != 0 do{
|
||||||
print("\t");
|
print("\t");
|
||||||
thread(T);
|
thread(T);
|
||||||
T = T.nextt;
|
T = (Thread)T.nextt;
|
||||||
}
|
}
|
||||||
setproc(mainpid);
|
setproc(mainpid);
|
||||||
}
|
}
|
||||||
|
|
@ -173,6 +170,7 @@ defn pthreads(P){
|
||||||
defn threads(){
|
defn threads(){
|
||||||
local P;
|
local P;
|
||||||
|
|
||||||
|
complex Pqueue _threadpq;
|
||||||
P = (Proc)_threadpq.$head;
|
P = (Proc)_threadpq.$head;
|
||||||
while P != 0 do{
|
while P != 0 do{
|
||||||
if P != (Proc)_threadpq.$head then print("\n");
|
if P != (Proc)_threadpq.$head then print("\n");
|
||||||
|
|
@ -184,6 +182,7 @@ defn threads(){
|
||||||
defn stacks(){
|
defn stacks(){
|
||||||
local P, mainpid;
|
local P, mainpid;
|
||||||
|
|
||||||
|
stkprefix = "";
|
||||||
mainpid = pid;
|
mainpid = pid;
|
||||||
P = (Proc)_threadpq.$head;
|
P = (Proc)_threadpq.$head;
|
||||||
while P != 0 do{
|
while P != 0 do{
|
||||||
|
|
@ -195,7 +194,7 @@ defn stacks(){
|
||||||
// }
|
// }
|
||||||
// print("threadstks(", P\X, ")\n");
|
// print("threadstks(", P\X, ")\n");
|
||||||
threadstks(P);
|
threadstks(P);
|
||||||
P = P.next;
|
P = (Proc)P.next;
|
||||||
print("\n");
|
print("\n");
|
||||||
}
|
}
|
||||||
setproc(mainpid);
|
setproc(mainpid);
|
||||||
|
|
@ -219,7 +218,7 @@ defn stacksizes(){
|
||||||
}
|
}
|
||||||
sp = *(T.sched);
|
sp = *(T.sched);
|
||||||
print(top-sp\D, "\n");
|
print(top-sp\D, "\n");
|
||||||
T = T.nextt;
|
T = (Thread)T.nextt;
|
||||||
}
|
}
|
||||||
P = P.next;
|
P = P.next;
|
||||||
}
|
}
|
||||||
|
|
@ -240,8 +239,8 @@ defn threadstks(P){
|
||||||
stkprefix = pref+"\t\t";
|
stkprefix = pref+"\t\t";
|
||||||
ign = stkignore;
|
ign = stkignore;
|
||||||
stkignore = {
|
stkignore = {
|
||||||
"^/sys/src/libthread/",
|
"plan9/src/libthread/",
|
||||||
"^/sys/src/libc/(386|arm|alpha|sparc|power|mips)/"
|
"plan9/src/libc/(386|arm|alpha|sparc|power|mips)/"
|
||||||
};
|
};
|
||||||
setproc(P.pid);
|
setproc(P.pid);
|
||||||
Tq = (Tqueue)P.threads;
|
Tq = (Tqueue)P.threads;
|
||||||
|
|
@ -252,7 +251,7 @@ defn threadstks(P){
|
||||||
print("\t");
|
print("\t");
|
||||||
thread(T);
|
thread(T);
|
||||||
threadstk(T);
|
threadstk(T);
|
||||||
T = T.nextt;
|
T = (Thread)T.nextt;
|
||||||
print("\n");
|
print("\n");
|
||||||
}
|
}
|
||||||
setproc(mainpid);
|
setproc(mainpid);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue