2007-08-14 Michael Snyder <msnyder@access-company.com>

* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
	tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
	tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
	tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
	tui.c, tui.h: Comment reformatting to coding standard (capitals,
	spaces after periods, etc).
This commit is contained in:
Michael Snyder
2007-08-14 21:20:09 +00:00
parent 5b6fe301a1
commit 1cc6d956c1
22 changed files with 460 additions and 412 deletions

View File

@ -1,5 +1,12 @@
2007-08-14 Michael Snyder <msnyder@access-company.com> 2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
* tui-data.c, tui-data.h, tui-disasm.c, tui-hooks.c, tui-layout.c, * tui-data.c, tui-data.h, tui-disasm.c, tui-hooks.c, tui-layout.c,
tui-regs.c, tui-source.c, tui-stack.c, tui-win.c, tui-windata.c, tui-regs.c, tui-source.c, tui-stack.c, tui-win.c, tui-windata.c,
tui-wingeneral.c, tui-wingeneral.h, tui-winsource.c, tui.c, tui-wingeneral.c, tui-wingeneral.h, tui-winsource.c, tui.c,

View File

@ -43,7 +43,8 @@
** PUBLIC FUNCTIONS ** ** PUBLIC FUNCTIONS **
******************************************/ ******************************************/
/* Dispatch the correct tui function based upon the control character. */ /* Dispatch the correct tui function based upon the control
character. */
unsigned int unsigned int
tui_dispatch_ctrl_char (unsigned int ch) tui_dispatch_ctrl_char (unsigned int ch)
{ {
@ -54,8 +55,8 @@ tui_dispatch_ctrl_char (unsigned int ch)
tui_refresh_all_win (); tui_refresh_all_win ();
/* If the command window has the logical focus, or no-one does /* If the command window has the logical focus, or no-one does
assume it is the command window; in this case, pass the assume it is the command window; in this case, pass the character
character on through and do nothing here. */ on through and do nothing here. */
if (win_info == NULL || win_info == TUI_CMD_WIN) if (win_info == NULL || win_info == TUI_CMD_WIN)
return ch; return ch;
else else

View File

@ -97,7 +97,7 @@ tui_set_win_highlight (struct tui_win_info *win_info, int highlight)
** ACCESSORS & MUTATORS FOR PRIVATE DATA ** ACCESSORS & MUTATORS FOR PRIVATE DATA
******************************************/ ******************************************/
/* Answer a whether the terminal window has been resized or not. */ /* Answer a whether the terminal window has been resized or not. */
int int
tui_win_resized (void) tui_win_resized (void)
{ {
@ -105,7 +105,7 @@ tui_win_resized (void)
} }
/* Set a whether the terminal window has been resized or not. */ /* Set a whether the terminal window has been resized or not. */
void void
tui_set_win_resized_to (int resized) tui_set_win_resized_to (int resized)
{ {
@ -113,7 +113,7 @@ tui_set_win_resized_to (int resized)
} }
/* Answer a pointer to the current layout definition. */ /* Answer a pointer to the current layout definition. */
struct tui_layout_def * struct tui_layout_def *
tui_layout_def (void) tui_layout_def (void)
{ {
@ -121,7 +121,7 @@ tui_layout_def (void)
} }
/* Answer the window with the logical focus. */ /* Answer the window with the logical focus. */
struct tui_win_info * struct tui_win_info *
tui_win_with_focus (void) tui_win_with_focus (void)
{ {
@ -129,7 +129,7 @@ tui_win_with_focus (void)
} }
/* Set the window that has the logical focus. */ /* Set the window that has the logical focus. */
void void
tui_set_win_with_focus (struct tui_win_info *win_info) tui_set_win_with_focus (struct tui_win_info *win_info)
{ {
@ -137,7 +137,7 @@ tui_set_win_with_focus (struct tui_win_info *win_info)
} }
/* Answer the length in chars, of tabs. */ /* Answer the length in chars, of tabs. */
int int
tui_default_tab_len (void) tui_default_tab_len (void)
{ {
@ -145,7 +145,7 @@ tui_default_tab_len (void)
} }
/* Set the length in chars, of tabs. */ /* Set the length in chars, of tabs. */
void void
tui_set_default_tab_len (int len) tui_set_default_tab_len (int len)
{ {
@ -175,7 +175,7 @@ tui_clear_source_windows (void)
} }
/* Clear the pertinant detail in the source windows. */ /* Clear the pertinant detail in the source windows. */
void void
tui_clear_source_windows_detail (void) tui_clear_source_windows_detail (void)
{ {
@ -197,7 +197,7 @@ tui_add_to_source_windows (struct tui_win_info *win_info)
} }
/* Clear the pertinant detail in the windows. */ /* Clear the pertinant detail in the windows. */
void void
tui_clear_win_detail (struct tui_win_info *win_info) tui_clear_win_detail (struct tui_win_info *win_info)
{ {
@ -267,7 +267,7 @@ tui_term_height (void)
} }
/* Mutator for the term height. */ /* Mutator for the term height. */
void void
tui_set_term_height_to (int h) tui_set_term_height_to (int h)
{ {
@ -275,7 +275,7 @@ tui_set_term_height_to (int h)
} }
/* Accessor for the term_width. */ /* Accessor for the term_width. */
int int
tui_term_width (void) tui_term_width (void)
{ {
@ -291,7 +291,7 @@ tui_set_term_width_to (int w)
} }
/* Accessor for the current layout. */ /* Accessor for the current layout. */
enum tui_layout_type enum tui_layout_type
tui_current_layout (void) tui_current_layout (void)
{ {
@ -379,7 +379,7 @@ tui_prev_win (struct tui_win_info *cur_win)
} }
/* Answer the window represented by name. */ /* Answer the window represented by name. */
struct tui_win_info * struct tui_win_info *
tui_partial_win_by_name (char *name) tui_partial_win_by_name (char *name)
{ {
@ -650,7 +650,8 @@ tui_add_content_elements (struct tui_gen_win_info *win_info, int num_elements)
init_content_element (element_ptr, win_info->type); init_content_element (element_ptr, win_info->type);
win_info->content_size++; win_info->content_size++;
} }
else /* Things must be really hosed now! We ran out of memory!? */ else /* Things must be really hosed now! We ran out of
memory!? */
return (-1); return (-1);
} }
} }
@ -659,8 +660,8 @@ tui_add_content_elements (struct tui_gen_win_info *win_info, int num_elements)
} }
/* Delete all curses windows associated with win_info, leaving everything /* Delete all curses windows associated with win_info, leaving
else intact. */ everything else intact. */
void void
tui_del_window (struct tui_win_info *win_info) tui_del_window (struct tui_win_info *win_info)
{ {
@ -814,8 +815,9 @@ tui_del_data_windows (tui_win_content content, int content_size)
int i; int i;
/* /*
** Remember that data window content elements are of type struct tui_gen_win_info *, ** Remember that data window content elements are of type
** each of which whose single element is a data element. ** struct tui_gen_win_info *, each of which whose single
** element is a data element.
*/ */
for (i = 0; i < content_size; i++) for (i = 0; i < content_size; i++)
{ {
@ -837,8 +839,9 @@ tui_free_data_content (tui_win_content content, int content_size)
int i; int i;
/* /*
** Remember that data window content elements are of type struct tui_gen_win_info *, ** Remember that data window content elements are of type
** each of which whose single element is a data element. ** struct tui_gen_win_info *, each of which whose single
** element is a data element.
*/ */
for (i = 0; i < content_size; i++) for (i = 0; i < content_size; i++)
{ {
@ -885,7 +888,7 @@ free_content_elements (tui_win_content content, int content_size, enum tui_win_t
if (type == SRC_WIN || type == DISASSEM_WIN) if (type == SRC_WIN || type == DISASSEM_WIN)
{ {
/* free whole source block */ /* Free whole source block. */
xfree (content[0]->which_element.source.line); xfree (content[0]->which_element.source.line);
} }
else else
@ -905,7 +908,8 @@ free_content_elements (tui_win_content content, int content_size, enum tui_win_t
case DATA_ITEM_WIN: case DATA_ITEM_WIN:
/* /*
** Note that data elements are not allocated ** Note that data elements are not allocated
** in a single block, but individually, as needed. ** in a single block, but individually, as
** needed.
*/ */
if (element->which_element.data.type != TUI_REGISTER) if (element->which_element.data.type != TUI_REGISTER)
xfree ((void *)element->which_element.data.name); xfree ((void *)element->which_element.data.name);
@ -923,6 +927,6 @@ free_content_elements (tui_win_content content, int content_size, enum tui_win_t
} }
} }
if (type != DATA_WIN && type != DATA_ITEM_WIN) if (type != DATA_WIN && type != DATA_ITEM_WIN)
xfree (content[0]); /* free the element block */ xfree (content[0]); /* Free the element block. */
} }
} }

View File

@ -34,24 +34,24 @@ struct tui_point
int x, y; int x, y;
}; };
/* Generic window information */ /* Generic window information. */
struct tui_gen_win_info struct tui_gen_win_info
{ {
WINDOW *handle; /* window handle */ WINDOW *handle; /* Window handle. */
enum tui_win_type type; /* type of window */ enum tui_win_type type; /* Type of window. */
int width; /* window width */ int width; /* Window width. */
int height; /* window height */ int height; /* Window height. */
struct tui_point origin; /* origin of window */ struct tui_point origin; /* Origin of window. */
void **content; /* content of window */ void **content; /* Content of window. */
int content_size; /* Size of content (# of elements) */ int content_size; /* Size of content (# of elements). */
int content_in_use; /* Can it be used, or is it already used? */ int content_in_use; /* Can it be used, or is it already used? */
int viewport_height; /* viewport height */ int viewport_height; /* Viewport height. */
int last_visible_line; /* index of last visible line */ int last_visible_line; /* Index of last visible line. */
int is_visible; /* whether the window is visible or not */ int is_visible; /* Whether the window is visible or not. */
char *title; /* Window title to display. */ char *title; /* Window title to display. */
}; };
/* Constant definitions */ /* Constant definitions. */
#define DEFAULT_TAB_LEN 8 #define DEFAULT_TAB_LEN 8
#define NO_SRC_STRING "[ No Source Available ]" #define NO_SRC_STRING "[ No Source Available ]"
#define NO_DISASSEM_STRING "[ No Assembly Available ]" #define NO_DISASSEM_STRING "[ No Assembly Available ]"
@ -82,8 +82,10 @@ struct tui_gen_win_info
#define PC_PREFIX "PC: " #define PC_PREFIX "PC: "
#define SINGLE_KEY "(SingleKey)" #define SINGLE_KEY "(SingleKey)"
/* Minimum/Maximum length of some fields displayed in the TUI status line. */ /* Minimum/Maximum length of some fields displayed in the TUI status
#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line numbers. */ line. */
#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line
numbers. */
#define MIN_PROC_WIDTH 12 #define MIN_PROC_WIDTH 12
#define MAX_TARGET_WIDTH 10 #define MAX_TARGET_WIDTH 10
#define MAX_PID_WIDTH 14 #define MAX_PID_WIDTH 14
@ -115,7 +117,7 @@ struct tui_list
}; };
/* The kinds of layouts available */ /* The kinds of layouts available. */
enum tui_layout_type enum tui_layout_type
{ {
SRC_COMMAND, SRC_COMMAND,
@ -126,7 +128,7 @@ enum tui_layout_type
UNDEFINED_LAYOUT UNDEFINED_LAYOUT
}; };
/* Basic data types that can be displayed in the data window. */ /* Basic data types that can be displayed in the data window. */
enum tui_data_type enum tui_data_type
{ {
TUI_REGISTER, TUI_REGISTER,
@ -135,7 +137,7 @@ enum tui_data_type
TUI_STRUCT TUI_STRUCT
}; };
/* Types of register displays */ /* Types of register displays. */
enum tui_register_display_type enum tui_register_display_type
{ {
TUI_UNDEFINED_REGS, TUI_UNDEFINED_REGS,
@ -146,7 +148,7 @@ enum tui_register_display_type
TUI_GENERAL_AND_SPECIAL_REGS TUI_GENERAL_AND_SPECIAL_REGS
}; };
/* Structure describing source line or line address */ /* Structure describing source line or line address. */
struct tui_line_or_address struct tui_line_or_address
{ {
enum { LOA_LINE, LOA_ADDRESS } loa; enum { LOA_LINE, LOA_ADDRESS } loa;
@ -157,7 +159,7 @@ struct tui_line_or_address
} u; } u;
}; };
/* Current Layout definition */ /* Current Layout definition. */
struct tui_layout_def struct tui_layout_def
{ {
enum tui_win_type display_mode; enum tui_win_type display_mode;
@ -166,7 +168,7 @@ struct tui_layout_def
enum tui_register_display_type float_regs_display_type; enum tui_register_display_type float_regs_display_type;
}; };
/* Elements in the Source/Disassembly Window */ /* Elements in the Source/Disassembly Window. */
struct tui_source_element struct tui_source_element
{ {
char *line; char *line;
@ -176,11 +178,11 @@ struct tui_source_element
}; };
/* Elements in the data display window content */ /* Elements in the data display window content. */
struct tui_data_element struct tui_data_element
{ {
const char *name; const char *name;
int item_no; /* the register number, or data display number */ int item_no; /* The register number, or data display number. */
enum tui_data_type type; enum tui_data_type type;
void *value; void *value;
int highlight; int highlight;
@ -188,7 +190,7 @@ struct tui_data_element
}; };
/* Elements in the command window content */ /* Elements in the command window content. */
struct tui_command_element struct tui_command_element
{ {
char *line; char *line;
@ -197,7 +199,7 @@ struct tui_command_element
#define MAX_LOCATOR_ELEMENT_LEN 100 #define MAX_LOCATOR_ELEMENT_LEN 100
/* Elements in the locator window content */ /* Elements in the locator window content. */
struct tui_locator_element struct tui_locator_element
{ {
char file_name[MAX_LOCATOR_ELEMENT_LEN]; char file_name[MAX_LOCATOR_ELEMENT_LEN];
@ -221,15 +223,15 @@ struct tui_locator_element
typedef char tui_exec_info_content[TUI_EXECINFO_SIZE]; typedef char tui_exec_info_content[TUI_EXECINFO_SIZE];
/* An content element in a window */ /* An content element in a window. */
union tui_which_element union tui_which_element
{ {
struct tui_source_element source; /* the source elements */ struct tui_source_element source; /* The source elements. */
struct tui_gen_win_info data_window; /* data display elements */ struct tui_gen_win_info data_window; /* Data display elements. */
struct tui_data_element data; /* elements of data_window */ struct tui_data_element data; /* Elements of data_window. */
struct tui_command_element command; /* command elements */ struct tui_command_element command; /* Command elements. */
struct tui_locator_element locator; /* locator elements */ struct tui_locator_element locator; /* Locator elements. */
tui_exec_info_content simple_string; /* simple char based elements */ tui_exec_info_content simple_string; /* Simple char based elements. */
}; };
struct tui_win_element struct tui_win_element
@ -239,30 +241,31 @@ struct tui_win_element
}; };
/* This describes the content of the window. */ /* This describes the content of the window. */
typedef struct tui_win_element **tui_win_content; typedef struct tui_win_element **tui_win_content;
/* This struct defines the specific information about a data display window */ /* This struct defines the specific information about a data display
window. */
struct tui_data_info struct tui_data_info
{ {
tui_win_content data_content; /* start of data display content */ tui_win_content data_content; /* Start of data display content. */
int data_content_count; int data_content_count;
tui_win_content regs_content; /* start of regs display content */ tui_win_content regs_content; /* Start of regs display content. */
int regs_content_count; int regs_content_count;
enum tui_register_display_type regs_display_type; enum tui_register_display_type regs_display_type;
int regs_column_count; int regs_column_count;
int display_regs; /* Should regs be displayed at all? */ int display_regs; /* Should regs be displayed at all? */
struct reggroup *current_group; struct reggroup *current_group;
}; };
struct tui_source_info struct tui_source_info
{ {
int has_locator; /* Does locator belongs to this window? */ int has_locator; /* Does locator belongs to this window? */
/* Execution information window. */ /* Execution information window. */
struct tui_gen_win_info *execution_info; struct tui_gen_win_info *execution_info;
int horizontal_offset; /* used for horizontal scroll */ int horizontal_offset; /* Used for horizontal scroll. */
struct tui_line_or_address start_line_or_addr; struct tui_line_or_address start_line_or_addr;
char *filename; char *filename;
}; };
@ -270,16 +273,16 @@ struct tui_source_info
struct tui_command_info struct tui_command_info
{ {
int cur_line; /* The current line position */ int cur_line; /* The current line position. */
int curch; /* The current cursor position */ int curch; /* The current cursor position. */
int start_line; int start_line;
}; };
/* This defines information about each logical window */ /* This defines information about each logical window. */
struct tui_win_info struct tui_win_info
{ {
struct tui_gen_win_info generic; /* general window information */ struct tui_gen_win_info generic; /* General window information. */
union union
{ {
struct tui_source_info source_info; struct tui_source_info source_info;
@ -288,8 +291,8 @@ struct tui_win_info
void *opaque; void *opaque;
} }
detail; detail;
int can_highlight; /* Can this window ever be highlighted? */ int can_highlight; /* Can this window ever be highlighted? */
int is_highlighted; /* Is this window highlighted? */ int is_highlighted; /* Is this window highlighted? */
}; };
extern int tui_win_is_source_type (enum tui_win_type win_type); extern int tui_win_is_source_type (enum tui_win_type win_type);
@ -299,15 +302,15 @@ extern void tui_set_win_highlight (struct tui_win_info *win_info,
int highlight); int highlight);
/* Global Data */ /* Global Data. */
extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]); extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]);
#define TUI_SRC_WIN tui_win_list[SRC_WIN] #define TUI_SRC_WIN tui_win_list[SRC_WIN]
#define TUI_DISASM_WIN tui_win_list[DISASSEM_WIN] #define TUI_DISASM_WIN tui_win_list[DISASSEM_WIN]
#define TUI_DATA_WIN tui_win_list[DATA_WIN] #define TUI_DATA_WIN tui_win_list[DATA_WIN]
#define TUI_CMD_WIN tui_win_list[CMD_WIN] #define TUI_CMD_WIN tui_win_list[CMD_WIN]
/* Data Manipulation Functions */ /* Data Manipulation Functions. */
extern void tui_initialize_static_data (void); extern void tui_initialize_static_data (void);
extern struct tui_gen_win_info *tui_alloc_generic_win_info (void); extern struct tui_gen_win_info *tui_alloc_generic_win_info (void);
extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type); extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type);

View File

@ -55,10 +55,10 @@ tui_disassemble (struct tui_asm_line *asm_lines, CORE_ADDR pc, int count)
{ {
struct ui_file *gdb_dis_out; struct ui_file *gdb_dis_out;
/* now init the ui_file structure */ /* Now init the ui_file structure. */
gdb_dis_out = tui_sfileopen (256); gdb_dis_out = tui_sfileopen (256);
/* Now construct each line */ /* Now construct each line. */
for (; count > 0; count--, asm_lines++) for (; count > 0; count--, asm_lines++)
{ {
if (asm_lines->addr_string) if (asm_lines->addr_string)
@ -76,16 +76,16 @@ tui_disassemble (struct tui_asm_line *asm_lines, CORE_ADDR pc, int count)
asm_lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out)); asm_lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out));
/* reset the buffer to empty */ /* Reset the buffer to empty. */
ui_file_rewind (gdb_dis_out); ui_file_rewind (gdb_dis_out);
} }
ui_file_delete (gdb_dis_out); ui_file_delete (gdb_dis_out);
return pc; return pc;
} }
/* Find the disassembly address that corresponds to FROM lines /* Find the disassembly address that corresponds to FROM lines above
above or below the PC. Variable sized instructions are taken or below the PC. Variable sized instructions are taken into
into account by the algorithm. */ account by the algorithm. */
static CORE_ADDR static CORE_ADDR
tui_find_disassembly_address (CORE_ADDR pc, int from) tui_find_disassembly_address (CORE_ADDR pc, int from)
{ {
@ -114,9 +114,9 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
int pos; int pos;
struct minimal_symbol *msymbol; struct minimal_symbol *msymbol;
/* Find backward an address which is a symbol /* Find backward an address which is a symbol and for which
and for which disassembling from that address will fill disassembling from that address will fill completely the
completely the window. */ window. */
pos = max_lines - 1; pos = max_lines - 1;
do { do {
new_low -= 1 * max_lines; new_low -= 1 * max_lines;
@ -131,11 +131,10 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
last_addr = asm_lines[pos].addr; last_addr = asm_lines[pos].addr;
} while (last_addr > pc && msymbol); } while (last_addr > pc && msymbol);
/* Scan forward disassembling one instruction at a time /* Scan forward disassembling one instruction at a time until
until the last visible instruction of the window the last visible instruction of the window matches the pc.
matches the pc. We keep the disassembled instructions We keep the disassembled instructions in the 'lines' window
in the 'lines' window and shift it downward (increasing and shift it downward (increasing its addresses). */
its addresses). */
if (last_addr < pc) if (last_addr < pc)
do do
{ {
@ -193,7 +192,8 @@ tui_set_disassem_content (CORE_ADDR pc)
cur_pc = (CORE_ADDR) cur_pc = (CORE_ADDR)
(((struct tui_win_element *) locator->content[0])->which_element.locator.addr); (((struct tui_win_element *) locator->content[0])->which_element.locator.addr);
max_lines = TUI_DISASM_WIN->generic.height - 2; /* account for hilite */ max_lines = TUI_DISASM_WIN->generic.height - 2; /* Account for
hilite. */
/* Get temporary table that will hold all strings (addr & insn). */ /* Get temporary table that will hold all strings (addr & insn). */
asm_lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line) asm_lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
@ -223,7 +223,7 @@ tui_set_disassem_content (CORE_ADDR pc)
line = (char*) alloca (max_size); line = (char*) alloca (max_size);
insn_pos = (1 + (addr_size / tab_len)) * tab_len; insn_pos = (1 + (addr_size / tab_len)) * tab_len;
/* Now construct each line */ /* Now construct each line. */
for (i = 0; i < max_lines; i++) for (i = 0; i < max_lines; i++)
{ {
struct tui_win_element *element; struct tui_win_element *element;
@ -235,7 +235,8 @@ tui_set_disassem_content (CORE_ADDR pc)
strcpy (line, asm_lines[i].addr_string); strcpy (line, asm_lines[i].addr_string);
cur_len = strlen (line); cur_len = strlen (line);
/* Add spaces to make the instructions start on the same column */ /* Add spaces to make the instructions start on the same
column. */
while (cur_len < insn_pos) while (cur_len < insn_pos)
{ {
strcat (line, " "); strcat (line, " ");
@ -244,7 +245,7 @@ tui_set_disassem_content (CORE_ADDR pc)
strcat (line, asm_lines[i].insn); strcat (line, asm_lines[i].insn);
/* Now copy the line taking the offset into account */ /* Now copy the line taking the offset into account. */
if (strlen (line) > offset) if (strlen (line) > offset)
strcpy (src->line, &line[offset]); strcpy (src->line, &line[offset]);
else else
@ -266,7 +267,7 @@ tui_set_disassem_content (CORE_ADDR pc)
} }
/* Function to display the disassembly window with disassembled code. */ /* Function to display the disassembly window with disassembled code. */
void void
tui_show_disassem (CORE_ADDR start_addr) tui_show_disassem (CORE_ADDR start_addr)
{ {
@ -279,8 +280,8 @@ tui_show_disassem (CORE_ADDR start_addr)
tui_add_win_to_layout (DISASSEM_WIN); tui_add_win_to_layout (DISASSEM_WIN);
tui_update_source_window (TUI_DISASM_WIN, s, val, FALSE); tui_update_source_window (TUI_DISASM_WIN, s, val, FALSE);
/* /*
** if the focus was in the src win, put it in the asm win, if the ** If the focus was in the src win, put it in the asm win, if
** source view isn't split ** the source view isn't split.
*/ */
if (tui_current_layout () != SRC_DISASSEM_COMMAND && win_with_focus == TUI_SRC_WIN) if (tui_current_layout () != SRC_DISASSEM_COMMAND && win_with_focus == TUI_SRC_WIN)
tui_set_win_focus_to (TUI_DISASM_WIN); tui_set_win_focus_to (TUI_DISASM_WIN);
@ -289,7 +290,7 @@ tui_show_disassem (CORE_ADDR start_addr)
} }
/* Function to display the disassembly window. */ /* Function to display the disassembly window. */
void void
tui_show_disassem_and_update_source (CORE_ADDR start_addr) tui_show_disassem_and_update_source (CORE_ADDR start_addr)
{ {
@ -302,7 +303,8 @@ tui_show_disassem_and_update_source (CORE_ADDR start_addr)
/* /*
** Update what is in the source window if it is displayed too, ** Update what is in the source window if it is displayed too,
** note that it follows what is in the disassembly window and visa-versa ** note that it follows what is in the disassembly window and
** visa-versa.
*/ */
sal = find_pc_line (start_addr, 0); sal = find_pc_line (start_addr, 0);
val.loa = LOA_LINE; val.loa = LOA_LINE;
@ -346,22 +348,22 @@ tui_get_begin_asm_address (void)
else else
addr = 0; addr = 0;
} }
else /* the target is executing */ else /* The target is executing. */
addr = element->addr; addr = element->addr;
return addr; return addr;
} }
/* Determine what the low address will be to display in the TUI's /* Determine what the low address will be to display in the TUI's
disassembly window. This may or may not be the same as the disassembly window. This may or may not be the same as the low
low address input. */ address input. */
CORE_ADDR CORE_ADDR
tui_get_low_disassembly_address (CORE_ADDR low, CORE_ADDR pc) tui_get_low_disassembly_address (CORE_ADDR low, CORE_ADDR pc)
{ {
int pos; int pos;
/* Determine where to start the disassembly so that the pc is about in the /* Determine where to start the disassembly so that the pc is about
middle of the viewport. */ in the middle of the viewport. */
pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2; pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2;
pc = tui_find_disassembly_address (pc, -pos); pc = tui_find_disassembly_address (pc, -pos);
@ -390,7 +392,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction,
else else
s = cursal.symtab; s = cursal.symtab;
/* account for hilite */ /* Account for hilite. */
max_lines = TUI_DISASM_WIN->generic.height - 2; max_lines = TUI_DISASM_WIN->generic.height - 2;
pc = content[0]->which_element.source.line_or_addr.u.addr; pc = content[0]->which_element.source.line_or_addr.u.addr;
dir = (scroll_direction == FORWARD_SCROLL) ? max_lines : - max_lines; dir = (scroll_direction == FORWARD_SCROLL) ? max_lines : - max_lines;

View File

@ -28,7 +28,7 @@
#include "gdb_string.h" #include "gdb_string.h"
/* A ``struct ui_file'' that is compatible with all the legacy /* A ``struct ui_file'' that is compatible with all the legacy
code. */ code. */
/* new */ /* new */
enum streamtype enum streamtype
@ -111,8 +111,8 @@ tui_sfileopen (int n)
tmpstream->ts_strbuf[0] = '\0'; tmpstream->ts_strbuf[0] = '\0';
} }
else else
/* Do not allocate the buffer now. The first time something is printed /* Do not allocate the buffer now. The first time something is
one will be allocated by tui_file_adjust_strbuf() */ printed one will be allocated by tui_file_adjust_strbuf(). */
tmpstream->ts_strbuf = NULL; tmpstream->ts_strbuf = NULL;
tmpstream->ts_buflen = n; tmpstream->ts_buflen = n;
return file; return file;
@ -161,7 +161,7 @@ tui_file_put (struct ui_file *file,
gdb_stderr are sent to the hook. Everything else is sent on to gdb_stderr are sent to the hook. Everything else is sent on to
fputs to allow file I/O to be handled appropriately. */ fputs to allow file I/O to be handled appropriately. */
/* FIXME: Should be broken up and moved to a TUI specific file. */ /* FIXME: Should be broken up and moved to a TUI specific file. */
void void
tui_file_fputs (const char *linebuffer, struct ui_file *file) tui_file_fputs (const char *linebuffer, struct ui_file *file)
@ -189,8 +189,9 @@ tui_file_get_strbuf (struct ui_file *file)
return (stream->ts_strbuf); return (stream->ts_strbuf);
} }
/* adjust the length of the buffer by the amount necessary /* Adjust the length of the buffer by the amount necessary to
to accomodate appending a string of length N to the buffer contents */ accomodate appending a string of length N to the buffer
contents. */
void void
tui_file_adjust_strbuf (int n, struct ui_file *file) tui_file_adjust_strbuf (int n, struct ui_file *file)
{ {
@ -205,7 +206,7 @@ tui_file_adjust_strbuf (int n, struct ui_file *file)
if (stream->ts_strbuf) if (stream->ts_strbuf)
{ {
/* There is already a buffer allocated */ /* There is already a buffer allocated. */
non_null_chars = strlen (stream->ts_strbuf); non_null_chars = strlen (stream->ts_strbuf);
if (n > (stream->ts_buflen - non_null_chars - 1)) if (n > (stream->ts_buflen - non_null_chars - 1))
@ -215,7 +216,7 @@ tui_file_adjust_strbuf (int n, struct ui_file *file)
} }
} }
else else
/* No buffer yet, so allocate one of the desired size */ /* No buffer yet, so allocate one of the desired size. */
stream->ts_strbuf = xmalloc ((n + 1) * sizeof (char)); stream->ts_strbuf = xmalloc ((n + 1) * sizeof (char));
} }

View File

@ -77,7 +77,7 @@ tui_query_hook (const char *msg, va_list argp)
echo (); echo ();
while (1) while (1)
{ {
wrap_here (""); /* Flush any buffered output */ wrap_here (""); /* Flush any buffered output. */
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
vfprintf_filtered (gdb_stdout, msg, argp); vfprintf_filtered (gdb_stdout, msg, argp);
@ -93,7 +93,7 @@ tui_query_hook (const char *msg, va_list argp)
retval = 1; retval = 1;
break; break;
} }
/* Eat rest of input line, to EOF or newline */ /* Eat rest of input line, to EOF or newline. */
if (answer != '\n') if (answer != '\n')
do do
{ {
@ -204,7 +204,8 @@ tui_target_wait_hook (ptid_t pid, struct target_waitstatus *status)
} }
/* The selected frame has changed. This is happens after a target /* The selected frame has changed. This is happens after a target
stop or when the user explicitly changes the frame (up/down/thread/...). */ stop or when the user explicitly changes the frame
(up/down/thread/...). */
static void static void
tui_selected_frame_level_changed_hook (int level) tui_selected_frame_level_changed_hook (int level)
{ {
@ -215,17 +216,18 @@ tui_selected_frame_level_changed_hook (int level)
return; return;
fi = get_selected_frame (NULL); fi = get_selected_frame (NULL);
/* Ensure that symbols for this frame are read in. Also, determine the /* Ensure that symbols for this frame are read in. Also, determine
source language of this frame, and switch to it if desired. */ the source language of this frame, and switch to it if
desired. */
if (fi) if (fi)
{ {
struct symtab *s; struct symtab *s;
s = find_pc_symtab (get_frame_pc (fi)); s = find_pc_symtab (get_frame_pc (fi));
/* elz: this if here fixes the problem with the pc not being displayed /* elz: This if here fixes the problem with the pc not being
in the tui asm layout, with no debug symbols. The value of s displayed in the tui asm layout, with no debug symbols. The
would be 0 here, and select_source_symtab would abort the value of s would be 0 here, and select_source_symtab would
command by calling the 'error' function */ abort the command by calling the 'error' function. */
if (s) if (s)
select_source_symtab (s); select_source_symtab (s);

View File

@ -33,7 +33,8 @@
#include "tui/tui-io.h" #include "tui/tui-io.h"
#include "exceptions.h" #include "exceptions.h"
/* Set to 1 when the TUI mode must be activated when we first start gdb. */ /* Set to 1 when the TUI mode must be activated when we first start
gdb. */
static int tui_start_enabled = 0; static int tui_start_enabled = 0;
/* Cleanup the tui before exiting. */ /* Cleanup the tui before exiting. */
@ -41,8 +42,8 @@ static int tui_start_enabled = 0;
static void static void
tui_exit (void) tui_exit (void)
{ {
/* Disable the tui. Curses mode is left leaving the screen /* Disable the tui. Curses mode is left leaving the screen in a
in a clean state (see endwin()). */ clean state (see endwin()). */
tui_disable (); tui_disable ();
} }
@ -67,8 +68,9 @@ tui_resume (void *data)
{ {
struct ui_file *stream; struct ui_file *stream;
/* gdb_setup_readline will change gdb_stdout. If the TUI was previously /* gdb_setup_readline will change gdb_stdout. If the TUI was
writing to gdb_stdout, then set it to the new gdb_stdout afterwards. */ previously writing to gdb_stdout, then set it to the new
gdb_stdout afterwards. */
stream = cli_out_set_stream (tui_old_uiout, gdb_stdout); stream = cli_out_set_stream (tui_old_uiout, gdb_stdout);
if (stream != gdb_stdout) if (stream != gdb_stdout)
@ -198,7 +200,7 @@ _initialize_tui_interp (void)
}; };
struct interp *tui_interp; struct interp *tui_interp;
/* Create a default uiout builder for the TUI. */ /* Create a default uiout builder for the TUI. */
tui_out = tui_out_new (gdb_stdout); tui_out = tui_out_new (gdb_stdout);
interp_add (interp_new (INTERP_TUI, NULL, tui_out, &procs)); interp_add (interp_new (INTERP_TUI, NULL, tui_out, &procs));
if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0) if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0)

View File

@ -84,36 +84,37 @@ key_is_command_char (int ch)
When the TUI is enabled, gdb has two modes a curses and a standard When the TUI is enabled, gdb has two modes a curses and a standard
mode. mode.
In curses mode, the gdb outputs are made in a curses command window. In curses mode, the gdb outputs are made in a curses command
For this, the gdb_stdout and gdb_stderr are redirected to the specific window. For this, the gdb_stdout and gdb_stderr are redirected to
ui_file implemented by TUI. The output is handled by tui_puts(). the specific ui_file implemented by TUI. The output is handled by
The input is also controlled by curses with tui_getc(). The readline tui_puts(). The input is also controlled by curses with
library uses this function to get its input. Several readline hooks tui_getc(). The readline library uses this function to get its
are installed to redirect readline output to the TUI (see also the input. Several readline hooks are installed to redirect readline
note below). output to the TUI (see also the note below).
In normal mode, the gdb outputs are restored to their origin, that In normal mode, the gdb outputs are restored to their origin, that
is as if TUI is not used. Readline also uses its original getc() is as if TUI is not used. Readline also uses its original getc()
function with stdin. function with stdin.
Note SCz/2001-07-21: the current readline is not clean in its management of Note SCz/2001-07-21: the current readline is not clean in its
the output. Even if we install a redisplay handler, it sometimes writes on management of the output. Even if we install a redisplay handler,
a stdout file. It is important to redirect every output produced by it sometimes writes on a stdout file. It is important to redirect
readline, otherwise the curses window will be garbled. This is implemented every output produced by readline, otherwise the curses window will
with a pipe that TUI reads and readline writes to. A gdb input handler be garbled. This is implemented with a pipe that TUI reads and
is created so that reading the pipe is handled automatically. readline writes to. A gdb input handler is created so that reading
This will probably not work on non-Unix platforms. The best fix is the pipe is handled automatically. This will probably not work on
to make readline clean enougth so that is never write on stdout. non-Unix platforms. The best fix is to make readline clean enougth
so that is never write on stdout.
Note SCz/2002-09-01: we now use more readline hooks and it seems that Note SCz/2002-09-01: we now use more readline hooks and it seems
with them we don't need the pipe anymore (verified by creating the pipe that with them we don't need the pipe anymore (verified by creating
and closing its end so that write causes a SIGPIPE). The old pipe code the pipe and closing its end so that write causes a SIGPIPE). The
is still there and can be conditionally removed by old pipe code is still there and can be conditionally removed by
#undef TUI_USE_PIPE_FOR_READLINE. */ #undef TUI_USE_PIPE_FOR_READLINE. */
/* For gdb 5.3, prefer to continue the pipe hack as a backup wheel. */ /* For gdb 5.3, prefer to continue the pipe hack as a backup wheel. */
#define TUI_USE_PIPE_FOR_READLINE #define TUI_USE_PIPE_FOR_READLINE
/*#undef TUI_USE_PIPE_FOR_READLINE*/ /* #undef TUI_USE_PIPE_FOR_READLINE */
/* TUI output files. */ /* TUI output files. */
static struct ui_file *tui_stdout; static struct ui_file *tui_stdout;
@ -207,7 +208,8 @@ tui_redisplay_readline (void)
int start_line; int start_line;
/* Detect when we temporarily left SingleKey and now the readline /* Detect when we temporarily left SingleKey and now the readline
edit buffer is empty, automatically restore the SingleKey mode. */ edit buffer is empty, automatically restore the SingleKey
mode. */
if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0) if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
tui_set_key_mode (TUI_SINGLE_KEY_MODE); tui_set_key_mode (TUI_SINGLE_KEY_MODE);
@ -275,8 +277,9 @@ tui_redisplay_readline (void)
fflush(stdout); fflush(stdout);
} }
/* Readline callback to prepare the terminal. It is called once /* Readline callback to prepare the terminal. It is called once each
each time we enter readline. Terminal is already setup in curses mode. */ time we enter readline. Terminal is already setup in curses
mode. */
static void static void
tui_prep_terminal (int notused1) tui_prep_terminal (int notused1)
{ {
@ -287,8 +290,8 @@ tui_prep_terminal (int notused1)
tui_rl_saved_prompt = xstrdup (rl_prompt); tui_rl_saved_prompt = xstrdup (rl_prompt);
} }
/* Readline callback to restore the terminal. It is called once /* Readline callback to restore the terminal. It is called once each
each time we leave readline. There is nothing to do in curses mode. */ time we leave readline. There is nothing to do in curses mode. */
static void static void
tui_deprep_terminal (void) tui_deprep_terminal (void)
{ {
@ -317,7 +320,7 @@ tui_readline_output (int code, gdb_client_data data)
are only interested in the basename, the portion following the are only interested in the basename, the portion following the
final slash. Otherwise, we return what we were passed. final slash. Otherwise, we return what we were passed.
Comes from readline/complete.c */ Comes from readline/complete.c. */
static char * static char *
printable_part (char *pathname) printable_part (char *pathname)
{ {
@ -331,9 +334,10 @@ printable_part (char *pathname)
return (temp ? ++temp : pathname); return (temp ? ++temp : pathname);
} }
/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we /* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and
are using it, check for and output a single character for `special' we are using it, check for and output a single character for
filenames. Return the number of characters we output. */ `special' filenames. Return the number of characters we
output. */
#define PUTX(c) \ #define PUTX(c) \
do { \ do { \
@ -369,7 +373,7 @@ print_filename (char *to_print, char *full_pathname)
} }
/* The user must press "y" or "n". Non-zero return means "y" pressed. /* The user must press "y" or "n". Non-zero return means "y" pressed.
Comes from readline/complete.c */ Comes from readline/complete.c. */
static int static int
get_y_or_n (void) get_y_or_n (void)
{ {
@ -411,7 +415,7 @@ tui_rl_display_match_list (char **matches, int len, int max)
int screenwidth = TUI_CMD_WIN->generic.width; int screenwidth = TUI_CMD_WIN->generic.width;
/* If there are many items, then ask the user if she really wants to /* If there are many items, then ask the user if she really wants to
see them all. */ see them all. */
if (len >= rl_completion_query_items) if (len >= rl_completion_query_items)
{ {
char msg[256]; char msg[256];
@ -425,25 +429,25 @@ tui_rl_display_match_list (char **matches, int len, int max)
} }
} }
/* How many items of MAX length can we fit in the screen window? */ /* How many items of MAX length can we fit in the screen window? */
max += 2; max += 2;
limit = screenwidth / max; limit = screenwidth / max;
if (limit != 1 && (limit * max == screenwidth)) if (limit != 1 && (limit * max == screenwidth))
limit--; limit--;
/* Avoid a possible floating exception. If max > screenwidth, /* Avoid a possible floating exception. If max > screenwidth, limit
limit will be 0 and a divide-by-zero fault will result. */ will be 0 and a divide-by-zero fault will result. */
if (limit == 0) if (limit == 0)
limit = 1; limit = 1;
/* How many iterations of the printing loop? */ /* How many iterations of the printing loop? */
count = (len + (limit - 1)) / limit; count = (len + (limit - 1)) / limit;
/* Watch out for special case. If LEN is less than LIMIT, then /* Watch out for special case. If LEN is less than LIMIT, then
just do the inner printing loop. just do the inner printing loop.
0 < len <= limit implies count = 1. */ 0 < len <= limit implies count = 1. */
/* Sort the items if they are not already sorted. */ /* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0) if (rl_ignore_completion_duplicates == 0)
qsort (matches + 1, len, sizeof (char *), qsort (matches + 1, len, sizeof (char *),
(QSFUNC *)_rl_qsort_string_compare); (QSFUNC *)_rl_qsort_string_compare);
@ -452,7 +456,7 @@ tui_rl_display_match_list (char **matches, int len, int max)
if (_rl_print_completions_horizontally == 0) if (_rl_print_completions_horizontally == 0)
{ {
/* Print the sorted items, up-and-down alphabetically, like ls. */ /* Print the sorted items, up-and-down alphabetically, like ls. */
for (i = 1; i <= count; i++) for (i = 1; i <= count; i++)
{ {
for (j = 0, l = i; j < limit; j++) for (j = 0, l = i; j < limit; j++)
@ -475,12 +479,12 @@ tui_rl_display_match_list (char **matches, int len, int max)
} }
else else
{ {
/* Print the sorted items, across alphabetically, like ls -x. */ /* Print the sorted items, across alphabetically, like ls -x. */
for (i = 1; matches[i]; i++) for (i = 1; matches[i]; i++)
{ {
temp = printable_part (matches[i]); temp = printable_part (matches[i]);
printed_len = print_filename (temp, matches[i]); printed_len = print_filename (temp, matches[i]);
/* Have we reached the end of this line? */ /* Have we reached the end of this line? */
if (matches[i+1]) if (matches[i+1])
{ {
if (i && (limit > 1) && (i % limit) == 0) if (i && (limit > 1) && (i % limit) == 0)
@ -607,9 +611,9 @@ tui_initialize_io (void)
tui_old_uiout = uiout = cli_out_new (gdb_stdout); tui_old_uiout = uiout = cli_out_new (gdb_stdout);
#ifdef TUI_USE_PIPE_FOR_READLINE #ifdef TUI_USE_PIPE_FOR_READLINE
/* Temporary solution for readline writing to stdout: /* Temporary solution for readline writing to stdout: redirect
redirect readline output in a pipe, read that pipe and readline output in a pipe, read that pipe and output the content
output the content in the curses command window. */ in the curses command window. */
if (pipe (tui_readline_pipe) != 0) if (pipe (tui_readline_pipe) != 0)
{ {
fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline"); fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline");
@ -636,8 +640,8 @@ tui_initialize_io (void)
#endif #endif
} }
/* Get a character from the command window. This is called from the readline /* Get a character from the command window. This is called from the
package. */ readline package. */
int int
tui_getc (FILE *fp) tui_getc (FILE *fp)
{ {
@ -654,7 +658,8 @@ tui_getc (FILE *fp)
ch = wgetch (w); ch = wgetch (w);
ch = tui_handle_resize_during_io (ch); ch = tui_handle_resize_during_io (ch);
/* The \n must be echoed because it will not be printed by readline. */ /* The \n must be echoed because it will not be printed by
readline. */
if (ch == '\n') if (ch == '\n')
{ {
/* When hitting return with an empty input, gdb executes the last /* When hitting return with an empty input, gdb executes the last
@ -681,7 +686,7 @@ tui_getc (FILE *fp)
} }
if (key_is_command_char (ch)) if (key_is_command_char (ch))
{ /* Handle prev/next/up/down here */ { /* Handle prev/next/up/down here. */
ch = tui_dispatch_ctrl_char (ch); ch = tui_dispatch_ctrl_char (ch);
} }

View File

@ -84,7 +84,7 @@ show_layout (enum tui_layout_type layout)
/* /*
** Since the new layout may cause changes in window size, we ** Since the new layout may cause changes in window size, we
** should free the content and reallocate on next display of ** should free the content and reallocate on next display of
** source/asm ** source/asm.
*/ */
tui_free_all_source_wins_content (); tui_free_all_source_wins_content ();
tui_clear_source_windows (); tui_clear_source_windows ();
@ -95,13 +95,13 @@ show_layout (enum tui_layout_type layout)
} }
else else
{ {
/* First make the current layout be invisible */ /* First make the current layout be invisible. */
tui_make_all_invisible (); tui_make_all_invisible ();
tui_make_invisible (tui_locator_win_info_ptr ()); tui_make_invisible (tui_locator_win_info_ptr ());
switch (layout) switch (layout)
{ {
/* Now show the new layout */ /* Now show the new layout. */
case SRC_COMMAND: case SRC_COMMAND:
show_source_command (); show_source_command ();
tui_add_to_source_windows (TUI_SRC_WIN); tui_add_to_source_windows (TUI_SRC_WIN);
@ -166,7 +166,7 @@ tui_set_layout (enum tui_layout_type layout_type,
{ {
show_layout (new_layout); show_layout (new_layout);
/* /*
** Now determine where focus should be ** Now determine where focus should be.
*/ */
if (win_with_focus != TUI_CMD_WIN) if (win_with_focus != TUI_CMD_WIN)
{ {
@ -178,7 +178,7 @@ tui_set_layout (enum tui_layout_type layout_type,
layout_def->split = FALSE; layout_def->split = FALSE;
break; break;
case DISASSEM_COMMAND: case DISASSEM_COMMAND:
/* the previous layout was not showing /* The previous layout was not showing
** code. this can happen if there is no ** code. this can happen if there is no
** source available: ** source available:
** 1. if the source file is in another dir OR ** 1. if the source file is in another dir OR
@ -191,7 +191,7 @@ tui_set_layout (enum tui_layout_type layout_type,
layout_def->split = FALSE; layout_def->split = FALSE;
break; break;
case SRC_DISASSEM_COMMAND: case SRC_DISASSEM_COMMAND:
/* the previous layout was not showing /* The previous layout was not showing
** code. this can happen if there is no ** code. this can happen if there is no
** source available: ** source available:
** 1. if the source file is in another dir OR ** 1. if the source file is in another dir OR
@ -214,7 +214,7 @@ tui_set_layout (enum tui_layout_type layout_type,
layout_def->split = FALSE; layout_def->split = FALSE;
break; break;
case DISASSEM_DATA_COMMAND: case DISASSEM_DATA_COMMAND:
/* the previous layout was not showing /* The previous layout was not showing
** code. this can happen if there is no ** code. this can happen if there is no
** source available: ** source available:
** 1. if the source file is in another dir OR ** 1. if the source file is in another dir OR
@ -417,7 +417,7 @@ tui_set_layout_for_display_command (const char *layout_name)
for (i = 0; (i < strlen (layout_name)); i++) for (i = 0; (i < strlen (layout_name)); i++)
buf_ptr[i] = toupper (buf_ptr[i]); buf_ptr[i] = toupper (buf_ptr[i]);
/* First check for ambiguous input */ /* First check for ambiguous input. */
if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$')) if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$'))
{ {
warning (_("Ambiguous command input.")); warning (_("Ambiguous command input."));
@ -442,11 +442,11 @@ tui_set_layout_for_display_command (const char *layout_name)
else else
new_layout = DISASSEM_DATA_COMMAND; new_layout = DISASSEM_DATA_COMMAND;
/* could ifdef out the following code. when compile with -z, there are null /* Could ifdef out the following code. when compile with
pointer references that cause a core dump if 'layout regs' is the first -z, there are null pointer references that cause a
layout command issued by the user. HP has asked us to hook up this code core dump if 'layout regs' is the first layout
- edie epstein 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 (subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME))
{ {
if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != if (TUI_DATA_WIN->detail.data_display_info.regs_display_type !=
@ -475,15 +475,14 @@ tui_set_layout_for_display_command (const char *layout_name)
dpy_type = TUI_GENERAL_REGS; dpy_type = TUI_GENERAL_REGS;
} }
/* end of potential ifdef /* End of potential ifdef.
*/ */
/* if ifdefed out code above, then assume that the user wishes to display the /* If ifdefed out code above, then assume that the user
general purpose registers wishes to display the general purpose registers .
*/ */
/* dpy_type = TUI_GENERAL_REGS; /* dpy_type = TUI_GENERAL_REGS; */
*/
} }
else if (subset_compare (buf_ptr, "NEXT")) else if (subset_compare (buf_ptr, "NEXT"))
new_layout = next_layout (); new_layout = next_layout ();
@ -978,7 +977,7 @@ make_source_or_disasm_window (struct tui_win_info **win_info_ptr, enum tui_win_t
} }
/* Show the Source/Command or the Disassem layout. */ /* Show the Source/Command or the Disassem layout. */
static void static void
show_source_or_disasm_and_command (enum tui_layout_type layout_type) show_source_or_disasm_and_command (enum tui_layout_type layout_type)
{ {

View File

@ -38,7 +38,7 @@ struct ui_out_data
}; };
typedef struct ui_out_data tui_out_data; typedef struct ui_out_data tui_out_data;
/* These are the CLI output functions */ /* These are the CLI output functions. */
static void tui_table_begin (struct ui_out *uiout, int nbrofcols, static void tui_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows, const char *tblid); int nr_rows, const char *tblid);
@ -69,10 +69,10 @@ static void tui_message (struct ui_out *uiout, int verbosity,
static void tui_wrap_hint (struct ui_out *uiout, char *identstring); static void tui_wrap_hint (struct ui_out *uiout, char *identstring);
static void tui_flush (struct ui_out *uiout); static void tui_flush (struct ui_out *uiout);
/* This is the CLI ui-out implementation functions vector */ /* This is the CLI ui-out implementation functions vector. */
/* FIXME: This can be initialized dynamically after default is set to /* FIXME: This can be initialized dynamically after default is set to
handle initial output in main.c */ handle initial output in main.c. */
static struct ui_out_impl tui_ui_out_impl = static struct ui_out_impl tui_ui_out_impl =
{ {
@ -95,7 +95,7 @@ static struct ui_out_impl tui_ui_out_impl =
0, /* Does not need MI hacks (i.e. needs CLI hacks). */ 0, /* Does not need MI hacks (i.e. needs CLI hacks). */
}; };
/* Prototypes for local functions */ /* Prototypes for local functions. */
extern void _initialize_tui_out (void); extern void _initialize_tui_out (void);
@ -109,7 +109,7 @@ static void out_field_fmt (struct ui_out *uiout, int fldno,
/* (none yet) */ /* (none yet) */
/* Mark beginning of a table */ /* Mark beginning of a table. */
void void
tui_table_begin (struct ui_out *uiout, int nbrofcols, tui_table_begin (struct ui_out *uiout, int nbrofcols,
@ -121,11 +121,11 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols,
data->suppress_output = 1; data->suppress_output = 1;
else else
/* Only the table suppresses the output and, fortunately, a table /* Only the table suppresses the output and, fortunately, a table
is not a recursive data structure. */ is not a recursive data structure. */
gdb_assert (data->suppress_output == 0); gdb_assert (data->suppress_output == 0);
} }
/* Mark beginning of a table body */ /* Mark beginning of a table body. */
void void
tui_table_body (struct ui_out *uiout) tui_table_body (struct ui_out *uiout)
@ -133,11 +133,11 @@ tui_table_body (struct ui_out *uiout)
tui_out_data *data = ui_out_data (uiout); tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output) if (data->suppress_output)
return; return;
/* first, close the table header line */ /* First, close the table header line. */
tui_text (uiout, "\n"); tui_text (uiout, "\n");
} }
/* Mark end of a table */ /* Mark end of a table. */
void void
tui_table_end (struct ui_out *uiout) tui_table_end (struct ui_out *uiout)
@ -146,7 +146,7 @@ tui_table_end (struct ui_out *uiout)
data->suppress_output = 0; data->suppress_output = 0;
} }
/* Specify table header */ /* Specify table header. */
void void
tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment, tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
@ -159,7 +159,7 @@ tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
tui_field_string (uiout, 0, width, alignment, 0, colhdr); tui_field_string (uiout, 0, width, alignment, 0, colhdr);
} }
/* Mark beginning of a list */ /* Mark beginning of a list. */
void void
tui_begin (struct ui_out *uiout, tui_begin (struct ui_out *uiout,
@ -172,7 +172,7 @@ tui_begin (struct ui_out *uiout,
return; return;
} }
/* Mark end of a list */ /* Mark end of a list. */
void void
tui_end (struct ui_out *uiout, tui_end (struct ui_out *uiout,
@ -184,14 +184,14 @@ tui_end (struct ui_out *uiout,
return; return;
} }
/* output an int field */ /* Output an int field. */
void void
tui_field_int (struct ui_out *uiout, int fldno, int width, tui_field_int (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment, enum ui_align alignment,
const char *fldname, int value) const char *fldname, int value)
{ {
char buffer[20]; /* FIXME: how many chars long a %d can become? */ char buffer[20]; /* FIXME: how many chars long a %d can become? */
tui_out_data *data = ui_out_data (uiout); tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output) if (data->suppress_output)
@ -209,7 +209,7 @@ tui_field_int (struct ui_out *uiout, int fldno, int width,
tui_field_string (uiout, fldno, width, alignment, fldname, buffer); tui_field_string (uiout, fldno, width, alignment, fldname, buffer);
} }
/* used to ommit a field */ /* Used to ommit a field. */
void void
tui_field_skip (struct ui_out *uiout, int fldno, int width, tui_field_skip (struct ui_out *uiout, int fldno, int width,
@ -222,8 +222,8 @@ tui_field_skip (struct ui_out *uiout, int fldno, int width,
tui_field_string (uiout, fldno, width, alignment, fldname, ""); tui_field_string (uiout, fldno, width, alignment, fldname, "");
} }
/* other specific tui_field_* end up here so alignment and field /* Other specific tui_field_* end up here so alignment and field
separators are both handled by tui_field_string */ separators are both handled by tui_field_string. */
void void
tui_field_string (struct ui_out *uiout, tui_field_string (struct ui_out *uiout,
@ -285,7 +285,7 @@ tui_field_string (struct ui_out *uiout,
field_separator (); field_separator ();
} }
/* This is the only field function that does not align */ /* This is the only field function that does not align. */
void void
tui_field_fmt (struct ui_out *uiout, int fldno, tui_field_fmt (struct ui_out *uiout, int fldno,
@ -362,10 +362,10 @@ tui_flush (struct ui_out *uiout)
gdb_flush (data->stream); gdb_flush (data->stream);
} }
/* local functions */ /* Local functions. */
/* Like tui_field_fmt, but takes a variable number of args /* Like tui_field_fmt, but takes a variable number of args and makes a
and makes a va_list and does not insert a separator */ va_list and does not insert a separator. */
/* VARARGS */ /* VARARGS */
static void static void
@ -382,7 +382,7 @@ out_field_fmt (struct ui_out *uiout, int fldno,
va_end (args); va_end (args);
} }
/* access to ui_out format private members */ /* Access to ui_out format private members. */
static void static void
field_separator (void) field_separator (void)
@ -391,7 +391,7 @@ field_separator (void)
fputc_filtered (' ', data->stream); fputc_filtered (' ', data->stream);
} }
/* initalize private members at startup */ /* Initalize private members at startup. */
struct ui_out * struct ui_out *
tui_out_new (struct ui_file *stream) tui_out_new (struct ui_file *stream)
@ -406,9 +406,9 @@ tui_out_new (struct ui_file *stream)
return ui_out_new (&tui_ui_out_impl, data, flags); return ui_out_new (&tui_ui_out_impl, data, flags);
} }
/* standard gdb initialization hook */ /* Standard gdb initialization hook. */
void void
_initialize_tui_out (void) _initialize_tui_out (void)
{ {
/* nothing needs to be done */ /* Nothing needs to be done. */
} }

View File

@ -114,8 +114,8 @@ tui_line_from_reg_element_no (int element_no)
} }
/* Answer the index of the first element in line_no. If line_no is past /* Answer the index of the first element in line_no. If line_no is
the register area (-1) is returned. */ past the register area (-1) is returned. */
int int
tui_first_reg_element_no_inline (int line_no) tui_first_reg_element_no_inline (int line_no)
{ {
@ -162,7 +162,8 @@ tui_show_registers (struct reggroup *group)
if (group == 0) if (group == 0)
group = general_reggroup; group = general_reggroup;
/* Say that registers should be displayed, even if there is a problem. */ /* Say that registers should be displayed, even if there is a
problem. */
display_info->display_regs = TRUE; display_info->display_regs = TRUE;
if (target_has_registers && target_has_stack && target_has_memory) if (target_has_registers && target_has_stack && target_has_memory)
@ -180,7 +181,7 @@ tui_show_registers (struct reggroup *group)
{ {
int i; int i;
/* Clear all notation of changed values */ /* Clear all notation of changed values. */
for (i = 0; i < display_info->regs_content_count; i++) for (i = 0; i < display_info->regs_content_count; i++)
{ {
struct tui_gen_win_info *data_item_win; struct tui_gen_win_info *data_item_win;
@ -198,8 +199,8 @@ tui_show_registers (struct reggroup *group)
/* Set the data window to display the registers of the register group /* Set the data window to display the registers of the register group
using the given frame. Values are refreshed only when refresh_values_only using the given frame. Values are refreshed only when
is TRUE. */ refresh_values_only is TRUE. */
static enum tui_status static enum tui_status
tui_show_register_group (struct gdbarch *gdbarch, struct reggroup *group, tui_show_register_group (struct gdbarch *gdbarch, struct reggroup *group,
@ -257,7 +258,7 @@ tui_show_register_group (struct gdbarch *gdbarch, struct reggroup *group,
display_info->regs_content_count = nr_regs; display_info->regs_content_count = nr_regs;
} }
/* Now set the register names and values */ /* Now set the register names and values. */
pos = 0; pos = 0;
for (regnum = 0; for (regnum = 0;
regnum < gdbarch_num_regs (current_gdbarch) regnum < gdbarch_num_regs (current_gdbarch)
@ -354,7 +355,8 @@ tui_display_registers_from (int start_element_no)
(TUI_DATA_WIN->generic.width - 2) / display_info->regs_column_count; (TUI_DATA_WIN->generic.width - 2) / display_info->regs_column_count;
/* /*
** Now create each data "sub" window, and write the display into it. ** Now create each data "sub" window, and write the display
** into it.
*/ */
cur_y = 1; cur_y = 1;
while (i < display_info->regs_content_count && while (i < display_info->regs_content_count &&
@ -367,7 +369,7 @@ tui_display_registers_from (int start_element_no)
struct tui_gen_win_info *data_item_win; struct tui_gen_win_info *data_item_win;
struct tui_data_element *data_element_ptr; struct tui_data_element *data_element_ptr;
/* create the window if necessary */ /* Create the window if necessary. */
data_item_win = &display_info->regs_content[i] data_item_win = &display_info->regs_content[i]
->which_element.data_window; ->which_element.data_window;
data_element_ptr = &((struct tui_win_element *) data_element_ptr = &((struct tui_win_element *)
@ -396,9 +398,9 @@ tui_display_registers_from (int start_element_no)
/* Get the printable representation of the register /* Get the printable representation of the register
and display it. */ and display it. */
tui_display_register (data_element_ptr, data_item_win); tui_display_register (data_element_ptr, data_item_win);
i++; /* next register */ i++; /* Next register. */
} }
cur_y++; /* next row; */ cur_y++; /* Next row. */
} }
} }
} }
@ -426,8 +428,9 @@ tui_display_reg_element_at_line (int start_element_no, int start_line_no)
first_line_on_last_page = 0; first_line_on_last_page = 0;
/* /*
** If there is no other data displayed except registers, ** If there is no other data displayed except registers,
** and the element_no causes us to scroll past the end of the ** and the element_no causes us to scroll past the end of
** registers, adjust what element to really start the display at. ** the registers, adjust what element to really start the
** display at.
*/ */
if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 && if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 &&
start_line_no > first_line_on_last_page) start_line_no > first_line_on_last_page)
@ -452,10 +455,10 @@ tui_display_registers_from_line (int line_no, int force_display)
if (line_no < 0) if (line_no < 0)
line = 0; line = 0;
else if (force_display) else if (force_display)
{ /* { /*
** If we must display regs (force_display is true), then make ** If we must display regs (force_display is true), then make
** sure that we don't display off the end of the registers. ** sure that we don't display off the end of the registers.
*/ */
if (line_no >= tui_last_regs_line_no ()) if (line_no >= tui_last_regs_line_no ())
{ {
if ((line = tui_line_from_reg_element_no ( if ((line = tui_line_from_reg_element_no (
@ -477,7 +480,7 @@ tui_display_registers_from_line (int line_no, int force_display)
return line; return line;
} }
return (-1); /* nothing was displayed */ return (-1); /* Nothing was displayed. */
} }
@ -522,8 +525,8 @@ tui_check_register_values (struct frame_info *frame)
} }
} }
/* Display a register in a window. If hilite is TRUE, /* Display a register in a window. If hilite is TRUE, then the value
then the value will be displayed in reverse video */ will be displayed in reverse video. */
static void static void
tui_display_register (struct tui_data_element *data, tui_display_register (struct tui_data_element *data,
struct tui_gen_win_info *win_info) struct tui_gen_win_info *win_info)
@ -702,9 +705,9 @@ tui_register_format (struct gdbarch *gdbarch, struct frame_info *frame,
do_cleanups (cleanups); do_cleanups (cleanups);
} }
/* Get the register value from the given frame and format it for /* Get the register value from the given frame and format it for the
the display. When changep is set, check if the new register value display. When changep is set, check if the new register value has
has changed with respect to the previous call. */ changed with respect to the previous call. */
static enum tui_status static enum tui_status
tui_get_register (struct gdbarch *gdbarch, struct frame_info *frame, tui_get_register (struct gdbarch *gdbarch, struct frame_info *frame,
struct tui_data_element *data, int regnum, int *changedp) struct tui_data_element *data, int regnum, int *changedp)

View File

@ -25,7 +25,7 @@
#ifndef TUI_REGS_H #ifndef TUI_REGS_H
#define TUI_REGS_H #define TUI_REGS_H
#include "tui/tui-data.h" /* For struct tui_register_display_type. */ #include "tui/tui-data.h" /* For struct tui_register_display_type. */
extern void tui_check_register_values (struct frame_info *); extern void tui_check_register_values (struct frame_info *);
extern void tui_show_registers (struct reggroup *group); extern void tui_show_registers (struct reggroup *group);

View File

@ -54,8 +54,8 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
if ((ret = tui_alloc_source_buffer (TUI_SRC_WIN)) == TUI_SUCCESS) if ((ret = tui_alloc_source_buffer (TUI_SRC_WIN)) == TUI_SUCCESS)
{ {
line_width = TUI_SRC_WIN->generic.width - 1; line_width = TUI_SRC_WIN->generic.width - 1;
/* Take hilite (window border) into account, when calculating /* Take hilite (window border) into account, when
the number of lines */ calculating the number of lines. */
nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no; nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no;
desc = open_source_file (s); desc = open_source_file (s);
if (desc < 0) if (desc < 0)
@ -99,8 +99,8 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
xfree (src->filename); xfree (src->filename);
src->filename = xstrdup (s->filename); src->filename = xstrdup (s->filename);
/* Determine the threshold for the length of the line /* Determine the threshold for the length of the
and the offset to start the display. */ line and the offset to start the display. */
offset = src->horizontal_offset; offset = src->horizontal_offset;
threshold = (line_width - 1) + offset; threshold = (line_width - 1) + offset;
stream = fdopen (desc, FOPEN_RT); stream = fdopen (desc, FOPEN_RT);
@ -116,14 +116,14 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
struct tui_win_element *element = (struct tui_win_element *) struct tui_win_element *element = (struct tui_win_element *)
TUI_SRC_WIN->generic.content[cur_line]; TUI_SRC_WIN->generic.content[cur_line];
/* get the first character in the line */ /* Get the first character in the line. */
c = fgetc (stream); c = fgetc (stream);
if (offset == 0) if (offset == 0)
src_line = ((struct tui_win_element *) src_line = ((struct tui_win_element *)
TUI_SRC_WIN->generic.content[ TUI_SRC_WIN->generic.content[
cur_line])->which_element.source.line; cur_line])->which_element.source.line;
/* Init the line with the line number */ /* Init the line with the line number. */
sprintf (src_line, "%-6d", cur_line_no); sprintf (src_line, "%-6d", cur_line_no);
cur_len = strlen (src_line); cur_len = strlen (src_line);
i = cur_len - i = cur_len -
@ -136,8 +136,8 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
} }
src_line[cur_len] = (char) 0; src_line[cur_len] = (char) 0;
/* Set whether element is the execution point and /* Set whether element is the execution point
whether there is a break point on it. */ and whether there is a break point on it. */
element->which_element.source.line_or_addr.loa = element->which_element.source.line_or_addr.loa =
LOA_LINE; LOA_LINE;
element->which_element.source.line_or_addr.u.line_no = element->which_element.source.line_or_addr.u.line_no =
@ -167,11 +167,11 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
src_line[i] = '?'; src_line[i] = '?';
} }
else else
{ /* Store the charcter in the line { /* Store the charcter in the
buffer. If it is a tab, then line buffer. If it is a tab,
translate to the correct number of then translate to the correct
chars so we don't overwrite our number of chars so we don't
buffer. */ overwrite our buffer. */
if (c == '\t') if (c == '\t')
{ {
int j, max_tab_len = tui_default_tab_len (); int j, max_tab_len = tui_default_tab_len ();
@ -190,8 +190,8 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
src_line[i + 1] = 0; src_line[i + 1] = 0;
} }
else else
{ /* If we have not reached EOL, then eat { /* If we have not reached EOL, then
chars until we do */ eat chars until we do. */
while (c != EOF && c != '\n' && c != '\r') while (c != EOF && c != '\n' && c != '\r')
c = fgetc (stream); c = fgetc (stream);
/* Handle non-'\n' end-of-line. */ /* Handle non-'\n' end-of-line. */
@ -207,7 +207,8 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
while (c != EOF && c != '\n' && c != '\r' && while (c != EOF && c != '\n' && c != '\r' &&
i < threshold && (c = fgetc (stream))); i < threshold && (c = fgetc (stream)));
} }
/* Now copy the line taking the offset into account */ /* Now copy the line taking the offset into
account. */
if (strlen (src_line) > offset) if (strlen (src_line) > offset)
strcpy (((struct tui_win_element *) TUI_SRC_WIN->generic.content[ strcpy (((struct tui_win_element *) TUI_SRC_WIN->generic.content[
cur_line])->which_element.source.line, cur_line])->which_element.source.line,
@ -232,9 +233,9 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
} }
/* elz: this function sets the contents of the source window to empty /* elz: This function sets the contents of the source window to empty
except for a line in the middle with a warning message about the except for a line in the middle with a warning message about the
source not being available. This function is called by source not being available. This function is called by
tui_erase_source_contents(), which in turn is invoked when the tui_erase_source_contents(), which in turn is invoked when the
source files cannot be accessed. */ source files cannot be accessed. */
@ -248,13 +249,13 @@ tui_set_source_content_nil (struct tui_win_info *win_info, char *warning_string)
line_width = win_info->generic.width - 1; line_width = win_info->generic.width - 1;
n_lines = win_info->generic.height - 2; n_lines = win_info->generic.height - 2;
/* set to empty each line in the window, except for the one /* Set to empty each line in the window, except for the one which
which contains the message */ contains the message. */
while (curr_line < win_info->generic.content_size) while (curr_line < win_info->generic.content_size)
{ {
/* set the information related to each displayed line /* Set the information related to each displayed line to null:
to null: i.e. the line number is 0, there is no bp, i.e. the line number is 0, there is no bp, it is not where
it is not where the program is stopped */ the program is stopped. */
struct tui_win_element *element = struct tui_win_element *element =
(struct tui_win_element *) win_info->generic.content[curr_line]; (struct tui_win_element *) win_info->generic.content[curr_line];
@ -263,14 +264,15 @@ tui_set_source_content_nil (struct tui_win_info *win_info, char *warning_string)
element->which_element.source.is_exec_point = FALSE; element->which_element.source.is_exec_point = FALSE;
element->which_element.source.has_break = FALSE; element->which_element.source.has_break = FALSE;
/* set the contents of the line to blank */ /* Set the contents of the line to blank. */
element->which_element.source.line[0] = (char) 0; element->which_element.source.line[0] = (char) 0;
/* if the current line is in the middle of the screen, then we /* If the current line is in the middle of the screen, then we
want to display the 'no source available' message in it. want to display the 'no source available' message in it.
Note: the 'weird' arithmetic with the line width and height Note: the 'weird' arithmetic with the line width and height
comes from the function tui_erase_source_content(). We need comes from the function tui_erase_source_content(). We need
to keep the screen and the window's actual contents in synch. */ to keep the screen and the window's actual contents in
synch. */
if (curr_line == (n_lines / 2 + 1)) if (curr_line == (n_lines / 2 + 1))
{ {
@ -348,8 +350,8 @@ tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no
+ num_to_scroll; + num_to_scroll;
if (l.u.line_no > s->nlines) if (l.u.line_no > s->nlines)
/*line = s->nlines - win_info->generic.content_size + 1; */ /* line = s->nlines - win_info->generic.content_size + 1; */
/*elz: fix for dts 23398 */ /* elz: fix for dts 23398. */
l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no; l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no;
} }
else else

View File

@ -56,9 +56,9 @@ static void tui_set_locator_info (const char *filename, const char *procname,
static void tui_update_command (char *, int); static void tui_update_command (char *, int);
/* Create the status line to display as much information as we /* Create the status line to display as much information as we can on
can on this single line: target name, process number, current this single line: target name, process number, current function,
function, current line, current PC, SingleKey mode. */ current line, current PC, SingleKey mode. */
static char* static char*
tui_make_status_line (struct tui_locator_element *loc) tui_make_status_line (struct tui_locator_element *loc)
{ {
@ -145,13 +145,13 @@ tui_make_status_line (struct tui_locator_element *loc)
} }
} }
/* Now convert elements to string form */ /* Now convert elements to string form. */
pname = loc->proc_name; pname = loc->proc_name;
/* Now create the locator line from the string version /* Now create the locator line from the string version of the
of the elements. We could use sprintf() here but elements. We could use sprintf() here but that wouldn't ensure
that wouldn't ensure that we don't overrun the size that we don't overrun the size of the allocated buffer.
of the allocated buffer. strcat_to_buf() will. */ strcat_to_buf() will. */
*string = (char) 0; *string = (char) 0;
if (target_width > 0) if (target_width > 0)
@ -174,7 +174,7 @@ tui_make_status_line (struct tui_locator_element *loc)
strcat_to_buf (string, status_size, " "); strcat_to_buf (string, status_size, " ");
} }
/* procedure/class name */ /* Procedure/class name. */
if (proc_width > 0) if (proc_width > 0)
{ {
if (strlen (pname) > proc_width) if (strlen (pname) > proc_width)
@ -207,9 +207,9 @@ tui_make_status_line (struct tui_locator_element *loc)
return string; return string;
} }
/* Get a printable name for the function at the address. /* Get a printable name for the function at the address. The symbol
The symbol name is demangled if demangling is turned on. name is demangled if demangling is turned on. Returns a pointer to
Returns a pointer to a static area holding the result. */ a static area holding the result. */
static char* static char*
tui_get_function_from_frame (struct frame_info *fi) tui_get_function_from_frame (struct frame_info *fi)
{ {
@ -220,9 +220,9 @@ tui_get_function_from_frame (struct frame_info *fi)
print_address_symbolic (get_frame_pc (fi), stream, demangle, ""); print_address_symbolic (get_frame_pc (fi), stream, demangle, "");
p = tui_file_get_strbuf (stream); p = tui_file_get_strbuf (stream);
/* Use simple heuristics to isolate the function name. The symbol can /* Use simple heuristics to isolate the function name. The symbol
be demangled and we can have function parameters. Remove them because can be demangled and we can have function parameters. Remove
the status line is too short to display them. */ them because the status line is too short to display them. */
if (*p == '<') if (*p == '<')
p++; p++;
strncpy (name, p, sizeof (name)); strncpy (name, p, sizeof (name));

View File

@ -227,8 +227,8 @@ show_tui_border_kind (struct ui_file *file, int from_tty,
} }
/* Tui internal configuration variables. These variables are /* Tui internal configuration variables. These variables are updated
updated by tui_update_variables to reflect the tui configuration by tui_update_variables to reflect the tui configuration
variables. */ variables. */
chtype tui_border_vline; chtype tui_border_vline;
chtype tui_border_hline; chtype tui_border_hline;
@ -349,11 +349,11 @@ _initialize_tui_win (void)
add_prefix_cmd ("tui", class_tui, set_tui_cmd, add_prefix_cmd ("tui", class_tui, set_tui_cmd,
_("TUI configuration variables"), _("TUI configuration variables"),
&tui_setlist, "set tui ", &tui_setlist, "set tui ",
0/*allow-unknown*/, &setlist); 0 /* allow-unknown */, &setlist);
add_prefix_cmd ("tui", class_tui, show_tui_cmd, add_prefix_cmd ("tui", class_tui, show_tui_cmd,
_("TUI configuration variables"), _("TUI configuration variables"),
&tui_showlist, "show tui ", &tui_showlist, "show tui ",
0/*allow-unknown*/, &showlist); 0 /* allow-unknown */, &showlist);
add_com ("refresh", class_tui, tui_refresh_all_command, add_com ("refresh", class_tui, tui_refresh_all_command,
_("Refresh the terminal display.\n")); _("Refresh the terminal display.\n"));
@ -461,7 +461,7 @@ tui_update_gdb_sizes (void)
} }
/* Set the logical focus to win_info. */ /* Set the logical focus to win_info. */
void void
tui_set_win_focus_to (struct tui_win_info *win_info) tui_set_win_focus_to (struct tui_win_info *win_info)
{ {
@ -570,7 +570,7 @@ tui_scroll_right (struct tui_win_info *win_to_scroll, int num_to_scroll)
} }
/* Scroll a window. Arguments are passed through a va_list. */ /* Scroll a window. Arguments are passed through a va_list. */
void void
tui_scroll (enum tui_scroll_direction direction, tui_scroll (enum tui_scroll_direction direction,
struct tui_win_info *win_to_scroll, struct tui_win_info *win_to_scroll,
@ -652,7 +652,7 @@ tui_resize_all (void)
#ifdef HAVE_RESIZE_TERM #ifdef HAVE_RESIZE_TERM
resize_term (screenheight, screenwidth); resize_term (screenheight, screenwidth);
#endif #endif
/* turn keypad off while we resize */ /* Turn keypad off while we resize. */
if (win_with_focus != TUI_CMD_WIN) if (win_with_focus != TUI_CMD_WIN)
keypad (TUI_CMD_WIN->generic.handle, FALSE); keypad (TUI_CMD_WIN->generic.handle, FALSE);
tui_update_gdb_sizes (); tui_update_gdb_sizes ();
@ -670,7 +670,7 @@ tui_resize_all (void)
else else
cmd_split_diff++; cmd_split_diff++;
} }
/* now adjust each window */ /* Now adjust each window. */
clear (); clear ();
refresh (); refresh ();
switch (cur_layout) switch (cur_layout)
@ -680,7 +680,7 @@ tui_resize_all (void)
first_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; first_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
first_win->generic.width += width_diff; first_win->generic.width += width_diff;
locator->width += width_diff; locator->width += width_diff;
/* check for invalid heights */ /* Check for invalid heights. */
if (height_diff == 0) if (height_diff == 0)
new_height = first_win->generic.height; new_height = first_win->generic.height;
else if ((first_win->generic.height + split_diff) >= else if ((first_win->generic.height + split_diff) >=
@ -716,8 +716,8 @@ tui_resize_all (void)
second_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; second_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
second_win->generic.width += width_diff; second_win->generic.width += width_diff;
} }
/* Change the first window's height/width */ /* Change the first window's height/width. */
/* check for invalid heights */ /* Check for invalid heights. */
if (height_diff == 0) if (height_diff == 0)
new_height = first_win->generic.height; new_height = first_win->generic.height;
else if ((first_win->generic.height + else if ((first_win->generic.height +
@ -732,8 +732,8 @@ tui_resize_all (void)
locator->width += width_diff; locator->width += width_diff;
/* Change the second window's height/width */ /* Change the second window's height/width. */
/* check for invalid heights */ /* Check for invalid heights. */
if (height_diff == 0) if (height_diff == 0)
new_height = second_win->generic.height; new_height = second_win->generic.height;
else if ((first_win->generic.height + else if ((first_win->generic.height +
@ -753,7 +753,7 @@ tui_resize_all (void)
second_win->generic.origin.y = first_win->generic.height - 1; second_win->generic.origin.y = first_win->generic.height - 1;
make_invisible_and_set_new_height (second_win, new_height); make_invisible_and_set_new_height (second_win, new_height);
/* Change the command window's height/width */ /* Change the command window's height/width. */
TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1; TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
make_invisible_and_set_new_height ( make_invisible_and_set_new_height (
TUI_CMD_WIN, TUI_CMD_WIN->generic.height + cmd_split_diff); TUI_CMD_WIN, TUI_CMD_WIN->generic.height + cmd_split_diff);
@ -767,8 +767,8 @@ tui_resize_all (void)
break; break;
} }
/* /*
** Now remove all invisible windows, and their content so that they get ** Now remove all invisible windows, and their content so that
** created again when called for with the new size ** they get created again when called for with the new size.
*/ */
for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++) for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
{ {
@ -780,7 +780,8 @@ tui_resize_all (void)
} }
} }
tui_set_win_resized_to (TRUE); tui_set_win_resized_to (TRUE);
/* turn keypad back on, unless focus is in the command window */ /* Turn keypad back on, unless focus is in the command
window. */
if (win_with_focus != TUI_CMD_WIN) if (win_with_focus != TUI_CMD_WIN)
keypad (TUI_CMD_WIN->generic.handle, TRUE); keypad (TUI_CMD_WIN->generic.handle, TRUE);
} }
@ -944,7 +945,7 @@ tui_refresh_all_command (char *arg, int from_tty)
} }
/* Set the height of the specified window. */ /* Set the height of the specified window. */
static void static void
tui_set_tab_width_command (char *arg, int from_tty) tui_set_tab_width_command (char *arg, int from_tty)
{ {
@ -963,7 +964,7 @@ tui_set_tab_width_command (char *arg, int from_tty)
} }
/* Set the height of the specified window. */ /* Set the height of the specified window. */
static void static void
tui_set_win_height (char *arg, int from_tty) tui_set_win_height (char *arg, int from_tty)
{ {
@ -984,7 +985,7 @@ tui_set_win_height (char *arg, int from_tty)
*buf_ptr = (char) 0; *buf_ptr = (char) 0;
/* /*
** Validate the window name ** Validate the window name.
*/ */
for (i = 0; i < strlen (wname); i++) for (i = 0; i < strlen (wname); i++)
wname[i] = toupper (wname[i]); wname[i] = toupper (wname[i]);
@ -995,7 +996,7 @@ tui_set_win_height (char *arg, int from_tty)
The window name specified must be valid and visible.\n")); The window name specified must be valid and visible.\n"));
else else
{ {
/* Process the size */ /* Process the size. */
while (*(++buf_ptr) == ' ') while (*(++buf_ptr) == ' ')
; ;
@ -1023,7 +1024,7 @@ The window name specified must be valid and visible.\n"));
new_height = win_info->generic.height + input_no; new_height = win_info->generic.height + input_no;
/* /*
** Now change the window's height, and adjust all ** Now change the window's height, and adjust all
** other windows around it ** other windows around it.
*/ */
if (tui_adjust_win_heights (win_info, if (tui_adjust_win_heights (win_info,
new_height) == TUI_FAILURE) new_height) == TUI_FAILURE)
@ -1048,7 +1049,7 @@ The window name specified must be valid and visible.\n"));
printf_filtered (WIN_HEIGHT_USAGE); printf_filtered (WIN_HEIGHT_USAGE);
} }
/* Set the height of the specified window, with va_list. */ /* Set the height of the specified window, with va_list. */
static void static void
tui_set_win_height_command (char *arg, int from_tty) tui_set_win_height_command (char *arg, int from_tty)
{ {
@ -1059,7 +1060,8 @@ tui_set_win_height_command (char *arg, int from_tty)
/* XDB Compatibility command for setting the window height. This will /* XDB Compatibility command for setting the window height. This will
increase or decrease the command window by the specified amount. */ increase or decrease the command window by the specified
amount. */
static void static void
tui_xdb_set_win_height (char *arg, int from_tty) tui_xdb_set_win_height (char *arg, int from_tty)
{ {
@ -1070,7 +1072,7 @@ tui_xdb_set_win_height (char *arg, int from_tty)
int input_no = atoi (arg); int input_no = atoi (arg);
if (input_no > 0) if (input_no > 0)
{ /* Add 1 for the locator */ { /* Add 1 for the locator. */
int new_height = tui_term_height () - (input_no + 1); int new_height = tui_term_height () - (input_no + 1);
if (!new_height_ok (tui_win_list[CMD_WIN], new_height) || if (!new_height_ok (tui_win_list[CMD_WIN], new_height) ||
@ -1151,11 +1153,11 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, int new_height)
second_win = (tui_source_windows ())->list[0]; second_win = (tui_source_windows ())->list[0];
} }
if (primary_win_info == TUI_CMD_WIN) if (primary_win_info == TUI_CMD_WIN)
{ /* { /*
** Split the change in height accross the 1st & 2nd windows ** Split the change in height accross the 1st & 2nd
** adjusting them as well. ** windows, adjusting them as well.
*/ */
int first_split_diff = diff / 2; /* subtract the locator */ int first_split_diff = diff / 2; /* Subtract the locator. */
int second_split_diff = first_split_diff; int second_split_diff = first_split_diff;
if (diff % 2) if (diff % 2)
@ -1174,7 +1176,8 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, int new_height)
second_split_diff++; second_split_diff++;
} }
} }
/* make sure that the minimum hieghts are honored */ /* Make sure that the minimum hieghts are
honored. */
while ((first_win->generic.height + first_split_diff) < 3) while ((first_win->generic.height + first_split_diff) < 3)
{ {
first_split_diff++; first_split_diff++;
@ -1197,10 +1200,10 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, int new_height)
else else
{ {
if ((TUI_CMD_WIN->generic.height + diff) < 1) if ((TUI_CMD_WIN->generic.height + diff) < 1)
{ /* { /*
** If there is no way to increase the command window ** If there is no way to increase the command window
** take real estate from the 1st or 2nd window. ** take real estate from the 1st or 2nd window.
*/ */
if ((TUI_CMD_WIN->generic.height + diff) < 1) if ((TUI_CMD_WIN->generic.height + diff) < 1)
{ {
int i; int i;
@ -1247,7 +1250,8 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, int new_height)
/* Function make the target window (and auxillary windows associated /* Function make the target window (and auxillary windows associated
with the targer) invisible, and set the new height and location. */ with the targer) invisible, and set the new height and
location. */
static void static void
make_invisible_and_set_new_height (struct tui_win_info *win_info, int height) make_invisible_and_set_new_height (struct tui_win_info *win_info, int height)
{ {
@ -1263,7 +1267,7 @@ make_invisible_and_set_new_height (struct tui_win_info *win_info, int height)
if (win_info != TUI_CMD_WIN) if (win_info != TUI_CMD_WIN)
win_info->generic.viewport_height--; win_info->generic.viewport_height--;
/* Now deal with the auxillary windows associated with win_info */ /* Now deal with the auxillary windows associated with win_info. */
switch (win_info->generic.type) switch (win_info->generic.type)
{ {
case SRC_WIN: case SRC_WIN:
@ -1287,7 +1291,7 @@ make_invisible_and_set_new_height (struct tui_win_info *win_info, int height)
} }
break; break;
case DATA_WIN: case DATA_WIN:
/* delete all data item windows */ /* Delete all data item windows. */
for (i = 0; i < win_info->generic.content_size; i++) for (i = 0; i < win_info->generic.content_size; i++)
{ {
gen_win_info = (struct tui_gen_win_info *) & ((struct tui_win_element *) gen_win_info = (struct tui_gen_win_info *) & ((struct tui_win_element *)
@ -1389,7 +1393,7 @@ new_height_ok (struct tui_win_info *primary_win_info, int new_height)
new_height <= (tui_term_height () - 2) && new_height <= (tui_term_height () - 2) &&
new_height >= MIN_WIN_HEIGHT)); new_height >= MIN_WIN_HEIGHT));
if (ok) if (ok)
{ /* check the total height */ { /* Check the total height. */
struct tui_win_info *win_info; struct tui_win_info *win_info;
if (primary_win_info == TUI_CMD_WIN) if (primary_win_info == TUI_CMD_WIN)
@ -1424,10 +1428,10 @@ new_height_ok (struct tui_win_info *primary_win_info, int new_height)
*/ */
total_height = cur_total_height = total_height = cur_total_height =
(first_win->generic.height + second_win->generic.height - 1) (first_win->generic.height + second_win->generic.height - 1)
+ TUI_CMD_WIN->generic.height + 1 /*locator */ ; + TUI_CMD_WIN->generic.height + 1; /* Locator. */
if (primary_win_info == TUI_CMD_WIN) if (primary_win_info == TUI_CMD_WIN)
{ {
/* locator included since first & second win share a line */ /* Locator included since first & second win share a line. */
ok = ((first_win->generic.height + ok = ((first_win->generic.height +
second_win->generic.height + diff) >= second_win->generic.height + diff) >=
(MIN_WIN_HEIGHT * 2) && (MIN_WIN_HEIGHT * 2) &&
@ -1445,14 +1449,14 @@ new_height_ok (struct tui_win_info *primary_win_info, int new_height)
/* /*
** First see if we can increase/decrease the command ** First see if we can increase/decrease the command
** window. And make sure that the command window is ** window. And make sure that the command window is
** at least 1 line ** at least 1 line.
*/ */
ok = ((TUI_CMD_WIN->generic.height + diff) > 0); ok = ((TUI_CMD_WIN->generic.height + diff) > 0);
if (!ok) if (!ok)
{ /* { /*
** Looks like we have to increase/decrease one of ** Looks like we have to increase/decrease one of
** the other windows ** the other windows.
*/ */
if (primary_win_info == first_win) if (primary_win_info == first_win)
ok = (second_win->generic.height + diff) >= min_height; ok = (second_win->generic.height + diff) >= min_height;
else else
@ -1493,13 +1497,13 @@ parse_scrolling_args (char *arg, struct tui_win_info **win_to_scroll,
/* /*
** First set up the default window to scroll, in case there is no ** First set up the default window to scroll, in case there is no
** window name arg ** window name arg.
*/ */
if (arg != (char *) NULL) if (arg != (char *) NULL)
{ {
char *buf, *buf_ptr; char *buf, *buf_ptr;
/* process the number of lines to scroll */ /* Process the number of lines to scroll. */
buf = buf_ptr = xstrdup (arg); buf = buf_ptr = xstrdup (arg);
if (isdigit (*buf_ptr)) if (isdigit (*buf_ptr))
{ {
@ -1518,7 +1522,7 @@ parse_scrolling_args (char *arg, struct tui_win_info **win_to_scroll,
*num_to_scroll = atoi (num_str); *num_to_scroll = atoi (num_str);
} }
/* process the window name if one is specified */ /* Process the window name if one is specified. */
if (buf_ptr != (char *) NULL) if (buf_ptr != (char *) NULL)
{ {
char *wname; char *wname;
@ -1533,7 +1537,7 @@ parse_scrolling_args (char *arg, struct tui_win_info **win_to_scroll,
else else
wname = "?"; wname = "?";
/* Validate the window name */ /* Validate the window name. */
for (i = 0; i < strlen (wname); i++) for (i = 0; i < strlen (wname); i++)
wname[i] = toupper (wname[i]); wname[i] = toupper (wname[i]);
*win_to_scroll = tui_partial_win_by_name (wname); *win_to_scroll = tui_partial_win_by_name (wname);

View File

@ -74,12 +74,12 @@ tui_first_data_element_no_in_line (int line_no)
/* /*
** First see if there is a register on line_no, and if so, set the ** First see if there is a register on line_no, and if so, set the
** first element number ** first element number.
*/ */
if ((first_element_no = tui_first_reg_element_no_inline (line_no)) == -1) if ((first_element_no = tui_first_reg_element_no_inline (line_no)) == -1)
{ /* { /*
** Looking at the general data, the 1st element on line_no ** Looking at the general data, the 1st element on line_no.
*/ */
} }
return first_element_no; return first_element_no;
@ -142,7 +142,7 @@ tui_display_all_data (void)
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
tui_display_registers_from (0); tui_display_registers_from (0);
/* /*
** Then display the other data ** Then display the other data.
*/ */
if (TUI_DATA_WIN->detail.data_display_info.data_content != if (TUI_DATA_WIN->detail.data_display_info.data_content !=
(tui_win_content) NULL && (tui_win_content) NULL &&
@ -165,7 +165,8 @@ tui_display_data_from_line (int line_no)
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
/* there is no general data, force regs to display (if there are any) */ /* There is no general data, force regs to display (if there are
any). */
if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0) if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0)
tui_display_registers_from_line (_line_no, TRUE); tui_display_registers_from_line (_line_no, TRUE);
else else
@ -174,30 +175,30 @@ tui_display_data_from_line (int line_no)
int regs_last_line = tui_last_regs_line_no (); int regs_last_line = tui_last_regs_line_no ();
/* display regs if we can */ /* Display regs if we can. */
if (tui_display_registers_from_line (_line_no, FALSE) < 0) if (tui_display_registers_from_line (_line_no, FALSE) < 0)
{ /* { /*
** _line_no is past the regs display, so calc where the ** _line_no is past the regs display, so calc where the
** start data element is ** start data element is.
*/ */
if (regs_last_line < _line_no) if (regs_last_line < _line_no)
{ /* figure out how many lines each element is to obtain { /* Figure out how many lines each element is to obtain
the start element_no */ the start element_no. */
} }
} }
else else
{ /* { /*
** calculate the starting element of the data display, given ** Calculate the starting element of the data display,
** regs_last_line and how many lines each element is, up to ** given regs_last_line and how many lines each element
** _line_no ** is, up to _line_no.
*/ */
} }
/* Now display the data , starting at element_no */ /* Now display the data , starting at element_no. */
} }
} }
/* Display data starting at element element_no. */ /* Display data starting at element element_no. */
void void
tui_display_data_from (int element_no, int reuse_windows) tui_display_data_from (int element_no, int reuse_windows)
{ {
@ -206,7 +207,7 @@ tui_display_data_from (int element_no, int reuse_windows)
if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count) if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
first_line = tui_line_from_reg_element_no (element_no); first_line = tui_line_from_reg_element_no (element_no);
else else
{ /* calculate the first_line from the element number */ { /* Calculate the first_line from the element number. */
} }
if (first_line >= 0) if (first_line >= 0)
@ -228,19 +229,20 @@ tui_refresh_data_win (void)
{ {
int first_element = tui_first_data_item_displayed (); int first_element = tui_first_data_item_displayed ();
if (first_element >= 0) /* re-use existing windows */ if (first_element >= 0) /* Re-use existing windows. */
tui_display_data_from (first_element, TRUE); tui_display_data_from (first_element, TRUE);
} }
} }
/* Function to check the data values and hilite any that have changed. */ /* Function to check the data values and hilite any that have
changed. */
void void
tui_check_data_values (struct frame_info *frame) tui_check_data_values (struct frame_info *frame)
{ {
tui_check_register_values (frame); tui_check_register_values (frame);
/* Now check any other data values that there are */ /* Now check any other data values that there are. */
if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible) if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
{ {
int i; int i;
@ -268,7 +270,7 @@ tui_check_data_values (struct frame_info *frame)
} }
/* Scroll the data window vertically forward or backward. */ /* Scroll the data window vertically forward or backward. */
void void
tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction, int num_to_scroll) tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction, int num_to_scroll)
{ {
@ -279,9 +281,8 @@ tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction, int num_to
if (first_element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count) if (first_element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
first_line = tui_line_from_reg_element_no (first_element_no); first_line = tui_line_from_reg_element_no (first_element_no);
else else
{ /* calculate the first line from the element number which is in { /* Calculate the first line from the element number which is in
** the general data content the general data content. */
*/
} }
if (first_line >= 0) if (first_line >= 0)

View File

@ -34,7 +34,7 @@
** PUBLIC FUNCTIONS ** PUBLIC FUNCTIONS
***********************/ ***********************/
/* Refresh the window. */ /* Refresh the window. */
void void
tui_refresh_win (struct tui_gen_win_info *win_info) tui_refresh_win (struct tui_gen_win_info *win_info)
{ {
@ -55,7 +55,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
} }
else if (win_info->type == CMD_WIN) else if (win_info->type == CMD_WIN)
{ {
/* Do nothing */ /* Do nothing. */
} }
else else
{ {
@ -67,7 +67,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
} }
/* Function to delete the curses window, checking for NULL. */ /* Function to delete the curses window, checking for NULL. */
void void
tui_delete_win (WINDOW *window) tui_delete_win (WINDOW *window)
{ {
@ -175,7 +175,7 @@ tui_make_window (struct tui_gen_win_info *win_info, int box_it)
static void static void
make_visible (struct tui_gen_win_info *win_info, int visible) make_visible (struct tui_gen_win_info *win_info, int visible)
{ {
/* Don't tear down/recreate command window */ /* Don't tear down/recreate command window. */
if (win_info->type == CMD_WIN) if (win_info->type == CMD_WIN)
return; return;
@ -213,7 +213,8 @@ tui_make_invisible (struct tui_gen_win_info *win_info)
} }
/* Makes all windows invisible (except the command and locator windows). */ /* Makes all windows invisible (except the command and locator
windows). */
static void static void
make_all_visible (int visible) make_all_visible (int visible)
{ {

View File

@ -114,7 +114,7 @@ tui_update_source_window_as_is (struct tui_win_info *win_info, struct symtab *s,
set_current_source_symtab_and_line (&sal); set_current_source_symtab_and_line (&sal);
/* /*
** If the focus was in the asm win, put it in the src ** If the focus was in the asm win, put it in the src
** win if we don't have a split layout ** win if we don't have a split layout.
*/ */
if (tui_win_with_focus () == TUI_DISASM_WIN && if (tui_win_with_focus () == TUI_DISASM_WIN &&
tui_current_layout () != SRC_DISASSEM_COMMAND) tui_current_layout () != SRC_DISASSEM_COMMAND)
@ -245,10 +245,10 @@ tui_erase_source_content (struct tui_win_info *win_info, int display_prompt)
x_pos, x_pos,
no_src_str); no_src_str);
/* elz: added this function call to set the real contents of /* elz: Added this function call to set the real contents of
the window to what is on the screen, so that later calls the window to what is on the screen, so that later calls
to refresh, do display to refresh, do display the correct stuff, and not the old
the correct stuff, and not the old image */ image. */
tui_set_source_content_nil (win_info, no_src_str); tui_set_source_content_nil (win_info, no_src_str);
} }
@ -337,7 +337,9 @@ tui_horizontal_source_scroll (struct tui_win_info *win_info,
} }
/* Set or clear the has_break flag in the line whose line is line_no. */ /* Set or clear the has_break flag in the line whose line is
line_no. */
void void
tui_set_is_exec_point_at (struct tui_line_or_address l, struct tui_win_info *win_info) tui_set_is_exec_point_at (struct tui_line_or_address l, struct tui_win_info *win_info)
{ {
@ -394,10 +396,12 @@ tui_update_all_breakpoint_info (void)
} }
/* Scan the source window and the breakpoints to update the /* Scan the source window and the breakpoints to update the has_break
has_break information for each line. information for each line.
Returns 1 if something changed and the execution window
must be refreshed. */ Returns 1 if something changed and the execution window must be
refreshed. */
int int
tui_update_breakpoint_info (struct tui_win_info *win, int current_only) tui_update_breakpoint_info (struct tui_win_info *win, int current_only)
{ {
@ -570,7 +574,7 @@ tui_alloc_source_buffer (struct tui_win_info *win_info)
char *src_line_buf; char *src_line_buf;
int i, line_width, max_lines; int i, line_width, max_lines;
max_lines = win_info->generic.height; /* less the highlight box */ max_lines = win_info->generic.height; /* Less the highlight box. */
line_width = win_info->generic.width - 1; line_width = win_info->generic.width - 1;
/* /*
* Allocate the buffer for the source lines. Do this only once * Allocate the buffer for the source lines. Do this only once
@ -587,7 +591,7 @@ tui_alloc_source_buffer (struct tui_win_info *win_info)
gdb_stderr); gdb_stderr);
return TUI_FAILURE; return TUI_FAILURE;
} }
/* allocate the content list */ /* Allocate the content list. */
if ((win_info->generic.content = if ((win_info->generic.content =
(void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL) (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL)
{ {

View File

@ -68,6 +68,6 @@ extern int tui_addr_is_displayed (CORE_ADDR, struct tui_win_info *, int);
/* Constant definitions. */ /* Constant definitions. */
#define SCROLL_THRESHOLD 2 /* threshold for lazy scroll */ #define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */
#endif #endif

View File

@ -70,7 +70,8 @@ struct tui_char_command
const char *cmd; const char *cmd;
}; };
/* Key mapping to gdb commands when the TUI is using the single key mode. */ /* Key mapping to gdb commands when the TUI is using the single key
mode. */
static const struct tui_char_command tui_commands[] = { static const struct tui_char_command tui_commands[] = {
{ 'c', "continue" }, { 'c', "continue" },
{ 'd', "down" }, { 'd', "down" },
@ -103,19 +104,22 @@ tui_rl_switch_mode (int notused1, int notused2)
tui_enable (); tui_enable ();
} }
/* Clear the readline in case switching occurred in middle of something. */ /* Clear the readline in case switching occurred in middle of
something. */
if (rl_end) if (rl_end)
rl_kill_text (0, rl_end); rl_kill_text (0, rl_end);
/* Since we left the curses mode, the terminal mode is restored to /* Since we left the curses mode, the terminal mode is restored to
some previous state. That state may not be suitable for readline some previous state. That state may not be suitable for readline
to work correctly (it may be restored in line mode). We force an 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 exit of the current readline so that readline is re-entered and
will be able to setup the terminal for its needs. By re-entering it will be able to setup the terminal for its needs. By
in readline, we also redisplay its prompt in the non-curses mode. */ re-entering in readline, we also redisplay its prompt in the
non-curses mode. */
rl_newline (1, '\n'); rl_newline (1, '\n');
/* Make sure the \n we are returning does not repeat the last command. */ /* Make sure the \n we are returning does not repeat the last
command. */
dont_repeat (); dont_repeat ();
return 0; return 0;
} }
@ -123,13 +127,13 @@ tui_rl_switch_mode (int notused1, int notused2)
/* TUI readline command. /* TUI readline command.
Change the TUI layout to show a next layout. Change the TUI layout to show a next layout.
This function is bound to CTRL-X 2. It is intended to provide This function is bound to CTRL-X 2. It is intended to provide
a functionality close to the Emacs split-window command. We always a functionality close to the Emacs split-window command. We
show two windows (src+asm), (src+regs) or (asm+regs). */ always show two windows (src+asm), (src+regs) or (asm+regs). */
static int static int
tui_rl_change_windows (int notused1, int notused2) tui_rl_change_windows (int notused1, int notused2)
{ {
if (!tui_active) if (!tui_active)
tui_rl_switch_mode (0/*notused*/, 0/*notused*/); tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
if (tui_active) if (tui_active)
{ {
@ -138,8 +142,8 @@ tui_rl_change_windows (int notused1, int notused2)
new_layout = tui_current_layout (); new_layout = tui_current_layout ();
/* Select a new layout to have a rolling layout behavior /* Select a new layout to have a rolling layout behavior with
with always two windows (except when undefined). */ always two windows (except when undefined). */
switch (new_layout) switch (new_layout)
{ {
case SRC_COMMAND: case SRC_COMMAND:
@ -177,7 +181,7 @@ static int
tui_rl_delete_other_windows (int notused1, int notused2) tui_rl_delete_other_windows (int notused1, int notused2)
{ {
if (!tui_active) if (!tui_active)
tui_rl_switch_mode (0/*notused*/, 0/*notused*/); tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
if (tui_active) if (tui_active)
{ {
@ -214,7 +218,7 @@ tui_rl_other_window (int count, int key)
struct tui_win_info *win_info; struct tui_win_info *win_info;
if (!tui_active) if (!tui_active)
tui_rl_switch_mode (0/*notused*/, 0/*notused*/); tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
win_info = tui_next_win (tui_win_with_focus ()); win_info = tui_next_win (tui_win_with_focus ());
if (win_info) if (win_info)
@ -239,8 +243,8 @@ tui_rl_command_key (int count, int key)
{ {
if (tui_commands[i].key == key) if (tui_commands[i].key == key)
{ {
/* Must save the command because it can be modified /* Must save the command because it can be modified by
by execute_command. */ execute_command. */
char *cmd = alloca (strlen (tui_commands[i].cmd) + 1); char *cmd = alloca (strlen (tui_commands[i].cmd) + 1);
strcpy (cmd, tui_commands[i].cmd); strcpy (cmd, tui_commands[i].cmd);
execute_command (cmd, TRUE); execute_command (cmd, TRUE);
@ -267,7 +271,7 @@ static int
tui_rl_next_keymap (int notused1, int notused2) tui_rl_next_keymap (int notused1, int notused2)
{ {
if (!tui_active) if (!tui_active)
tui_rl_switch_mode (0/*notused*/, 0/*notused*/); tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE
? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE); ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
@ -288,7 +292,8 @@ tui_rl_startup_hook (void)
return 0; return 0;
} }
/* Change the TUI key mode by installing the appropriate readline keymap. */ /* Change the TUI key mode by installing the appropriate readline
keymap. */
void void
tui_set_key_mode (enum tui_key_mode mode) tui_set_key_mode (enum tui_key_mode mode)
{ {
@ -375,7 +380,7 @@ tui_enable (void)
cbreak (); cbreak ();
noecho (); noecho ();
/*timeout (1);*/ /* timeout (1); */
nodelay(w, FALSE); nodelay(w, FALSE);
nl(); nl();
keypad (w, TRUE); keypad (w, TRUE);
@ -465,7 +470,7 @@ strcat_to_buf (char *buf, int buflen, const char *item_to_add)
} }
#if 0 #if 0
/* Solaris <sys/termios.h> defines CTRL. */ /* Solaris <sys/termios.h> defines CTRL. */
#ifndef CTRL #ifndef CTRL
#define CTRL(x) (x & ~0140) #define CTRL(x) (x & ~0140)
#endif #endif
@ -479,7 +484,7 @@ tui_reset (void)
struct termio mode; struct termio mode;
/* /*
** reset the teletype mode bits to a sensible state. ** Reset the teletype mode bits to a sensible state.
** Copied tset.c ** Copied tset.c
*/ */
#if defined (TIOCGETC) #if defined (TIOCGETC)
@ -507,7 +512,7 @@ tui_reset (void)
tbuf.t_startc = CHK (tbuf.t_startc, CTRL ('Q')); tbuf.t_startc = CHK (tbuf.t_startc, CTRL ('Q'));
tbuf.t_stopc = CHK (tbuf.t_stopc, CTRL ('S')); tbuf.t_stopc = CHK (tbuf.t_stopc, CTRL ('S'));
tbuf.t_eofc = CHK (tbuf.t_eofc, CTRL ('D')); tbuf.t_eofc = CHK (tbuf.t_eofc, CTRL ('D'));
/* brkc is left alone */ /* brkc is left alone. */
ioctl (FILEDES, TIOCSETC, &tbuf); ioctl (FILEDES, TIOCSETC, &tbuf);
#endif /* TIOCGETC */ #endif /* TIOCGETC */
mode.sg_flags &= ~(RAW mode.sg_flags &= ~(RAW
@ -525,7 +530,7 @@ void
tui_show_source (const char *file, int line) tui_show_source (const char *file, int line)
{ {
struct symtab_and_line cursal = get_current_source_symtab_and_line (); struct symtab_and_line cursal = get_current_source_symtab_and_line ();
/* make sure that the source window is displayed */ /* Make sure that the source window is displayed. */
tui_add_win_to_layout (SRC_WIN); tui_add_win_to_layout (SRC_WIN);
tui_update_source_windows_with_line (cursal.symtab, line); tui_update_source_windows_with_line (cursal.symtab, line);

View File

@ -36,7 +36,7 @@ enum tui_status
TUI_FAILURE TUI_FAILURE
}; };
/* Types of windows */ /* Types of windows. */
enum tui_win_type enum tui_win_type
{ {
SRC_WIN = 0, SRC_WIN = 0,
@ -80,13 +80,15 @@ enum tui_key_mode
/* SingleKey mode with some keys bound to gdb commands. */ /* SingleKey mode with some keys bound to gdb commands. */
TUI_SINGLE_KEY_MODE, TUI_SINGLE_KEY_MODE,
/* Read/edit one command and return to SingleKey after it's processed. */ /* Read/edit one command and return to SingleKey after it's
processed. */
TUI_ONE_COMMAND_MODE TUI_ONE_COMMAND_MODE
}; };
extern enum tui_key_mode tui_current_key_mode; extern enum tui_key_mode tui_current_key_mode;
/* Change the TUI key mode by installing the appropriate readline keymap. */ /* Change the TUI key mode by installing the appropriate readline
keymap. */
extern void tui_set_key_mode (enum tui_key_mode mode); extern void tui_set_key_mode (enum tui_key_mode mode);
extern int tui_active; extern int tui_active;