/* TUI readline command. Switch the output mode between TUI/standard gdb. */ static int tui_rl_switch_mode (int notused1, int notused2) { if (tui_active) { tui_disable (); rl_prep_terminal (0); } else { rl_deprep_terminal (); tui_enable (); } /* Clear the readline in case switching occurred in middle of something. */ if (rl_end) rl_kill_text (0, rl_end); /* Since we left the curses mode, the terminal mode is restored to some previous state. That state may not be suitable for readline to work correctly (it may be restored in line mode). We force an exit of the current readline so that readline is re-entered and it will be able to setup the terminal for its needs. By re-entering in readline, we also redisplay its prompt in the non-curses mode. */ rl_newline (1, '\n'); /* Make sure the \n we are returning does not repeat the last command. */ dont_repeat (); return 0; }
static int tui_resume (void *data) { struct ui_file *stream; /* gdb_setup_readline will change gdb_stdout. If the TUI was previously writing to gdb_stdout, then set it to the new gdb_stdout afterwards. */ stream = cli_out_set_stream (tui_old_uiout, gdb_stdout); if (stream != gdb_stdout) { cli_out_set_stream (tui_old_uiout, stream); stream = NULL; } gdb_setup_readline (); if (stream != NULL) cli_out_set_stream (tui_old_uiout, gdb_stdout); if (tui_start_enabled) tui_enable (); return 1; }
static void tui_toggle_split_layout_command (char *arg, int from_tty) { struct tui_layout_def *layout_def = tui_layout_def (); /* Make sure the curses mode is enabled. */ tui_enable (); layout_def->split = (!layout_def->split); tui_handle_xdb_layout (layout_def); }
static void tui_layout_command (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); /* Switch to the selected layout. */ if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS) warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE); }
/* Show the registers of the given group in the data window and refresh the window. */ void tui_show_registers (struct reggroup *group) { enum tui_status ret = TUI_FAILURE; struct tui_data_info *display_info; /* Make sure the curses mode is enabled. */ tui_enable (); /* Make sure the register window is visible. If not, select an appropriate layout. */ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible) tui_set_layout_for_display_command (DATA_NAME); display_info = &TUI_DATA_WIN->detail.data_display_info; if (group == 0) group = general_reggroup; /* Say that registers should be displayed, even if there is a problem. */ display_info->display_regs = TRUE; if (target_has_registers && target_has_stack && target_has_memory) { ret = tui_show_register_group (group, get_selected_frame (NULL), group == display_info->current_group); } if (ret == TUI_FAILURE) { display_info->current_group = 0; tui_erase_data_content (NO_REGS_STRING); } else { int i; /* Clear all notation of changed values. */ for (i = 0; i < display_info->regs_content_count; i++) { struct tui_gen_win_info *data_item_win; struct tui_win_element *win; data_item_win = &display_info->regs_content[i] ->which_element.data_window; win = (struct tui_win_element *) data_item_win->content[0]; win->which_element.data.highlight = FALSE; } display_info->current_group = group; tui_display_all_data (); } }
static void tui_toggle_layout_command (char *arg, int from_tty) { struct tui_layout_def *layout_def = tui_layout_def (); /* Make sure the curses mode is enabled. */ tui_enable (); if (layout_def->display_mode == SRC_WIN) layout_def->display_mode = DISASSEM_WIN; else layout_def->display_mode = SRC_WIN; if (!layout_def->split) tui_handle_xdb_layout (layout_def); }