base: Ensure the CP annotation compiles again

A bit of revamping to get the CP annotate functionality to compile.
This commit is contained in:
Andreas Hansson 2014-09-19 10:35:12 -04:00
parent efd5cf323a
commit 586a219d11
2 changed files with 50 additions and 13 deletions

View file

@ -28,7 +28,7 @@
* Authors: Ali Saidi * Authors: Ali Saidi
*/ */
#include "arch/alpha/linux/threadinfo.hh" #include "arch/generic/linux/threadinfo.hh"
#include "arch/utility.hh" #include "arch/utility.hh"
#include "base/loader/object_file.hh" #include "base/loader/object_file.hh"
#include "base/callback.hh" #include "base/callback.hh"
@ -37,6 +37,8 @@
#include "base/trace.hh" #include "base/trace.hh"
#include "config/the_isa.hh" #include "config/the_isa.hh"
#include "cpu/thread_context.hh" #include "cpu/thread_context.hh"
#include "debug/Annotate.hh"
#include "debug/AnnotateVerbose.hh"
#include "sim/arguments.hh" #include "sim/arguments.hh"
#include "sim/core.hh" #include "sim/core.hh"
#include "sim/sim_exit.hh" #include "sim/sim_exit.hh"
@ -142,6 +144,17 @@ CPA::startup()
registerExitCallback(new AnnotateDumpCallback(this)); 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 void
CPA::swSmBegin(ThreadContext *tc) CPA::swSmBegin(ThreadContext *tc)
{ {
@ -328,12 +341,9 @@ CPA::swAutoBegin(ThreadContext *tc, Addr next_pc)
string sym; string sym;
Addr sym_addr = 0; Addr sym_addr = 0;
SymbolTable *symtab = NULL;
if (!TheISA::inUserMode(tc)) { if (!TheISA::inUserMode(tc)) {
debugSymbolTable->findNearestSymbol(next_pc, sym, sym_addr); debugSymbolTable->findNearestSymbol(next_pc, sym, sym_addr);
symtab = debugSymbolTable;
} else { } else {
Linux::ThreadInfo ti(tc); Linux::ThreadInfo ti(tc);
string app = ti.curTaskName(); string app = ti.curTaskName();
@ -1285,7 +1295,7 @@ CPA::unserialize(Checkpoint *cp, const std::string &section)
paramIn(cp, section, csprintf("nameCache%d.str", x), str); paramIn(cp, section, csprintf("nameCache%d.str", x), str);
paramIn(cp, section, csprintf("nameCache%d.int", x), sysi); paramIn(cp, section, csprintf("nameCache%d.int", x), sysi);
nameCache[sys] = std::make_pair<std::string,int>(str, sysi); nameCache[sys] = std::make_pair(str, sysi);
} }
//smStack (SmStack) //smStack (SmStack)

View file

@ -1,4 +1,16 @@
/* /*
* Copyright (c) 2014 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
* not be construed as granting a license to any other intellectual
* property including but not limited to intellectual property relating
* to a hardware implementation of the functionality of the software
* licensed hereunder. You may use the software subject to the license
* terms below provided that you ensure that this notice is replicated
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
* Copyright (c) 2006-2009 The Regents of The University of Michigan * Copyright (c) 2006-2009 The Regents of The University of Michigan
* All rights reserved. * All rights reserved.
* *
@ -40,6 +52,7 @@
#include "base/hashmap.hh" #include "base/hashmap.hh"
#include "base/trace.hh" #include "base/trace.hh"
#include "base/types.hh" #include "base/types.hh"
#include "debug/AnnotateQ.hh"
#include "config/cp_annotate.hh" #include "config/cp_annotate.hh"
#include "config/the_isa.hh" #include "config/the_isa.hh"
#include "sim/serialize.hh" #include "sim/serialize.hh"
@ -109,6 +122,24 @@ class CPA
int32_t count = 1) { return; } int32_t count = 1) { return; }
}; };
#else #else
/**
* Provide a hash function for the CPI Id type
*/
__hash_namespace_begin
template <>
struct hash<std::pair<std::string, uint64_t> >
{
size_t
operator()(const std::pair<std::string, uint64_t>& x) const
{
return hash<std::string>()(x.first);
}
};
__hash_namespace_end
class CPA : SimObject class CPA : SimObject
{ {
public: public:
@ -290,7 +321,7 @@ class CPA : SimObject
if (smi == 0) { if (smi == 0) {
smCache[sysi-1][smid] = smi = ++numSm; smCache[sysi-1][smid] = smi = ++numSm;
assert(smi < 65535); assert(smi < 65535);
smMap.push_back(std::make_pair<int, Id>(sysi, smid)); smMap.push_back(std::make_pair(sysi, smid));
} }
return smi; return smi;
} }
@ -325,7 +356,7 @@ class CPA : SimObject
{ {
NameCache::iterator i = nameCache.find(s); NameCache::iterator i = nameCache.find(s);
if (i == nameCache.end()) { if (i == nameCache.end()) {
nameCache[s] = std::make_pair<std::string,int>(s->name(), ++numSys); nameCache[s] = std::make_pair(s->name(), ++numSys);
i = nameCache.find(s); i = nameCache.find(s);
// might need to put smstackid into map here, but perhaps not // might need to put smstackid into map here, but perhaps not
//smStack.push_back(std::vector<int>()); //smStack.push_back(std::vector<int>());
@ -354,7 +385,7 @@ class CPA : SimObject
qBytes.push_back(0); qBytes.push_back(0);
qData.push_back(AnnotateList()); qData.push_back(AnnotateList());
numQ[sys-1]++; numQ[sys-1]++;
qMap.push_back(std::make_pair<int, Id>(sys, qid)); qMap.push_back(std::make_pair(sys, qid));
} }
return qi; return qi;
} }
@ -494,11 +525,7 @@ class CPA : SimObject
CPA(Params *p); CPA(Params *p);
void startup(); void startup();
// This code is ISA specific and will need to be changed uint64_t getFrame(ThreadContext *tc);
// if the annotation code is used for something other than Alpha
inline uint64_t getFrame(ThreadContext *tc)
{ return (tc->readMiscRegNoEffect(TheISA::IPR_PALtemp23) &
~ULL(0x3FFF)); }
static bool available() { return true; } static bool available() { return true; }