mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
Move source window common to code to tui-winsource.[ch]
Like the previous rearranging patches, this moves the source and disassembly window base class code to tui-winsource.[ch]. The execution info window is also moved, because it is associated with this base class. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) (struct tui_source_window_base): Move from tui-data.h. * tui/tui-winsource.c: Move many method definitions from elsewhere. Remove "structuring" comments. * tui/tui-wingeneral.c (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Move to tui-winsource.c. * tui/tui-win.c (tui_source_window_base::refresh_all) (tui_source_window_base::update_tab_width) (tui_source_window_base::set_new_height) (tui_source_window_base::do_make_visible_with_new_height): Move to tui-winsource.c. * tui/tui-source.h: Update. * tui/tui-source.c (tui_source_window_base::reset): Move to tui-winsource.c. * tui/tui-disasm.h: Update. * tui/tui-data.h (struct tui_exec_info_window): Move to tui-winsource.h. (struct tui_source_window_base): Likewise. * tui/tui-data.c (tui_source_window_base::clear_detail) (tui_source_window_base, ~tui_source_window_base): Move to tui-winsource.c.
This commit is contained in:
@ -1,3 +1,28 @@
|
|||||||
|
2019-07-17 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui-winsource.h (struct tui_exec_info_window)
|
||||||
|
(struct tui_source_window_base): Move from tui-data.h.
|
||||||
|
* tui/tui-winsource.c: Move many method definitions from
|
||||||
|
elsewhere. Remove "structuring" comments.
|
||||||
|
* tui/tui-wingeneral.c (tui_source_window_base::make_visible)
|
||||||
|
(tui_source_window_base::refresh_window): Move to
|
||||||
|
tui-winsource.c.
|
||||||
|
* tui/tui-win.c (tui_source_window_base::refresh_all)
|
||||||
|
(tui_source_window_base::update_tab_width)
|
||||||
|
(tui_source_window_base::set_new_height)
|
||||||
|
(tui_source_window_base::do_make_visible_with_new_height): Move to
|
||||||
|
tui-winsource.c.
|
||||||
|
* tui/tui-source.h: Update.
|
||||||
|
* tui/tui-source.c (tui_source_window_base::reset): Move to
|
||||||
|
tui-winsource.c.
|
||||||
|
* tui/tui-disasm.h: Update.
|
||||||
|
* tui/tui-data.h (struct tui_exec_info_window): Move to
|
||||||
|
tui-winsource.h.
|
||||||
|
(struct tui_source_window_base): Likewise.
|
||||||
|
* tui/tui-data.c (tui_source_window_base::clear_detail)
|
||||||
|
(tui_source_window_base, ~tui_source_window_base): Move to
|
||||||
|
tui-winsource.c.
|
||||||
|
|
||||||
2019-07-17 Tom Tromey <tom@tromey.com>
|
2019-07-17 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* tui/tui-win.c (tui_resize_all)
|
* tui/tui-win.c (tui_resize_all)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "tui/tui.h"
|
#include "tui/tui.h"
|
||||||
#include "tui/tui-data.h"
|
#include "tui/tui-data.h"
|
||||||
#include "tui/tui-wingeneral.h"
|
#include "tui/tui-wingeneral.h"
|
||||||
|
#include "tui/tui-winsource.h"
|
||||||
#include "gdb_curses.h"
|
#include "gdb_curses.h"
|
||||||
|
|
||||||
/****************************
|
/****************************
|
||||||
@ -139,17 +140,6 @@ tui_add_to_source_windows (struct tui_source_window_base *win_info)
|
|||||||
source_windows.push_back (win_info);
|
source_windows.push_back (win_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::clear_detail ()
|
|
||||||
{
|
|
||||||
gdbarch = NULL;
|
|
||||||
start_line_or_addr.loa = LOA_ADDRESS;
|
|
||||||
start_line_or_addr.u.addr = 0;
|
|
||||||
horizontal_offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Accessor for the locator win info. Answers a pointer to the static
|
/* Accessor for the locator win info. Answers a pointer to the static
|
||||||
locator win info struct. */
|
locator win info struct. */
|
||||||
struct tui_locator_window *
|
struct tui_locator_window *
|
||||||
@ -313,23 +303,8 @@ tui_win_info::tui_win_info (enum tui_win_type type)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
tui_source_window_base::tui_source_window_base (enum tui_win_type type)
|
|
||||||
: tui_win_info (type),
|
|
||||||
execution_info (new tui_exec_info_window ())
|
|
||||||
{
|
|
||||||
gdb_assert (type == SRC_WIN || type == DISASSEM_WIN);
|
|
||||||
start_line_or_addr.loa = LOA_ADDRESS;
|
|
||||||
start_line_or_addr.u.addr = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
tui_gen_win_info::~tui_gen_win_info ()
|
tui_gen_win_info::~tui_gen_win_info ()
|
||||||
{
|
{
|
||||||
tui_delete_win (handle);
|
tui_delete_win (handle);
|
||||||
xfree (title);
|
xfree (title);
|
||||||
}
|
}
|
||||||
|
|
||||||
tui_source_window_base::~tui_source_window_base ()
|
|
||||||
{
|
|
||||||
xfree (fullname);
|
|
||||||
delete execution_info;
|
|
||||||
}
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "observable.h"
|
#include "observable.h"
|
||||||
|
|
||||||
struct tui_cmd_window;
|
struct tui_cmd_window;
|
||||||
|
struct tui_source_window_base;
|
||||||
struct tui_source_window;
|
struct tui_source_window;
|
||||||
|
|
||||||
/* This is a point definition. */
|
/* This is a point definition. */
|
||||||
@ -203,34 +204,6 @@ struct tui_source_element
|
|||||||
|
|
||||||
typedef char tui_exec_info_content[TUI_EXECINFO_SIZE];
|
typedef char tui_exec_info_content[TUI_EXECINFO_SIZE];
|
||||||
|
|
||||||
/* Execution info window class. */
|
|
||||||
|
|
||||||
struct tui_exec_info_window : public tui_gen_win_info
|
|
||||||
{
|
|
||||||
tui_exec_info_window ()
|
|
||||||
: tui_gen_win_info (EXEC_INFO_WIN)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~tui_exec_info_window () override
|
|
||||||
{
|
|
||||||
xfree (m_content);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get or allocate contents. */
|
|
||||||
tui_exec_info_content *maybe_allocate_content (int n_elements);
|
|
||||||
|
|
||||||
/* Return the contents. */
|
|
||||||
const tui_exec_info_content *get_content () const
|
|
||||||
{
|
|
||||||
return m_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
tui_exec_info_content *m_content = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Locator window class. */
|
/* Locator window class. */
|
||||||
|
|
||||||
struct tui_locator_window : public tui_gen_win_info
|
struct tui_locator_window : public tui_gen_win_info
|
||||||
@ -334,62 +307,6 @@ public:
|
|||||||
bool is_highlighted = false;
|
bool is_highlighted = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The base class for all source-like windows, namely the source and
|
|
||||||
disassembly windows. */
|
|
||||||
|
|
||||||
struct tui_source_window_base : public tui_win_info
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
explicit tui_source_window_base (enum tui_win_type type);
|
|
||||||
~tui_source_window_base () override;
|
|
||||||
DISABLE_COPY_AND_ASSIGN (tui_source_window_base);
|
|
||||||
|
|
||||||
void do_scroll_horizontal (int num_to_scroll) override;
|
|
||||||
void do_make_visible_with_new_height () override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void clear_detail () override;
|
|
||||||
|
|
||||||
void make_visible (bool visible) override;
|
|
||||||
void refresh_window () override;
|
|
||||||
void refresh_all () override;
|
|
||||||
|
|
||||||
/* Refill the source window's source cache and update it. If this
|
|
||||||
is a disassembly window, then just update it. */
|
|
||||||
void refill ();
|
|
||||||
|
|
||||||
/* Set the location of the execution point. */
|
|
||||||
void set_is_exec_point_at (struct tui_line_or_address l);
|
|
||||||
|
|
||||||
void set_new_height (int height) override;
|
|
||||||
|
|
||||||
void update_tab_width () override;
|
|
||||||
|
|
||||||
/* Return true if the location LOC corresponds to the line number
|
|
||||||
LINE_NO in this source window; false otherwise. */
|
|
||||||
virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
|
|
||||||
|
|
||||||
void reset (int height, int width,
|
|
||||||
int origin_x, int origin_y) override;
|
|
||||||
|
|
||||||
/* Does the locator belong to this window? */
|
|
||||||
bool m_has_locator = false;
|
|
||||||
/* Execution information window. */
|
|
||||||
struct tui_exec_info_window *execution_info;
|
|
||||||
/* Used for horizontal scroll. */
|
|
||||||
int horizontal_offset = 0;
|
|
||||||
struct tui_line_or_address start_line_or_addr;
|
|
||||||
|
|
||||||
/* It is the resolved form as returned by symtab_to_fullname. */
|
|
||||||
char *fullname = nullptr;
|
|
||||||
|
|
||||||
/* Architecture associated with code at this location. */
|
|
||||||
struct gdbarch *gdbarch = nullptr;
|
|
||||||
|
|
||||||
std::vector<tui_source_element> content;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern int tui_win_is_auxiliary (enum tui_win_type win_type);
|
extern int tui_win_is_auxiliary (enum tui_win_type win_type);
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "tui/tui.h"
|
#include "tui/tui.h"
|
||||||
#include "tui/tui-data.h"
|
#include "tui/tui-data.h"
|
||||||
|
#include "tui-winsource.h"
|
||||||
|
|
||||||
/* A TUI disassembly window. */
|
/* A TUI disassembly window. */
|
||||||
|
|
||||||
|
@ -291,12 +291,3 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
|
|||||||
&& filename_cmp (fullname,
|
&& filename_cmp (fullname,
|
||||||
symtab_to_fullname (loc->symtab)) == 0);
|
symtab_to_fullname (loc->symtab)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::reset (int height, int width,
|
|
||||||
int origin_x, int origin_y)
|
|
||||||
{
|
|
||||||
tui_gen_win_info::reset (height, width - 3,
|
|
||||||
origin_x + 3, origin_y);
|
|
||||||
execution_info->reset (height, 3, origin_x, origin_y);
|
|
||||||
}
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#define TUI_TUI_SOURCE_H
|
#define TUI_TUI_SOURCE_H
|
||||||
|
|
||||||
#include "tui/tui-data.h"
|
#include "tui/tui-data.h"
|
||||||
|
#include "tui-winsource.h"
|
||||||
|
|
||||||
struct symtab;
|
struct symtab;
|
||||||
|
|
||||||
@ -40,6 +41,8 @@ struct tui_source_window : public tui_source_window_base
|
|||||||
return SRC_NAME;
|
return SRC_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return true if the location LOC corresponds to the line number
|
||||||
|
LINE_NO in this source window; false otherwise. */
|
||||||
bool location_matches_p (struct bp_location *loc, int line_no) override;
|
bool location_matches_p (struct bp_location *loc, int line_no) override;
|
||||||
|
|
||||||
bool showing_source_p (const char *filename) const;
|
bool showing_source_p (const char *filename) const;
|
||||||
|
@ -498,17 +498,6 @@ tui_win_info::right_scroll (int num_to_scroll)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::refresh_all ()
|
|
||||||
{
|
|
||||||
tui_show_source_content (this);
|
|
||||||
tui_check_and_display_highlight_if_needed (this);
|
|
||||||
tui_erase_exec_info_content (this);
|
|
||||||
tui_update_exec_info (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tui_refresh_all_win (void)
|
tui_refresh_all_win (void)
|
||||||
{
|
{
|
||||||
@ -899,19 +888,6 @@ unsigned int tui_tab_width = DEFAULT_TAB_LEN;
|
|||||||
|
|
||||||
static unsigned int internal_tab_width = DEFAULT_TAB_LEN;
|
static unsigned int internal_tab_width = DEFAULT_TAB_LEN;
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::update_tab_width ()
|
|
||||||
{
|
|
||||||
/* We don't really change the height of any windows, but
|
|
||||||
calling these 2 functions causes a complete regeneration
|
|
||||||
and redisplay of the window's contents, which will take
|
|
||||||
the new tab width into account. */
|
|
||||||
make_invisible_and_set_new_height (height);
|
|
||||||
make_visible_with_new_height ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* After the tab width is set, call this to update the relevant
|
/* After the tab width is set, call this to update the relevant
|
||||||
windows. */
|
windows. */
|
||||||
|
|
||||||
@ -1215,28 +1191,6 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::set_new_height (int height)
|
|
||||||
{
|
|
||||||
execution_info->make_visible (false);
|
|
||||||
execution_info->height = height;
|
|
||||||
execution_info->origin.y = origin.y;
|
|
||||||
if (height > 1)
|
|
||||||
execution_info->viewport_height = height - 1;
|
|
||||||
else
|
|
||||||
execution_info->viewport_height = height;
|
|
||||||
execution_info->viewport_height--;
|
|
||||||
|
|
||||||
if (m_has_locator)
|
|
||||||
{
|
|
||||||
tui_locator_window *gen_win_info = tui_locator_win_info_ptr ();
|
|
||||||
gen_win_info->make_visible (false);
|
|
||||||
gen_win_info->origin.y = origin.y + height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See tui-data.h. */
|
/* See tui-data.h. */
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1268,50 +1222,6 @@ tui_win_info::make_visible_with_new_height ()
|
|||||||
|
|
||||||
/* See tui-data.h. */
|
/* See tui-data.h. */
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::do_make_visible_with_new_height ()
|
|
||||||
{
|
|
||||||
execution_info->make_visible (true);
|
|
||||||
if (!content.empty ())
|
|
||||||
{
|
|
||||||
struct tui_line_or_address line_or_addr;
|
|
||||||
struct symtab_and_line cursal
|
|
||||||
= get_current_source_symtab_and_line ();
|
|
||||||
|
|
||||||
line_or_addr = start_line_or_addr;
|
|
||||||
tui_update_source_window (this, gdbarch,
|
|
||||||
cursal.symtab, line_or_addr, TRUE);
|
|
||||||
}
|
|
||||||
else if (deprecated_safe_get_selected_frame () != NULL)
|
|
||||||
{
|
|
||||||
struct tui_line_or_address line;
|
|
||||||
struct symtab_and_line cursal
|
|
||||||
= get_current_source_symtab_and_line ();
|
|
||||||
struct frame_info *frame = deprecated_safe_get_selected_frame ();
|
|
||||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
|
||||||
|
|
||||||
struct symtab *s = find_pc_line_symtab (get_frame_pc (frame));
|
|
||||||
if (type == SRC_WIN)
|
|
||||||
{
|
|
||||||
line.loa = LOA_LINE;
|
|
||||||
line.u.line_no = cursal.line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line.loa = LOA_ADDRESS;
|
|
||||||
find_line_pc (s, cursal.line, &line.u.addr);
|
|
||||||
}
|
|
||||||
tui_update_source_window (this, gdbarch, s, line, TRUE);
|
|
||||||
}
|
|
||||||
if (m_has_locator)
|
|
||||||
{
|
|
||||||
tui_locator_win_info_ptr ()->make_visible (true);
|
|
||||||
tui_show_locator_content ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
tui_win_info::max_height () const
|
tui_win_info::max_height () const
|
||||||
{
|
{
|
||||||
|
@ -166,15 +166,6 @@ tui_gen_win_info::make_visible (bool visible)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::make_visible (bool visible)
|
|
||||||
{
|
|
||||||
execution_info->make_visible (visible);
|
|
||||||
tui_win_info::make_visible (visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Makes all windows invisible (except the command and locator
|
/* Makes all windows invisible (except the command and locator
|
||||||
windows). */
|
windows). */
|
||||||
static void
|
static void
|
||||||
@ -196,15 +187,6 @@ tui_make_all_invisible (void)
|
|||||||
make_all_visible (false);
|
make_all_visible (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See tui-data.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
tui_source_window_base::refresh_window ()
|
|
||||||
{
|
|
||||||
execution_info->refresh_window ();
|
|
||||||
tui_win_info::refresh_window ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Function to refresh all the windows currently displayed. */
|
/* Function to refresh all the windows currently displayed. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -300,6 +300,150 @@ tui_show_source_content (struct tui_source_window_base *win_info)
|
|||||||
|
|
||||||
/* See tui-data.h. */
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::clear_detail ()
|
||||||
|
{
|
||||||
|
gdbarch = NULL;
|
||||||
|
start_line_or_addr.loa = LOA_ADDRESS;
|
||||||
|
start_line_or_addr.u.addr = 0;
|
||||||
|
horizontal_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_source_window_base::tui_source_window_base (enum tui_win_type type)
|
||||||
|
: tui_win_info (type),
|
||||||
|
execution_info (new tui_exec_info_window ())
|
||||||
|
{
|
||||||
|
gdb_assert (type == SRC_WIN || type == DISASSEM_WIN);
|
||||||
|
start_line_or_addr.loa = LOA_ADDRESS;
|
||||||
|
start_line_or_addr.u.addr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tui_source_window_base::~tui_source_window_base ()
|
||||||
|
{
|
||||||
|
xfree (fullname);
|
||||||
|
delete execution_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::reset (int height, int width,
|
||||||
|
int origin_x, int origin_y)
|
||||||
|
{
|
||||||
|
tui_gen_win_info::reset (height, width - 3,
|
||||||
|
origin_x + 3, origin_y);
|
||||||
|
execution_info->reset (height, 3, origin_x, origin_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::refresh_all ()
|
||||||
|
{
|
||||||
|
tui_show_source_content (this);
|
||||||
|
tui_check_and_display_highlight_if_needed (this);
|
||||||
|
tui_erase_exec_info_content (this);
|
||||||
|
tui_update_exec_info (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::update_tab_width ()
|
||||||
|
{
|
||||||
|
/* We don't really change the height of any windows, but
|
||||||
|
calling these 2 functions causes a complete regeneration
|
||||||
|
and redisplay of the window's contents, which will take
|
||||||
|
the new tab width into account. */
|
||||||
|
make_invisible_and_set_new_height (height);
|
||||||
|
make_visible_with_new_height ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::set_new_height (int height)
|
||||||
|
{
|
||||||
|
execution_info->make_visible (false);
|
||||||
|
execution_info->height = height;
|
||||||
|
execution_info->origin.y = origin.y;
|
||||||
|
if (height > 1)
|
||||||
|
execution_info->viewport_height = height - 1;
|
||||||
|
else
|
||||||
|
execution_info->viewport_height = height;
|
||||||
|
execution_info->viewport_height--;
|
||||||
|
|
||||||
|
if (m_has_locator)
|
||||||
|
{
|
||||||
|
tui_locator_window *gen_win_info = tui_locator_win_info_ptr ();
|
||||||
|
gen_win_info->make_visible (false);
|
||||||
|
gen_win_info->origin.y = origin.y + height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::do_make_visible_with_new_height ()
|
||||||
|
{
|
||||||
|
execution_info->make_visible (true);
|
||||||
|
if (!content.empty ())
|
||||||
|
{
|
||||||
|
struct tui_line_or_address line_or_addr;
|
||||||
|
struct symtab_and_line cursal
|
||||||
|
= get_current_source_symtab_and_line ();
|
||||||
|
|
||||||
|
line_or_addr = start_line_or_addr;
|
||||||
|
tui_update_source_window (this, gdbarch,
|
||||||
|
cursal.symtab, line_or_addr, TRUE);
|
||||||
|
}
|
||||||
|
else if (deprecated_safe_get_selected_frame () != NULL)
|
||||||
|
{
|
||||||
|
struct tui_line_or_address line;
|
||||||
|
struct symtab_and_line cursal
|
||||||
|
= get_current_source_symtab_and_line ();
|
||||||
|
struct frame_info *frame = deprecated_safe_get_selected_frame ();
|
||||||
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
|
|
||||||
|
struct symtab *s = find_pc_line_symtab (get_frame_pc (frame));
|
||||||
|
if (type == SRC_WIN)
|
||||||
|
{
|
||||||
|
line.loa = LOA_LINE;
|
||||||
|
line.u.line_no = cursal.line;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line.loa = LOA_ADDRESS;
|
||||||
|
find_line_pc (s, cursal.line, &line.u.addr);
|
||||||
|
}
|
||||||
|
tui_update_source_window (this, gdbarch, s, line, TRUE);
|
||||||
|
}
|
||||||
|
if (m_has_locator)
|
||||||
|
{
|
||||||
|
tui_locator_win_info_ptr ()->make_visible (true);
|
||||||
|
tui_show_locator_content ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::make_visible (bool visible)
|
||||||
|
{
|
||||||
|
execution_info->make_visible (visible);
|
||||||
|
tui_win_info::make_visible (visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
tui_source_window_base::refresh_window ()
|
||||||
|
{
|
||||||
|
execution_info->refresh_window ();
|
||||||
|
tui_win_info::refresh_window ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See tui-data.h. */
|
||||||
|
|
||||||
void
|
void
|
||||||
tui_source_window_base::refill ()
|
tui_source_window_base::refill ()
|
||||||
{
|
{
|
||||||
@ -616,8 +760,3 @@ tui_addr_is_displayed (CORE_ADDR addr,
|
|||||||
|
|
||||||
return is_displayed;
|
return is_displayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************
|
|
||||||
** STATIC LOCAL FUNCTIONS **
|
|
||||||
******************************************/
|
|
||||||
|
@ -24,7 +24,87 @@
|
|||||||
|
|
||||||
#include "tui/tui-data.h"
|
#include "tui/tui-data.h"
|
||||||
|
|
||||||
struct tui_win_info;
|
/* Execution info window class. */
|
||||||
|
|
||||||
|
struct tui_exec_info_window : public tui_gen_win_info
|
||||||
|
{
|
||||||
|
tui_exec_info_window ()
|
||||||
|
: tui_gen_win_info (EXEC_INFO_WIN)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~tui_exec_info_window () override
|
||||||
|
{
|
||||||
|
xfree (m_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get or allocate contents. */
|
||||||
|
tui_exec_info_content *maybe_allocate_content (int n_elements);
|
||||||
|
|
||||||
|
/* Return the contents. */
|
||||||
|
const tui_exec_info_content *get_content () const
|
||||||
|
{
|
||||||
|
return m_content;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
tui_exec_info_content *m_content = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The base class for all source-like windows, namely the source and
|
||||||
|
disassembly windows. */
|
||||||
|
|
||||||
|
struct tui_source_window_base : public tui_win_info
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
explicit tui_source_window_base (enum tui_win_type type);
|
||||||
|
~tui_source_window_base () override;
|
||||||
|
DISABLE_COPY_AND_ASSIGN (tui_source_window_base);
|
||||||
|
|
||||||
|
void do_scroll_horizontal (int num_to_scroll) override;
|
||||||
|
void do_make_visible_with_new_height () override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void clear_detail () override;
|
||||||
|
|
||||||
|
void make_visible (bool visible) override;
|
||||||
|
void refresh_window () override;
|
||||||
|
void refresh_all () override;
|
||||||
|
|
||||||
|
/* Refill the source window's source cache and update it. If this
|
||||||
|
is a disassembly window, then just update it. */
|
||||||
|
void refill ();
|
||||||
|
|
||||||
|
/* Set the location of the execution point. */
|
||||||
|
void set_is_exec_point_at (struct tui_line_or_address l);
|
||||||
|
|
||||||
|
void set_new_height (int height) override;
|
||||||
|
|
||||||
|
void update_tab_width () override;
|
||||||
|
|
||||||
|
virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
|
||||||
|
|
||||||
|
void reset (int height, int width,
|
||||||
|
int origin_x, int origin_y) override;
|
||||||
|
|
||||||
|
/* Does the locator belong to this window? */
|
||||||
|
bool m_has_locator = false;
|
||||||
|
/* Execution information window. */
|
||||||
|
struct tui_exec_info_window *execution_info;
|
||||||
|
/* Used for horizontal scroll. */
|
||||||
|
int horizontal_offset = 0;
|
||||||
|
struct tui_line_or_address start_line_or_addr;
|
||||||
|
|
||||||
|
/* It is the resolved form as returned by symtab_to_fullname. */
|
||||||
|
char *fullname = nullptr;
|
||||||
|
|
||||||
|
/* Architecture associated with code at this location. */
|
||||||
|
struct gdbarch *gdbarch = nullptr;
|
||||||
|
|
||||||
|
std::vector<tui_source_element> content;
|
||||||
|
};
|
||||||
|
|
||||||
/* Update the execution windows to show the active breakpoints. This
|
/* Update the execution windows to show the active breakpoints. This
|
||||||
is called whenever a breakpoint is inserted, removed or has its
|
is called whenever a breakpoint is inserted, removed or has its
|
||||||
|
Reference in New Issue
Block a user