/* 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. */
+ SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. */
enum tui_status
-tui_set_layout (enum tui_layout_type layout_type,
- enum tui_register_display_type regs_display_type)
+tui_set_layout (enum tui_layout_type layout_type)
{
enum tui_status status = TUI_SUCCESS;
- if (layout_type != UNDEFINED_LAYOUT
- || regs_display_type != TUI_UNDEFINED_REGS)
+ if (layout_type != UNDEFINED_LAYOUT)
{
enum tui_layout_type cur_layout = tui_current_layout (),
new_layout = UNDEFINED_LAYOUT;
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;
+ 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)
+ regs_populate = (new_layout == SRC_DATA_COMMAND
+ || new_layout == DISASSEM_DATA_COMMAND);
+ if (new_layout != cur_layout)
{
- if (new_layout != cur_layout)
- {
- show_layout (new_layout);
+ show_layout (new_layout);
- /* Now determine where focus should be. */
- if (win_with_focus != TUI_CMD_WIN)
+ /* Now determine where focus should be. */
+ if (win_with_focus != TUI_CMD_WIN)
+ {
+ switch (new_layout)
{
- 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;
- }
+ 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);
}
+ /*
+ * 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);
+ struct reggroup *group =
+ TUI_DATA_WIN->detail.data_display_info.current_group;
+ tui_show_registers (group);
}
}
}
return h;
}
-
/* Function to initialize gdb commands, for tui window layout
manipulation. */
**************************/
-/* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
- REGS, $REGS, $GREGS, $FREGS, $SREGS. */
+/* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, or
+ REGS. */
enum tui_status
-tui_set_layout_for_display_command (const char *layout_name)
+tui_set_layout_by_name (const char *layout_name)
{
enum tui_status status = TUI_SUCCESS;
int i;
char *buf_ptr;
enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
- enum tui_register_display_type dpy_type = TUI_UNDEFINED_REGS;
enum tui_layout_type cur_layout = tui_current_layout ();
buf_ptr = (char *) xstrdup (layout_name);
buf_ptr[i] = toupper (buf_ptr[i]);
/* First check for ambiguous input. */
- if (strlen (buf_ptr) <= 1
- && (*buf_ptr == 'S' || *buf_ptr == '$'))
+ if (strlen (buf_ptr) <= 1 && *buf_ptr == 'S')
{
warning (_("Ambiguous command input."));
status = TUI_FAILURE;
new_layout = DISASSEM_COMMAND;
else if (subset_compare (buf_ptr, "SPLIT"))
new_layout = SRC_DISASSEM_COMMAND;
- else if (subset_compare (buf_ptr, "REGS")
- || subset_compare (buf_ptr, TUI_GENERAL_SPECIAL_REGS_NAME)
- || subset_compare (buf_ptr, TUI_GENERAL_REGS_NAME)
- || subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME)
- || subset_compare (buf_ptr, TUI_SPECIAL_REGS_NAME))
+ else if (subset_compare (buf_ptr, "REGS"))
{
- if (cur_layout == SRC_COMMAND
+ if (cur_layout == SRC_COMMAND
|| cur_layout == SRC_DATA_COMMAND)
new_layout = SRC_DATA_COMMAND;
else
new_layout = DISASSEM_DATA_COMMAND;
-
- /* Could ifdef out the following code. when compile with
- -z, there are null pointer references that cause a
- core dump if 'layout regs' is the first layout
- command issued by the user. HP has asked us to hook
- up this code. - edie epstein */
- if (subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME))
- {
- if (TUI_DATA_WIN->detail.data_display_info.regs_display_type
- != TUI_SFLOAT_REGS
- && TUI_DATA_WIN->detail.data_display_info.regs_display_type
- != TUI_DFLOAT_REGS)
- dpy_type = TUI_SFLOAT_REGS;
- else
- dpy_type =
- TUI_DATA_WIN->detail.data_display_info.regs_display_type;
- }
- else if (subset_compare (buf_ptr,
- TUI_GENERAL_SPECIAL_REGS_NAME))
- dpy_type = TUI_GENERAL_AND_SPECIAL_REGS;
- else if (subset_compare (buf_ptr, TUI_GENERAL_REGS_NAME))
- dpy_type = TUI_GENERAL_REGS;
- else if (subset_compare (buf_ptr, TUI_SPECIAL_REGS_NAME))
- dpy_type = TUI_SPECIAL_REGS;
- else if (TUI_DATA_WIN)
- {
- if (TUI_DATA_WIN->detail.data_display_info.regs_display_type
- != TUI_UNDEFINED_REGS)
- dpy_type
- = TUI_DATA_WIN->detail.data_display_info.regs_display_type;
- else
- dpy_type = TUI_GENERAL_REGS;
- }
-
- /* End of potential ifdef.
- */
-
- /* If ifdefed out code above, then assume that the user
- wishes to display the general purpose registers .
- */
-
- /* dpy_type = TUI_GENERAL_REGS; */
}
else if (subset_compare (buf_ptr, "NEXT"))
new_layout = next_layout ();
else
status = TUI_FAILURE;
- tui_set_layout (new_layout, dpy_type);
+ tui_set_layout (new_layout);
}
xfree (buf_ptr);
}
tui_enable ();
/* Switch to the selected layout. */
- if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS)
+ if (tui_set_layout_by_name (arg) != TUI_SUCCESS)
warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE);
}