51 #include "readline/readline.h"
81 #define WIN_HEIGHT_USAGE "Usage: winheight <win_name> [+ | -] <#lines>\n"
82 #define XDBWIN_HEIGHT_USAGE "Usage: w <#lines>\n"
83 #define FOCUS_USAGE "Usage: focus {<win> | next | prev}\n"
90 # define ACS_LRCORNER '+'
93 # define ACS_LLCORNER '+'
96 # define ACS_ULCORNER '+'
99 # define ACS_URCORNER '+'
102 # define ACS_HLINE '-'
105 # define ACS_VLINE '|'
138 {
"normal", A_NORMAL },
139 {
"standout", A_STANDOUT },
140 {
"reverse", A_REVERSE },
142 {
"half-standout", A_DIM | A_STANDOUT },
144 {
"bold-standout", A_BOLD | A_STANDOUT },
146 {
"normal", A_NORMAL }
211 The attribute mode to use for the active TUI window border is \"%s\".\n"),
223 The attribute mode to use for the TUI window borders is \"%s\".\n"),
259 if (name && strcmp (table->
name, name) == 0)
278 entry =
translate (tui_border_mode, tui_border_mode_translate);
279 if (tui_border_attrs != entry->
value)
281 tui_border_attrs = entry->
value;
284 entry =
translate (tui_active_border_mode, tui_border_mode_translate);
285 if (tui_active_border_attrs != entry->
value)
287 tui_active_border_attrs = entry->
value;
294 entry =
translate (tui_border_kind, tui_border_kind_translate_lrcorner);
295 if (tui_border_lrcorner != (chtype) entry->
value)
300 entry =
translate (tui_border_kind, tui_border_kind_translate_llcorner);
303 entry =
translate (tui_border_kind, tui_border_kind_translate_ulcorner);
306 entry =
translate (tui_border_kind, tui_border_kind_translate_urcorner);
309 entry =
translate (tui_border_kind, tui_border_kind_translate_hline);
312 entry =
translate (tui_border_kind, tui_border_kind_translate_vline);
343 _(
"Text User Interface commands."),
344 &tuilist,
"tui ", 0, &
cmdlist);
362 const char *text,
const char *
word)
370 const char *completion_name = NULL;
380 completion_name =
"src";
383 completion_name =
"asm";
386 completion_name =
"regs";
389 completion_name =
"cmd";
395 if (completion_name != NULL)
438 _(
"TUI configuration variables"),
439 &tui_setlist,
"set tui ",
442 _(
"TUI configuration variables"),
443 &tui_showlist,
"show tui ",
447 _(
"Refresh the terminal display.\n"));
449 Set the width (in characters) of tab stops.\n\
450 Usage: tabset <n>\n"));
452 Set the height of a specified window.\n\
453 Usage: winheight <win_name> [+ | -] <#lines>\n\
455 src : the source window\n\
456 cmd : the command window\n\
457 asm : the disassembly window\n\
458 regs : the register display\n"));
461 _(
"List of all displayed windows.\n"));
463 Set focus to named window or next/prev window.\n\
464 Usage: focus {<win> | next | prev}\n\
465 Valid Window names are:\n\
466 src : the source window\n\
467 asm : the disassembly window\n\
468 regs : the register display\n\
469 cmd : the command window\n"));
473 Scroll window forward.\n\
474 Usage: + [win] [n]\n"));
476 Scroll window backward.\n\
477 Usage: - [win] [n]\n"));
479 Scroll window text to the left.\n\
480 Usage: < [win] [n]\n"));
482 Scroll window text to the right.\n\
483 Usage: > [win] [n]\n"));
487 &tui_border_kind,
_(
"\
488 Set the kind of border for TUI windows."),
_(
"\
489 Show the kind of border for TUI windows."),
_(
"\
490 This variable controls the border of TUI windows:\n\
491 space use a white space\n\
492 ascii use ascii characters + - | for the border\n\
493 acs use the Alternate Character Set"),
496 &tui_setlist, &tui_showlist);
499 &tui_border_mode,
_(
"\
500 Set the attribute mode to use for the TUI window borders."),
_(
"\
501 Show the attribute mode to use for the TUI window borders."),
_(
"\
502 This variable controls the attributes to use for the window borders:\n\
503 normal normal display\n\
504 standout use highlight mode of terminal\n\
505 reverse use reverse video mode\n\
506 half use half bright\n\
507 half-standout use half bright and standout mode\n\
508 bold use extra bright or bold\n\
509 bold-standout use extra bright or bold with standout mode"),
512 &tui_setlist, &tui_showlist);
515 &tui_active_border_mode,
_(
"\
516 Set the attribute mode to use for the active TUI window border."),
_(
"\
517 Show the attribute mode to use for the active TUI window border."),
_(
"\
518 This variable controls the attributes to use for the active window border:\n\
519 normal normal display\n\
520 standout use highlight mode of terminal\n\
521 reverse use reverse video mode\n\
522 half use half bright\n\
523 half-standout use half bright and standout mode\n\
524 bold use extra bright or bold\n\
525 bold-standout use extra bright or bold with standout mode"),
528 &tui_setlist, &tui_showlist);
556 if (win_info != NULL)
560 if (win_with_focus != NULL
576 int _num_to_scroll = num_to_scroll;
578 if (num_to_scroll == 0)
601 int _num_to_scroll = num_to_scroll;
603 if (num_to_scroll == 0)
627 int _num_to_scroll = num_to_scroll;
629 if (_num_to_scroll == 0)
650 int _num_to_scroll = num_to_scroll;
652 if (_num_to_scroll == 0)
698 clearok (curscr, TRUE);
739 int height_diff, width_diff;
740 int screenheight, screenwidth;
742 rl_get_screen_size (&screenheight, &screenwidth);
745 if (height_diff || width_diff)
753 int new_height, split_diff, cmd_split_diff, num_wins_displayed = 2;
755 #ifdef HAVE_RESIZE_TERM
756 resize_term (screenheight, screenwidth);
767 num_wins_displayed++;
768 split_diff = height_diff / num_wins_displayed;
769 cmd_split_diff = split_diff;
770 if (height_diff % num_wins_displayed)
781 clearok (curscr, TRUE);
789 locator->
width += width_diff;
791 if (height_diff == 0)
801 locator->
origin.
y = new_height + 1;
805 new_height = screenheight -
TUI_CMD_WIN->generic.origin.y;
830 if (height_diff == 0)
834 (screenheight - MIN_CMD_WIN_HEIGHT - 1))
835 new_height = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2;
842 locator->
width += width_diff;
846 if (height_diff == 0)
850 (screenheight - MIN_CMD_WIN_HEIGHT - 1))
852 new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1;
854 new_height = (new_height / 2) + 1;
904 tui_sigwinch_handler (
int signal)
914 rl_resize_terminal ();
918 int screen_height, screen_width;
920 rl_get_screen_size (&screen_height, &screen_width);
948 #ifdef HAVE_SIGACTION
949 struct sigaction old_winch;
951 memset (&old_winch, 0,
sizeof (old_winch));
952 old_winch.sa_handler = &tui_sigwinch_handler;
954 old_winch.sa_flags = SA_RESTART;
956 sigaction (SIGWINCH, &old_winch, NULL);
958 signal (SIGWINCH, &tui_sigwinch_handler);
973 int num_to_scroll = 1;
978 if (arg == (
char *) NULL)
989 int num_to_scroll = 1;
994 if (arg == (
char *) NULL)
1032 if (arg != (
char *) NULL)
1034 char *buf_ptr = (
char *) xstrdup (arg);
1038 for (i = 0; (i < strlen (buf_ptr)); i++)
1039 buf_ptr[i] = toupper (arg[i]);
1050 warning (
_(
"Invalid window specified. \n\
1051 The window name specified must be valid and visible.\n"));
1115 if (arg != (
char *) NULL)
1143 warning (
_(
"Tab widths greater than 0 must be specified."));
1154 if (arg != (
char *) NULL)
1156 char *buf = xstrdup (arg);
1157 char *buf_ptr = buf;
1158 char *wname = (
char *) NULL;
1163 buf_ptr = strchr (buf_ptr,
' ');
1164 if (buf_ptr != (
char *) NULL)
1166 *buf_ptr = (char) 0;
1169 for (i = 0; i < strlen (wname); i++)
1170 wname[i] = toupper (wname[i]);
1175 warning (
_(
"Invalid window specified. \n\
1176 The window name specified must be valid and visible.\n"));
1180 while (*(++buf_ptr) ==
' ')
1183 if (*buf_ptr != (
char) 0)
1186 int fixed_size = TRUE;
1189 if (*buf_ptr ==
'+' || *buf_ptr ==
'-')
1191 if (*buf_ptr ==
'-')
1196 input_no = atoi (buf_ptr);
1202 new_height = input_no;
1210 warning (
_(
"Invalid window height specified.\n%s"),
1216 warning (
_(
"Invalid window height specified.\n%s"),
1224 if (buf != (
char *) NULL)
1257 diff = (new_height - primary_win_info->
generic.
height) * (-1);
1267 src_win_info = win_info;
1272 src_win_info = primary_win_info;
1301 int first_split_diff = diff / 2;
1302 int second_split_diff = first_split_diff;
1315 second_split_diff--;
1317 second_split_diff++;
1325 second_split_diff--;
1327 while ((second_win->
generic.
height + second_split_diff) < 3)
1329 second_split_diff++;
1338 + second_split_diff);
1354 if (primary_win_info == first_win)
1360 if (primary_win_info == first_win)
1367 if (primary_win_info == second_win)
1444 gen_win_info->
handle = (WINDOW *) NULL;
1479 cursal.
symtab, line_or_addr, TRUE);
1543 diff = (new_height - primary_win_info->
generic.
height) * (-1);
1566 int cur_total_height, total_height, min_height = 0;
1584 total_height = cur_total_height =
1596 total_height = new_height +
1613 if (primary_win_info == first_win)
1620 if (primary_win_info == first_win)
1621 total_height = new_height +
1625 total_height = new_height +
1633 ok = (new_height >= min_height
1634 && total_height <= cur_total_height);
1653 if (arg != (
char *) NULL)
1655 char *buf, *buf_ptr;
1658 buf = buf_ptr = xstrdup (arg);
1659 if (isdigit (*buf_ptr))
1664 buf_ptr = strchr (buf_ptr,
' ');
1665 if (buf_ptr != (
char *) NULL)
1667 *buf_ptr = (char) 0;
1669 *num_to_scroll = atoi (num_str);
1672 else if (num_to_scroll)
1673 *num_to_scroll = atoi (num_str);
1677 if (buf_ptr != (
char *) NULL)
1682 if (*buf_ptr ==
' ')
1683 while (*(++buf_ptr) ==
' ')
1686 if (*buf_ptr != (
char) 0)
1691 for (i = 0; i < strlen (wname); i++)
1692 wname[i] = toupper (wname[i]);
1701 error (
_(
"Invalid window specified. \n\
1702 The window name specified must be valid and visible.\n"));
static const char *const tui_border_kind_enums[]
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
void tui_update_gdb_sizes(void)
void tui_set_term_height_to(int h)
void tui_vertical_data_scroll(enum tui_scroll_direction scroll_direction, int num_to_scroll)
struct tui_command_info command_info
static void make_visible_with_new_height(struct tui_win_info *)
void tui_scroll_backward(struct tui_win_info *win_to_scroll, int num_to_scroll)
int tui_win_has_locator(struct tui_win_info *win_info)
CORE_ADDR get_frame_pc(struct frame_info *frame)
static void tui_refresh_all_command(char *, int)
struct tui_win_info * tui_win_list[MAX_MAJOR_WINDOWS]
static void tui_scroll_forward_command(char *, int)
const char * tui_win_name(const struct tui_gen_win_info *win_info)
int tui_term_height(void)
static void parse_scrolling_args(char *, struct tui_win_info **, int *)
void tui_make_invisible(struct tui_gen_win_info *win_info)
const char * tui_border_mode
void tui_refresh_data_win(void)
void add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void tui_scroll_forward(struct tui_win_info *win_to_scroll, int num_to_scroll)
void warning(const char *fmt,...)
static void tui_set_focus_command(char *, int)
void mark_async_signal_handler(async_signal_handler *async_handler_ptr)
static void tui_set_win_height(char *arg, int from_tty)
const char * tui_border_kind
struct symtab_and_line get_current_source_symtab_and_line(void)
struct ui_file * gdb_stdout
void tui_horizontal_source_scroll(struct tui_win_info *win_info, enum tui_scroll_direction direction, int num_to_scroll)
struct tui_win_info * tui_prev_win(struct tui_win_info *cur_win)
struct tui_list * tui_source_windows(void)
void tui_update_exec_info(struct tui_win_info *win_info)
void tui_set_win_focus_to(struct tui_win_info *win_info)
static enum tui_status tui_adjust_win_heights(struct tui_win_info *, int)
#define VEC_safe_push(T, V, O)
union tui_line_or_address::@171 u
struct cmd_list_element * cmdlist
void tui_unhighlight_win(struct tui_win_info *win_info)
void tui_redisplay_readline(void)
enum tui_line_or_address_kind loa
void tui_set_var_cmd(char *null_args, int from_tty, struct cmd_list_element *c)
void tui_delete_win(WINDOW *window)
void printf_filtered(const char *format,...)
struct tui_win_info * tui_next_win(struct tui_win_info *cur_win)
void tui_update_source_window(struct tui_win_info *win_info, struct gdbarch *gdbarch, struct symtab *s, struct tui_line_or_address line_or_addr, int noerror)
void tui_refresh_all_win(void)
void tui_set_term_width_to(int w)
void tui_scroll(enum tui_scroll_direction direction, struct tui_win_info *win_to_scroll, int num_to_scroll)
struct cmd_list_element * setlist
static void set_tui_cmd(char *args, int from_tty)
void tui_erase_source_content(struct tui_win_info *win_info, int display_prompt)
static void tui_all_windows_info(char *, int)
struct tui_gen_win_info generic
struct tui_source_info source_info
static void tui_scroll_backward_command(char *, int)
void initialize_file_ftype(void)
void tui_show_source_content(struct tui_win_info *win_info)
void tui_highlight_win(struct tui_win_info *win_info)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
const char * const_char_ptr
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
void tui_vertical_disassem_scroll(enum tui_scroll_direction scroll_direction, int num_to_scroll)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
struct cmd_list_element * showlist
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
struct tui_win_info * tui_win_with_focus(void)
struct frame_info * deprecated_safe_get_selected_frame(void)
struct tui_line_or_address start_line_or_addr
struct tui_gen_win_info * tui_locator_win_info_ptr(void)
static struct cmd_list_element * tuilist
static void tui_set_focus(char *arg, int from_tty)
int tui_active_border_attrs
void tui_scroll_right(struct tui_win_info *win_to_scroll, int num_to_scroll)
static void show_tui_border_kind(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
struct cmd_list_element * add_info(const char *name, cmd_cfunc_ftype *fun, const char *doc)
void tui_vertical_source_scroll(enum tui_scroll_direction scroll_direction, int num_to_scroll)
chtype tui_border_ulcorner
async_signal_handler * create_async_signal_handler(sig_handler_func *proc, gdb_client_data client_data)
chtype tui_border_urcorner
static void make_invisible_and_set_new_height(struct tui_win_info *, int)
void printf_unfiltered(const char *format,...)
chtype tui_border_lrcorner
static int new_height_ok(struct tui_win_info *, int)
void tui_rehighlight_all(void)
void tui_free_window(struct tui_win_info *win_info)
void tui_initialize_win(void)
chtype tui_border_llcorner
void tui_set_win_resized_to(int resized)
struct cmd_list_element ** tui_get_cmd_list(void)
int find_line_pc(struct symtab *symtab, int line, CORE_ADDR *pc)
void tui_show_locator_content(void)
static void tui_scroll_left_command(char *, int)
void tui_make_visible(struct tui_gen_win_info *win_info)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
static struct tui_translate * translate(const char *name, struct tui_translate *table)
int tui_update_variables(void)
struct tui_gen_win_info * execution_info
static const char *const tui_border_mode_enums[]
void tui_resize_all(void)
void tui_set_win_with_focus(struct tui_win_info *win_info)
static void tui_command(char *args, int from_tty)
struct tui_win_info * tui_partial_win_by_name(char *name)
static struct tui_win_info * win_with_focus
#define VEC_address(T, V)
static void tui_set_tab_width_command(char *, int)
void tui_erase_exec_info_content(struct tui_win_info *win_info)
void tui_scroll_left(struct tui_win_info *win_to_scroll, int num_to_scroll)
void tui_refresh_all(struct tui_win_info **list)
void tui_check_and_display_highlight_if_needed(struct tui_win_info *win_info)
union tui_win_info::@172 detail
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static void tui_scroll_right_command(char *, int)
#define EMPTY_SOURCE_PROMPT
void tui_display_all_data(void)
static void show_tui_cmd(char *args, int from_tty)
static void show_tui_active_border_mode(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
const char * tui_active_border_mode
int subset_compare(char *string_to_compare, char *template_string)
void tui_free_win_content(struct tui_gen_win_info *win_info)
struct symtab * find_pc_line_symtab(CORE_ADDR pc)
initialize_file_ftype _initialize_tui_win
void set_screen_width_and_height(int width, int height)
void tui_set_default_tab_len(int len)
static void tui_set_win_height_command(char *, int)
void error(const char *fmt,...)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
#define MIN_CMD_WIN_HEIGHT
static void show_tui_border_mode(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
enum tui_layout_type tui_current_layout(void)