diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2023-01-03 12:48:48 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-01-20 14:48:57 -0500 |
commit | 43e8c9ce20357a12dc5ccaf9ac84eea2cb6aa39b (patch) | |
tree | e215166063e113d280e3e119cc7429e9ea5604b4 /gdb/frame.c | |
parent | 1298c32f01b3ae90fb17665f9b9b01c932767fd5 (diff) | |
download | gdb-43e8c9ce20357a12dc5ccaf9ac84eea2cb6aa39b.zip gdb-43e8c9ce20357a12dc5ccaf9ac84eea2cb6aa39b.tar.gz gdb-43e8c9ce20357a12dc5ccaf9ac84eea2cb6aa39b.tar.bz2 |
gdb: move frame_info_ptr to frame.{c,h}
A patch later in this series will make frame_info_ptr access some
fields internal to frame_info, which we don't want to expose outside of
frame.c. Move the frame_info_ptr class to frame.h, and the definitions
to frame.c. Remove frame-info.c and frame-info.h.
Change-Id: Ic5949759e6262ea0da6123858702d48fe5673fea
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Diffstat (limited to 'gdb/frame.c')
-rw-r--r-- | gdb/frame.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/gdb/frame.c b/gdb/frame.c index 2f9622a..b5f4839 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -19,7 +19,6 @@ #include "defs.h" #include "frame.h" -#include "frame-info.h" #include "target.h" #include "value.h" #include "inferior.h" /* for inferior_ptid */ @@ -3161,6 +3160,48 @@ maintenance_print_frame_id (const char *args, int from_tty) get_frame_id (frame).to_string ().c_str ()); } +/* See frame-info-ptr.h. */ + +intrusive_list<frame_info_ptr> frame_info_ptr::frame_list; + +/* See frame-info-ptr.h. */ + +void +frame_info_ptr::prepare_reinflate () +{ + m_cached_level = frame_relative_level (*this); + + if (m_cached_level != 0) + m_cached_id = get_frame_id (*this); +} + +/* See frame-info-ptr.h. */ + +void +frame_info_ptr::reinflate () +{ + /* Ensure we have a valid frame level (sentinel frame or above), indicating + prepare_reinflate was called. */ + gdb_assert (m_cached_level >= -1); + + if (m_ptr != nullptr) + { + /* The frame_info wasn't invalidated, no need to reinflate. */ + return; + } + + /* Frame #0 needs special handling, see comment in select_frame. */ + if (m_cached_level == 0) + m_ptr = get_current_frame ().get (); + else + { + gdb_assert (frame_id_p (m_cached_id)); + m_ptr = frame_find_by_id (m_cached_id).get (); + } + + gdb_assert (m_ptr != nullptr); +} + void _initialize_frame (); void _initialize_frame () |