/* 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 (); } }
/* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND, SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or UNDEFINED_LAYOUT, then the data window is populated according to regs_display_type. */ enum tui_status tui_set_layout (enum tui_layout_type layout_type, enum tui_register_display_type regs_display_type) { enum tui_status status = TUI_SUCCESS; if (layout_type != UNDEFINED_LAYOUT || regs_display_type != TUI_UNDEFINED_REGS) { enum tui_layout_type cur_layout = tui_current_layout (), new_layout = UNDEFINED_LAYOUT; int regs_populate = FALSE; struct gdbarch *gdbarch; CORE_ADDR addr; struct tui_win_info *win_with_focus = tui_win_with_focus (); struct tui_layout_def *layout_def = tui_layout_def (); extract_display_start_addr (&gdbarch, &addr); if (layout_type == UNDEFINED_LAYOUT && regs_display_type != TUI_UNDEFINED_REGS) { if (cur_layout == SRC_DISASSEM_COMMAND) new_layout = DISASSEM_DATA_COMMAND; else if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND) new_layout = SRC_DATA_COMMAND; else if (cur_layout == DISASSEM_COMMAND || cur_layout == DISASSEM_DATA_COMMAND) new_layout = DISASSEM_DATA_COMMAND; } else new_layout = layout_type; regs_populate = (new_layout == SRC_DATA_COMMAND || new_layout == DISASSEM_DATA_COMMAND || regs_display_type != TUI_UNDEFINED_REGS); if (new_layout != cur_layout || regs_display_type != TUI_UNDEFINED_REGS) { if (new_layout != cur_layout) { show_layout (new_layout); /* Now determine where focus should be. */ if (win_with_focus != TUI_CMD_WIN) { switch (new_layout) { case SRC_COMMAND: tui_set_win_focus_to (TUI_SRC_WIN); layout_def->display_mode = SRC_WIN; layout_def->split = FALSE; break; case DISASSEM_COMMAND: /* The previous layout was not showing code. This can happen if there is no source available: 1. if the source file is in another dir OR 2. if target was compiled without -g We still want to show the assembly though! */ tui_get_begin_asm_address (&gdbarch, &addr); tui_set_win_focus_to (TUI_DISASM_WIN); layout_def->display_mode = DISASSEM_WIN; layout_def->split = FALSE; break; case SRC_DISASSEM_COMMAND: /* The previous layout was not showing code. This can happen if there is no source available: 1. if the source file is in another dir OR 2. if target was compiled without -g We still want to show the assembly though! */ tui_get_begin_asm_address (&gdbarch, &addr); if (win_with_focus == TUI_SRC_WIN) tui_set_win_focus_to (TUI_SRC_WIN); else tui_set_win_focus_to (TUI_DISASM_WIN); layout_def->split = TRUE; break; case SRC_DATA_COMMAND: if (win_with_focus != TUI_DATA_WIN) tui_set_win_focus_to (TUI_SRC_WIN); else tui_set_win_focus_to (TUI_DATA_WIN); layout_def->display_mode = SRC_WIN; layout_def->split = FALSE; break; case DISASSEM_DATA_COMMAND: /* The previous layout was not showing code. This can happen if there is no source available: 1. if the source file is in another dir OR 2. if target was compiled without -g We still want to show the assembly though! */ tui_get_begin_asm_address (&gdbarch, &addr); if (win_with_focus != TUI_DATA_WIN) tui_set_win_focus_to (TUI_DISASM_WIN); else tui_set_win_focus_to (TUI_DATA_WIN); layout_def->display_mode = DISASSEM_WIN; layout_def->split = FALSE; break; default: break; } } /* * Now update the window content. */ if (!regs_populate && (new_layout == SRC_DATA_COMMAND || new_layout == DISASSEM_DATA_COMMAND)) tui_display_all_data (); tui_update_source_windows_with_addr (gdbarch, addr); } if (regs_populate) { tui_show_registers (TUI_DATA_WIN->detail.data_display_info.current_group); } } } else status = TUI_FAILURE; return status; }