fastmodel: Use a shared pointer to track PC events.
authorGabe Black <gabeblack@google.com>
Sat, 1 Feb 2020 10:21:15 +0000 (02:21 -0800)
committerGabe Black <gabeblack@google.com>
Thu, 20 Feb 2020 10:20:45 +0000 (10:20 +0000)
commit5100b81d1cc5639756d1e4ef9d66649d6be53ff8
treefef5b220456bd1589eeeeaa7cd00d16df0c9a4ae
parent11e57de23a4c0bba958c3a8f92adc2694d7e2c4f
fastmodel: Use a shared pointer to track PC events.

When the last event is removed from a breakpoint, then the breakpoint
itself is uninstalled from IRIS, and the list is deleted. Even though
the list has been traversed and so we don't lose track of any other
events that need to be processed, we also still need to check against
end() to see that we're done. If that now freed memory gets
overwritten, then we won't see the end and will wander right off the
end of the list into nonsense.

This change modifies the breakpoint info tracking structure to keep a
shared pointer to the event list. The pointer will still automatically
manage the list's memory so that it doesn't leak, and it won't get
deleted out from under us as we're iterating through it.

Change-Id: I5ad0f095d07f0a3a5cce9c10f03121827a674c33
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24965
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chun-Chen TK Hsu <chunchenhsu@google.com>
src/arch/arm/fastmodel/iris/thread_context.cc
src/arch/arm/fastmodel/iris/thread_context.hh