#define TUI_EXEC_POS 2
#define TUI_EXECINFO_SIZE 4
-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)
- {
- }
-};
-
/* Elements in the Source/Disassembly Window. */
struct tui_source_element
{
line_or_addr.u.line_no = 0;
}
- ~tui_source_element ()
- {
- xfree (line);
- }
-
DISABLE_COPY_AND_ASSIGN (tui_source_element);
tui_source_element (tui_source_element &&other)
- : line (other.line),
+ : line (std::move (other.line)),
line_or_addr (other.line_or_addr),
is_exec_point (other.is_exec_point),
break_mode (other.break_mode)
{
- other.line = nullptr;
}
- char *line = nullptr;
+ std::string line;
struct tui_line_or_address line_or_addr;
bool is_exec_point = false;
tui_bp_flags break_mode = 0;
{
protected:
explicit tui_source_window_base (enum tui_win_type type);
- ~tui_source_window_base () override;
+ ~tui_source_window_base ();
+
DISABLE_COPY_AND_ASSIGN (tui_source_window_base);
void do_scroll_horizontal (int num_to_scroll) override;
void rerender () override;
-public:
-
- void clear_detail ();
+ virtual enum tui_status set_contents
+ (struct gdbarch *gdbarch,
+ struct symtab *s,
+ struct tui_line_or_address line_or_addr) = 0;
- void make_visible (bool visible) override;
- void refresh_window () override;
- void refresh_all () override;
+public:
/* Refill the source window's source cache and update it. If this
is a disassembly window, then just update it. */
virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
- void resize (int height, int width,
- int origin_x, int origin_y) override;
-
- void show_source_content ();
-
void update_exec_info ();
/* Update the window to display the given location. Does nothing if
virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
int line_no, CORE_ADDR addr) = 0;
+ void update_source_window_as_is (struct gdbarch *gdbarch,
+ struct symtab *s,
+ struct tui_line_or_address line_or_addr);
+ void update_source_window (struct gdbarch *gdbarch,
+ struct symtab *s,
+ struct tui_line_or_address line_or_addr);
+
+ /* Scan the source window and the breakpoints to update the
+ break_mode information for each line. Returns true if something
+ changed and the execution window must be refreshed. See
+ tui_update_all_breakpoint_info for a description of
+ BEING_DELETED. */
+ bool update_breakpoint_info (struct breakpoint *being_deleted,
+ bool current_only);
+
/* Erase the source content. */
virtual void erase_source_content () = 0;
- /* 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;
+
+private:
+
+ void show_source_content ();
+
+ /* Called when the user "set style enabled" setting is changed. */
+ void style_changed ();
+
+ /* A token used to register and unregister an observer. */
+ gdb::observers::token m_observable;
};
removed from the list of breakpoints. */
extern void tui_update_all_breakpoint_info (struct breakpoint *being_deleted);
-/* Scan the source window and the breakpoints to update the break_mode
- information for each line. Returns true if something changed and
- the execution window must be refreshed. See
- tui_update_all_breakpoint_info for a description of
- BEING_DELETED. */
-extern bool tui_update_breakpoint_info (struct tui_source_window_base *win,
- struct breakpoint *being_deleted,
- bool current_only);
-
/* Function to display the "main" routine. */
extern void tui_display_main (void);
-extern void tui_update_source_window (struct tui_source_window_base *,
- struct gdbarch *, struct symtab *,
- struct tui_line_or_address,
- int);
-extern void tui_update_source_window_as_is (struct tui_source_window_base *,
- struct gdbarch *, struct symtab *,
- struct tui_line_or_address,
- int);
extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
extern void tui_update_source_windows_with_line (struct symtab *,
int);
+/* Extract some source text from PTR. LINE_NO is the line number. If
+ it is positive, it is printed at the start of the line. FIRST_COL
+ is the first column to extract, and LINE_WIDTH is the number of
+ characters to display. NDIGITS is used to format the line number
+ (if it is positive). If NDIGITS is greater than 0, then that many
+ digits are used; otherwise the line number is formatted with 6
+ digits and the text is aligned to the next tab stop. Returns a
+ string holding the desired text. PTR is updated to point to the
+ start of the next line. */
+
+extern std::string tui_copy_source_line (const char **ptr,
+ int line_no, int first_col,
+ int line_width, int ndigits);
+
/* Constant definitions. */
#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */