1 /* TUI display registers in window.
3 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
6 Contributed by Hewlett-Packard Company.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
27 #include "tui/tui-data.h"
35 #include "gdb_string.h"
36 #include "tui/tui-layout.h"
37 #include "tui/tui-win.h"
38 #include "tui/tui-windata.h"
39 #include "tui/tui-wingeneral.h"
40 #include "tui/tui-file.h"
42 #include "gdb_curses.h"
44 /*****************************************
45 ** LOCAL DEFINITIONS **
46 ******************************************/
47 #define DOUBLE_FLOAT_LABEL_WIDTH 6
48 #define DOUBLE_FLOAT_LABEL_FMT "%6.6s: "
49 #define DOUBLE_FLOAT_VALUE_WIDTH 30 /*min of 16 but may be in sci notation */
51 #define SINGLE_FLOAT_LABEL_WIDTH 6
52 #define SINGLE_FLOAT_LABEL_FMT "%6.6s: "
53 #define SINGLE_FLOAT_VALUE_WIDTH 25 /* min of 8 but may be in sci notation */
55 #define SINGLE_LABEL_WIDTH 16
56 #define SINGLE_LABEL_FMT "%10.10s: "
57 #define SINGLE_VALUE_WIDTH 20 /* minimum of 8 but may be in sci notation */
59 /* In the code HP gave Cygnus, this was actually a function call to a
60 PA-specific function, which was supposed to determine whether the
61 target was a 64-bit or 32-bit processor. However, the 64-bit
62 support wasn't complete, so we didn't merge that in, so we leave
63 this here as a stub. */
66 /*****************************************
68 ******************************************/
71 /*****************************************
72 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
73 ******************************************/
74 static enum tui_status tui_set_regs_content
75 (int, int, struct frame_info *, enum tui_register_display_type, int);
76 static const char *tui_register_name (int);
77 static enum tui_status tui_get_register_raw_value (int, char *, struct frame_info *);
78 static void tui_set_register_element
79 (int, struct frame_info *, struct tui_data_element *, int);
80 static void tui_display_register (int, struct tui_gen_win_info *, enum precision_type);
81 static void tui_register_format
82 (char *, int, int, struct tui_data_element *, enum precision_type);
83 static enum tui_status tui_set_general_regs_content (int);
84 static enum tui_status tui_set_special_regs_content (int);
85 static enum tui_status tui_set_general_and_special_regs_content (int);
86 static enum tui_status tui_set_float_regs_content (enum tui_register_display_type, int);
87 static int tui_reg_value_has_changed
88 (struct tui_data_element *, struct frame_info *, char *);
89 static void tui_show_float_command (char *, int);
90 static void tui_show_general_command (char *, int);
91 static void tui_show_special_command (char *, int);
92 static void tui_v_show_registers_command_support (enum tui_register_display_type);
93 static void _tui_toggle_float_regs_command (char *, int);
94 static void tui_scroll_regs_forward_command (char *, int);
95 static void tui_scroll_regs_backward_command (char *, int);
99 /*****************************************
100 ** PUBLIC FUNCTIONS **
101 ******************************************/
103 /* Answer the number of the last line in the regs display. If there
104 are no registers (-1) is returned. */
106 tui_last_regs_line_no (void)
108 int num_lines = (-1);
110 if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
112 num_lines = (TUI_DATA_WIN->detail.data_display_info.regs_content_count /
113 TUI_DATA_WIN->detail.data_display_info.regs_column_count);
114 if (TUI_DATA_WIN->detail.data_display_info.regs_content_count %
115 TUI_DATA_WIN->detail.data_display_info.regs_column_count)
122 /* Answer the line number that the register element at element_no is
123 on. If element_no is greater than the number of register elements
124 there are, -1 is returned. */
126 tui_line_from_reg_element_no (int element_no)
128 if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
136 (TUI_DATA_WIN->detail.data_display_info.regs_column_count * i))
149 /* Answer the index of the first element in line_no. If line_no is past
150 the register area (-1) is returned. */
152 tui_first_reg_element_no_inline (int line_no)
154 if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count)
155 <= TUI_DATA_WIN->detail.data_display_info.regs_content_count)
156 return ((line_no + 1) *
157 TUI_DATA_WIN->detail.data_display_info.regs_column_count) -
158 TUI_DATA_WIN->detail.data_display_info.regs_column_count;
164 /* Answer the index of the last element in line_no. If line_no is
165 past the register area (-1) is returned. */
167 tui_last_reg_element_no_in_line (int line_no)
169 if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count) <=
170 TUI_DATA_WIN->detail.data_display_info.regs_content_count)
171 return ((line_no + 1) *
172 TUI_DATA_WIN->detail.data_display_info.regs_column_count) - 1;
178 /* Calculate the number of columns that should be used to display the
181 tui_calculate_regs_column_count (enum tui_register_display_type dpy_type)
183 int col_count, col_width;
185 if (IS_64BIT || dpy_type == TUI_DFLOAT_REGS)
186 col_width = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH;
189 if (dpy_type == TUI_SFLOAT_REGS)
190 col_width = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH;
192 col_width = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH;
194 col_count = (TUI_DATA_WIN->generic.width - 2) / col_width;
200 /* Show the registers int the data window as indicated by dpy_type. If
201 there is any other registers being displayed, then they are
202 cleared. What registers are displayed is dependent upon dpy_type. */
204 tui_show_registers (enum tui_register_display_type dpy_type)
206 enum tui_status ret = TUI_FAILURE;
207 int refresh_values_only = FALSE;
209 /* Say that registers should be displayed, even if there is a problem */
210 TUI_DATA_WIN->detail.data_display_info.display_regs = TRUE;
212 if (target_has_registers)
214 refresh_values_only =
215 (dpy_type == TUI_DATA_WIN->detail.data_display_info.regs_display_type);
218 case TUI_GENERAL_REGS:
219 ret = tui_set_general_regs_content (refresh_values_only);
221 case TUI_SFLOAT_REGS:
222 case TUI_DFLOAT_REGS:
223 ret = tui_set_float_regs_content (dpy_type, refresh_values_only);
226 /* could ifdef out */
228 case TUI_SPECIAL_REGS:
229 ret = tui_set_special_regs_content (refresh_values_only);
231 case TUI_GENERAL_AND_SPECIAL_REGS:
232 ret = tui_set_general_and_special_regs_content (refresh_values_only);
235 /* end of potential if def */
241 if (ret == TUI_FAILURE)
243 TUI_DATA_WIN->detail.data_display_info.regs_display_type = TUI_UNDEFINED_REGS;
244 tui_erase_data_content (NO_REGS_STRING);
250 /* Clear all notation of changed values */
251 for (i = 0; (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); i++)
253 struct tui_gen_win_info * data_item_win;
255 data_item_win = &TUI_DATA_WIN->detail.data_display_info.
256 regs_content[i]->which_element.data_window;
257 (&((struct tui_win_element *)
258 data_item_win->content[0])->which_element.data)->highlight = FALSE;
260 TUI_DATA_WIN->detail.data_display_info.regs_display_type = dpy_type;
261 tui_display_all_data ();
263 (tui_layout_def ())->regs_display_type = dpy_type;
269 /* Function to display the registers in the content from
270 'start_element_no' until the end of the register content or the end
271 of the display height. No checking for displaying past the end of
272 the registers is done here. */
274 tui_display_registers_from (int start_element_no)
276 if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL &&
277 TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
279 int i = start_element_no;
280 int j, value_chars_wide, item_win_width, cur_y, label_width;
281 enum precision_type precision;
283 precision = (TUI_DATA_WIN->detail.data_display_info.regs_display_type
284 == TUI_DFLOAT_REGS) ?
285 double_precision : unspecified_precision;
287 TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)
289 value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH;
290 label_width = DOUBLE_FLOAT_LABEL_WIDTH;
294 if (TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
297 value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH;
298 label_width = SINGLE_FLOAT_LABEL_WIDTH;
302 value_chars_wide = SINGLE_VALUE_WIDTH;
303 label_width = SINGLE_LABEL_WIDTH;
306 item_win_width = value_chars_wide + label_width;
308 ** Now create each data "sub" window, and write the display into it.
311 while (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count &&
312 cur_y <= TUI_DATA_WIN->generic.viewport_height)
315 (j < TUI_DATA_WIN->detail.data_display_info.regs_column_count &&
316 i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); j++)
318 struct tui_gen_win_info * data_item_win;
319 struct tui_data_element * data_element_ptr;
321 /* create the window if necessary */
322 data_item_win = &TUI_DATA_WIN->detail.data_display_info.
323 regs_content[i]->which_element.data_window;
324 data_element_ptr = &((struct tui_win_element *)
325 data_item_win->content[0])->which_element.data;
326 if (data_item_win->handle == (WINDOW *) NULL)
328 data_item_win->height = 1;
329 data_item_win->width = (precision == double_precision) ?
330 item_win_width + 2 : item_win_width + 1;
331 data_item_win->origin.x = (item_win_width * j) + 1;
332 data_item_win->origin.y = cur_y;
333 tui_make_window (data_item_win, DONT_BOX_WINDOW);
334 scrollok (data_item_win->handle, FALSE);
336 touchwin (data_item_win->handle);
339 ** Get the printable representation of the register
342 tui_display_register (
343 data_element_ptr->item_no, data_item_win, precision);
344 i++; /* next register */
346 cur_y++; /* next row; */
354 /* Function to display the registers in the content from
355 'start_element_no' on 'start_line_no' until the end of the register
356 content or the end of the display height. This function checks
357 that we won't display off the end of the register display. */
359 tui_display_reg_element_at_line (int start_element_no, int start_line_no)
361 if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL &&
362 TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
364 int element_no = start_element_no;
366 if (start_element_no != 0 && start_line_no != 0)
368 int last_line_no, first_line_on_last_page;
370 last_line_no = tui_last_regs_line_no ();
371 first_line_on_last_page = last_line_no - (TUI_DATA_WIN->generic.height - 2);
372 if (first_line_on_last_page < 0)
373 first_line_on_last_page = 0;
375 ** If there is no other data displayed except registers,
376 ** and the element_no causes us to scroll past the end of the
377 ** registers, adjust what element to really start the display at.
379 if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 &&
380 start_line_no > first_line_on_last_page)
381 element_no = tui_first_reg_element_no_inline (first_line_on_last_page);
383 tui_display_registers_from (element_no);
389 /* Function to display the registers starting at line line_no in the
390 data window. Answers the line number that the display actually
391 started from. If nothing is displayed (-1) is returned. */
393 tui_display_registers_from_line (int line_no, int force_display)
395 if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
397 int line, element_no;
401 else if (force_display)
403 ** If we must display regs (force_display is true), then make
404 ** sure that we don't display off the end of the registers.
406 if (line_no >= tui_last_regs_line_no ())
408 if ((line = tui_line_from_reg_element_no (
409 TUI_DATA_WIN->detail.data_display_info.regs_content_count - 1)) < 0)
418 element_no = tui_first_reg_element_no_inline (line);
419 if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
420 tui_display_reg_element_at_line (element_no, line);
427 return (-1); /* nothing was displayed */
431 /* This function check all displayed registers for changes in values,
432 given a particular frame. If the values have changed, they are
433 updated with the new value and highlighted. */
435 tui_check_register_values (struct frame_info *frame)
437 if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
439 if (TUI_DATA_WIN->detail.data_display_info.regs_content_count <= 0 &&
440 TUI_DATA_WIN->detail.data_display_info.display_regs)
441 tui_show_registers ((tui_layout_def ())->regs_display_type);
445 char raw_buf[MAX_REGISTER_SIZE];
448 (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); i++)
450 struct tui_data_element * data_element_ptr;
451 struct tui_gen_win_info * data_item_win_ptr;
454 data_item_win_ptr = &TUI_DATA_WIN->detail.data_display_info.
455 regs_content[i]->which_element.data_window;
456 data_element_ptr = &((struct tui_win_element *)
457 data_item_win_ptr->content[0])->which_element.data;
458 was_hilighted = data_element_ptr->highlight;
459 data_element_ptr->highlight =
460 tui_reg_value_has_changed (data_element_ptr, frame, &raw_buf[0]);
461 if (data_element_ptr->highlight)
465 size = DEPRECATED_REGISTER_RAW_SIZE (data_element_ptr->item_no);
466 for (j = 0; j < size; j++)
467 ((char *) data_element_ptr->value)[j] = raw_buf[j];
468 tui_display_register (
469 data_element_ptr->item_no,
471 ((TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
473 double_precision : unspecified_precision));
475 else if (was_hilighted)
477 data_element_ptr->highlight = FALSE;
478 tui_display_register (
479 data_element_ptr->item_no,
481 ((TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
483 double_precision : unspecified_precision));
493 ** tui_toggle_float_regs().
496 tui_toggle_float_regs (void)
498 struct tui_layout_def * layout_def = tui_layout_def ();
500 if (layout_def->float_regs_display_type == TUI_SFLOAT_REGS)
501 layout_def->float_regs_display_type = TUI_DFLOAT_REGS;
503 layout_def->float_regs_display_type = TUI_SFLOAT_REGS;
505 if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible &&
506 (TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_SFLOAT_REGS ||
507 TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS))
508 tui_show_registers (layout_def->float_regs_display_type);
511 } /* tui_toggle_float_regs */
515 _initialize_tui_regs (void)
519 add_com ("fr", class_tui, tui_show_float_command,
520 "Display only floating point registers\n");
521 add_com ("gr", class_tui, tui_show_general_command,
522 "Display only general registers\n");
523 add_com ("sr", class_tui, tui_show_special_command,
524 "Display only special registers\n");
525 add_com ("+r", class_tui, tui_scroll_regs_forward_command,
526 "Scroll the registers window forward\n");
527 add_com ("-r", class_tui, tui_scroll_regs_backward_command,
528 "Scroll the register window backward\n");
529 add_com ("tf", class_tui, _tui_toggle_float_regs_command,
530 "Toggle between single and double precision floating point registers.\n");
531 add_cmd (TUI_FLOAT_REGS_NAME_LOWER,
533 _tui_toggle_float_regs_command,
534 "Toggle between single and double precision floating point \
541 /*****************************************
542 ** STATIC LOCAL FUNCTIONS **
543 ******************************************/
547 ** tui_register_name().
548 ** Return the register name.
551 tui_register_name (int reg_num)
553 return REGISTER_NAME (reg_num);
555 extern int pagination_enabled;
558 tui_restore_gdbout (void *ui)
560 ui_file_delete (gdb_stdout);
561 gdb_stdout = (struct ui_file*) ui;
562 pagination_enabled = 1;
566 ** tui_register_format
567 ** Function to format the register name and value into a buffer,
568 ** suitable for printing or display
571 tui_register_format (char *buf, int buf_len, int reg_num,
572 struct tui_data_element * data_element,
573 enum precision_type precision)
575 struct ui_file *stream;
576 struct ui_file *old_stdout;
578 struct cleanup *cleanups;
582 name = REGISTER_NAME (reg_num);
589 pagination_enabled = 0;
590 old_stdout = gdb_stdout;
591 stream = tui_sfileopen (buf_len);
593 cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
594 gdbarch_print_registers_info (current_gdbarch, stream, deprecated_selected_frame,
597 /* Save formatted output in the buffer. */
598 p = tui_file_get_strbuf (stream);
600 while (*p && *p == *name++ && buf_len)
608 while (pos < 8 && buf_len)
614 strncpy (buf, p, buf_len);
616 /* Remove the possible \n. */
617 p = strchr (buf, '\n');
621 do_cleanups (cleanups);
625 #define NUM_GENERAL_REGS 32
626 /* Set the content of the data window to consist of the general
628 static enum tui_status
629 tui_set_general_regs_content (int refresh_values_only)
631 return (tui_set_regs_content (0,
632 NUM_GENERAL_REGS - 1,
633 deprecated_selected_frame,
635 refresh_values_only));
640 #ifndef PCOQ_HEAD_REGNUM
641 #define START_SPECIAL_REGS 0
643 #define START_SPECIAL_REGS PCOQ_HEAD_REGNUM
646 /* Set the content of the data window to consist of the special
648 static enum tui_status
649 tui_set_special_regs_content (int refresh_values_only)
651 enum tui_status ret = TUI_FAILURE;
654 end_reg_num = FP0_REGNUM - 1;
655 ret = tui_set_regs_content (START_SPECIAL_REGS,
657 deprecated_selected_frame,
659 refresh_values_only);
665 /* Set the content of the data window to consist of the special
667 static enum tui_status
668 tui_set_general_and_special_regs_content (int refresh_values_only)
670 enum tui_status ret = TUI_FAILURE;
671 int end_reg_num = (-1);
673 end_reg_num = FP0_REGNUM - 1;
674 ret = tui_set_regs_content (
675 0, end_reg_num, deprecated_selected_frame, TUI_SPECIAL_REGS, refresh_values_only);
680 /* Set the content of the data window to consist of the float
682 static enum tui_status
683 tui_set_float_regs_content (enum tui_register_display_type dpy_type,
684 int refresh_values_only)
686 enum tui_status ret = TUI_FAILURE;
689 start_reg_num = FP0_REGNUM;
690 ret = tui_set_regs_content (start_reg_num,
692 deprecated_selected_frame,
694 refresh_values_only);
700 /* Answer TRUE if the register's value has changed, FALSE otherwise.
701 If TRUE, new_value is filled in with the new value. */
703 tui_reg_value_has_changed (struct tui_data_element * data_element,
704 struct frame_info *frame, char *new_value)
706 int has_changed = FALSE;
708 if (data_element->item_no != UNDEFINED_ITEM &&
709 tui_register_name (data_element->item_no) != (char *) NULL)
711 char raw_buf[MAX_REGISTER_SIZE];
714 if (tui_get_register_raw_value (data_element->item_no, raw_buf, frame) == TUI_SUCCESS)
716 int size = DEPRECATED_REGISTER_RAW_SIZE (data_element->item_no);
718 for (i = 0; (i < size && !has_changed); i++)
719 has_changed = (((char *) data_element->value)[i] != raw_buf[i]);
720 if (has_changed && new_value != (char *) NULL)
722 for (i = 0; i < size; i++)
723 new_value[i] = raw_buf[i];
732 /* Get the register raw value. The raw value is returned in reg_value. */
733 static enum tui_status
734 tui_get_register_raw_value (int reg_num, char *reg_value, struct frame_info *frame)
736 enum tui_status ret = TUI_FAILURE;
738 if (target_has_registers)
740 get_frame_register (frame, reg_num, reg_value);
741 /* NOTE: cagney/2003-03-13: This is bogus. It is refering to
742 the register cache and not the frame which could have pulled
743 the register value off the stack. */
744 if (register_cached (reg_num) >= 0)
752 /* Function to initialize a data element with the input and the
755 tui_set_register_element (int reg_num, struct frame_info *frame,
756 struct tui_data_element * data_element,
757 int refresh_value_only)
759 if (data_element != (struct tui_data_element *) NULL)
761 if (!refresh_value_only)
763 data_element->item_no = reg_num;
764 data_element->name = tui_register_name (reg_num);
765 data_element->highlight = FALSE;
767 if (data_element->value == NULL)
768 data_element->value = xmalloc (MAX_REGISTER_SIZE);
769 if (data_element->value != NULL)
770 tui_get_register_raw_value (reg_num, data_element->value, frame);
775 /* Set the content of the data window to consist of the registers
776 numbered from start_reg_num to end_reg_num. Note that if
777 refresh_values_only is TRUE, start_reg_num and end_reg_num are
779 static enum tui_status
780 tui_set_regs_content (int start_reg_num, int end_reg_num,
781 struct frame_info *frame,
782 enum tui_register_display_type dpy_type,
783 int refresh_values_only)
785 enum tui_status ret = TUI_FAILURE;
786 int num_regs = end_reg_num - start_reg_num + 1;
787 int allocated_here = FALSE;
789 if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0 &&
790 !refresh_values_only)
792 tui_free_data_content (TUI_DATA_WIN->detail.data_display_info.regs_content,
793 TUI_DATA_WIN->detail.data_display_info.regs_content_count);
794 TUI_DATA_WIN->detail.data_display_info.regs_content_count = 0;
796 if (TUI_DATA_WIN->detail.data_display_info.regs_content_count <= 0)
798 TUI_DATA_WIN->detail.data_display_info.regs_content =
799 tui_alloc_content (num_regs, DATA_WIN);
800 allocated_here = TRUE;
803 if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL)
807 if (!refresh_values_only || allocated_here)
809 TUI_DATA_WIN->generic.content = NULL;
810 TUI_DATA_WIN->generic.content_size = 0;
811 tui_add_content_elements (&TUI_DATA_WIN->generic, num_regs);
812 TUI_DATA_WIN->detail.data_display_info.regs_content =
813 (tui_win_content) TUI_DATA_WIN->generic.content;
814 TUI_DATA_WIN->detail.data_display_info.regs_content_count = num_regs;
817 ** Now set the register names and values
819 for (i = start_reg_num; (i <= end_reg_num); i++)
821 struct tui_gen_win_info * data_item_win;
823 data_item_win = &TUI_DATA_WIN->detail.data_display_info.
824 regs_content[i - start_reg_num]->which_element.data_window;
825 tui_set_register_element (
828 &((struct tui_win_element *) data_item_win->content[0])->which_element.data,
829 !allocated_here && refresh_values_only);
831 TUI_DATA_WIN->detail.data_display_info.regs_column_count =
832 tui_calculate_regs_column_count (dpy_type);
834 if (TUI_DATA_WIN->detail.data_display_info.data_content_count > 0)
836 /* delete all the windows? */
837 /* realloc content equal to data_content_count + regs_content_count */
838 /* append TUI_DATA_WIN->detail.data_display_info.data_content to content */
841 TUI_DATA_WIN->generic.content_size =
842 TUI_DATA_WIN->detail.data_display_info.regs_content_count +
843 TUI_DATA_WIN->detail.data_display_info.data_content_count;
851 /* Function to display a register in a window. If hilite is TRUE,
852 than the value will be displayed in reverse video. */
854 tui_display_register (int reg_num,
855 struct tui_gen_win_info * win_info, /* the data item window */
856 enum precision_type precision)
858 if (win_info->handle != (WINDOW *) NULL)
862 int value_chars_wide, label_width;
863 struct tui_data_element * data_element_ptr = &((tui_win_content)
864 win_info->content)[0]->which_element.data;
867 TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)
869 value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH;
870 label_width = DOUBLE_FLOAT_LABEL_WIDTH;
874 if (TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
877 value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH;
878 label_width = SINGLE_FLOAT_LABEL_WIDTH;
882 value_chars_wide = SINGLE_VALUE_WIDTH;
883 label_width = SINGLE_LABEL_WIDTH;
888 tui_register_format (buf,
889 value_chars_wide + label_width,
894 if (data_element_ptr->highlight)
895 wstandout (win_info->handle);
897 wmove (win_info->handle, 0, 0);
898 for (i = 1; i < win_info->width; i++)
899 waddch (win_info->handle, ' ');
900 wmove (win_info->handle, 0, 0);
901 waddstr (win_info->handle, buf);
903 if (data_element_ptr->highlight)
904 wstandend (win_info->handle);
905 tui_refresh_win (win_info);
911 tui_v_show_registers_command_support (enum tui_register_display_type dpy_type)
914 if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
915 { /* Data window already displayed, show the registers */
916 if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != dpy_type)
917 tui_show_registers (dpy_type);
920 (tui_layout_def ())->regs_display_type = dpy_type;
927 tui_show_float_command (char *arg, int from_tty)
929 if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible ||
930 (TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_SFLOAT_REGS &&
931 TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_DFLOAT_REGS))
932 tui_v_show_registers_command_support ((tui_layout_def ())->float_regs_display_type);
937 tui_show_general_command (char *arg, int from_tty)
939 tui_v_show_registers_command_support (TUI_GENERAL_REGS);
944 tui_show_special_command (char *arg, int from_tty)
946 tui_v_show_registers_command_support (TUI_SPECIAL_REGS);
951 _tui_toggle_float_regs_command (char *arg, int from_tty)
953 if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
954 tui_toggle_float_regs ();
957 struct tui_layout_def * layout_def = tui_layout_def ();
959 if (layout_def->float_regs_display_type == TUI_SFLOAT_REGS)
960 layout_def->float_regs_display_type = TUI_DFLOAT_REGS;
962 layout_def->float_regs_display_type = TUI_SFLOAT_REGS;
968 tui_scroll_regs_forward_command (char *arg, int from_tty)
970 tui_scroll (FORWARD_SCROLL, TUI_DATA_WIN, 1);
975 tui_scroll_regs_backward_command (char *arg, int from_tty)
977 tui_scroll (BACKWARD_SCROLL, TUI_DATA_WIN, 1);