Home | History | Annotate | Line # | Download | only in tui
tui-data.h revision 1.1
      1  1.1  christos /* TUI data manipulation routines.
      2  1.1  christos 
      3  1.1  christos    Copyright (C) 1998-2014 Free Software Foundation, Inc.
      4  1.1  christos 
      5  1.1  christos    Contributed by Hewlett-Packard Company.
      6  1.1  christos 
      7  1.1  christos    This file is part of GDB.
      8  1.1  christos 
      9  1.1  christos    This program is free software; you can redistribute it and/or modify
     10  1.1  christos    it under the terms of the GNU General Public License as published by
     11  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     12  1.1  christos    (at your option) any later version.
     13  1.1  christos 
     14  1.1  christos    This program is distributed in the hope that it will be useful,
     15  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  1.1  christos    GNU General Public License for more details.
     18  1.1  christos 
     19  1.1  christos    You should have received a copy of the GNU General Public License
     20  1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     21  1.1  christos 
     22  1.1  christos #ifndef TUI_DATA_H
     23  1.1  christos #define TUI_DATA_H
     24  1.1  christos 
     25  1.1  christos #include "tui/tui.h"	/* For enum tui_win_type.  */
     26  1.1  christos #include "gdb_curses.h"	/* For WINDOW.  */
     27  1.1  christos 
     28  1.1  christos /* This is a point definition.  */
     29  1.1  christos struct tui_point
     30  1.1  christos {
     31  1.1  christos   int x, y;
     32  1.1  christos };
     33  1.1  christos 
     34  1.1  christos /* Generic window information.  */
     35  1.1  christos struct tui_gen_win_info
     36  1.1  christos {
     37  1.1  christos   WINDOW *handle;	    /* Window handle.  */
     38  1.1  christos   enum tui_win_type type;   /* Type of window.  */
     39  1.1  christos   int width;		    /* Window width.  */
     40  1.1  christos   int height;		    /* Window height.  */
     41  1.1  christos   struct tui_point origin;  /* Origin of window.  */
     42  1.1  christos   void **content;	    /* Content of window.  */
     43  1.1  christos   int content_size;	    /* Size of content (# of elements).  */
     44  1.1  christos   int content_in_use;	    /* Can it be used, or is it already used?  */
     45  1.1  christos   int viewport_height;	    /* Viewport height.  */
     46  1.1  christos   int last_visible_line;    /* Index of last visible line.  */
     47  1.1  christos   int is_visible;	    /* Whether the window is visible or not.  */
     48  1.1  christos   char *title;              /* Window title to display.  */
     49  1.1  christos };
     50  1.1  christos 
     51  1.1  christos /* Constant definitions.  */
     52  1.1  christos #define DEFAULT_TAB_LEN         8
     53  1.1  christos #define NO_SRC_STRING           "[ No Source Available ]"
     54  1.1  christos #define NO_DISASSEM_STRING      "[ No Assembly Available ]"
     55  1.1  christos #define NO_REGS_STRING          "[ Register Values Unavailable ]"
     56  1.1  christos #define NO_DATA_STRING          "[ No Data Values Displayed ]"
     57  1.1  christos #define MAX_CONTENT_COUNT       100
     58  1.1  christos #define SRC_NAME                "SRC"
     59  1.1  christos #define CMD_NAME                "CMD"
     60  1.1  christos #define DATA_NAME               "REGS"
     61  1.1  christos #define DISASSEM_NAME           "ASM"
     62  1.1  christos #define TUI_NULL_STR            ""
     63  1.1  christos #define DEFAULT_HISTORY_COUNT	25
     64  1.1  christos #define BOX_WINDOW              TRUE
     65  1.1  christos #define DONT_BOX_WINDOW         FALSE
     66  1.1  christos #define HILITE                  TRUE
     67  1.1  christos #define NO_HILITE               FALSE
     68  1.1  christos #define WITH_LOCATOR            TRUE
     69  1.1  christos #define NO_LOCATOR              FALSE
     70  1.1  christos #define EMPTY_SOURCE_PROMPT     TRUE
     71  1.1  christos #define NO_EMPTY_SOURCE_PROMPT  FALSE
     72  1.1  christos #define UNDEFINED_ITEM          -1
     73  1.1  christos #define MIN_WIN_HEIGHT          3
     74  1.1  christos #define MIN_CMD_WIN_HEIGHT      3
     75  1.1  christos 
     76  1.1  christos /* Strings to display in the TUI status line.  */
     77  1.1  christos #define PROC_PREFIX             "In: "
     78  1.1  christos #define LINE_PREFIX             "Line: "
     79  1.1  christos #define PC_PREFIX               "PC: "
     80  1.1  christos #define SINGLE_KEY              "(SingleKey)"
     81  1.1  christos 
     82  1.1  christos /* Minimum/Maximum length of some fields displayed in the TUI status
     83  1.1  christos    line.  */
     84  1.1  christos #define MIN_LINE_WIDTH     4	/* Use at least 4 digits for line
     85  1.1  christos 				   numbers.  */
     86  1.1  christos #define MIN_PROC_WIDTH    12
     87  1.1  christos #define MAX_TARGET_WIDTH  10
     88  1.1  christos #define MAX_PID_WIDTH     14
     89  1.1  christos 
     90  1.1  christos #define TUI_FLOAT_REGS_NAME                  "$FREGS"
     91  1.1  christos #define TUI_FLOAT_REGS_NAME_LOWER            "$fregs"
     92  1.1  christos #define TUI_GENERAL_REGS_NAME                "$GREGS"
     93  1.1  christos #define TUI_GENERAL_REGS_NAME_LOWER          "$gregs"
     94  1.1  christos #define TUI_SPECIAL_REGS_NAME                "$SREGS"
     95  1.1  christos #define TUI_SPECIAL_REGS_NAME_LOWER          "$sregs"
     96  1.1  christos #define TUI_GENERAL_SPECIAL_REGS_NAME        "$REGS"
     97  1.1  christos #define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER  "$regs"
     98  1.1  christos 
     99  1.1  christos /* Scroll direction enum.  */
    100  1.1  christos enum tui_scroll_direction
    101  1.1  christos {
    102  1.1  christos   FORWARD_SCROLL,
    103  1.1  christos   BACKWARD_SCROLL,
    104  1.1  christos   LEFT_SCROLL,
    105  1.1  christos   RIGHT_SCROLL
    106  1.1  christos };
    107  1.1  christos 
    108  1.1  christos 
    109  1.1  christos /* General list struct.  */
    110  1.1  christos struct tui_list
    111  1.1  christos {
    112  1.1  christos   struct tui_win_info **list;
    113  1.1  christos   int count;
    114  1.1  christos };
    115  1.1  christos 
    116  1.1  christos 
    117  1.1  christos /* The kinds of layouts available.  */
    118  1.1  christos enum tui_layout_type
    119  1.1  christos {
    120  1.1  christos   SRC_COMMAND,
    121  1.1  christos   DISASSEM_COMMAND,
    122  1.1  christos   SRC_DISASSEM_COMMAND,
    123  1.1  christos   SRC_DATA_COMMAND,
    124  1.1  christos   DISASSEM_DATA_COMMAND,
    125  1.1  christos   UNDEFINED_LAYOUT
    126  1.1  christos };
    127  1.1  christos 
    128  1.1  christos /* Basic data types that can be displayed in the data window.  */
    129  1.1  christos enum tui_data_type
    130  1.1  christos {
    131  1.1  christos   TUI_REGISTER,
    132  1.1  christos   TUI_SCALAR,
    133  1.1  christos   TUI_COMPLEX,
    134  1.1  christos   TUI_STRUCT
    135  1.1  christos };
    136  1.1  christos 
    137  1.1  christos /* Types of register displays.  */
    138  1.1  christos enum tui_register_display_type
    139  1.1  christos {
    140  1.1  christos   TUI_UNDEFINED_REGS,
    141  1.1  christos   TUI_GENERAL_REGS,
    142  1.1  christos   TUI_SFLOAT_REGS,
    143  1.1  christos   TUI_DFLOAT_REGS,
    144  1.1  christos   TUI_SPECIAL_REGS,
    145  1.1  christos   TUI_GENERAL_AND_SPECIAL_REGS
    146  1.1  christos };
    147  1.1  christos 
    148  1.1  christos /* Structure describing source line or line address.  */
    149  1.1  christos struct tui_line_or_address
    150  1.1  christos {
    151  1.1  christos   enum { LOA_LINE, LOA_ADDRESS } loa;
    152  1.1  christos   union
    153  1.1  christos     {
    154  1.1  christos       int line_no;
    155  1.1  christos       CORE_ADDR addr;
    156  1.1  christos     } u;
    157  1.1  christos };
    158  1.1  christos 
    159  1.1  christos /* Current Layout definition.  */
    160  1.1  christos struct tui_layout_def
    161  1.1  christos {
    162  1.1  christos   enum tui_win_type display_mode;
    163  1.1  christos   int split;
    164  1.1  christos   enum tui_register_display_type regs_display_type;
    165  1.1  christos   enum tui_register_display_type float_regs_display_type;
    166  1.1  christos };
    167  1.1  christos 
    168  1.1  christos /* Elements in the Source/Disassembly Window.  */
    169  1.1  christos struct tui_source_element
    170  1.1  christos {
    171  1.1  christos   char *line;
    172  1.1  christos   struct tui_line_or_address line_or_addr;
    173  1.1  christos   int is_exec_point;
    174  1.1  christos   int has_break;
    175  1.1  christos };
    176  1.1  christos 
    177  1.1  christos 
    178  1.1  christos /* Elements in the data display window content.  */
    179  1.1  christos struct tui_data_element
    180  1.1  christos {
    181  1.1  christos   const char *name;
    182  1.1  christos   int item_no;		/* The register number, or data display
    183  1.1  christos 			   number.  */
    184  1.1  christos   enum tui_data_type type;
    185  1.1  christos   void *value;
    186  1.1  christos   int highlight;
    187  1.1  christos   char *content;
    188  1.1  christos };
    189  1.1  christos 
    190  1.1  christos 
    191  1.1  christos /* Elements in the command window content.  */
    192  1.1  christos struct tui_command_element
    193  1.1  christos {
    194  1.1  christos   char *line;
    195  1.1  christos };
    196  1.1  christos 
    197  1.1  christos #ifdef PATH_MAX
    198  1.1  christos # define MAX_LOCATOR_ELEMENT_LEN        PATH_MAX
    199  1.1  christos #else
    200  1.1  christos # define MAX_LOCATOR_ELEMENT_LEN        1024
    201  1.1  christos #endif
    202  1.1  christos 
    203  1.1  christos /* Elements in the locator window content.  */
    204  1.1  christos struct tui_locator_element
    205  1.1  christos {
    206  1.1  christos   /* Resolved absolute filename as returned by symtab_to_fullname.  */
    207  1.1  christos   char full_name[MAX_LOCATOR_ELEMENT_LEN];
    208  1.1  christos   char proc_name[MAX_LOCATOR_ELEMENT_LEN];
    209  1.1  christos   int line_no;
    210  1.1  christos   CORE_ADDR addr;
    211  1.1  christos   /* Architecture associated with code at this location.  */
    212  1.1  christos   struct gdbarch *gdbarch;
    213  1.1  christos };
    214  1.1  christos 
    215  1.1  christos /* Flags to tell what kind of breakpoint is at current line.  */
    216  1.1  christos #define TUI_BP_ENABLED      0x01
    217  1.1  christos #define TUI_BP_DISABLED     0x02
    218  1.1  christos #define TUI_BP_HIT          0x04
    219  1.1  christos #define TUI_BP_CONDITIONAL  0x08
    220  1.1  christos #define TUI_BP_HARDWARE     0x10
    221  1.1  christos 
    222  1.1  christos /* Position of breakpoint markers in the exec info string.  */
    223  1.1  christos #define TUI_BP_HIT_POS      0
    224  1.1  christos #define TUI_BP_BREAK_POS    1
    225  1.1  christos #define TUI_EXEC_POS        2
    226  1.1  christos #define TUI_EXECINFO_SIZE   4
    227  1.1  christos 
    228  1.1  christos typedef char tui_exec_info_content[TUI_EXECINFO_SIZE];
    229  1.1  christos 
    230  1.1  christos /* An content element in a window.  */
    231  1.1  christos union tui_which_element
    232  1.1  christos {
    233  1.1  christos   struct tui_source_element source;	/* The source elements.  */
    234  1.1  christos   struct tui_gen_win_info data_window;	/* Data display elements.  */
    235  1.1  christos   struct tui_data_element data;		/* Elements of data_window.  */
    236  1.1  christos   struct tui_command_element command;	/* Command elements.  */
    237  1.1  christos   struct tui_locator_element locator;	/* Locator elements.  */
    238  1.1  christos   tui_exec_info_content simple_string;	/* Simple char based elements.  */
    239  1.1  christos };
    240  1.1  christos 
    241  1.1  christos struct tui_win_element
    242  1.1  christos {
    243  1.1  christos   int highlight;
    244  1.1  christos   union tui_which_element which_element;
    245  1.1  christos };
    246  1.1  christos 
    247  1.1  christos 
    248  1.1  christos /* This describes the content of the window.  */
    249  1.1  christos typedef struct tui_win_element **tui_win_content;
    250  1.1  christos 
    251  1.1  christos 
    252  1.1  christos /* This struct defines the specific information about a data display
    253  1.1  christos    window.  */
    254  1.1  christos struct tui_data_info
    255  1.1  christos {
    256  1.1  christos   tui_win_content data_content;	/* Start of data display content.  */
    257  1.1  christos   int data_content_count;
    258  1.1  christos   tui_win_content regs_content;	/* Start of regs display content.  */
    259  1.1  christos   int regs_content_count;
    260  1.1  christos   enum tui_register_display_type regs_display_type;
    261  1.1  christos   int regs_column_count;
    262  1.1  christos   int display_regs;		/* Should regs be displayed at all?  */
    263  1.1  christos   struct reggroup *current_group;
    264  1.1  christos };
    265  1.1  christos 
    266  1.1  christos 
    267  1.1  christos struct tui_source_info
    268  1.1  christos {
    269  1.1  christos   int has_locator;		/* Does locator belongs to this window?  */
    270  1.1  christos   /* Execution information window.  */
    271  1.1  christos   struct tui_gen_win_info *execution_info;
    272  1.1  christos   int horizontal_offset;	/* Used for horizontal scroll.  */
    273  1.1  christos   struct tui_line_or_address start_line_or_addr;
    274  1.1  christos 
    275  1.1  christos   /* It is the resolved form as returned by symtab_to_fullname.  */
    276  1.1  christos   char *fullname;
    277  1.1  christos 
    278  1.1  christos   /* Architecture associated with code at this location.  */
    279  1.1  christos   struct gdbarch *gdbarch;
    280  1.1  christos };
    281  1.1  christos 
    282  1.1  christos 
    283  1.1  christos struct tui_command_info
    284  1.1  christos {
    285  1.1  christos   int cur_line;			/* The current line position.  */
    286  1.1  christos   int curch;			/* The current cursor position.  */
    287  1.1  christos   int start_line;
    288  1.1  christos };
    289  1.1  christos 
    290  1.1  christos 
    291  1.1  christos /* This defines information about each logical window.  */
    292  1.1  christos struct tui_win_info
    293  1.1  christos {
    294  1.1  christos   struct tui_gen_win_info generic;	/* General window information.  */
    295  1.1  christos   union
    296  1.1  christos   {
    297  1.1  christos     struct tui_source_info source_info;
    298  1.1  christos     struct tui_data_info data_display_info;
    299  1.1  christos     struct tui_command_info command_info;
    300  1.1  christos     void *opaque;
    301  1.1  christos   }
    302  1.1  christos   detail;
    303  1.1  christos   int can_highlight;	/* Can this window ever be highlighted?  */
    304  1.1  christos   int is_highlighted;	/* Is this window highlighted?  */
    305  1.1  christos };
    306  1.1  christos 
    307  1.1  christos extern int tui_win_is_source_type (enum tui_win_type win_type);
    308  1.1  christos extern int tui_win_is_auxillary (enum tui_win_type win_type);
    309  1.1  christos extern int tui_win_has_locator (struct tui_win_info *win_info);
    310  1.1  christos extern void tui_set_win_highlight (struct tui_win_info *win_info,
    311  1.1  christos 				   int highlight);
    312  1.1  christos 
    313  1.1  christos 
    314  1.1  christos /* Global Data.  */
    315  1.1  christos extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]);
    316  1.1  christos 
    317  1.1  christos #define TUI_SRC_WIN     tui_win_list[SRC_WIN]
    318  1.1  christos #define TUI_DISASM_WIN	tui_win_list[DISASSEM_WIN]
    319  1.1  christos #define TUI_DATA_WIN    tui_win_list[DATA_WIN]
    320  1.1  christos #define TUI_CMD_WIN     tui_win_list[CMD_WIN]
    321  1.1  christos 
    322  1.1  christos /* Data Manipulation Functions.  */
    323  1.1  christos extern void tui_initialize_static_data (void);
    324  1.1  christos extern struct tui_gen_win_info *tui_alloc_generic_win_info (void);
    325  1.1  christos extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type);
    326  1.1  christos extern void tui_init_generic_part (struct tui_gen_win_info *);
    327  1.1  christos extern void tui_init_win_info (struct tui_win_info *);
    328  1.1  christos extern tui_win_content tui_alloc_content (int, enum tui_win_type);
    329  1.1  christos extern int tui_add_content_elements (struct tui_gen_win_info *,
    330  1.1  christos 				     int);
    331  1.1  christos extern void tui_init_content_element (struct tui_win_element *,
    332  1.1  christos 				      enum tui_win_type);
    333  1.1  christos extern void tui_free_window (struct tui_win_info *);
    334  1.1  christos extern void tui_free_win_content (struct tui_gen_win_info *);
    335  1.1  christos extern void tui_free_data_content (tui_win_content, int);
    336  1.1  christos extern void tui_free_all_source_wins_content (void);
    337  1.1  christos extern void tui_del_window (struct tui_win_info *);
    338  1.1  christos extern void tui_del_data_windows (tui_win_content, int);
    339  1.1  christos extern struct tui_win_info *tui_partial_win_by_name (char *);
    340  1.1  christos extern char *tui_win_name (struct tui_gen_win_info *);
    341  1.1  christos extern enum tui_layout_type tui_current_layout (void);
    342  1.1  christos extern void tui_set_current_layout_to (enum tui_layout_type);
    343  1.1  christos extern int tui_term_height (void);
    344  1.1  christos extern void tui_set_term_height_to (int);
    345  1.1  christos extern int tui_term_width (void);
    346  1.1  christos extern void tui_set_term_width_to (int);
    347  1.1  christos extern struct tui_gen_win_info *tui_locator_win_info_ptr (void);
    348  1.1  christos extern struct tui_gen_win_info *tui_source_exec_info_win_ptr (void);
    349  1.1  christos extern struct tui_gen_win_info *tui_disassem_exec_info_win_ptr (void);
    350  1.1  christos extern struct tui_list *tui_source_windows (void);
    351  1.1  christos extern void tui_clear_source_windows (void);
    352  1.1  christos extern void tui_clear_source_windows_detail (void);
    353  1.1  christos extern void tui_clear_win_detail (struct tui_win_info *);
    354  1.1  christos extern void tui_add_to_source_windows (struct tui_win_info *);
    355  1.1  christos extern int tui_default_tab_len (void);
    356  1.1  christos extern void tui_set_default_tab_len (int);
    357  1.1  christos extern struct tui_win_info *tui_win_with_focus (void);
    358  1.1  christos extern void tui_set_win_with_focus (struct tui_win_info *);
    359  1.1  christos extern struct tui_layout_def *tui_layout_def (void);
    360  1.1  christos extern int tui_win_resized (void);
    361  1.1  christos extern void tui_set_win_resized_to (int);
    362  1.1  christos 
    363  1.1  christos extern struct tui_win_info *tui_next_win (struct tui_win_info *);
    364  1.1  christos extern struct tui_win_info *tui_prev_win (struct tui_win_info *);
    365  1.1  christos 
    366  1.1  christos extern void tui_add_to_source_windows (struct tui_win_info *);
    367  1.1  christos 
    368  1.1  christos #endif /* TUI_DATA_H */
    369