systemc: Add a bunch of missing overrides to the systemc headers.
[gem5.git] / src / base / cp_annotate.cc
index 69b926b29921cdb8aaac09962dead62403eeec8f..b387b99ca7f96b747a8f592dd5af396030897374 100644 (file)
  * Authors: Ali Saidi
  */
 
-#include "arch/utility.hh"
-#include "arch/alpha/linux/threadinfo.hh"
 #include "base/cp_annotate.hh"
+
+#include "arch/generic/linux/threadinfo.hh"
+#include "arch/utility.hh"
 #include "base/callback.hh"
 #include "base/loader/object_file.hh"
 #include "base/output.hh"
 #include "base/trace.hh"
 #include "config/the_isa.hh"
 #include "cpu/thread_context.hh"
+#include "debug/Annotate.hh"
+#include "debug/AnnotateVerbose.hh"
 #include "sim/arguments.hh"
 #include "sim/core.hh"
 #include "sim/sim_exit.hh"
@@ -142,6 +145,17 @@ CPA::startup()
 
     registerExitCallback(new AnnotateDumpCallback(this));
 }
+
+uint64_t
+CPA::getFrame(ThreadContext *tc)
+{
+    // This code is ISA specific and will need to be changed
+    // if the annotation code is used for something other than Alpha
+    return (tc->readMiscRegNoEffect(TheISA::IPR_PALtemp23) &
+            ~ULL(0x3FFF));
+
+}
+
 void
 CPA::swSmBegin(ThreadContext *tc)
 {
@@ -156,7 +170,7 @@ CPA::swSmBegin(ThreadContext *tc)
         debugSymbolTable->findNearestSymbol(
             tc->readIntReg(ReturnAddressReg), st, junk);
 
-    CopyStringOut(tc, sm, args[0], 50);
+    tc->getVirtProxy().readString(sm, args[0], 50);
     System *sys = tc->getSystemPtr();
     StringWrap name(sys->name());
 
@@ -167,8 +181,8 @@ CPA::swSmBegin(ThreadContext *tc)
     int smi = getSm(sysi, sm, args[1]);
     DPRINTF(Annotate,  "Starting machine: %s(%d) sysi: %d id: %#x\n", sm,
             smi, sysi, args[1]);
-    DPRINTF(Annotate, "smMap[%d] = %d, %s, %#x\n", smi, 
-            smMap[smi-1].first, smMap[smi-1].second.first, 
+    DPRINTF(Annotate, "smMap[%d] = %d, %s, %#x\n", smi,
+            smMap[smi-1].first, smMap[smi-1].second.first,
             smMap[smi-1].second.second);
 
     uint64_t frame = getFrame(tc);
@@ -213,7 +227,7 @@ CPA::swSmBegin(ThreadContext *tc)
         scLinks[sysi-1].erase(id);
         an->stq = smi;
         an->dump = true;
-        DPRINTF(Annotate, 
+        DPRINTF(Annotate,
                 "Found prev unknown linking from %d to state machine %s(%d)\n",
                 an->sm, sm, smi);
 
@@ -242,7 +256,7 @@ CPA::swSmEnd(ThreadContext *tc)
 
     Arguments args(tc);
     char sm[50];
-    CopyStringOut(tc, sm, args[0], 50);
+    tc->getVirtProxy().readString(sm, args[0], 50);
     System *sys = tc->getSystemPtr();
     doSwSmEnd(sys, tc->contextId(), sm, getFrame(tc));
 }
@@ -275,11 +289,11 @@ CPA::doSwSmEnd(System *sys, int cpuid, string sm, uint64_t frame)
 
         warn("State machine stack not unwinding correctly at %d\n", curTick());
     } else {
-        DPRINTF(Annotate, 
+        DPRINTF(Annotate,
                 "State machine ending:%s sysi:%d id:%#x back:%d getSm:%d\n",
                 sm, sysi, smMap[smib-1].second.second, smStack[sid].back(),
                 getSm(sysi, sm, smMap[smib-1].second.second));
-        assert(getSm(sysi, sm, smMap[smib-1].second.second) == 
+        assert(getSm(sysi, sm, smMap[smib-1].second.second) ==
                 smStack[sid].back());
 
         int smi = smStack[sid].back();
@@ -310,7 +324,7 @@ CPA::swExplictBegin(ThreadContext *tc)
 
     Arguments args(tc);
     char st[50];
-    CopyStringOut(tc, st, args[1], 50);
+    tc->getVirtProxy().readString(st, args[1], 50);
 
     StringWrap name(tc->getSystemPtr()->name());
     DPRINTF(Annotate, "Explict begin of state %s\n", st);
@@ -328,12 +342,9 @@ CPA::swAutoBegin(ThreadContext *tc, Addr next_pc)
 
     string sym;
     Addr sym_addr = 0;
-    SymbolTable *symtab = NULL;
-
 
     if (!TheISA::inUserMode(tc)) {
         debugSymbolTable->findNearestSymbol(next_pc, sym, sym_addr);
-        symtab = debugSymbolTable;
     } else {
         Linux::ThreadInfo ti(tc);
         string app = ti.curTaskName();
@@ -390,7 +401,7 @@ CPA::swEnd(ThreadContext *tc)
             tc->readIntReg(ReturnAddressReg), st, junk);
     System *sys = tc->getSystemPtr();
     StringWrap name(sys->name());
+
     int sysi = getSys(sys);
     StackId sid = StackId(sysi, getFrame(tc));
     if (!smStack[sid].size()) {
@@ -417,7 +428,7 @@ CPA::swQ(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     int32_t count = args[2];
     System *sys = tc->getSystemPtr();
 
@@ -433,7 +444,7 @@ CPA::swQ(ThreadContext *tc)
         //warn("Tried to queue 0 bytes in %s, ignoring\n", q);
         return;
     }
-    DPRINTFS(AnnotateQ, sys, 
+    DPRINTFS(AnnotateQ, sys,
             "swQ: %s[%#x] cur size %d %d bytes: %d adding: %d\n",
             q, id, qSize[qi-1], qData[qi-1].size(), qBytes[qi-1], count);
     doQ(sys, FL_NONE, tc->contextId(), smi, q, qi, count);
@@ -448,7 +459,7 @@ CPA::swDq(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     int32_t count = args[2];
     System *sys = tc->getSystemPtr();
 
@@ -460,7 +471,7 @@ CPA::swDq(ThreadContext *tc)
     int qi = getQ(sysi, q, id);
     if (swExpl[sid])
         swExpl[sid] = false;
-    DPRINTFS(AnnotateQ, sys, 
+    DPRINTFS(AnnotateQ, sys,
             "swDq: %s[%#x] cur size %d %d bytes: %d removing: %d\n",
             q, id, qSize[qi-1], qData[qi-1].size(), qBytes[qi-1], count);
     assert(count != 0);
@@ -477,7 +488,7 @@ CPA::swPq(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     System *sys = tc->getSystemPtr();
     int32_t count = args[2];
 
@@ -489,7 +500,7 @@ CPA::swPq(ThreadContext *tc)
     int qi = getQ(sysi, q, id);
     if (swExpl[sid])
         swExpl[sid] = false;
-    DPRINTFS(AnnotateQ, sys, 
+    DPRINTFS(AnnotateQ, sys,
             "swPq: %s [%#x] cur size %d %d bytes: %d peeking: %d\n",
             q, id, qSize[qi-1], qData[qi-1].size(), qBytes[qi-1], count);
 
@@ -512,7 +523,7 @@ CPA::swRq(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     System *sys = tc->getSystemPtr();
     int32_t count = args[2];
 
@@ -524,7 +535,7 @@ CPA::swRq(ThreadContext *tc)
     int qi = getQ(sysi, q, id);
     if (swExpl[sid])
         swExpl[sid] = false;
-    DPRINTFS(AnnotateQ, sys, 
+    DPRINTFS(AnnotateQ, sys,
             "swRq: %s [%#x] cur size %d %d bytes: %d reserve: %d\n",
             q, id, qSize[qi-1], qData[qi-1].size(), qBytes[qi-1], count);
 
@@ -543,7 +554,7 @@ CPA::swWf(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     System *sys = tc->getSystemPtr();
     int32_t count = args[3];
 
@@ -557,7 +568,7 @@ CPA::swWf(ThreadContext *tc)
 
     if (!!args[2]) {
         char sm[50];
-        CopyStringOut(tc, sm, args[2], 50);
+        tc->getVirtProxy().readString(sm, args[2], 50);
         doSwSmEnd(tc->getSystemPtr(), tc->contextId(), sm, getFrame(tc));
     }
 }
@@ -571,7 +582,7 @@ CPA::swWe(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     System *sys = tc->getSystemPtr();
     int32_t count = args[3];
 
@@ -585,7 +596,7 @@ CPA::swWe(ThreadContext *tc)
 
     if (!!args[2]) {
         char sm[50];
-        CopyStringOut(tc, sm, args[2], 50);
+        tc->getVirtProxy().readString(sm, args[2], 50);
         doSwSmEnd(tc->getSystemPtr(), tc->contextId(), sm, getFrame(tc));
     }
 }
@@ -599,7 +610,7 @@ CPA::swSq(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     System *sys = tc->getSystemPtr();
     StringWrap name(sys->name());
     int32_t size = args[2];
@@ -667,7 +678,7 @@ CPA::swAq(ThreadContext *tc)
     char q[50];
     Arguments args(tc);
     uint64_t id = args[0];
-    CopyStringOut(tc, q, args[1], 50);
+    tc->getVirtProxy().readString(q, args[1], 50);
     System *sys = tc->getSystemPtr();
     StringWrap name(sys->name());
     int32_t size = args[2];
@@ -686,7 +697,7 @@ CPA::swAq(ThreadContext *tc)
             x++;
         }
 
-        warn("%d: Queue Assert: SW said there should be %d byte(s) in %s," 
+        warn("%d: Queue Assert: SW said there should be %d byte(s) in %s,"
                 "however there are %d byte(s)\n",
             curTick(), size, q, qBytes[qi-1]);
         DPRINTF(AnnotateQ, "%d: Queue Assert: SW said there should be %d"
@@ -703,7 +714,7 @@ CPA::swLink(ThreadContext *tc)
 
     char lsm[50];
     Arguments args(tc);
-    CopyStringOut(tc, lsm, args[0], 50);
+    tc->getVirtProxy().readString(lsm, args[0], 50);
     System *sys = tc->getSystemPtr();
     StringWrap name(sys->name());
 
@@ -727,7 +738,7 @@ CPA::swLink(ThreadContext *tc)
 
     if (!!args[2]) {
         char sm[50];
-        CopyStringOut(tc, sm, args[2], 50);
+        tc->getVirtProxy().readString(sm, args[2], 50);
         doSwSmEnd(tc->getSystemPtr(), tc->contextId(), sm, getFrame(tc));
     }
 }
@@ -778,7 +789,7 @@ CPA::swSyscallLink(ThreadContext  *tc)
 
     char lsm[50];
     Arguments args(tc);
-    CopyStringOut(tc, lsm, args[0], 50);
+    tc->getVirtProxy().readString(lsm, args[0], 50);
     System *sys = tc->getSystemPtr();
     StringWrap name(sys->name());
     int sysi = getSys(sys);
@@ -795,7 +806,7 @@ CPA::swSyscallLink(ThreadContext  *tc)
             smi, lsm);
 
     if (scLinks[sysi-1][id])
-        DPRINTF(Annotate, 
+        DPRINTF(Annotate,
                 "scLinks already contains entry for system %d %s[%x] of %d\n",
                 sysi, lsm, getFrame(tc), scLinks[sysi-1][id]);
     assert(scLinks[sysi-1][id] == 0);
@@ -804,7 +815,7 @@ CPA::swSyscallLink(ThreadContext  *tc)
 
     if (!!args[1]) {
         char sm[50];
-        CopyStringOut(tc, sm, args[1], 50);
+        tc->getVirtProxy().readString(sm, args[1], 50);
         doSwSmEnd(tc->getSystemPtr(), tc->contextId(), sm, getFrame(tc));
     }
 }
@@ -812,7 +823,7 @@ CPA::swSyscallLink(ThreadContext  *tc)
 CPA::AnnDataPtr
 CPA::add(int t, int f, int c, int sm, int stq, int32_t d)
 {
-    AnnDataPtr an = new AnnotateData;
+    AnnDataPtr an = std::make_shared<AnnotateData>();
     an->time = curTick();
     an->data = d;
     an->orig_data = d;
@@ -827,7 +838,7 @@ CPA::add(int t, int f, int c, int sm, int stq, int32_t d)
 
     DPRINTF(AnnotateVerbose, "Annotate: op: %d flags: 0x%x sm: %d state: %d time: %d, data: %d\n",
             an->op, an->flag, an->sm, an->stq, an->time, an->data);
-    
+
     // Don't dump Links because we might be setting no-dump on it
     if (an->op != OP_LINK)
         dump(false);
@@ -1053,7 +1064,7 @@ CPA::doDq(System *sys, int flags, int cpuid, int sm,
 
 
 void
-CPA::serialize(std::ostream &os)
+CPA::serialize(CheckpointOut &cp) const
 {
 
     SERIALIZE_SCALAR(numSm);
@@ -1067,8 +1078,6 @@ CPA::serialize(std::ostream &os)
     arrayParamOut(os, "qSize", qSize);
     arrayParamOut(os, "qBytes", qBytes);
 
-    std::list<AnnDataPtr>::iterator ai;
-
     SCache::iterator i;
     int x = 0, y = 0;
 
@@ -1197,40 +1206,37 @@ CPA::serialize(std::ostream &os)
     }
 
     // qData (vector<AnnotateList>)
-    for(x = 0; x < qData.size(); x++) {
+    for (x = 0; x < qData.size(); x++) {
         if (!qData[x].size())
             continue;
         y = 0;
-        ai = qData[x].begin();
-        while (ai != qData[x].end()) {
-            nameOut(os, csprintf("%s.Q%d_%d", name(), x, y));
-            (*ai)->serialize(os);
-            ai++;
+        for (auto &ann : qData[x]) {
+            ann->serializeSection(os, csprintf("Q%d_%d", x, y));
             y++;
         }
     }
 }
 
 void
-CPA::unserialize(Checkpoint *cp, const std::string &section)
+CPA::unserialize(CheckpointIn &cp)
 {
     UNSERIALIZE_SCALAR(numSm);
     UNSERIALIZE_SCALAR(numSmt);
-    arrayParamIn(cp, section, "numSt", numSt);
-    arrayParamIn(cp, section, "numQ", numQ);
+    UNSERIALIZE_CONTAINER(numSt);
+    UNSERIALIZE_CONTAINER(numQ);
     UNSERIALIZE_SCALAR(numSys);
     UNSERIALIZE_SCALAR(numQs);
     UNSERIALIZE_SCALAR(conId);
-    arrayParamIn(cp, section, "qSize", qSize);
-    arrayParamIn(cp, section, "qBytes", qBytes);
+    UNSERIALIZE_CONTAINER(qSize);
+    UNSERIALIZE_CONTAINER(qBytes);
 
 
     // smtCache (SCache
     string str;
     int smi;
     for (int x = 0;  x < numSmt; x++) {
-        paramIn(cp, section, csprintf("smtCache%d.str", x), str);
-        paramIn(cp, section, csprintf("smtCache%d.int", x), smi);
+        paramIn(cp, csprintf("smtCache%d.str", x), str);
+        paramIn(cp, csprintf("smtCache%d.int", x), smi);
         smtCache[str] = smi;
     }
 
@@ -1238,8 +1244,8 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
     stCache.resize(numSmt);
     for (int x = 0;  x < numSmt; x++) {
         for (int y = 0; y < numSt[x]; y++) {
-            paramIn(cp, section, csprintf("stCache%d_%d.str", x,y), str);
-            paramIn(cp, section, csprintf("stCache%d_%d.int", x,y), smi);
+            paramIn(cp, csprintf("stCache%d_%d.str", x,y), str);
+            paramIn(cp, csprintf("stCache%d_%d.int", x,y), smi);
             stCache[x][str] = smi;
         }
     }
@@ -1249,9 +1255,9 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
     qCache.resize(numSys);
     for (int x = 0;  x < numSys; x++) {
         for (int y = 0; y < numQ[x]; y++) {
-            paramIn(cp, section, csprintf("qCache%d_%d.str", x,y), str);
-            paramIn(cp, section, csprintf("qCache%d_%d.id", x,y), id);
-            paramIn(cp, section, csprintf("qCache%d_%d.int", x,y), smi);
+            paramIn(cp, csprintf("qCache%d_%d.str", x,y), str);
+            paramIn(cp, csprintf("qCache%d_%d.id", x,y), id);
+            paramIn(cp, csprintf("qCache%d_%d.int", x,y), smi);
             qCache[x][Id(str,id)] = smi;
         }
     }
@@ -1260,11 +1266,11 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
     smCache.resize(numSys);
     for (int x = 0;  x < numSys; x++) {
         int size;
-        paramIn(cp, section, csprintf("smCache%d", x), size);
+        paramIn(cp, csprintf("smCache%d", x), size);
         for (int y = 0; y < size; y++) {
-            paramIn(cp, section, csprintf("smCache%d_%d.str", x,y), str);
-            paramIn(cp, section, csprintf("smCache%d_%d.id", x,y), id);
-            paramIn(cp, section, csprintf("smCache%d_%d.int", x,y), smi);
+            paramIn(cp, csprintf("smCache%d_%d.str", x,y), str);
+            paramIn(cp, csprintf("smCache%d_%d.id", x,y), id);
+            paramIn(cp, csprintf("smCache%d_%d.int", x,y), smi);
             smCache[x][Id(str,id)] = smi;
         }
     }
@@ -1280,27 +1286,27 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
         string str;
         int sysi;
 
-        objParamIn(cp, section, csprintf("nameCache%d.name", x), sptr);
+        objParamIn(cp, csprintf("nameCache%d.name", x), sptr);
         sys = dynamic_cast<System*>(sptr);
 
-        paramIn(cp, section, csprintf("nameCache%d.str", x), str);
-        paramIn(cp, section, csprintf("nameCache%d.int", x), sysi);
-        nameCache[sys] = std::make_pair<std::string,int>(str, sysi);
+        paramIn(cp, csprintf("nameCache%d.str", x), str);
+        paramIn(cp, csprintf("nameCache%d.int", x), sysi);
+        nameCache[sys] = std::make_pair(str, sysi);
     }
 
     //smStack (SmStack)
     int smStack_size;
-    paramIn(cp, section, "smStackIdCount", smStack_size);
+    paramIn(cp, "smStackIdCount", smStack_size);
     for (int x = 0; x < smStack_size; x++) {
         int sysi;
         uint64_t frame;
         int count;
-        paramIn(cp, section, csprintf("smStackId%d.sys", x), sysi);
-        paramIn(cp, section, csprintf("smStackId%d.frame", x), frame);
-        paramIn(cp, section, csprintf("smStackId%d.count", x), count);
+        paramIn(cp, csprintf("smStackId%d.sys", x), sysi);
+        paramIn(cp, csprintf("smStackId%d.frame", x), frame);
+        paramIn(cp, csprintf("smStackId%d.count", x), count);
         StackId sid = StackId(sysi, frame);
         for (int y = 0; y < count; y++) {
-            paramIn(cp, section, csprintf("smStackId%d_%d", x, y), smi);
+            paramIn(cp, csprintf("smStackId%d_%d", x, y), smi);
             smStack[sid].push_back(smi);
         }
     }
@@ -1308,23 +1314,23 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
     // lnMap (LinkMap)
     int lsmi;
     int lnMap_size;
-    paramIn(cp, section, "lnMapSize", lnMap_size);
+    paramIn(cp, "lnMapSize", lnMap_size);
     for (int x = 0;  x < lnMap_size; x++) {
-        paramIn(cp, section, csprintf("lnMap%d.smi", x), smi);
-        paramIn(cp, section, csprintf("lnMap%d.lsmi", x), lsmi);
+        paramIn(cp, csprintf("lnMap%d.smi", x), smi);
+        paramIn(cp, csprintf("lnMap%d.lsmi", x), lsmi);
         lnMap[smi] = lsmi;
     }
 
     // swExpl (vector)
     int swExpl_size;
-    paramIn(cp, section, "swExplCount", swExpl_size);
+    paramIn(cp, "swExplCount", swExpl_size);
     for (int x = 0; x < swExpl_size; x++) {
         int sysi;
         uint64_t frame;
         bool b;
-        paramIn(cp, section, csprintf("swExpl%d.sys", x), sysi);
-        paramIn(cp, section, csprintf("swExpl%d.frame", x), frame);
-        paramIn(cp, section, csprintf("swExpl%d.swexpl", x), b);
+        paramIn(cp, csprintf("swExpl%d.sys", x), sysi);
+        paramIn(cp, csprintf("swExpl%d.frame", x), frame);
+        paramIn(cp, csprintf("swExpl%d.swexpl", x), b);
         StackId sid = StackId(sysi, frame);
         swExpl[sid] = b;
     }
@@ -1332,10 +1338,10 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
     // lastState (IMap)
     int sti;
     int lastState_size;
-    paramIn(cp, section, "lastStateSize", lastState_size);
+    paramIn(cp, "lastStateSize", lastState_size);
     for (int x = 0;  x < lastState_size; x++) {
-        paramIn(cp, section, csprintf("lastState%d.smi", x), smi);
-        paramIn(cp, section, csprintf("lastState%d.sti", x), sti);
+        paramIn(cp, csprintf("lastState%d.smi", x), smi);
+        paramIn(cp, csprintf("lastState%d.sti", x), sti);
         lastState[smi] = sti;
     }
 
@@ -1343,17 +1349,17 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
     //smMap (IdMap)
     smMap.resize(numSm);
     for (int x = 0; x < smMap.size(); x++) {
-        paramIn(cp, section, csprintf("smMap%d.sys", x), smMap[x].first);
-        paramIn(cp, section, csprintf("smMap%d.smname", x), smMap[x].second.first);
-        paramIn(cp, section, csprintf("smMap%d.id", x), smMap[x].second.second);
+        paramIn(cp, csprintf("smMap%d.sys", x), smMap[x].first);
+        paramIn(cp, csprintf("smMap%d.smname", x), smMap[x].second.first);
+        paramIn(cp, csprintf("smMap%d.id", x), smMap[x].second.second);
     }
 
     //qMap (IdMap)
     qMap.resize(numQs);
     for (int x = 0; x < qMap.size(); x++) {
-        paramIn(cp, section, csprintf("qMap%d.sys", x), qMap[x].first);
-        paramIn(cp, section, csprintf("qMap%d.qname", x), qMap[x].second.first);
-        paramIn(cp, section, csprintf("qMap%d.id", x), qMap[x].second.second);
+        paramIn(cp, csprintf("qMap%d.sys", x), qMap[x].first);
+        paramIn(cp, csprintf("qMap%d.qname", x), qMap[x].second.first);
+        paramIn(cp, csprintf("qMap%d.id", x), qMap[x].second.second);
     }
 
 
@@ -1363,8 +1369,8 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
         if (!qSize[x])
             continue;
         for (int y = 0; y < qSize[x]; y++) {
-            AnnDataPtr a = new AnnotateData;
-            a->unserialize(cp, csprintf("%s.Q%d_%d", section, x, y));
+            AnnDataPtr a = std::make_shared<AnnotateData>();
+            a->unserializeSection(cp, csprintf("Q%d_%d", x, y));
             data.push_back(a);
             qData[x].push_back(a);
         }
@@ -1372,7 +1378,7 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
 }
 
 void
-CPA::AnnotateData::serialize(std::ostream &os)
+CPA::AnnotateData::serialize(CheckpointOut &cp) const
 {
     SERIALIZE_SCALAR(time);
     SERIALIZE_SCALAR(data);
@@ -1384,7 +1390,7 @@ CPA::AnnotateData::serialize(std::ostream &os)
 }
 
 void
-CPA::AnnotateData::unserialize(Checkpoint *cp, const std::string &section)
+CPA::AnnotateData::unserialize(CheckpointIn &cp)
 {
     UNSERIALIZE_SCALAR(time);
     UNSERIALIZE_SCALAR(data);