diff options
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-data.c | 1 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.c | 1 | ||||
-rw-r--r-- | gdb/tui/tui-file.c | 10 | ||||
-rw-r--r-- | gdb/tui/tui-interp.c | 1 | ||||
-rw-r--r-- | gdb/tui/tui-main.c | 1 | ||||
-rw-r--r-- | gdb/tui/tui-out.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-regs.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-source.c | 4 | ||||
-rw-r--r-- | gdb/tui/tui-stack.c | 3 | ||||
-rw-r--r-- | gdb/tui/tui-win.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.c | 4 | ||||
-rw-r--r-- | gdb/tui/tui.c | 2 |
12 files changed, 33 insertions, 4 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index ee88cf1..22c00c9 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -402,6 +402,7 @@ tui_partial_win_by_name (char *name) if (tui_win_list[i] != 0) { char *cur_name = tui_win_name (&tui_win_list[i]->generic); + if (strlen (name) <= strlen (cur_name) && strncmp (name, cur_name, strlen (name)) == 0) win_info = tui_win_list[i]; diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index cb8358e..6d8aa1b 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -214,6 +214,7 @@ tui_set_disassem_content (struct gdbarch *gdbarch, CORE_ADDR pc) for (i = 0; i < max_lines; i++) { size_t len = strlen (asm_lines[i].addr_string); + if (len > addr_size) addr_size = len; diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c index fc26fb5..2e4e821 100644 --- a/gdb/tui/tui-file.c +++ b/gdb/tui/tui-file.c @@ -60,6 +60,7 @@ tui_file_new (void) { struct tui_stream *tui = XMALLOC (struct tui_stream); struct ui_file *file = ui_file_new (); + set_ui_file_data (file, tui, tui_file_delete); set_ui_file_flush (file, tui_file_flush); set_ui_file_fputs (file, tui_file_fputs); @@ -74,6 +75,7 @@ static void tui_file_delete (struct ui_file *file) { struct tui_stream *tmpstream = ui_file_data (file); + if (tmpstream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_delete: bad magic number")); @@ -90,6 +92,7 @@ tui_fileopen (FILE *stream) { struct ui_file *file = tui_file_new (); struct tui_stream *tmpstream = ui_file_data (file); + tmpstream->ts_streamtype = afile; tmpstream->ts_filestream = stream; tmpstream->ts_strbuf = NULL; @@ -102,6 +105,7 @@ tui_sfileopen (int n) { struct ui_file *file = tui_file_new (); struct tui_stream *tmpstream = ui_file_data (file); + tmpstream->ts_streamtype = astring; tmpstream->ts_filestream = NULL; if (n > 0) @@ -121,6 +125,7 @@ static int tui_file_isatty (struct ui_file *file) { struct tui_stream *stream = ui_file_data (file); + if (stream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_isatty: bad magic number")); @@ -134,6 +139,7 @@ static void tui_file_rewind (struct ui_file *file) { struct tui_stream *stream = ui_file_data (file); + if (stream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_rewind: bad magic number")); @@ -146,6 +152,7 @@ tui_file_put (struct ui_file *file, void *dest) { struct tui_stream *stream = ui_file_data (file); + if (stream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_put: bad magic number")); @@ -182,6 +189,7 @@ char * tui_file_get_strbuf (struct ui_file *file) { struct tui_stream *stream = ui_file_data (file); + if (stream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_get_strbuf: bad magic number")); @@ -196,6 +204,7 @@ tui_file_adjust_strbuf (int n, struct ui_file *file) { struct tui_stream *stream = ui_file_data (file); int non_null_chars; + if (stream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_adjust_strbuf: bad magic number")); @@ -223,6 +232,7 @@ static void tui_file_flush (struct ui_file *file) { struct tui_stream *stream = ui_file_data (file); + if (stream->ts_magic != &tui_file_magic) internal_error (__FILE__, __LINE__, _("tui_file_flush: bad magic number")); diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index cb8ec87..ae23a6c 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -169,6 +169,7 @@ tui_command_loop (void *data) while (1) { int result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL); + if (result < 0) break; diff --git a/gdb/tui/tui-main.c b/gdb/tui/tui-main.c index e073096..f302bd6 100644 --- a/gdb/tui/tui-main.c +++ b/gdb/tui/tui-main.c @@ -27,6 +27,7 @@ int main (int argc, char **argv) { struct captured_main_args args; + memset (&args, 0, sizeof args); args.argc = argc; args.argv = argv; diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 0b8ad00..8cd6b88 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -53,6 +53,7 @@ tui_field_int (struct ui_out *uiout, int value) { tui_out_data *data = ui_out_data (uiout); + if (data->base.suppress_output) return; @@ -80,6 +81,7 @@ tui_field_string (struct ui_out *uiout, const char *string) { tui_out_data *data = ui_out_data (uiout); + if (data->base.suppress_output) return; @@ -110,6 +112,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno, va_list args) { tui_out_data *data = ui_out_data (uiout); + if (data->base.suppress_output) return; @@ -124,6 +127,7 @@ static void tui_text (struct ui_out *uiout, const char *string) { tui_out_data *data = ui_out_data (uiout); + if (data->base.suppress_output) return; data->start_of_line ++; @@ -166,7 +170,7 @@ extern void _initialize_tui_out (void); void _initialize_tui_out (void) { -/* Inherit the CLI version. */ + /* Inherit the CLI version. */ tui_ui_out_impl = cli_ui_out_impl; /* Override a few methods. */ diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 7c0ebce..5df09af 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -743,8 +743,8 @@ tui_get_register (struct frame_info *frame, if (target_has_registers) { gdb_byte buf[MAX_REGISTER_SIZE]; - get_frame_register (frame, regnum, buf); + get_frame_register (frame, regnum, buf); if (changedp) { struct gdbarch *gdbarch = get_frame_arch (frame); diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 8bd3055..ddad6a1 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -64,6 +64,7 @@ tui_set_source_content (struct symtab *s, if (!noerror) { char *name = alloca (strlen (s->filename) + 100); + sprintf (name, "%s:%d", s->filename, line_no); print_sys_errmsg (name, errno); } @@ -116,7 +117,7 @@ tui_set_source_content (struct symtab *s, while (cur_line < nlines) { 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. */ c = fgetc (stream); @@ -263,6 +264,7 @@ tui_set_source_content_nil (struct tui_win_info *win_info, struct tui_win_element *element = (struct tui_win_element *) win_info->generic.content[curr_line]; + element->which_element.source.line_or_addr.loa = LOA_LINE; element->which_element.source.line_or_addr.u.line_no = 0; element->which_element.source.is_exec_point = FALSE; diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index d6b514d..7aaf544 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -355,6 +355,7 @@ tui_show_frame_info (struct frame_info *fi) for (i = 0; i < (tui_source_windows ())->count; i++) { union tui_which_element *item; + win_info = (tui_source_windows ())->list[i]; item = &((struct tui_win_element *) locator->content[0])->which_element; @@ -378,6 +379,7 @@ tui_show_frame_info (struct frame_info *fi) if (win_info == TUI_SRC_WIN) { struct tui_line_or_address l; + l.loa = LOA_LINE; l.u.line_no = start_line; if (!(source_already_displayed @@ -395,6 +397,7 @@ tui_show_frame_info (struct frame_info *fi) if (win_info == TUI_DISASM_WIN) { struct tui_line_or_address a; + a.loa = LOA_ADDRESS; a.u.addr = low; if (!tui_addr_is_displayed (item->locator.addr, win_info, TRUE)) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 50e054e..d7d5e39 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -827,6 +827,7 @@ tui_initialize_win (void) #ifdef SIGWINCH #ifdef HAVE_SIGACTION struct sigaction old_winch; + memset (&old_winch, 0, sizeof (old_winch)); old_winch.sa_handler = &tui_sigwinch_handler; sigaction (SIGWINCH, &old_winch, NULL); @@ -1241,6 +1242,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, if ((TUI_CMD_WIN->generic.height + diff) < 1) { int i; + for (i = TUI_CMD_WIN->generic.height + diff; (i < 1); i++) if (primary_win_info == first_win) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index d6f83e8..2e07fc8 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -221,7 +221,8 @@ tui_clear_source_content (struct tui_win_info *win_info, for (i = 0; i < win_info->generic.content_size; i++) { struct tui_win_element *element = - (struct tui_win_element *) win_info->generic.content[i]; + (struct tui_win_element *) win_info->generic.content[i]; + element->which_element.source.has_break = FALSE; element->which_element.source.is_exec_point = FALSE; } @@ -328,6 +329,7 @@ tui_horizontal_source_scroll (struct tui_win_info *win_info, if (win_info->generic.type == SRC_WIN) { struct symtab_and_line cursal = get_current_source_symtab_and_line (); + if (cursal.symtab == NULL) s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL))); else diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index e126d81..fb736a9 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -244,6 +244,7 @@ tui_rl_command_key (int count, int key) /* 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); return 0; @@ -530,6 +531,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. */ tui_add_win_to_layout (SRC_WIN); |