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"),
343 _(
"Text User Interface commands."),
365 int include_next_prev_p,
366 const char *text,
const char *word)
368 std::vector<const char *> completion_name_vec;
373 const char *completion_name = NULL;
382 completion_name_vec.push_back (completion_name);
389 if (completion_name_vec.empty ())
391 completion_name_vec.push_back (
SRC_NAME);
392 completion_name_vec.push_back (
CMD_NAME);
395 if (include_next_prev_p)
397 completion_name_vec.push_back (
"next");
398 completion_name_vec.push_back (
"prev");
402 completion_name_vec.push_back (NULL);
412 const char *text,
const char *word)
424 const char *text,
const char *word)
447 _(
"TUI configuration variables"),
448 &tui_setlist,
"set tui ",
451 _(
"TUI configuration variables"),
452 &tui_showlist,
"show tui ",
456 _(
"Refresh the terminal display.\n"));
458 Set the width (in characters) of tab stops.\n\ 459 Usage: tabset <n>\n"));
461 Set or modify the height of a specified window.\n\ 462 Usage: winheight <win_name> [+ | -] <#lines>\n\ 464 src : the source window\n\ 465 cmd : the command window\n\ 466 asm : the disassembly window\n\ 467 regs : the register display\n"));
471 _(
"List of all displayed windows.\n"));
473 Set focus to named window or next/prev window.\n\ 474 Usage: focus {<win> | next | prev}\n\ 475 Valid Window names are:\n\ 476 src : the source window\n\ 477 asm : the disassembly window\n\ 478 regs : the register display\n\ 479 cmd : the command window\n"));
483 Scroll window forward.\n\ 484 Usage: + [win] [n]\n"));
486 Scroll window backward.\n\ 487 Usage: - [win] [n]\n"));
489 Scroll window text to the left.\n\ 490 Usage: < [win] [n]\n"));
492 Scroll window text to the right.\n\ 493 Usage: > [win] [n]\n"));
498 Set the kind of border for TUI windows."),
_(
"\ 499 Show the kind of border for TUI windows."),
_(
"\ 500 This variable controls the border of TUI windows:\n\ 501 space use a white space\n\ 502 ascii use ascii characters + - | for the border\n\ 503 acs use the Alternate Character Set"),
506 &tui_setlist, &tui_showlist);
510 Set the attribute mode to use for the TUI window borders."),
_(
"\ 511 Show the attribute mode to use for the TUI window borders."),
_(
"\ 512 This variable controls the attributes to use for the window borders:\n\ 513 normal normal display\n\ 514 standout use highlight mode of terminal\n\ 515 reverse use reverse video mode\n\ 516 half use half bright\n\ 517 half-standout use half bright and standout mode\n\ 518 bold use extra bright or bold\n\ 519 bold-standout use extra bright or bold with standout mode"),
522 &tui_setlist, &tui_showlist);
526 Set the attribute mode to use for the active TUI window border."),
_(
"\ 527 Show the attribute mode to use for the active TUI window border."),
_(
"\ 528 This variable controls the attributes to use for the active window border:\n\ 529 normal normal display\n\ 530 standout use highlight mode of terminal\n\ 531 reverse use reverse video mode\n\ 532 half use half bright\n\ 533 half-standout use half bright and standout mode\n\ 534 bold use extra bright or bold\n\ 535 bold-standout use extra bright or bold with standout mode"),
538 &tui_setlist, &tui_showlist);
566 if (win_info != NULL)
586 int _num_to_scroll = num_to_scroll;
588 if (num_to_scroll == 0)
611 int _num_to_scroll = num_to_scroll;
613 if (num_to_scroll == 0)
637 int _num_to_scroll = num_to_scroll;
639 if (_num_to_scroll == 0)
660 int _num_to_scroll = num_to_scroll;
662 if (_num_to_scroll == 0)
708 clearok (curscr, TRUE);
749 int height_diff, width_diff;
750 int screenheight, screenwidth;
752 rl_get_screen_size (&screenheight, &screenwidth);
755 if (height_diff || width_diff)
763 int new_height, split_diff, cmd_split_diff, num_wins_displayed = 2;
765 #ifdef HAVE_RESIZE_TERM 766 resize_term (screenheight, screenwidth);
777 num_wins_displayed++;
778 split_diff = height_diff / num_wins_displayed;
779 cmd_split_diff = split_diff;
780 if (height_diff % num_wins_displayed)
791 clearok (curscr, TRUE);
799 locator->
width += width_diff;
801 if (height_diff == 0)
811 locator->
origin.
y = new_height + 1;
815 new_height = screenheight -
TUI_CMD_WIN->generic.origin.y;
840 if (height_diff == 0)
852 locator->
width += width_diff;
856 if (height_diff == 0)
864 new_height = (new_height / 2) + 1;
914 tui_sigwinch_handler (
int signal)
924 rl_resize_terminal ();
928 int screen_height, screen_width;
930 rl_get_screen_size (&screen_height, &screen_width);
958 #ifdef HAVE_SIGACTION 959 struct sigaction old_winch;
961 memset (&old_winch, 0,
sizeof (old_winch));
962 old_winch.sa_handler = &tui_sigwinch_handler;
964 old_winch.sa_flags = SA_RESTART;
966 sigaction (SIGWINCH, &old_winch, NULL);
968 signal (SIGWINCH, &tui_sigwinch_handler);
983 int num_to_scroll = 1;
988 if (arg == (
char *) NULL)
999 int num_to_scroll = 1;
1004 if (arg == (
char *) NULL)
1042 if (arg != (
char *) NULL)
1044 char *buf_ptr = (
char *) xstrdup (arg);
1048 for (i = 0; (i < strlen (buf_ptr)); i++)
1049 buf_ptr[i] = tolower (arg[i]);
1060 warning (
_(
"Invalid window specified. \n\ 1061 The window name specified must be valid and visible.\n"));
1125 if (arg != (
char *) NULL)
1153 warning (
_(
"Tab widths greater than 0 must be specified."));
1164 if (arg != (
char *) NULL)
1167 char *buf = ©[0];
1168 char *buf_ptr = buf;
1174 buf_ptr = strchr (buf_ptr,
' ');
1175 if (buf_ptr != (
char *) NULL)
1177 *buf_ptr = (char) 0;
1180 for (i = 0; i < strlen (wname); i++)
1181 wname[i] = tolower (wname[i]);
1186 warning (
_(
"Invalid window specified. \n\ 1187 The window name specified must be valid and visible.\n"));
1191 while (*(++buf_ptr) ==
' ')
1194 if (*buf_ptr != (
char) 0)
1197 int fixed_size = TRUE;
1200 if (*buf_ptr ==
'+' || *buf_ptr ==
'-')
1202 if (*buf_ptr ==
'-')
1207 input_no = atoi (buf_ptr);
1213 new_height = input_no;
1221 warning (
_(
"Invalid window height specified.\n%s"),
1227 warning (
_(
"Invalid window height specified.\n%s"),
1265 diff = (new_height - primary_win_info->
generic.
height) * (-1);
1275 src_win_info = win_info;
1280 src_win_info = primary_win_info;
1309 int first_split_diff = diff / 2;
1310 int second_split_diff = first_split_diff;
1323 second_split_diff--;
1325 second_split_diff++;
1333 second_split_diff--;
1335 while ((second_win->
generic.
height + second_split_diff) < 3)
1337 second_split_diff++;
1346 + second_split_diff);
1362 if (primary_win_info == first_win)
1368 if (primary_win_info == first_win)
1375 if (primary_win_info == second_win)
1452 gen_win_info->
handle = NULL;
1487 cursal.
symtab, line_or_addr, TRUE);
1547 diff = (new_height - primary_win_info->
generic.
height) * (-1);
1570 int cur_total_height, total_height, min_height = 0;
1588 total_height = cur_total_height =
1600 total_height = new_height +
1617 if (primary_win_info == first_win)
1624 if (primary_win_info == first_win)
1625 total_height = new_height +
1629 total_height = new_height +
1637 ok = (new_height >= min_height
1638 && total_height <= cur_total_height);
1657 if (arg != (
char *) NULL)
1664 if (isdigit (*buf_ptr))
1669 buf_ptr = strchr (buf_ptr,
' ');
1670 if (buf_ptr != (
char *) NULL)
1672 *buf_ptr = (char) 0;
1674 *num_to_scroll = atoi (num_str);
1677 else if (num_to_scroll)
1678 *num_to_scroll = atoi (num_str);
1682 if (buf_ptr != (
char *) NULL)
1686 if (*buf_ptr ==
' ')
1687 while (*(++buf_ptr) ==
' ')
1690 if (*buf_ptr != (
char) 0)
1693 for (
char *p = buf_ptr; *p !=
'\0'; p++)
1705 error (
_(
"Invalid window specified. \n\ 1706 The window name specified must be valid and visible.\n"));
static const char *const tui_border_kind_enums[]
static void tui_scroll_right_command(const char *, int)
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)
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)
struct tui_win_info * tui_win_list[MAX_MAJOR_WINDOWS]
static void tui_set_win_height(const char *arg, int from_tty)
const char * tui_win_name(const struct tui_gen_win_info *win_info)
int tui_term_height(void)
void tui_make_invisible(struct tui_gen_win_info *win_info)
const char * tui_border_mode
void tui_refresh_data_win(void)
void tui_scroll_forward(struct tui_win_info *win_to_scroll, int num_to_scroll)
void warning(const char *fmt,...)
void mark_async_signal_handler(async_signal_handler *async_handler_ptr)
const char * tui_border_kind
struct symtab_and_line get_current_source_symtab_and_line(void)
void tui_horizontal_source_scroll(struct tui_win_info *win_info, enum tui_scroll_direction direction, int num_to_scroll)
struct cmd_list_element * add_info(const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
void complete_on_enum(completion_tracker &tracker, const char *const *enumlist, const char *text, const char *word)
void * memset(T *s, int c, size_t n)=delete
struct tui_translate tui_border_mode_translate[]
struct tui_win_info * tui_prev_win(struct tui_win_info *cur_win)
static void tui_command(const char *args, int from_tty)
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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
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)
static void tui_all_windows_info(const char *, int)
struct cmd_list_element * cmdlist
void tui_unhighlight_win(struct tui_win_info *win_info)
static void parse_scrolling_args(const char *, struct tui_win_info **, int *)
void tui_redisplay_readline(void)
enum tui_line_or_address_kind loa
static void show_tui_cmd(const char *args, int from_tty)
void tui_delete_win(WINDOW *window)
static void tui_set_tab_width_command(const char *, int)
void printf_filtered(const char *format,...)
static void tui_refresh_all_command(const char *, int)
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)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
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)
static void focus_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
struct cmd_list_element * setlist
void tui_erase_source_content(struct tui_win_info *win_info, int display_prompt)
struct tui_gen_win_info generic
struct tui_source_info source_info
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,...)
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)
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)
static void tui_scroll_forward_command(const char *, int)
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
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)
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)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
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)
struct tui_win_info * tui_partial_win_by_name(const char *name)
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)
struct tui_translate tui_border_kind_translate_lrcorner[]
void tui_show_locator_content(void)
static void window_name_completer(completion_tracker &tracker, int include_next_prev_p, const char *text, const char *word)
struct tui_translate tui_border_kind_translate_vline[]
void tui_make_visible(struct tui_gen_win_info *win_info)
void _initialize_tui_win(void)
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)
union tui_win_info::@182 detail
static void set_tui_cmd(const char *args, int from_tty)
int tui_update_variables(void)
struct tui_translate tui_border_kind_translate_ulcorner[]
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)
union tui_line_or_address::@181 u
struct tui_translate tui_border_kind_translate_hline[]
static void winheight_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
static struct tui_win_info * win_with_focus
static void tui_scroll_backward_command(const 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)
static void tui_scroll_left_command(const char *, int)
void tui_refresh_all(struct tui_win_info **list)
void tui_check_and_display_highlight_if_needed(struct tui_win_info *win_info)
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
#define EMPTY_SOURCE_PROMPT
struct tui_translate tui_border_kind_translate_urcorner[]
void tui_display_all_data(void)
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
void tui_free_win_content(struct tui_gen_win_info *win_info)
void tui_set_var_cmd(const char *null_args, int from_tty, struct cmd_list_element *c)
struct symtab * find_pc_line_symtab(CORE_ADDR pc)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
static void tui_set_focus_command(const char *, int)
static void tui_set_win_height_command(const char *, int)
void set_screen_width_and_height(int width, int height)
void tui_set_default_tab_len(int len)
void error(const char *fmt,...)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
struct tui_translate tui_border_kind_translate_llcorner[]
#define MIN_CMD_WIN_HEIGHT
int subset_compare(const char *string_to_compare, const char *template_string)
static void show_tui_border_mode(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void tui_set_focus(const char *arg, int from_tty)
enum tui_layout_type tui_current_layout(void)