aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-07-25 14:06:34 -0300
committerBruno Larsen <blarsen@redhat.com>2022-10-10 11:57:10 +0200
commitba380b3e5162e89c4c81a73f4fb9fcbbbbe75e24 (patch)
treef04bfa9e20db390811ba51e4a38a47655596c1f6 /gdb/frame.c
parenta0cbd6505e9590baddd27d2ce603103d6e77421a (diff)
downloadbinutils-ba380b3e5162e89c4c81a73f4fb9fcbbbbe75e24.zip
binutils-ba380b3e5162e89c4c81a73f4fb9fcbbbbe75e24.tar.gz
binutils-ba380b3e5162e89c4c81a73f4fb9fcbbbbe75e24.tar.bz2
Introduce frame_info_ptr smart pointer class
This adds frame_info_ptr, a smart pointer class. Every instance of the class is kept on an intrusive list. When reinit_frame_cache is called, the list is traversed and all the pointers are invalidated. This should help catch the typical GDB bug of keeping a frame_info pointer alive where a frame ID was needed instead. Co-Authored-By: Bruno Larsen <blarsen@redhat.com> Approved-by: Tom Tomey <tom@tromey.com>
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index 8df5feb..44cb529 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -56,6 +56,9 @@ static struct frame_info *sentinel_frame;
/* Number of calls to reinit_frame_cache. */
static unsigned int frame_cache_generation = 0;
+/* See frame-info.h. */
+intrusive_list<frame_info_ptr> frame_info_ptr::frame_list;
+
/* See frame.h. */
unsigned int
@@ -2006,6 +2009,9 @@ reinit_frame_cache (void)
select_frame (NULL);
frame_stash_invalidate ();
+ for (frame_info_ptr &iter : frame_info_ptr::frame_list)
+ iter.invalidate ();
+
frame_debug_printf ("generation=%d", frame_cache_generation);
}