1Debug: module 2{ 3 PATH: con "/dis/lib/debug.dis"; 4 5 Terror, Tid, Tadt, Tadtpick, Tarray, Tbig, Tbyte, Tchan, Treal, 6 Tfn, Targ, Tlocal, Tglobal, Tint, Tlist, Tmodule, Tnil, Tnone, 7 Tref, Tstring, Ttuple, Tend, Targs, Tslice, Tpoly: con iota; 8 9 Pos: adt 10 { 11 file: string; 12 line: int; # line number: origin 1 13 pos: int; # character within the line: origin 0 14 }; 15 Src: adt 16 { 17 start: Pos; # range within source files 18 stop: Pos; 19 }; 20 Id: adt 21 { 22 src: ref Src; 23 name: string; 24 offset: int; # start of pc, offset in frame, etc 25 stoppc: int; # limit pc of function 26 t: cyclic ref Type; 27 }; 28 Type: adt 29 { 30 src: ref Src; 31 kind: int; 32 size: int; 33 name: string; # for adts, modules 34 Of: cyclic ref Type; # for lists, arrays, etc. 35 ids: cyclic array of ref Id; # for adts, etc. locals for fns 36 tags: cyclic array of ref Type;# for adts with pick tags 37 38 text: fn(t: self ref Type, sym: ref Sym): string; 39 getkind: fn(t: self ref Type, sym: ref Sym): int; 40 }; 41 Sym: adt 42 { 43 path: string; 44 name: string; # implements name 45 src: array of ref Src; 46 srcstmt: array of int; 47 adts: array of ref Type; 48 fns: array of ref Id; 49 vars: array of ref Id; 50 51 srctopc: fn(s: self ref Sym, src: ref Src): int; 52 pctosrc: fn(s: self ref Sym, pc: int): ref Src; 53 }; 54 55 Module: adt 56 { 57 path: string; # from whence loaded 58 code: int; # address of code start 59 data: int; # address of data 60 comp: int; # compiled to native assembler? 61 sym: ref Sym; 62 63 addsym: fn(m: self ref Module, sym: ref Sym); 64 stdsym: fn(m: self ref Module); 65 dis: fn(m: self ref Module): string; 66 sbl: fn(m: self ref Module): string; 67 }; 68 69 StepExp, StepStmt, StepOver, StepOut: con iota; 70 Prog: adt 71 { 72 id: int; 73 heap: ref Sys->FD; # prog heap file 74 ctl: ref Sys->FD; # prog control file 75 dbgctl: ref Sys->FD; # debug file 76 stk: ref Sys->FD; # stack file 77 78 status: fn(p: self ref Prog): (int, string, string, string); 79 stack: fn(p: self ref Prog): (array of ref Exp, string); 80 step: fn(p: self ref Prog, how: int): string; 81 cont: fn(p: self ref Prog): string; 82 grab: fn(p: self ref Prog): string; 83 start: fn(p: self ref Prog): string; 84 stop: fn(p: self ref Prog): string; 85 unstop: fn(p: self ref Prog): string; 86 kill: fn(p: self ref Prog): string; 87 event: fn(p: self ref Prog): string; 88 setbpt: fn(p: self ref Prog, dis: string, pc: int): string; 89 delbpt: fn(p: self ref Prog, dis: string, pc: int): string; 90 }; 91 92 Exp: adt 93 { 94 name: string; 95 offset: int; 96 pc: int; 97 m: ref Module; 98 p: ref Prog; 99 100 # this is private 101 id: ref Id; 102 103 expand: fn(e: self ref Exp): array of ref Exp; 104 val: fn(e: self ref Exp): (string, int); 105 typename: fn(e: self ref Exp): string; 106 kind: fn(e: self ref Exp): int; 107 src: fn(e: self ref Exp): ref Src; 108 findsym:fn(e: self ref Exp): string; 109 srcstr: fn(e: self ref Exp): string; 110 }; 111 112 init: fn(): int; 113 sym: fn(sbl: string): (ref Sym, string); 114 prog: fn(pid: int): (ref Prog, string); 115 startprog: fn(dis, dir: string, ctxt: ref Draw->Context, argv: list of string): (ref Prog, string); 116}; 117