class SkipCalibrateClocksEvent : public SkipFuncEvent
{
public:
- SkipCalibrateClocksEvent(PCEventQueue *q, const std::string &desc,
+ SkipCalibrateClocksEvent(PCEventScope *s, const std::string &desc,
Addr addr)
- : SkipFuncEvent(q, desc, addr) {}
+ : SkipFuncEvent(s, desc, addr) {}
virtual void process(ThreadContext *tc);
};
class IdleStartEvent : public PCEvent
{
public:
- IdleStartEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr)
+ IdleStartEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr)
{}
virtual void process(ThreadContext *tc);
};
private:
struct SkipDelayLoopEvent : public SkipFuncEvent
{
- SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : SkipFuncEvent(q, desc, addr) {}
+ SkipDelayLoopEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : SkipFuncEvent(s, desc, addr) {}
virtual void process(ThreadContext *tc);
};
struct PrintThreadInfo : public PCEvent
{
- PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr) {}
+ PrintThreadInfo(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr) {}
virtual void process(ThreadContext *tc);
};
class DumpStatsPCEvent : public PCEvent
{
public:
- DumpStatsPCEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr)
+ DumpStatsPCEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr)
{}
virtual void process(ThreadContext* tc);
class DumpStatsPCEvent64 : public DumpStatsPCEvent {
public:
- DumpStatsPCEvent64(PCEventQueue *q, const std::string &desc, Addr addr)
- : DumpStatsPCEvent(q, desc, addr)
+ DumpStatsPCEvent64(PCEventScope *s, const std::string &desc, Addr addr)
+ : DumpStatsPCEvent(s, desc, addr)
{}
private:
void getTaskDetails(ThreadContext *tc, uint32_t &pid, uint32_t &tgid,
class IdleStartEvent : public PCEvent
{
public:
- IdleStartEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr)
+ IdleStartEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr)
{}
virtual void process(ThreadContext *tc);
};
class SkipDelayLoopEvent : public SkipFuncEvent
{
public:
- SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : SkipFuncEvent(q, desc, addr) {}
+ SkipDelayLoopEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : SkipFuncEvent(s, desc, addr) {}
virtual void process(ThreadContext *tc);
};
class PrintThreadInfo : public PCEvent
{
public:
- PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr) {}
+ PrintThreadInfo(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr) {}
virtual void process(ThreadContext *tc);
};
class IdleStartEvent : public PCEvent
{
public:
- IdleStartEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr)
+ IdleStartEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr)
{}
virtual void process(ThreadContext *tc);
};
int refcount;
public:
- HardBreakpoint(BaseRemoteGDB *_gdb, PCEventQueue *q, Addr pc)
- : PCEvent(q, "HardBreakpoint Event", pc),
+ HardBreakpoint(BaseRemoteGDB *_gdb, PCEventScope *s, Addr pc)
+ : PCEvent(s, "HardBreakpoint Event", pc),
gdb(_gdb), refcount(0)
{
DPRINTF(GDBMisc, "creating hardware breakpoint at %#x\n", evpc);
return std::equal_range(pcMap.begin(), pcMap.end(), pc, MapCompare());
}
-BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+BreakPCEvent::BreakPCEvent(PCEventScope *s, const std::string &desc, Addr addr,
bool del)
- : PCEvent(q, desc, addr), remove(del)
+ : PCEvent(s, desc, addr), remove(del)
{
}
delete this;
}
-PanicPCEvent::PanicPCEvent(PCEventQueue *q, const std::string &desc, Addr pc)
- : PCEvent(q, desc, pc)
+PanicPCEvent::PanicPCEvent(PCEventScope *s, const std::string &desc, Addr pc)
+ : PCEvent(s, desc, pc)
{
}
class ThreadContext;
class PCEventQueue;
class System;
+class PCEventScope;
class PCEvent
{
protected:
std::string description;
- PCEventQueue *queue;
+ PCEventScope *scope;
Addr evpc;
public:
- PCEvent(PCEventQueue *q, const std::string &desc, Addr pc);
+ PCEvent(PCEventScope *q, const std::string &desc, Addr pc);
- virtual ~PCEvent() { if (queue) remove(); }
+ virtual ~PCEvent() { if (scope) remove(); }
// for DPRINTF
virtual const std::string name() const { return description; }
virtual void process(ThreadContext *tc) = 0;
};
-class PCEventQueue
+class PCEventScope
+{
+ public:
+ virtual bool remove(PCEvent *event) = 0;
+ virtual bool schedule(PCEvent *event) = 0;
+};
+
+class PCEventQueue : public PCEventScope
{
protected:
class MapCompare {
PCEventQueue();
~PCEventQueue();
- bool remove(PCEvent *event);
- bool schedule(PCEvent *event);
+ bool remove(PCEvent *event) override;
+ bool schedule(PCEvent *event) override;
bool service(ThreadContext *tc)
{
if (pcMap.empty())
inline
-PCEvent::PCEvent(PCEventQueue *q, const std::string &desc, Addr pc)
- : description(desc), queue(q), evpc(pc)
+PCEvent::PCEvent(PCEventScope *s, const std::string &desc, Addr pc)
+ : description(desc), scope(s), evpc(pc)
{
- queue->schedule(this);
+ scope->schedule(this);
}
inline bool
PCEvent::remove()
{
- if (!queue)
+ if (!scope)
panic("cannot remove an uninitialized event;");
- return queue->remove(this);
+ return scope->remove(this);
}
class BreakPCEvent : public PCEvent
bool remove;
public:
- BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+ BreakPCEvent(PCEventScope *s, const std::string &desc, Addr addr,
bool del = false);
virtual void process(ThreadContext *tc);
};
class PanicPCEvent : public PCEvent
{
public:
- PanicPCEvent(PCEventQueue *q, const std::string &desc, Addr pc);
+ PanicPCEvent(PCEventScope *s, const std::string &desc, Addr pc);
virtual void process(ThreadContext *tc);
};
uint64_t argMultToNs;
public:
- UDelayEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+ UDelayEvent(PCEventScope *s, const std::string &desc, Addr addr,
uint64_t mult, uint64_t div)
- : SkipFuncEvent(q, desc, addr), argDivToNs(div), argMultToNs(mult) {}
+ : SkipFuncEvent(s, desc, addr), argDivToNs(div), argMultToNs(mult) {}
virtual void process(ThreadContext *xc);
};
class DebugPrintkEvent : public SkipFuncEvent
{
public:
- DebugPrintkEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : SkipFuncEvent(q, desc, addr) {}
+ DebugPrintkEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : SkipFuncEvent(s, desc, addr) {}
virtual void process(ThreadContext *xc);
};
std::string fname;
public:
- DmesgDumpEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+ DmesgDumpEvent(PCEventScope *s, const std::string &desc, Addr addr,
const std::string &_fname)
- : PCEvent(q, desc, addr), fname(_fname) {}
+ : PCEvent(s, desc, addr), fname(_fname) {}
virtual void process(ThreadContext *xc);
};
std::string fname;
public:
- KernelPanicEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+ KernelPanicEvent(PCEventScope *s, const std::string &desc, Addr addr,
const std::string &_fname)
- : PCEvent(q, desc, addr), fname(_fname) {}
+ : PCEvent(s, desc, addr), fname(_fname) {}
virtual void process(ThreadContext *xc);
};
uint64_t argMultToNs;
public:
- UDelayEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+ UDelayEvent(PCEventScope *s, const std::string &desc, Addr addr,
uint64_t mult, uint64_t div)
- : SkipFuncEvent(q, desc, addr), argDivToNs(div), argMultToNs(mult) {}
+ : SkipFuncEvent(s, desc, addr), argDivToNs(div), argMultToNs(mult) {}
virtual void process(ThreadContext *xc);
};
class SkipFuncEvent : public PCEvent
{
public:
- SkipFuncEvent(PCEventQueue *q, const std::string &desc, Addr addr)
- : PCEvent(q, desc, addr)
+ SkipFuncEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ : PCEvent(s, desc, addr)
{}
virtual void process(ThreadContext *tc);
};