From 1cc6d956c14542a182c11d5a5ee91d5a00a9af4a Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 14 Aug 2007 21:20:09 +0000 Subject: [PATCH] 2007-08-14 Michael Snyder * 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). --- gdb/ChangeLog | 7 +++ gdb/tui/tui-command.c | 7 +-- gdb/tui/tui-data.c | 50 +++++++++--------- gdb/tui/tui-data.h | 107 ++++++++++++++++++++------------------- gdb/tui/tui-disasm.c | 60 +++++++++++----------- gdb/tui/tui-file.c | 17 ++++--- gdb/tui/tui-hooks.c | 20 ++++---- gdb/tui/tui-interp.c | 14 ++--- gdb/tui/tui-io.c | 101 ++++++++++++++++++------------------ gdb/tui/tui-layout.c | 41 ++++++++------- gdb/tui/tui-out.c | 50 +++++++++--------- gdb/tui/tui-regs.c | 49 +++++++++--------- gdb/tui/tui-regs.h | 2 +- gdb/tui/tui-source.c | 60 +++++++++++----------- gdb/tui/tui-stack.c | 30 +++++------ gdb/tui/tui-win.c | 104 +++++++++++++++++++------------------ gdb/tui/tui-windata.c | 57 +++++++++++---------- gdb/tui/tui-wingeneral.c | 11 ++-- gdb/tui/tui-winsource.c | 28 +++++----- gdb/tui/tui-winsource.h | 2 +- gdb/tui/tui.c | 49 ++++++++++-------- gdb/tui/tui.h | 8 +-- 22 files changed, 461 insertions(+), 413 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index af80397c18c..a043bf48ca7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2007-08-14 Michael Snyder + * 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-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, diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index ba5e32a3910..5a776fa9de3 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -43,7 +43,8 @@ ** PUBLIC FUNCTIONS ** ******************************************/ -/* Dispatch the correct tui function based upon the control character. */ +/* Dispatch the correct tui function based upon the control + character. */ unsigned int tui_dispatch_ctrl_char (unsigned int ch) { @@ -54,8 +55,8 @@ tui_dispatch_ctrl_char (unsigned int ch) tui_refresh_all_win (); /* If the command window has the logical focus, or no-one does - assume it is the command window; in this case, pass the - character on through and do nothing here. */ + assume it is the command window; in this case, pass the character + on through and do nothing here. */ if (win_info == NULL || win_info == TUI_CMD_WIN) return ch; else diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 4004aaa0a8e..8da696cc235 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -97,7 +97,7 @@ tui_set_win_highlight (struct tui_win_info *win_info, int highlight) ** 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 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 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 * 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 * 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 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 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 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 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 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 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 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 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 * 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); 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); } } @@ -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 - else intact. */ +/* Delete all curses windows associated with win_info, leaving + everything else intact. */ void 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; /* - ** Remember that data window content elements are of type struct tui_gen_win_info *, - ** each of which whose single element is a data element. + ** Remember that data window content elements are of type + ** struct tui_gen_win_info *, each of which whose single + ** element is a data element. */ for (i = 0; i < content_size; i++) { @@ -837,8 +839,9 @@ tui_free_data_content (tui_win_content content, int content_size) int i; /* - ** Remember that data window content elements are of type struct tui_gen_win_info *, - ** each of which whose single element is a data element. + ** Remember that data window content elements are of type + ** struct tui_gen_win_info *, each of which whose single + ** element is a data element. */ 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) { - /* free whole source block */ + /* Free whole source block. */ xfree (content[0]->which_element.source.line); } else @@ -905,7 +908,8 @@ free_content_elements (tui_win_content content, int content_size, enum tui_win_t case DATA_ITEM_WIN: /* ** 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) 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) - xfree (content[0]); /* free the element block */ + xfree (content[0]); /* Free the element block. */ } } diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 8a0a9ad1a10..d5cb4b27dcb 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -34,24 +34,24 @@ struct tui_point int x, y; }; -/* Generic window information */ +/* Generic window information. */ struct tui_gen_win_info { - WINDOW *handle; /* window handle */ - enum tui_win_type type; /* type of window */ - int width; /* window width */ - int height; /* window height */ - struct tui_point origin; /* origin of window */ - void **content; /* content of window */ - int content_size; /* Size of content (# of elements) */ - int content_in_use; /* Can it be used, or is it already used? */ - int viewport_height; /* viewport height */ - int last_visible_line; /* index of last visible line */ - int is_visible; /* whether the window is visible or not */ - char *title; /* Window title to display. */ + WINDOW *handle; /* Window handle. */ + enum tui_win_type type; /* Type of window. */ + int width; /* Window width. */ + int height; /* Window height. */ + struct tui_point origin; /* Origin of window. */ + void **content; /* Content of window. */ + int content_size; /* Size of content (# of elements). */ + int content_in_use; /* Can it be used, or is it already used? */ + int viewport_height; /* Viewport height. */ + int last_visible_line; /* Index of last visible line. */ + int is_visible; /* Whether the window is visible or not. */ + char *title; /* Window title to display. */ }; -/* Constant definitions */ +/* Constant definitions. */ #define DEFAULT_TAB_LEN 8 #define NO_SRC_STRING "[ No Source Available ]" #define NO_DISASSEM_STRING "[ No Assembly Available ]" @@ -82,8 +82,10 @@ struct tui_gen_win_info #define PC_PREFIX "PC: " #define SINGLE_KEY "(SingleKey)" -/* Minimum/Maximum length of some fields displayed in the TUI status line. */ -#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line numbers. */ +/* Minimum/Maximum length of some fields displayed in the TUI status + line. */ +#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line + numbers. */ #define MIN_PROC_WIDTH 12 #define MAX_TARGET_WIDTH 10 #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 { SRC_COMMAND, @@ -126,7 +128,7 @@ enum tui_layout_type 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 { TUI_REGISTER, @@ -135,7 +137,7 @@ enum tui_data_type TUI_STRUCT }; -/* Types of register displays */ +/* Types of register displays. */ enum tui_register_display_type { TUI_UNDEFINED_REGS, @@ -146,7 +148,7 @@ enum tui_register_display_type TUI_GENERAL_AND_SPECIAL_REGS }; -/* Structure describing source line or line address */ +/* Structure describing source line or line address. */ struct tui_line_or_address { enum { LOA_LINE, LOA_ADDRESS } loa; @@ -157,7 +159,7 @@ struct tui_line_or_address } u; }; -/* Current Layout definition */ +/* Current Layout definition. */ struct tui_layout_def { enum tui_win_type display_mode; @@ -166,7 +168,7 @@ struct tui_layout_def 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 { 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 { 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; void *value; 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 { char *line; @@ -197,7 +199,7 @@ struct tui_command_element #define MAX_LOCATOR_ELEMENT_LEN 100 -/* Elements in the locator window content */ +/* Elements in the locator window content. */ struct tui_locator_element { char file_name[MAX_LOCATOR_ELEMENT_LEN]; @@ -221,15 +223,15 @@ struct tui_locator_element 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 { - struct tui_source_element source; /* the source elements */ - struct tui_gen_win_info data_window; /* data display elements */ - struct tui_data_element data; /* elements of data_window */ - struct tui_command_element command; /* command elements */ - struct tui_locator_element locator; /* locator elements */ - tui_exec_info_content simple_string; /* simple char based elements */ + struct tui_source_element source; /* The source elements. */ + struct tui_gen_win_info data_window; /* Data display elements. */ + struct tui_data_element data; /* Elements of data_window. */ + struct tui_command_element command; /* Command elements. */ + struct tui_locator_element locator; /* Locator elements. */ + tui_exec_info_content simple_string; /* Simple char based elements. */ }; 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; -/* 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 { - tui_win_content data_content; /* start of data display content */ + tui_win_content data_content; /* Start of data display content. */ 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; enum tui_register_display_type regs_display_type; 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 tui_source_info { - int has_locator; /* Does locator belongs to this window? */ + int has_locator; /* Does locator belongs to this window? */ /* Execution information window. */ 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; char *filename; }; @@ -270,16 +273,16 @@ struct tui_source_info struct tui_command_info { - int cur_line; /* The current line position */ - int curch; /* The current cursor position */ + int cur_line; /* The current line position. */ + int curch; /* The current cursor position. */ int start_line; }; -/* This defines information about each logical window */ +/* This defines information about each logical window. */ struct tui_win_info { - struct tui_gen_win_info generic; /* general window information */ + struct tui_gen_win_info generic; /* General window information. */ union { struct tui_source_info source_info; @@ -288,8 +291,8 @@ struct tui_win_info void *opaque; } detail; - int can_highlight; /* Can this window ever be highlighted? */ - int is_highlighted; /* Is this window highlighted? */ + int can_highlight; /* Can this window ever be highlighted? */ + int is_highlighted; /* Is this window highlighted? */ }; 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); -/* Global Data */ +/* Global Data. */ extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]); -#define TUI_SRC_WIN tui_win_list[SRC_WIN] -#define TUI_DISASM_WIN tui_win_list[DISASSEM_WIN] -#define TUI_DATA_WIN tui_win_list[DATA_WIN] -#define TUI_CMD_WIN tui_win_list[CMD_WIN] +#define TUI_SRC_WIN tui_win_list[SRC_WIN] +#define TUI_DISASM_WIN tui_win_list[DISASSEM_WIN] +#define TUI_DATA_WIN tui_win_list[DATA_WIN] +#define TUI_CMD_WIN tui_win_list[CMD_WIN] -/* Data Manipulation Functions */ +/* Data Manipulation Functions. */ extern void tui_initialize_static_data (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); diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 2f5cf1011d8..42975b87db5 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -55,10 +55,10 @@ tui_disassemble (struct tui_asm_line *asm_lines, CORE_ADDR pc, int count) { struct ui_file *gdb_dis_out; - /* now init the ui_file structure */ + /* Now init the ui_file structure. */ gdb_dis_out = tui_sfileopen (256); - /* Now construct each line */ + /* Now construct each line. */ for (; count > 0; count--, asm_lines++) { 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)); - /* reset the buffer to empty */ + /* Reset the buffer to empty. */ ui_file_rewind (gdb_dis_out); } ui_file_delete (gdb_dis_out); return pc; } -/* Find the disassembly address that corresponds to FROM lines - above or below the PC. Variable sized instructions are taken - into account by the algorithm. */ +/* Find the disassembly address that corresponds to FROM lines above + or below the PC. Variable sized instructions are taken into + account by the algorithm. */ static CORE_ADDR tui_find_disassembly_address (CORE_ADDR pc, int from) { @@ -114,9 +114,9 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) int pos; struct minimal_symbol *msymbol; - /* Find backward an address which is a symbol - and for which disassembling from that address will fill - completely the window. */ + /* Find backward an address which is a symbol and for which + disassembling from that address will fill completely the + window. */ pos = max_lines - 1; do { new_low -= 1 * max_lines; @@ -131,11 +131,10 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) last_addr = asm_lines[pos].addr; } while (last_addr > pc && msymbol); - /* Scan forward disassembling one instruction at a time - until the last visible instruction of the window - matches the pc. We keep the disassembled instructions - in the 'lines' window and shift it downward (increasing - its addresses). */ + /* Scan forward disassembling one instruction at a time until + the last visible instruction of the window matches the pc. + We keep the disassembled instructions in the 'lines' window + and shift it downward (increasing its addresses). */ if (last_addr < pc) do { @@ -193,7 +192,8 @@ tui_set_disassem_content (CORE_ADDR pc) cur_pc = (CORE_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). */ 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); insn_pos = (1 + (addr_size / tab_len)) * tab_len; - /* Now construct each line */ + /* Now construct each line. */ for (i = 0; i < max_lines; i++) { struct tui_win_element *element; @@ -235,7 +235,8 @@ tui_set_disassem_content (CORE_ADDR pc) strcpy (line, asm_lines[i].addr_string); 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) { strcat (line, " "); @@ -244,7 +245,7 @@ tui_set_disassem_content (CORE_ADDR pc) 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) strcpy (src->line, &line[offset]); 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 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_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 - ** source view isn't split + ** If the focus was in the src win, put it in the asm win, if + ** the source view isn't split. */ if (tui_current_layout () != SRC_DISASSEM_COMMAND && win_with_focus == TUI_SRC_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 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, - ** 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); val.loa = LOA_LINE; @@ -346,22 +348,22 @@ tui_get_begin_asm_address (void) else addr = 0; } - else /* the target is executing */ + else /* The target is executing. */ addr = element->addr; return addr; } /* 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 - low address input. */ + disassembly window. This may or may not be the same as the low + address input. */ CORE_ADDR tui_get_low_disassembly_address (CORE_ADDR low, CORE_ADDR pc) { int pos; - /* Determine where to start the disassembly so that the pc is about in the - middle of the viewport. */ + /* Determine where to start the disassembly so that the pc is about + in the middle of the viewport. */ pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2; pc = tui_find_disassembly_address (pc, -pos); @@ -390,7 +392,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction, else s = cursal.symtab; - /* account for hilite */ + /* Account for hilite. */ max_lines = TUI_DISASM_WIN->generic.height - 2; pc = content[0]->which_element.source.line_or_addr.u.addr; dir = (scroll_direction == FORWARD_SCROLL) ? max_lines : - max_lines; diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c index e8eaef8849b..84bc0be3597 100644 --- a/gdb/tui/tui-file.c +++ b/gdb/tui/tui-file.c @@ -28,7 +28,7 @@ #include "gdb_string.h" /* A ``struct ui_file'' that is compatible with all the legacy - code. */ + code. */ /* new */ enum streamtype @@ -111,8 +111,8 @@ tui_sfileopen (int n) tmpstream->ts_strbuf[0] = '\0'; } else - /* Do not allocate the buffer now. The first time something is printed - one will be allocated by tui_file_adjust_strbuf() */ + /* Do not allocate the buffer now. The first time something is + printed one will be allocated by tui_file_adjust_strbuf(). */ tmpstream->ts_strbuf = NULL; tmpstream->ts_buflen = n; 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 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 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); } -/* adjust the length of the buffer by the amount necessary - to accomodate appending a string of length N to the buffer contents */ +/* Adjust the length of the buffer by the amount necessary to + accomodate appending a string of length N to the buffer + contents. */ void 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) { - /* There is already a buffer allocated */ + /* There is already a buffer allocated. */ non_null_chars = strlen (stream->ts_strbuf); if (n > (stream->ts_buflen - non_null_chars - 1)) @@ -215,7 +216,7 @@ tui_file_adjust_strbuf (int n, struct ui_file *file) } } 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)); } diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 0ce3404b851..550999a6047 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -77,7 +77,7 @@ tui_query_hook (const char *msg, va_list argp) echo (); while (1) { - wrap_here (""); /* Flush any buffered output */ + wrap_here (""); /* Flush any buffered output. */ gdb_flush (gdb_stdout); vfprintf_filtered (gdb_stdout, msg, argp); @@ -93,7 +93,7 @@ tui_query_hook (const char *msg, va_list argp) retval = 1; break; } - /* Eat rest of input line, to EOF or newline */ + /* Eat rest of input line, to EOF or newline. */ if (answer != '\n') 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 - 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 tui_selected_frame_level_changed_hook (int level) { @@ -215,17 +216,18 @@ tui_selected_frame_level_changed_hook (int level) return; fi = get_selected_frame (NULL); - /* Ensure that symbols for this frame are read in. Also, determine the - source language of this frame, and switch to it if desired. */ + /* Ensure that symbols for this frame are read in. Also, determine + the source language of this frame, and switch to it if + desired. */ if (fi) { struct symtab *s; s = find_pc_symtab (get_frame_pc (fi)); - /* elz: this if here fixes the problem with the pc not being displayed - in the tui asm layout, with no debug symbols. The value of s - would be 0 here, and select_source_symtab would abort the - command by calling the 'error' function */ + /* elz: This if here fixes the problem with the pc not being + displayed in the tui asm layout, with no debug symbols. The + value of s would be 0 here, and select_source_symtab would + abort the command by calling the 'error' function. */ if (s) select_source_symtab (s); diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index 292c7db95f3..30fd11f513f 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -33,7 +33,8 @@ #include "tui/tui-io.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; /* Cleanup the tui before exiting. */ @@ -41,8 +42,8 @@ static int tui_start_enabled = 0; static void tui_exit (void) { - /* Disable the tui. Curses mode is left leaving the screen - in a clean state (see endwin()). */ + /* Disable the tui. Curses mode is left leaving the screen in a + clean state (see endwin()). */ tui_disable (); } @@ -67,8 +68,9 @@ tui_resume (void *data) { struct ui_file *stream; - /* gdb_setup_readline will change gdb_stdout. If the TUI was previously - writing to gdb_stdout, then set it to the new gdb_stdout afterwards. */ + /* gdb_setup_readline will change gdb_stdout. If the TUI was + previously writing to gdb_stdout, then set it to the new + gdb_stdout afterwards. */ stream = cli_out_set_stream (tui_old_uiout, gdb_stdout); if (stream != gdb_stdout) @@ -198,7 +200,7 @@ _initialize_tui_interp (void) }; 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); interp_add (interp_new (INTERP_TUI, NULL, tui_out, &procs)); if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index d39b08976cd..51f21081f2b 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -84,36 +84,37 @@ key_is_command_char (int ch) When the TUI is enabled, gdb has two modes a curses and a standard mode. - In curses mode, the gdb outputs are made in a curses command window. - For this, the gdb_stdout and gdb_stderr are redirected to the specific - ui_file implemented by TUI. The output is handled by tui_puts(). - The input is also controlled by curses with tui_getc(). The readline - library uses this function to get its input. Several readline hooks - are installed to redirect readline output to the TUI (see also the - note below). + In curses mode, the gdb outputs are made in a curses command + window. For this, the gdb_stdout and gdb_stderr are redirected to + the specific ui_file implemented by TUI. The output is handled by + tui_puts(). The input is also controlled by curses with + tui_getc(). The readline library uses this function to get its + input. Several readline hooks are installed to redirect readline + output to the TUI (see also the note below). 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() function with stdin. - Note SCz/2001-07-21: the current readline is not clean in its management of - the output. Even if we install a redisplay handler, it sometimes writes on - a stdout file. It is important to redirect every output produced by - readline, otherwise the curses window will be garbled. This is implemented - with a pipe that TUI reads and readline writes to. A gdb input handler - is created so that reading the pipe is handled automatically. - This will probably not work on 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 - with them we don't need the pipe anymore (verified by creating the pipe - and closing its end so that write causes a SIGPIPE). The old pipe code - is still there and can be conditionally removed by + Note SCz/2001-07-21: the current readline is not clean in its + management of the output. Even if we install a redisplay handler, + it sometimes writes on a stdout file. It is important to redirect + every output produced by readline, otherwise the curses window will + be garbled. This is implemented with a pipe that TUI reads and + readline writes to. A gdb input handler is created so that reading + the pipe is handled automatically. This will probably not work on + 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 with them we don't need the pipe anymore (verified by creating + the pipe and closing its end so that write causes a SIGPIPE). The + old pipe code is still there and can be conditionally removed by #undef TUI_USE_PIPE_FOR_READLINE. */ /* For gdb 5.3, prefer to continue the pipe hack as a backup wheel. */ #define TUI_USE_PIPE_FOR_READLINE -/*#undef TUI_USE_PIPE_FOR_READLINE*/ +/* #undef TUI_USE_PIPE_FOR_READLINE */ /* TUI output files. */ static struct ui_file *tui_stdout; @@ -207,7 +208,8 @@ tui_redisplay_readline (void) int start_line; /* 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) tui_set_key_mode (TUI_SINGLE_KEY_MODE); @@ -275,8 +277,9 @@ tui_redisplay_readline (void) fflush(stdout); } -/* Readline callback to prepare the terminal. It is called once - each time we enter readline. Terminal is already setup in curses mode. */ +/* Readline callback to prepare the terminal. It is called once each + time we enter readline. Terminal is already setup in curses + mode. */ static void tui_prep_terminal (int notused1) { @@ -287,8 +290,8 @@ tui_prep_terminal (int notused1) tui_rl_saved_prompt = xstrdup (rl_prompt); } -/* Readline callback to restore the terminal. It is called once - each time we leave readline. There is nothing to do in curses mode. */ +/* Readline callback to restore the terminal. It is called once each + time we leave readline. There is nothing to do in curses mode. */ static 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 final slash. Otherwise, we return what we were passed. - Comes from readline/complete.c */ + Comes from readline/complete.c. */ static char * printable_part (char *pathname) { @@ -331,9 +334,10 @@ printable_part (char *pathname) return (temp ? ++temp : pathname); } -/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we - are using it, check for and output a single character for `special' - filenames. Return the number of characters we output. */ +/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and + we are using it, check for and output a single character for + `special' filenames. Return the number of characters we + output. */ #define PUTX(c) \ 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. - Comes from readline/complete.c */ + Comes from readline/complete.c. */ static int 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; /* 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) { 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; limit = screenwidth / max; if (limit != 1 && (limit * max == screenwidth)) limit--; - /* Avoid a possible floating exception. If max > screenwidth, - limit will be 0 and a divide-by-zero fault will result. */ + /* Avoid a possible floating exception. If max > screenwidth, limit + will be 0 and a divide-by-zero fault will result. */ if (limit == 0) limit = 1; - /* How many iterations of the printing loop? */ + /* How many iterations of the printing loop? */ count = (len + (limit - 1)) / limit; /* Watch out for special case. If LEN is less than LIMIT, then 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) qsort (matches + 1, len, sizeof (char *), (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) { - /* 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 (j = 0, l = i; j < limit; j++) @@ -475,12 +479,12 @@ tui_rl_display_match_list (char **matches, int len, int max) } 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++) { temp = printable_part (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 (i && (limit > 1) && (i % limit) == 0) @@ -607,9 +611,9 @@ tui_initialize_io (void) tui_old_uiout = uiout = cli_out_new (gdb_stdout); #ifdef TUI_USE_PIPE_FOR_READLINE - /* Temporary solution for readline writing to stdout: - redirect readline output in a pipe, read that pipe and - output the content in the curses command window. */ + /* Temporary solution for readline writing to stdout: redirect + readline output in a pipe, read that pipe and output the content + in the curses command window. */ if (pipe (tui_readline_pipe) != 0) { fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline"); @@ -636,8 +640,8 @@ tui_initialize_io (void) #endif } -/* Get a character from the command window. This is called from the readline - package. */ +/* Get a character from the command window. This is called from the + readline package. */ int tui_getc (FILE *fp) { @@ -654,7 +658,8 @@ tui_getc (FILE *fp) ch = wgetch (w); 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') { /* 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)) - { /* Handle prev/next/up/down here */ + { /* Handle prev/next/up/down here. */ ch = tui_dispatch_ctrl_char (ch); } diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 2c349d407ba..d7cf31bf042 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -84,7 +84,7 @@ show_layout (enum tui_layout_type layout) /* ** Since the new layout may cause changes in window size, we ** should free the content and reallocate on next display of - ** source/asm + ** source/asm. */ tui_free_all_source_wins_content (); tui_clear_source_windows (); @@ -95,13 +95,13 @@ show_layout (enum tui_layout_type layout) } else { - /* First make the current layout be invisible */ + /* First make the current layout be invisible. */ tui_make_all_invisible (); tui_make_invisible (tui_locator_win_info_ptr ()); switch (layout) { - /* Now show the new layout */ + /* Now show the new layout. */ case SRC_COMMAND: show_source_command (); 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); /* - ** Now determine where focus should be + ** Now determine where focus should be. */ if (win_with_focus != TUI_CMD_WIN) { @@ -178,7 +178,7 @@ tui_set_layout (enum tui_layout_type layout_type, layout_def->split = FALSE; break; case DISASSEM_COMMAND: - /* the previous layout was not showing + /* The previous layout was not showing ** code. this can happen if there is no ** source available: ** 1. if the source file is in another dir OR @@ -191,7 +191,7 @@ tui_set_layout (enum tui_layout_type layout_type, layout_def->split = FALSE; break; case SRC_DISASSEM_COMMAND: - /* the previous layout was not showing + /* The previous layout was not showing ** code. this can happen if there is no ** source available: ** 1. if the source file is in another dir OR @@ -214,7 +214,7 @@ tui_set_layout (enum tui_layout_type layout_type, layout_def->split = FALSE; break; case DISASSEM_DATA_COMMAND: - /* the previous layout was not showing + /* The previous layout was not showing ** code. this can happen if there is no ** source available: ** 1. if the source file is in another dir OR @@ -417,7 +417,7 @@ tui_set_layout_for_display_command (const char *layout_name) for (i = 0; (i < strlen (layout_name)); 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 == '$')) { warning (_("Ambiguous command input.")); @@ -442,11 +442,11 @@ tui_set_layout_for_display_command (const char *layout_name) else new_layout = DISASSEM_DATA_COMMAND; -/* could ifdef out the following code. when compile with -z, there are null - pointer references that cause a core dump if 'layout regs' is the first - layout command issued by the user. HP has asked us to hook up this code - - edie epstein - */ + /* Could ifdef out the following code. when compile with + -z, there are null pointer references that cause a + core dump if 'layout regs' is the first layout + command issued by the user. HP has asked us to hook + up this code. - edie epstein */ if (subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME)) { if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != @@ -475,15 +475,14 @@ tui_set_layout_for_display_command (const char *layout_name) 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 - general purpose registers - */ + /* If ifdefed out code above, then assume that the user + wishes to display the general purpose registers . + */ -/* dpy_type = TUI_GENERAL_REGS; - */ + /* dpy_type = TUI_GENERAL_REGS; */ } else if (subset_compare (buf_ptr, "NEXT")) 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 show_source_or_disasm_and_command (enum tui_layout_type layout_type) { diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index df6091e7b94..2a34473b8f9 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -38,7 +38,7 @@ struct ui_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, 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_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 - handle initial output in main.c */ + handle initial output in main.c. */ 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). */ }; -/* Prototypes for local functions */ +/* Prototypes for local functions. */ extern void _initialize_tui_out (void); @@ -109,7 +109,7 @@ static void out_field_fmt (struct ui_out *uiout, int fldno, /* (none yet) */ -/* Mark beginning of a table */ +/* Mark beginning of a table. */ void 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; else /* 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); } -/* Mark beginning of a table body */ +/* Mark beginning of a table body. */ void 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); if (data->suppress_output) return; - /* first, close the table header line */ + /* First, close the table header line. */ tui_text (uiout, "\n"); } -/* Mark end of a table */ +/* Mark end of a table. */ void tui_table_end (struct ui_out *uiout) @@ -146,7 +146,7 @@ tui_table_end (struct ui_out *uiout) data->suppress_output = 0; } -/* Specify table header */ +/* Specify table header. */ void 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); } -/* Mark beginning of a list */ +/* Mark beginning of a list. */ void tui_begin (struct ui_out *uiout, @@ -172,7 +172,7 @@ tui_begin (struct ui_out *uiout, return; } -/* Mark end of a list */ +/* Mark end of a list. */ void tui_end (struct ui_out *uiout, @@ -184,14 +184,14 @@ tui_end (struct ui_out *uiout, return; } -/* output an int field */ +/* Output an int field. */ void tui_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, 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); 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); } -/* used to ommit a field */ +/* Used to ommit a field. */ void 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, ""); } -/* other specific tui_field_* end up here so alignment and field - separators are both handled by tui_field_string */ +/* Other specific tui_field_* end up here so alignment and field + separators are both handled by tui_field_string. */ void tui_field_string (struct ui_out *uiout, @@ -285,7 +285,7 @@ tui_field_string (struct ui_out *uiout, field_separator (); } -/* This is the only field function that does not align */ +/* This is the only field function that does not align. */ void tui_field_fmt (struct ui_out *uiout, int fldno, @@ -362,10 +362,10 @@ tui_flush (struct ui_out *uiout) gdb_flush (data->stream); } -/* local functions */ +/* Local functions. */ -/* Like tui_field_fmt, but takes a variable number of args - and makes a va_list and does not insert a separator */ +/* Like tui_field_fmt, but takes a variable number of args and makes a + va_list and does not insert a separator. */ /* VARARGS */ static void @@ -382,7 +382,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, va_end (args); } -/* access to ui_out format private members */ +/* Access to ui_out format private members. */ static void field_separator (void) @@ -391,7 +391,7 @@ field_separator (void) fputc_filtered (' ', data->stream); } -/* initalize private members at startup */ +/* Initalize private members at startup. */ struct ui_out * 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); } -/* standard gdb initialization hook */ +/* Standard gdb initialization hook. */ void _initialize_tui_out (void) { - /* nothing needs to be done */ + /* Nothing needs to be done. */ } diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index a2caee6afc6..e7056c3e71b 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -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 - the register area (-1) is returned. */ +/* Answer the index of the first element in line_no. If line_no is + past the register area (-1) is returned. */ int tui_first_reg_element_no_inline (int line_no) { @@ -162,7 +162,8 @@ tui_show_registers (struct reggroup *group) if (group == 0) 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; if (target_has_registers && target_has_stack && target_has_memory) @@ -180,7 +181,7 @@ tui_show_registers (struct reggroup *group) { int i; - /* Clear all notation of changed values */ + /* Clear all notation of changed values. */ for (i = 0; i < display_info->regs_content_count; i++) { 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 - using the given frame. Values are refreshed only when refresh_values_only - is TRUE. */ + using the given frame. Values are refreshed only when + refresh_values_only is TRUE. */ static enum tui_status 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; } - /* Now set the register names and values */ + /* Now set the register names and values. */ pos = 0; for (regnum = 0; 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; /* - ** 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; 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_data_element *data_element_ptr; - /* create the window if necessary */ + /* Create the window if necessary. */ data_item_win = &display_info->regs_content[i] ->which_element.data_window; 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 and display it. */ 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; /* ** If there is no other data displayed except registers, - ** and the element_no causes us to scroll past the end of the - ** registers, adjust what element to really start the display at. + ** and the element_no causes us to scroll past the end of + ** the registers, adjust what element to really start the + ** display at. */ if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 && 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) line = 0; else if (force_display) - { /* - ** If we must display regs (force_display is true), then make - ** sure that we don't display off the end of the registers. - */ + { /* + ** If we must display regs (force_display is true), then make + ** sure that we don't display off the end of the registers. + */ if (line_no >= tui_last_regs_line_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 (-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, - then the value will be displayed in reverse video */ +/* Display a register in a window. If hilite is TRUE, then the value + will be displayed in reverse video. */ static void tui_display_register (struct tui_data_element *data, struct tui_gen_win_info *win_info) @@ -702,9 +705,9 @@ tui_register_format (struct gdbarch *gdbarch, struct frame_info *frame, do_cleanups (cleanups); } -/* Get the register value from the given frame and format it for - the display. When changep is set, check if the new register value - has changed with respect to the previous call. */ +/* Get the register value from the given frame and format it for the + display. When changep is set, check if the new register value has + changed with respect to the previous call. */ static enum tui_status tui_get_register (struct gdbarch *gdbarch, struct frame_info *frame, struct tui_data_element *data, int regnum, int *changedp) diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index 0774a12f15d..148305bedd4 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -25,7 +25,7 @@ #ifndef 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_show_registers (struct reggroup *group); diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 44b43627074..09886fdb254 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -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) { line_width = TUI_SRC_WIN->generic.width - 1; - /* Take hilite (window border) into account, when calculating - the number of lines */ + /* Take hilite (window border) into account, when + calculating the number of lines. */ nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no; desc = open_source_file (s); if (desc < 0) @@ -99,8 +99,8 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror) xfree (src->filename); src->filename = xstrdup (s->filename); - /* Determine the threshold for the length of the line - and the offset to start the display. */ + /* Determine the threshold for the length of the + line and the offset to start the display. */ offset = src->horizontal_offset; threshold = (line_width - 1) + offset; 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 *) TUI_SRC_WIN->generic.content[cur_line]; - /* get the first character in the line */ + /* Get the first character in the line. */ c = fgetc (stream); if (offset == 0) src_line = ((struct tui_win_element *) TUI_SRC_WIN->generic.content[ 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); cur_len = strlen (src_line); 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; - /* Set whether element is the execution point and - whether there is a break point on it. */ + /* Set whether element is the execution point + and whether there is a break point on it. */ element->which_element.source.line_or_addr.loa = LOA_LINE; 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] = '?'; } else - { /* Store the charcter in the line - buffer. If it is a tab, then - translate to the correct number of - chars so we don't overwrite our - buffer. */ + { /* Store the charcter in the + line buffer. If it is a tab, + then translate to the correct + number of chars so we don't + overwrite our buffer. */ if (c == '\t') { 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; } else - { /* If we have not reached EOL, then eat - chars until we do */ + { /* If we have not reached EOL, then + eat chars until we do. */ while (c != EOF && c != '\n' && c != '\r') c = fgetc (stream); /* 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' && 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) strcpy (((struct tui_win_element *) TUI_SRC_WIN->generic.content[ 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 - 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 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; n_lines = win_info->generic.height - 2; - /* set to empty each line in the window, except for the one - which contains the message */ + /* Set to empty each line in the window, except for the one which + contains the message. */ while (curr_line < win_info->generic.content_size) { - /* set the information related to each displayed line - to null: i.e. the line number is 0, there is no bp, - it is not where the program is stopped */ + /* Set the information related to each displayed line to null: + i.e. the line number is 0, there is no bp, it is not where + the program is stopped. */ struct tui_win_element *element = (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.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; - /* 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. Note: the 'weird' arithmetic with the line width and height - comes from the function tui_erase_source_content(). We need - to keep the screen and the window's actual contents in synch. */ + comes from the function tui_erase_source_content(). We need + to keep the screen and the window's actual contents in + synch. */ 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 + num_to_scroll; if (l.u.line_no > s->nlines) - /*line = s->nlines - win_info->generic.content_size + 1; */ - /*elz: fix for dts 23398 */ + /* line = s->nlines - win_info->generic.content_size + 1; */ + /* elz: fix for dts 23398. */ l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no; } else diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index acbe5d7ad05..89b8c1f2aab 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -56,9 +56,9 @@ static void tui_set_locator_info (const char *filename, const char *procname, static void tui_update_command (char *, int); -/* Create the status line to display as much information as we - can on this single line: target name, process number, current - function, current line, current PC, SingleKey mode. */ +/* Create the status line to display as much information as we can on + this single line: target name, process number, current function, + current line, current PC, SingleKey mode. */ static char* 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; - /* Now create the locator line from the string version - of the elements. We could use sprintf() here but - that wouldn't ensure that we don't overrun the size - of the allocated buffer. strcat_to_buf() will. */ + /* Now create the locator line from the string version of the + elements. We could use sprintf() here but that wouldn't ensure + that we don't overrun the size of the allocated buffer. + strcat_to_buf() will. */ *string = (char) 0; if (target_width > 0) @@ -174,7 +174,7 @@ tui_make_status_line (struct tui_locator_element *loc) strcat_to_buf (string, status_size, " "); } - /* procedure/class name */ + /* Procedure/class name. */ if (proc_width > 0) { if (strlen (pname) > proc_width) @@ -207,9 +207,9 @@ tui_make_status_line (struct tui_locator_element *loc) return string; } -/* Get a printable name for the function at the address. - The symbol name is demangled if demangling is turned on. - Returns a pointer to a static area holding the result. */ +/* Get a printable name for the function at the address. The symbol + name is demangled if demangling is turned on. Returns a pointer to + a static area holding the result. */ static char* 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, ""); p = tui_file_get_strbuf (stream); - /* Use simple heuristics to isolate the function name. The symbol can - be demangled and we can have function parameters. Remove them because - the status line is too short to display them. */ + /* Use simple heuristics to isolate the function name. The symbol + can be demangled and we can have function parameters. Remove + them because the status line is too short to display them. */ if (*p == '<') p++; strncpy (name, p, sizeof (name)); diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 500810b435e..7022400aaa1 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -227,8 +227,8 @@ show_tui_border_kind (struct ui_file *file, int from_tty, } -/* Tui internal configuration variables. These variables are - updated by tui_update_variables to reflect the tui configuration +/* Tui internal configuration variables. These variables are updated + by tui_update_variables to reflect the tui configuration variables. */ chtype tui_border_vline; chtype tui_border_hline; @@ -349,11 +349,11 @@ _initialize_tui_win (void) add_prefix_cmd ("tui", class_tui, set_tui_cmd, _("TUI configuration variables"), &tui_setlist, "set tui ", - 0/*allow-unknown*/, &setlist); + 0 /* allow-unknown */, &setlist); add_prefix_cmd ("tui", class_tui, show_tui_cmd, _("TUI configuration variables"), &tui_showlist, "show tui ", - 0/*allow-unknown*/, &showlist); + 0 /* allow-unknown */, &showlist); add_com ("refresh", class_tui, tui_refresh_all_command, _("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 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 tui_scroll (enum tui_scroll_direction direction, struct tui_win_info *win_to_scroll, @@ -652,7 +652,7 @@ tui_resize_all (void) #ifdef HAVE_RESIZE_TERM resize_term (screenheight, screenwidth); #endif - /* turn keypad off while we resize */ + /* Turn keypad off while we resize. */ if (win_with_focus != TUI_CMD_WIN) keypad (TUI_CMD_WIN->generic.handle, FALSE); tui_update_gdb_sizes (); @@ -670,7 +670,7 @@ tui_resize_all (void) else cmd_split_diff++; } - /* now adjust each window */ + /* Now adjust each window. */ clear (); refresh (); switch (cur_layout) @@ -680,7 +680,7 @@ tui_resize_all (void) first_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; first_win->generic.width += width_diff; locator->width += width_diff; - /* check for invalid heights */ + /* Check for invalid heights. */ if (height_diff == 0) new_height = first_win->generic.height; 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->generic.width += width_diff; } - /* Change the first window's height/width */ - /* check for invalid heights */ + /* Change the first window's height/width. */ + /* Check for invalid heights. */ if (height_diff == 0) new_height = first_win->generic.height; else if ((first_win->generic.height + @@ -732,8 +732,8 @@ tui_resize_all (void) locator->width += width_diff; - /* Change the second window's height/width */ - /* check for invalid heights */ + /* Change the second window's height/width. */ + /* Check for invalid heights. */ if (height_diff == 0) new_height = second_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; 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; make_invisible_and_set_new_height ( TUI_CMD_WIN, TUI_CMD_WIN->generic.height + cmd_split_diff); @@ -767,8 +767,8 @@ tui_resize_all (void) break; } /* - ** Now remove all invisible windows, and their content so that they get - ** created again when called for with the new size + ** Now remove all invisible windows, and their content so that + ** they get created again when called for with the new size. */ 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); - /* 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) 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 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 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; /* - ** Validate the window name + ** Validate the window name. */ for (i = 0; i < strlen (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")); else { - /* Process the size */ + /* Process the size. */ 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; /* ** Now change the window's height, and adjust all - ** other windows around it + ** other windows around it. */ if (tui_adjust_win_heights (win_info, new_height) == TUI_FAILURE) @@ -1048,7 +1049,7 @@ The window name specified must be valid and visible.\n")); 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 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 - increase or decrease the command window by the specified amount. */ + increase or decrease the command window by the specified + amount. */ static void 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); if (input_no > 0) - { /* Add 1 for the locator */ + { /* Add 1 for the locator. */ int new_height = tui_term_height () - (input_no + 1); 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]; } if (primary_win_info == TUI_CMD_WIN) - { /* - ** Split the change in height accross the 1st & 2nd windows - ** adjusting them as well. - */ - int first_split_diff = diff / 2; /* subtract the locator */ + { /* + ** Split the change in height accross the 1st & 2nd + ** windows, adjusting them as well. + */ + int first_split_diff = diff / 2; /* Subtract the locator. */ int second_split_diff = first_split_diff; if (diff % 2) @@ -1174,7 +1176,8 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, int new_height) 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) { first_split_diff++; @@ -1197,10 +1200,10 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, int new_height) else { if ((TUI_CMD_WIN->generic.height + diff) < 1) - { /* - ** If there is no way to increase the command window - ** take real estate from the 1st or 2nd window. - */ + { /* + ** If there is no way to increase the command window + ** take real estate from the 1st or 2nd window. + */ if ((TUI_CMD_WIN->generic.height + diff) < 1) { 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 - with the targer) invisible, and set the new height and location. */ + with the targer) invisible, and set the new height and + location. */ static void 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) 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) { case SRC_WIN: @@ -1287,7 +1291,7 @@ make_invisible_and_set_new_height (struct tui_win_info *win_info, int height) } break; case DATA_WIN: - /* delete all data item windows */ + /* Delete all data item windows. */ for (i = 0; i < win_info->generic.content_size; i++) { 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 >= MIN_WIN_HEIGHT)); if (ok) - { /* check the total height */ + { /* Check the total height. */ struct tui_win_info *win_info; 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 = (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) { - /* locator included since first & second win share a line */ + /* Locator included since first & second win share a line. */ ok = ((first_win->generic.height + second_win->generic.height + diff) >= (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 ** 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); if (!ok) - { /* - ** Looks like we have to increase/decrease one of - ** the other windows - */ + { /* + ** Looks like we have to increase/decrease one of + ** the other windows. + */ if (primary_win_info == first_win) ok = (second_win->generic.height + diff) >= min_height; 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 - ** window name arg + ** window name arg. */ if (arg != (char *) NULL) { char *buf, *buf_ptr; - /* process the number of lines to scroll */ + /* Process the number of lines to scroll. */ buf = buf_ptr = xstrdup (arg); 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); } - /* process the window name if one is specified */ + /* Process the window name if one is specified. */ if (buf_ptr != (char *) NULL) { char *wname; @@ -1533,7 +1537,7 @@ parse_scrolling_args (char *arg, struct tui_win_info **win_to_scroll, else wname = "?"; - /* Validate the window name */ + /* Validate the window name. */ for (i = 0; i < strlen (wname); i++) wname[i] = toupper (wname[i]); *win_to_scroll = tui_partial_win_by_name (wname); diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c index 3959988d30b..f5ffb4bbe98 100644 --- a/gdb/tui/tui-windata.c +++ b/gdb/tui/tui-windata.c @@ -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 element number + ** first element number. */ 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; @@ -142,7 +142,7 @@ tui_display_all_data (void) tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); 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 != (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); - /* 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) tui_display_registers_from_line (_line_no, TRUE); else @@ -174,30 +175,30 @@ tui_display_data_from_line (int 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) - { /* - ** _line_no is past the regs display, so calc where the - ** start data element is - */ + { /* + ** _line_no is past the regs display, so calc where the + ** start data element is. + */ if (regs_last_line < _line_no) - { /* figure out how many lines each element is to obtain - the start element_no */ + { /* Figure out how many lines each element is to obtain + the start element_no. */ } } else - { /* - ** calculate the starting element of the data display, given - ** regs_last_line and how many lines each element is, up to - ** _line_no - */ + { /* + ** Calculate the starting element of the data display, + ** given regs_last_line and how many lines each element + ** 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 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) first_line = tui_line_from_reg_element_no (element_no); else - { /* calculate the first_line from the element number */ + { /* Calculate the first_line from the element number. */ } if (first_line >= 0) @@ -228,19 +229,20 @@ tui_refresh_data_win (void) { 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); } } -/* 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 tui_check_data_values (struct frame_info *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) { 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 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) first_line = tui_line_from_reg_element_no (first_element_no); else - { /* calculate the first line from the element number which is in - ** the general data content - */ + { /* Calculate the first line from the element number which is in + the general data content. */ } if (first_line >= 0) diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index c0de03ff620..0249d8a1459 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -34,7 +34,7 @@ ** PUBLIC FUNCTIONS ***********************/ -/* Refresh the window. */ +/* Refresh the window. */ void 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) { - /* Do nothing */ + /* Do nothing. */ } 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 tui_delete_win (WINDOW *window) { @@ -175,7 +175,7 @@ tui_make_window (struct tui_gen_win_info *win_info, int box_it) static void 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) 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 make_all_visible (int visible) { diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index dc3fa6bb97e..66fd9014cfe 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -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); /* ** 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 && 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, no_src_str); - /* elz: added this function call to set the real contents of - the window to what is on the screen, so that later calls - to refresh, do display - the correct stuff, and not the old image */ + /* elz: Added this function call to set the real contents of + the window to what is on the screen, so that later calls + to refresh, do display the correct stuff, and not the old + image. */ 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 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 - has_break information for each line. - Returns 1 if something changed and the execution window - must be refreshed. */ +/* Scan the source window and the breakpoints to update the has_break + information for each line. + + Returns 1 if something changed and the execution window must be + refreshed. */ + int 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; 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; /* * 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); return TUI_FAILURE; } - /* allocate the content list */ + /* Allocate the content list. */ if ((win_info->generic.content = (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL) { diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 74a4d0f01a0..2dc124e0c72 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -68,6 +68,6 @@ extern int tui_addr_is_displayed (CORE_ADDR, struct tui_win_info *, int); /* Constant definitions. */ -#define SCROLL_THRESHOLD 2 /* threshold for lazy scroll */ +#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */ #endif diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 6d30e3f904c..0a13148baf1 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -70,7 +70,8 @@ struct tui_char_command 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[] = { { 'c', "continue" }, { 'd', "down" }, @@ -103,19 +104,22 @@ tui_rl_switch_mode (int notused1, int notused2) 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) rl_kill_text (0, rl_end); /* Since we left the curses mode, the terminal mode is restored to some previous state. That state may not be suitable for readline 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 - will be able to setup the terminal for its needs. By re-entering - in readline, we also redisplay its prompt in the non-curses mode. */ + exit of the current readline so that readline is re-entered and + it will be able to setup the terminal for its needs. By + re-entering in readline, we also redisplay its prompt in the + non-curses mode. */ 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 (); return 0; } @@ -123,13 +127,13 @@ tui_rl_switch_mode (int notused1, int notused2) /* TUI readline command. Change the TUI layout to show a next layout. This function is bound to CTRL-X 2. It is intended to provide - a functionality close to the Emacs split-window command. We always - show two windows (src+asm), (src+regs) or (asm+regs). */ + a functionality close to the Emacs split-window command. We + always show two windows (src+asm), (src+regs) or (asm+regs). */ static int tui_rl_change_windows (int notused1, int notused2) { if (!tui_active) - tui_rl_switch_mode (0/*notused*/, 0/*notused*/); + tui_rl_switch_mode (0 /* notused */, 0 /* notused */); if (tui_active) { @@ -138,8 +142,8 @@ tui_rl_change_windows (int notused1, int notused2) new_layout = tui_current_layout (); - /* Select a new layout to have a rolling layout behavior - with always two windows (except when undefined). */ + /* Select a new layout to have a rolling layout behavior with + always two windows (except when undefined). */ switch (new_layout) { case SRC_COMMAND: @@ -177,7 +181,7 @@ static int tui_rl_delete_other_windows (int notused1, int notused2) { if (!tui_active) - tui_rl_switch_mode (0/*notused*/, 0/*notused*/); + tui_rl_switch_mode (0 /* notused */, 0 /* notused */); if (tui_active) { @@ -214,7 +218,7 @@ tui_rl_other_window (int count, int key) struct tui_win_info *win_info; 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 ()); if (win_info) @@ -239,8 +243,8 @@ tui_rl_command_key (int count, int key) { if (tui_commands[i].key == key) { - /* Must save the command because it can be modified - by execute_command. */ + /* Must save the command because it can be modified by + execute_command. */ char *cmd = alloca (strlen (tui_commands[i].cmd) + 1); strcpy (cmd, tui_commands[i].cmd); execute_command (cmd, TRUE); @@ -267,7 +271,7 @@ static int tui_rl_next_keymap (int notused1, int notused2) { 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_SINGLE_KEY_MODE : TUI_COMMAND_MODE); @@ -288,7 +292,8 @@ tui_rl_startup_hook (void) 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 tui_set_key_mode (enum tui_key_mode mode) { @@ -375,7 +380,7 @@ tui_enable (void) cbreak (); noecho (); - /*timeout (1);*/ + /* timeout (1); */ nodelay(w, FALSE); nl(); keypad (w, TRUE); @@ -465,7 +470,7 @@ strcat_to_buf (char *buf, int buflen, const char *item_to_add) } #if 0 -/* Solaris defines CTRL. */ +/* Solaris defines CTRL. */ #ifndef CTRL #define CTRL(x) (x & ~0140) #endif @@ -479,7 +484,7 @@ tui_reset (void) struct termio mode; /* - ** reset the teletype mode bits to a sensible state. + ** Reset the teletype mode bits to a sensible state. ** Copied tset.c */ #if defined (TIOCGETC) @@ -507,7 +512,7 @@ tui_reset (void) tbuf.t_startc = CHK (tbuf.t_startc, CTRL ('Q')); tbuf.t_stopc = CHK (tbuf.t_stopc, CTRL ('S')); tbuf.t_eofc = CHK (tbuf.t_eofc, CTRL ('D')); - /* brkc is left alone */ + /* brkc is left alone. */ ioctl (FILEDES, TIOCSETC, &tbuf); #endif /* TIOCGETC */ mode.sg_flags &= ~(RAW @@ -525,7 +530,7 @@ void tui_show_source (const char *file, int 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_update_source_windows_with_line (cursal.symtab, line); diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 97e3e948cea..8482ad9bc3f 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -36,7 +36,7 @@ enum tui_status TUI_FAILURE }; -/* Types of windows */ +/* Types of windows. */ enum tui_win_type { SRC_WIN = 0, @@ -80,13 +80,15 @@ enum tui_key_mode /* SingleKey mode with some keys bound to gdb commands. */ 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 }; 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 int tui_active; -- 2.30.2