diff --git a/mps/code/buffer.c b/mps/code/buffer.c index 6e6616fc5b8..e55c12a7e8d 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -147,10 +147,17 @@ Bool BufferCheck(Buffer buffer) Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream) { Res res; + char abzMode[5]; if (!CHECKT(Buffer, buffer)) return ResFAIL; if (stream == NULL) return ResFAIL; + abzMode[0] = (buffer->mode & BufferModeTRANSITION) ? 't' : '_'; + abzMode[1] = (buffer->mode & BufferModeLOGGED) ? 'l' : '_'; + abzMode[2] = (buffer->mode & BufferModeFLIPPED) ? 'f' : '_'; + abzMode[3] = (buffer->mode & BufferModeATTACHED) ? 'a' : '_'; + abzMode[4] = '\0'; + res = WriteF(stream, "Buffer $P ($U) {\n", (WriteFP)buffer, (WriteFU)buffer->serial, @@ -160,7 +167,8 @@ Res BufferDescribe(Buffer buffer, mps_lib_FILE *stream) " Pool $P\n", (WriteFP)buffer->pool, buffer->isMutator ? " Mutator Buffer\n" : " Internal Buffer\n", - " Mode $B\n", (WriteFB)(buffer->mode), + " mode $S (TRANSITION, LOGGED, FLIPPED, ATTACHED)\n", + (WriteFS)abzMode, " fillSize $UKb\n", (WriteFU)(buffer->fillSize / 1024), " emptySize $UKb\n", (WriteFU)(buffer->emptySize / 1024), " alignment $W\n", (WriteFW)buffer->alignment, diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index df0716571cb..b92e0877aca 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -26,6 +26,7 @@ typedef struct amcGenStruct *amcGen; /* forward declarations */ +static Bool amcSegHasNailboard(Seg seg); static Bool AMCCheck(AMC amc); static Res AMCFix(Pool pool, ScanState ss, Seg seg, Ref *refIO); static Res AMCHeaderFix(Pool pool, ScanState ss, Seg seg, Ref *refIO); @@ -105,6 +106,9 @@ static Bool amcSegCheck(amcSeg amcseg) CHECKD(GCSeg, &amcseg->gcSegStruct); CHECKL(*amcseg->segTypeP == AMCPTypeNailboard || *amcseg->segTypeP == AMCPTypeGen); + if (*amcseg->segTypeP == AMCPTypeNailboard) { + CHECKL(SegNailed(amcSeg2Seg(amcseg)) != TraceSetEMPTY); + } CHECKL(BoolCheck(amcseg->new)); return TRUE; } @@ -160,7 +164,7 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) if (!CHECKT(amcSeg, amcseg)) return ResFAIL; /* Describe the superclass fields first via next-method call */ - super = SEG_SUPERCLASS(GCSegClass); + super = SEG_SUPERCLASS(amcSegClass); res = super->describe(seg, stream); if (res != ResOK) return res; @@ -171,18 +175,33 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) base = SegBase(seg); p = AddrAdd(base, pool->format->headerSize); limit = SegLimit(seg); - if (SegBuffer(seg) != NULL) - init = BufferGetInit(SegBuffer(seg)); - else - init = limit; res = WriteF(stream, "AMC seg $P [$A,$A){\n", (WriteFP)seg, (WriteFA)base, (WriteFA)limit, - " Map\n", NULL); if (res != ResOK) return res; + if (amcSegHasNailboard(seg)) { + res = WriteF(stream, " Boarded\n", NULL); + /* @@@@ should have AMCNailboardDescribe() */ + } else { + if (SegNailed(seg) == TraceSetEMPTY) { + res = WriteF(stream, " Mobile\n", NULL); + } else { + res = WriteF(stream, " Stuck\n", NULL); + } + } + if (res != ResOK) return res; + + res = WriteF(stream, " Map: *===:object bbbb:buffer\n", NULL); + if (res != ResOK) return res; + + if (SegBuffer(seg) != NULL) + init = BufferGetInit(SegBuffer(seg)); + else + init = limit; + for(i = base; i < limit; i = AddrAdd(i, row)) { Addr j; char c; @@ -194,9 +213,9 @@ static Res AMCSegDescribe(Seg seg, mps_lib_FILE *stream) /* @@@@ This misses a header-sized pad at the end. */ for(j = i; j < AddrAdd(i, row); j = AddrAdd(j, step)) { if (j >= limit) - c = ' '; + c = ' '; /* if seg is not a whole number of print rows */ else if (j >= init) - c = '.'; + c = 'b'; else if (j == p) { c = '*'; p = (pool->format->skip)(p); diff --git a/mps/code/seg.c b/mps/code/seg.c index 05773c0198a..9acf15f73c0 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -1560,14 +1560,20 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream) res = super->describe(seg, stream); if (res != ResOK) return res; - if (gcseg->buffer != NULL) { - res = BufferDescribe(gcseg->buffer, stream); - if (res != ResOK) return res; - } res = WriteF(stream, " summary $W\n", (WriteFW)gcseg->summary, NULL); - return res; + if (res != ResOK) return res; + + if (gcseg->buffer == NULL) { + res = WriteF(stream, " buffer: NULL\n", NULL); + } + else { + res = BufferDescribe(gcseg->buffer, stream); + } + if (res != ResOK) return res; + + return ResOK; }