Skip to content

Commit

Permalink
gdb: move frame_info_ptr to frame.{c,h}
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
simark committed Jan 20, 2023
1 parent 1298c32 commit 43e8c9c
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 284 deletions.
1 change: 0 additions & 1 deletion gdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,6 @@ COMMON_SFILES = \
findvar.c \
frame.c \
frame-base.c \
frame-info.c \
frame-unwind.c \
gcore.c \
gdb-demangle.c \
Expand Down
1 change: 1 addition & 0 deletions gdb/c-lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct ui_file;
struct language_arch_info;
struct type_print_options;
struct parser_state;
struct compile_instance;

#include "compile/compile.h"
#include "value.h"
Expand Down
2 changes: 1 addition & 1 deletion gdb/dwarf2/call-site.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#define CALL_SITE_H

#include "dwarf2/types.h"
#include "../frame.h"
#include "gdbsupport/function-view.h"
#include "frame-info.h"

struct dwarf2_locexpr_baton;
struct dwarf2_per_cu_data;
Expand Down
65 changes: 0 additions & 65 deletions gdb/frame-info.c

This file was deleted.

211 changes: 0 additions & 211 deletions gdb/frame-info.h

This file was deleted.

43 changes: 42 additions & 1 deletion gdb/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 ()
Expand Down
Loading

0 comments on commit 43e8c9c

Please sign in to comment.