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>
This commit is contained in:
parent
a0cbd6505e
commit
ba380b3e51
3 changed files with 187 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue