diff options
author | Ali Saidi <Ali.Saidi@ARM.com> | 2012-05-10 18:04:27 -0500 |
---|---|---|
committer | Ali Saidi <Ali.Saidi@ARM.com> | 2012-05-10 18:04:27 -0500 |
commit | 4f66bcdd2e2cf983f66fe745eaa27698e90d0d60 (patch) | |
tree | c4efa628413252b7bad0188db83af6096ae2a1e8 /src/cpu | |
parent | 5ecaf30219d8a846f2747d4d67503c21c6e13333 (diff) | |
download | gem5-4f66bcdd2e2cf983f66fe745eaa27698e90d0d60.tar.xz |
gem5: fix some iterator use and erase bugs
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/pc_event.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cpu/pc_event.cc b/src/cpu/pc_event.cc index 9cf63f7d3..2b54ee5fb 100644 --- a/src/cpu/pc_event.cc +++ b/src/cpu/pc_event.cc @@ -56,13 +56,18 @@ PCEventQueue::remove(PCEvent *event) { 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; |