Fix snafu in version number. Regenerate files
[binutils-gdb.git] / gdb / frame-info.c
blob40a872ea152df7c509c31cac51579098c9aeb0b9
1 /* Frame info pointer
3 Copyright (C) 2022 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "defs.h"
22 #include "frame-info.h"
23 #include "frame.h"
25 /* See frame-info-ptr.h. */
27 intrusive_list<frame_info_ptr> frame_info_ptr::frame_list;
29 /* See frame-info-ptr.h. */
31 void
32 frame_info_ptr::prepare_reinflate ()
34 m_cached_level = frame_relative_level (*this);
36 if (m_cached_level != 0)
37 m_cached_id = get_frame_id (*this);
40 /* See frame-info-ptr.h. */
42 void
43 frame_info_ptr::reinflate ()
45 /* Ensure we have a valid frame level (sentinel frame or above), indicating
46 prepare_reinflate was called. */
47 gdb_assert (m_cached_level >= -1);
49 if (m_ptr != nullptr)
51 /* The frame_info wasn't invalidated, no need to reinflate. */
52 return;
55 /* Frame #0 needs special handling, see comment in select_frame. */
56 if (m_cached_level == 0)
57 m_ptr = get_current_frame ().get ();
58 else
60 gdb_assert (frame_id_p (m_cached_id));
61 m_ptr = frame_find_by_id (m_cached_id).get ();
64 gdb_assert (m_ptr != nullptr);