-
Notifications
You must be signed in to change notification settings - Fork 2
/
dss.c
56 lines (46 loc) · 2.39 KB
/
dss.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Copyright 1990-2011, Jsoftware Inc. All rights reserved. */
/* License in license.txt. */
/* */
/* Debug: Single Step */
#include "j.h"
#include "d.h"
/* d->dcss - single step code in current function */
/* jt->dbssd - the d whose dcss is non-zero */
/* jt->dbss - single step code for propagation to appropriate function */
DC jtssnext(J jt,DC d,C c){
d=d->dclnk;
while(d&&DCCALL!=d->dctype)d=d->dclnk; /* find next call */
if(d&&!d->dcsusp){d->dcss=c; jt->dbssd=d;}
else {d=0; jt->dbssd=0;}
R d;
} /* set dcss for next stack level */
static A jtssdo(J jt,A a,A w,C c){DC d,e;I n,*v;
RZ(w=vs(w));
ASSERT(jt->db,EVDOMAIN);
d=jt->sitop; /* cut back to topmost suspension */
while(d&&!d->dcsusp){ /* do until topmost suspension */
if(d->dctype==DCCALL)*(I*)(d->dci)=-2; /* terminate each call */
d=d->dclnk;
}
ASSERT(d,EVDOMAIN); /* must have a suspension */
while(d&&DCCALL!=d->dctype)d=d->dclnk; /* find topmost call */
ASSERT(d,EVDOMAIN); /* must have a call */
if(a)RE(n=lnumcw(i0(a),d->dcc)); /* source line # to cw line # */
v=(I*)d->dci; /* pointer to line # */
jt->dbsusact=SUSSS;
switch(c){
case SSSTEPOVER: if(a)*v=n-1; else --*v; jt->dbss=d->dcss=c; jt->dbssd=d; break;
case SSSTEPINTO: if(a)*v=n-1; else --*v; jt->dbss=d->dcss=c; jt->dbssd=d; break;
case SSSTEPOUT: if(a)*v=n-1; else --*v; jt->dbss=d->dcss=0; ssnext(d,c); break;
case SSCUTBACK: *v=-2; jt->dbss=d->dcss=0; e=ssnext(d,c); if(e)--*(I*)e->dci;
}
fa(jt->dbssexec); jt->dbssexec=AN(w)?ra(w):0;
R mtm; /* 0 return to terminate call */
}
F1(jtdbcutback ){R ssdo(0L,w,SSCUTBACK );} /* 13!:19 */
F1(jtdbstepover1){R ssdo(0L,w,SSSTEPOVER);} /* 13!:20 */
F2(jtdbstepover2){R ssdo(a, w,SSSTEPOVER);}
F1(jtdbstepinto1){R ssdo(0L,w,SSSTEPINTO);} /* 13!:21 */
F2(jtdbstepinto2){R ssdo(a, w,SSSTEPINTO);}
F1(jtdbstepout1 ){R ssdo(0L,w,SSSTEPOUT );} /* 13!:22 */
F2(jtdbstepout2 ){R ssdo(a, w,SSSTEPOUT );}