*/
#include <algorithm>
-#include <map>
#include <string>
#include <utility>
#include "base/debug.hh"
#include "base/trace.hh"
-#include "config/full_system.hh"
#include "cpu/base.hh"
-#include "cpu/thread_context.hh"
#include "cpu/pc_event.hh"
+#include "cpu/thread_context.hh"
+#include "debug/PCEvent.hh"
#include "sim/core.hh"
#include "sim/system.hh"
{
int removed = 0;
range_t range = equal_range(event);
- for (iterator i = range.first; i != range.second; ++i) {
+ iterator i = range.first;
+ while (i != range.second &&
+ i != pc_map.end()) {
if (*i == event) {
DPRINTF(PCEvent, "PC based event removed at %#x: %s\n",
event->pc(), event->descr());
- pc_map.erase(i);
+ i = pc_map.erase(i);
++removed;
+ } else {
+ i++;
}
+
}
return removed > 0;
bool
PCEventQueue::doService(ThreadContext *tc)
{
- Addr pc = tc->readPC() & ~0x3;
+ // This will fail to break on Alpha PALcode addresses, but that is
+ // a rare use case.
+ Addr pc = tc->instAddr();
int serviced = 0;
range_t range = equal_range(pc);
for (iterator i = range.first; i != range.second; ++i) {
// another event. This for example, prevents two invocations
// of the SkipFuncEvent. Maybe we should have separate PC
// event queues for each processor?
- if (pc != (tc->readPC() & ~0x3))
+ if (pc != tc->instAddr())
continue;
DPRINTF(PCEvent, "PC based event serviced at %#x: %s\n",
const_iterator e = pc_map.end();
for (; i != e; ++i)
- cprintf("%d: event at %#x: %s\n", curTick, (*i)->pc(),
+ cprintf("%d: event at %#x: %s\n", curTick(), (*i)->pc(),
(*i)->descr());
}
{
StringWrap name(tc->getCpuPtr()->name() + ".break_event");
DPRINTFN("break event %s triggered\n", descr());
- debug_break();
+ Debug::breakpoint();
if (remove)
delete this;
}
-#if FULL_SYSTEM
void
sched_break_pc_sys(System *sys, Addr addr)
{
}
}
-#endif