int removed = 0;
range_t range = equal_range(event);
iterator i = range.first;
- while (i != range.second &&
- i != pc_map.end()) {
+ while (i != range.second && i != pcMap.end()) {
if (*i == event) {
DPRINTF(PCEvent, "PC based event removed at %#x: %s\n",
event->pc(), event->descr());
- i = pc_map.erase(i);
+ i = pcMap.erase(i);
++removed;
} else {
i++;
}
-
}
return removed > 0;
bool
PCEventQueue::schedule(PCEvent *event)
{
- pc_map.push_back(event);
- sort(pc_map.begin(), pc_map.end(), MapCompare());
+ pcMap.push_back(event);
+ sort(pcMap.begin(), pcMap.end(), MapCompare());
DPRINTF(PCEvent, "PC based event scheduled for %#x: %s\n",
event->pc(), event->descr());
void
PCEventQueue::dump() const
{
- const_iterator i = pc_map.begin();
- const_iterator e = pc_map.end();
+ const_iterator i = pcMap.begin();
+ const_iterator e = pcMap.end();
for (; i != e; ++i)
cprintf("%d: event at %#x: %s\n", curTick(), (*i)->pc(),
PCEventQueue::range_t
PCEventQueue::equal_range(Addr pc)
{
- return std::equal_range(pc_map.begin(), pc_map.end(), pc, MapCompare());
+ return std::equal_range(pcMap.begin(), pcMap.end(), pc, MapCompare());
}
BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr,
class PCEventQueue
{
protected:
- typedef PCEvent * record_t;
class MapCompare {
public:
- bool operator()(const record_t &l, const record_t &r) const {
+ bool
+ operator()(PCEvent * const &l, PCEvent * const &r) const
+ {
return l->pc() < r->pc();
}
- bool operator()(const record_t &l, Addr pc) const {
+ bool
+ operator()(PCEvent * const &l, Addr pc) const
+ {
return l->pc() < pc;
}
- bool operator()(Addr pc, const record_t &r) const {
+ bool
+ operator()(Addr pc, PCEvent * const &r) const
+ {
return pc < r->pc();
}
};
- typedef std::vector<record_t> map_t;
+ typedef std::vector<PCEvent *> Map;
public:
- typedef map_t::iterator iterator;
- typedef map_t::const_iterator const_iterator;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
protected:
typedef std::pair<iterator, iterator> range_t;
typedef std::pair<const_iterator, const_iterator> const_range_t;
protected:
- map_t pc_map;
+ Map pcMap;
bool doService(ThreadContext *tc);
bool schedule(PCEvent *event);
bool service(ThreadContext *tc)
{
- if (pc_map.empty())
+ if (pcMap.empty())
return false;
return doService(tc);