2 // usage: acid -l pool -l leak
4 include("/sys/src/libc/port/pool.acid");
12 while a != 0 && a < 0x60000000 do {
27 while b < atail && b.magic != ARENATAIL_MAGIC do {
31 print("B2NB(", b\X, ") = b\n");
32 b = atail; // end loop
36 print("lost at block ", (b-4)\X, ", scanning forward\n");
37 while b < atail && b.magic != KEMPT_MAGIC && b.magic != FREE_MAGIC do
39 print("stopped at ", b\X, " ", *b\X, "\n");
44 print("found wrong tail to arena ", arena\X, " wanted ", atail\X, "\n");
50 if end <= a && a < xbloc then
52 if 0x7efff000 <= a && a < 0x7ffff000 then
62 if addr.magic == KEMPT_MAGIC || addr.magic == FREE_MAGIC then {
69 if addr.magic == KEMPT_MAGIC then
73 print(s, " ", addr\X, " ", a.size\X, " ");
74 print(*(addr+8)\X, " ", *(addr+12)\X, "\n");
83 print("range ", type, " ", s\X, " ", e\X, "\n");
87 if isptr(y) then print("data ", x\X, " ", y\X, " ", type, "\n");
98 // assume map()[1] is "data"
99 dumprange(map()[1][1], end, "bss"); // bss
100 dumprange(end, xbloc, "alloc"); // allocated
102 if 0x7efff000 < *SP && *SP < 0x7ffff000 then
105 s = 0x7fff7000; // 32 k
107 dumprange(s, 0x7ffff000, "stack");
113 dumprange(0, sizeofUreg, "reg");
120 print("==LEAK BEGIN==\n");
129 print("==LEAK END==\n");
135 print("==BLOCK BEGIN==\n");
137 print("==BLOCK END==\n");