CPA: Add code to automatically record function symbols as CPU executes.

This commit is contained in:
Ali Saidi 2009-02-26 19:29:17 -05:00
parent 6fd4bc34a1
commit d447ccb2c6
4 changed files with 20 additions and 0 deletions

View file

@ -35,6 +35,7 @@
#include "arch/alpha/osfpal.hh" #include "arch/alpha/osfpal.hh"
#include "arch/alpha/tlb.hh" #include "arch/alpha/tlb.hh"
#include "arch/alpha/kgdb.h" #include "arch/alpha/kgdb.h"
#include "base/cp_annotate.hh"
#include "base/debug.hh" #include "base/debug.hh"
#include "base/remote_gdb.hh" #include "base/remote_gdb.hh"
#include "base/stats/events.hh" #include "base/stats/events.hh"
@ -560,6 +561,8 @@ SimpleThread::hwrei()
setNextPC(readMiscRegNoEffect(IPR_EXC_ADDR)); setNextPC(readMiscRegNoEffect(IPR_EXC_ADDR));
CPA::cpa()->swAutoBegin(tc, readNextPC());
if (!misspeculating()) { if (!misspeculating()) {
if (kernelStats) if (kernelStats)
kernelStats->hwrei(); kernelStats->hwrei();

View file

@ -36,6 +36,7 @@
#include <string> #include <string>
#include "arch/utility.hh" #include "arch/utility.hh"
#include "base/cp_annotate.hh"
#include "base/loader/symtab.hh" #include "base/loader/symtab.hh"
#include "base/timebuf.hh" #include "base/timebuf.hh"
#include "cpu/exetrace.hh" #include "cpu/exetrace.hh"
@ -1097,6 +1098,12 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num)
if (node) if (node)
thread[tid]->profileNode = node; thread[tid]->profileNode = node;
} }
if (CPA::available()) {
if (head_inst->isControl()) {
ThreadContext *tc = thread[tid]->getTC();
CPA::cpa()->swAutoBegin(tc, head_inst->readNextPC());
}
}
#endif #endif
if (head_inst->traceData) { if (head_inst->traceData) {

View file

@ -28,6 +28,7 @@
* Authors: Kevin Lim * Authors: Kevin Lim
*/ */
#include "base/cp_annotate.hh"
#include "cpu/o3/dyn_inst.hh" #include "cpu/o3/dyn_inst.hh"
template <class Impl> template <class Impl>
@ -136,6 +137,10 @@ BaseO3DynInst<Impl>::hwrei()
// Set the next PC based on the value of the EXC_ADDR IPR. // Set the next PC based on the value of the EXC_ADDR IPR.
this->setNextPC(this->cpu->readMiscRegNoEffect(AlphaISA::IPR_EXC_ADDR, this->setNextPC(this->cpu->readMiscRegNoEffect(AlphaISA::IPR_EXC_ADDR,
this->threadNumber)); this->threadNumber));
if (CPA::available()) {
ThreadContext *tc = this->cpu->tcBase(this->threadNumber);
CPA::cpa()->swAutoBegin(tc, this->readNextPC());
}
// Tell CPU to clear any state it needs to if a hwrei is taken. // Tell CPU to clear any state it needs to if a hwrei is taken.
this->cpu->hwrei(this->threadNumber); this->cpu->hwrei(this->threadNumber);

View file

@ -31,6 +31,7 @@
#include "arch/utility.hh" #include "arch/utility.hh"
#include "arch/faults.hh" #include "arch/faults.hh"
#include "base/cprintf.hh" #include "base/cprintf.hh"
#include "base/cp_annotate.hh"
#include "base/inifile.hh" #include "base/inifile.hh"
#include "base/loader/symtab.hh" #include "base/loader/symtab.hh"
#include "base/misc.hh" #include "base/misc.hh"
@ -450,6 +451,10 @@ BaseSimpleCPU::postExecute()
comLoadEventQueue[0]->serviceEvents(numLoad); comLoadEventQueue[0]->serviceEvents(numLoad);
} }
if (CPA::available()) {
CPA::cpa()->swAutoBegin(tc, thread->readNextPC());
}
traceFunctions(thread->readPC()); traceFunctions(thread->readPC());
if (traceData) { if (traceData) {