3 defn acidinit() // Called after all the init modules are loaded
10 "/sys/src/libc/port/",
11 "/sys/src/libc/9sys/",
15 srcfiles = {}; // list of loaded files
16 srctext = {}; // the text of the files
26 _stk({"PC", *PC, "SP", *SP}, 0);
29 defn lstk() // trace with locals
31 _stk({"PC", *PC, "SP", *SP}, 1);
34 defn gpr() // print general(hah hah!) purpose registers
36 print("AX\t", *AX, " BX\t", *BX, " CX\t", *CX, " DX\t", *DX, "\n");
37 print("DI\t", *DI, " SI\t", *SI, " BP\t", *BP, "\n");
40 defn spr() // print special processor registers
46 print("PC\t", pc, " ", fmt(pc, 'a'), " ");
48 print("SP\t", *SP, " ECODE ", *ECODE, " EFLAG ", *EFLAGS, "\n");
49 print("CS\t", *CS, " DS\t ", *DS, " SS\t", *SS, "\n");
50 print("GS\t", *GS, " FS\t ", *FS, " ES\t", *ES, "\n");
53 print("TRAP\t", cause, " ", reason(cause), "\n");
56 defn regs() // print all registers
64 print("MM0\t", *MM0, " MM1\t", *MM1, "\n");
65 print("MM2\t", *MM2, " MM3\t", *MM3, "\n");
66 print("MM4\t", *MM4, " MM5\t", *MM5, "\n");
67 print("MM6\t", *MM6, " MM7\t", *MM7, "\n");
72 if *fmt(*PC-1, 'b') == 0xCC then {
73 // Linux stops us after the breakpoint, not at it
87 // FIgure out why we stopped.
88 if *fmt(pc, 'b') == 0xCC then {
91 // fix up instruction for print; will put back later
93 } else if *(pc-2\x) == 0x80CD then {
99 if printstopped then {
100 print(pid,": ", why, "\t");
101 print(fmt(pc, 'a'), "\t", *fmt(pc, 'i'), "\n");
104 if why == "breakpoint" then
105 *fmt(pc, bpfmt) = bpinst;
107 if printstopped && notes then {
108 if notes[0] != "sys: breakpoint" then {
109 print("Notes pending:\n");
112 print("\t", head l, "\n");
148 print(" di ", addr.di, "\n");
149 print(" si ", addr.si, "\n");
150 print(" bp ", addr.bp, "\n");
151 print(" nsp ", addr.nsp, "\n");
152 print(" bx ", addr.bx, "\n");
153 print(" dx ", addr.dx, "\n");
154 print(" cx ", addr.cx, "\n");
155 print(" ax ", addr.ax, "\n");
156 print(" gs ", addr.gs, "\n");
157 print(" fs ", addr.fs, "\n");
158 print(" es ", addr.es, "\n");
159 print(" ds ", addr.ds, "\n");
160 print(" trap ", addr.trap, "\n");
161 print(" ecode ", addr.ecode, "\n");
162 print(" pc ", addr.pc, "\n");
163 print(" cs ", addr.cs, "\n");
164 print(" flags ", addr.flags, "\n");
165 print(" sp ", addr.sp, "\n");
166 print(" ss ", addr.ss, "\n");
190 if !havesymbol("_DYNAMIC") then
195 if *a == 21 then // 21 == DT_DEBUG
205 if systype == "linux" || systype == "freebsd" then {
213 while m != 0 && n < 100 do {
215 if m.name && *(m.name\b) && access(*(m.name\s)) then
216 print("textfile({\"", *(m.name\s), "\", ", m.addr\X, "});\n");