diff options
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-command.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-command.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-data.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-data.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.c | 40 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-file.c | 8 | ||||
-rw-r--r-- | gdb/tui/tui-file.h | 13 | ||||
-rw-r--r-- | gdb/tui/tui-hooks.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-hooks.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-interp.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-io.c | 10 | ||||
-rw-r--r-- | gdb/tui/tui-io.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-layout.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-layout.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-location.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-location.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-regs.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-regs.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-source.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-source.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-status.c | 14 | ||||
-rw-r--r-- | gdb/tui/tui-status.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-win.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-win.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-wingeneral.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-wingeneral.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui.c | 39 | ||||
-rw-r--r-- | gdb/tui/tui.h | 2 |
31 files changed, 115 insertions, 83 deletions
diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index 677721d..9bd33e2 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -1,6 +1,6 @@ /* Specific command window processing. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h index 61f8cf3..2f82291 100644 --- a/gdb/tui/tui-command.h +++ b/gdb/tui/tui-command.h @@ -1,6 +1,6 @@ /* Specific command window processing. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 962dbc5..7d1d055 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -1,6 +1,6 @@ /* TUI data manipulation routines. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 6f2087b..dd33a59 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -1,6 +1,6 @@ /* TUI data manipulation routines. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index bb1ff7b..07453b4 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -1,6 +1,6 @@ /* Disassembly display. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -100,6 +100,9 @@ tui_disassemble (struct gdbarch *gdbarch, { bool term_out = disassembler_styling && gdb_stdout->can_emit_style_escape (); string_file gdb_dis_out (term_out); + struct ui_file *stream = (addr_size == nullptr + ? (decltype (stream))&null_stream + : (decltype (stream))&gdb_dis_out); /* Must start with an empty list. */ asm_lines.clear (); @@ -108,11 +111,13 @@ tui_disassemble (struct gdbarch *gdbarch, for (int i = 0; i < count; ++i) { tui_asm_line tal; - CORE_ADDR orig_pc = pc; + + /* Save the instruction address. */ + tal.addr = pc; try { - pc = pc + gdb_print_insn (gdbarch, pc, &gdb_dis_out, NULL); + pc += gdb_print_insn (gdbarch, pc, stream, NULL); } catch (const gdb_exception_error &except) { @@ -124,25 +129,24 @@ tui_disassemble (struct gdbarch *gdbarch, return pc; } + /* If that's all we need, continue. */ + if (addr_size == nullptr) + { + asm_lines.push_back (std::move (tal)); + continue; + } + /* Capture the disassembled instruction. */ tal.insn = gdb_dis_out.release (); /* And capture the address the instruction is at. */ - tal.addr = orig_pc; - print_address (gdbarch, orig_pc, &gdb_dis_out); + print_address (gdbarch, tal.addr, &gdb_dis_out); tal.addr_string = gdb_dis_out.release (); + tal.addr_size = (term_out + ? len_without_escapes (tal.addr_string) + : tal.addr_string.size ()); - if (addr_size != nullptr) - { - size_t new_size; - - if (term_out) - new_size = len_without_escapes (tal.addr_string); - else - new_size = tal.addr_string.size (); - *addr_size = std::max (*addr_size, new_size); - tal.addr_size = new_size; - } + *addr_size = std::max (*addr_size, tal.addr_size); asm_lines.push_back (std::move (tal)); } @@ -546,9 +550,7 @@ run_tests () } /* namespace selftests */ #endif /* GDB_SELF_TEST */ -void _initialize_tui_disasm (); -void -_initialize_tui_disasm () +INIT_GDB_FILE (tui_disasm) { #if GDB_SELF_TEST selftests::register_test ("tui-disasm", selftests::tui::disasm::run_tests); diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h index 4279bb0..173cc8b 100644 --- a/gdb/tui/tui-disasm.h +++ b/gdb/tui/tui-disasm.h @@ -1,6 +1,6 @@ /* Disassembly display. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c index 17ac138..df6f503 100644 --- a/gdb/tui/tui-file.c +++ b/gdb/tui/tui-file.c @@ -1,5 +1,5 @@ /* UI_FILE - a generic STDIO like output stream. - Copyright (C) 1999-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -21,7 +21,7 @@ #include "tui/tui-command.h" void -tui_file::puts (const char *linebuffer) +tui_file::do_puts (const char *linebuffer) { tui_puts (linebuffer); if (!m_buffered) @@ -29,7 +29,7 @@ tui_file::puts (const char *linebuffer) } void -tui_file::write (const char *buf, long length_buf) +tui_file::do_write (const char *buf, long length_buf) { tui_write (buf, length_buf); if (!m_buffered) @@ -41,5 +41,5 @@ tui_file::flush () { if (m_buffered) tui_cmd_win ()->refresh_window (); - stdio_file::flush (); + escape_buffering_file::flush (); } diff --git a/gdb/tui/tui-file.h b/gdb/tui/tui-file.h index 6178a90..b6dc058 100644 --- a/gdb/tui/tui-file.h +++ b/gdb/tui/tui-file.h @@ -1,5 +1,5 @@ /* TUI_FILE - a STDIO-like output stream for the TUI. - Copyright (C) 1999-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -23,18 +23,21 @@ /* A STDIO-like output stream for the TUI. */ -class tui_file : public stdio_file +class tui_file : public escape_buffering_file { public: tui_file (FILE *stream, bool buffered) - : stdio_file (stream), + : escape_buffering_file (stream), m_buffered (buffered) {} - void write (const char *buf, long length_buf) override; - void puts (const char *) override; void flush () override; +protected: + + void do_write (const char *buf, long length_buf) override; + void do_puts (const char *) override; + private: /* True if this stream is buffered. */ diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 69294cc..024fedd 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -1,6 +1,6 @@ /* GDB hooks for TUI. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -262,9 +262,7 @@ tui_remove_hooks (void) tui_attach_detach_observers (false); } -void _initialize_tui_hooks (); -void -_initialize_tui_hooks () +INIT_GDB_FILE (tui_hooks) { /* Install the permanent hooks. */ gdb::observers::new_objfile.attach (tui_new_objfile_hook, "tui-hooks"); diff --git a/gdb/tui/tui-hooks.h b/gdb/tui/tui-hooks.h index 21ba169..6fee785 100644 --- a/gdb/tui/tui-hooks.h +++ b/gdb/tui/tui-hooks.h @@ -1,6 +1,6 @@ /* External/Public TUI hools header file, for GDB the GNU debugger. - Copyright (C) 2004-2024 Free Software Foundation, Inc. + Copyright (C) 2004-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index 25761be..3d0e152 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -1,6 +1,6 @@ /* TUI Interpreter definitions for GDB, the GNU debugger. - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -161,9 +161,7 @@ tui_interp_factory (const char *name) return new tui_interp (name); } -void _initialize_tui_interp (); -void -_initialize_tui_interp () +INIT_GDB_FILE (tui_interp) { interp_factory_register (INTERP_TUI, tui_interp_factory); diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index b3ede07..c97e8fd 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -1,6 +1,6 @@ /* TUI support I/O functions. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -319,6 +319,8 @@ tui_apply_style (WINDOW *w, ui_file_style style) wattron (w, A_NORMAL); wattroff (w, A_BOLD); wattroff (w, A_DIM); + wattroff (w, A_ITALIC); + wattroff (w, A_UNDERLINE); wattroff (w, A_REVERSE); if (last_color_pair != -1) wattroff (w, COLOR_PAIR (last_color_pair)); @@ -366,6 +368,12 @@ tui_apply_style (WINDOW *w, ui_file_style style) gdb_assert_not_reached ("invalid intensity"); } + if (style.is_italic ()) + wattron (w, A_ITALIC); + + if (style.is_underline ()) + wattron (w, A_UNDERLINE); + if (style.is_reverse ()) wattron (w, A_REVERSE); diff --git a/gdb/tui/tui-io.h b/gdb/tui/tui-io.h index 66b3b90..aa931f8 100644 --- a/gdb/tui/tui-io.h +++ b/gdb/tui/tui-io.h @@ -1,6 +1,6 @@ /* TUI support I/O functions. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 3fac65f..558055d 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -1,6 +1,6 @@ /* TUI layout window management. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -1294,9 +1294,7 @@ tui_new_layout_command (const char *spec, int from_tty) /* Function to initialize gdb commands, for tui window layout manipulation. */ -void _initialize_tui_layout (); -void -_initialize_tui_layout () +INIT_GDB_FILE (tui_layout) { struct cmd_list_element *layout_cmd = add_basic_prefix_cmd ("layout", class_tui, _("\ diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h index 107b123..6046bb6 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -1,6 +1,6 @@ /* TUI layout window management. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-location.c b/gdb/tui/tui-location.c index 8e63d4f..24a14fb 100644 --- a/gdb/tui/tui-location.c +++ b/gdb/tui/tui-location.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2021-2024 Free Software Foundation, Inc. +/* Copyright (C) 2021-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/tui/tui-location.h b/gdb/tui/tui-location.h index 5eda4bd..eecefbc 100644 --- a/gdb/tui/tui-location.h +++ b/gdb/tui/tui-location.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021-2024 Free Software Foundation, Inc. +/* Copyright (C) 2021-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 5158c06..ac2757a 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -1,6 +1,6 @@ /* TUI display registers in window. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -566,9 +566,7 @@ tui_reggroup_completer (struct cmd_list_element *ignore, complete_on_enum (tracker, extra, text, word); } -void _initialize_tui_regs (); -void -_initialize_tui_regs () +INIT_GDB_FILE (tui_regs) { struct cmd_list_element **tuicmd, *cmd; diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index 48f6aa0..5f7afa6 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -1,6 +1,6 @@ /* TUI display registers in window. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 2ef0308..e2dff84 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -1,6 +1,6 @@ /* TUI display source window. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h index 10702b2..626ac40 100644 --- a/gdb/tui/tui-source.h +++ b/gdb/tui/tui-source.h @@ -1,6 +1,6 @@ /* TUI display source window. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-status.c b/gdb/tui/tui-status.c index fa2d07c..1e09975 100644 --- a/gdb/tui/tui-status.c +++ b/gdb/tui/tui-status.c @@ -1,6 +1,6 @@ /* TUI status line. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -271,10 +271,14 @@ tui_show_frame_info (const frame_info_ptr &fi) symtab_and_line sal = find_frame_sal (fi); const char *func_name; + std::optional<CORE_ADDR> tmp_pc = get_frame_pc_if_available (fi); /* find_frame_sal does not always set PC, but we want to ensure that it is available in the SAL. */ - if (get_frame_pc_if_available (fi, &sal.pc)) - func_name = tui_get_function_from_frame (fi); + if (tmp_pc.has_value ()) + { + sal.pc = *tmp_pc; + func_name = tui_get_function_from_frame (fi); + } else func_name = _("<unavailable>"); @@ -325,9 +329,7 @@ tui_update_command (const char *arg, int from_tty) /* Function to initialize gdb commands, for tui window stack manipulation. */ -void _initialize_tui_stack (); -void -_initialize_tui_stack () +INIT_GDB_FILE (tui_stack) { add_com ("update", class_tui, tui_update_command, _("\ diff --git a/gdb/tui/tui-status.h b/gdb/tui/tui-status.h index 8b507fd..2a84732 100644 --- a/gdb/tui/tui-status.h +++ b/gdb/tui/tui-status.h @@ -1,6 +1,6 @@ /* TUI status line. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 95639f5..d4fbbf1 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1,6 +1,6 @@ /* TUI window generic functions. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -1091,9 +1091,7 @@ bool tui_left_margin_verbose = false; /* Function to initialize gdb commands, for tui window manipulation. */ -void _initialize_tui_win (); -void -_initialize_tui_win () +INIT_GDB_FILE (tui_win) { static struct cmd_list_element *tui_setlist; static struct cmd_list_element *tui_showlist; diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h index 1521993..64153cf 100644 --- a/gdb/tui/tui-win.h +++ b/gdb/tui/tui-win.h @@ -1,6 +1,6 @@ /* TUI window generic functions. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index 90fdaceb..de4ef52 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -1,6 +1,6 @@ /* General window behavior. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h index b037e79..0e0e5fe 100644 --- a/gdb/tui/tui-wingeneral.h +++ b/gdb/tui/tui-wingeneral.h @@ -1,6 +1,6 @@ /* General window behavior. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index b5889a8..618d72b 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -1,6 +1,6 @@ /* TUI display source/assembly window. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -461,7 +461,9 @@ tui_source_window_base::rerender () /* find_frame_sal does not always set SAL.PC, but we want to ensure that it is available in the SAL before updating the window. */ - get_frame_pc_if_available (frame, &sal.pc); + std::optional<CORE_ADDR> tmp_pc = get_frame_pc_if_available (frame); + if (tmp_pc.has_value ()) + sal.pc = *tmp_pc; maybe_update (get_frame_arch (frame), sal); update_exec_info (false); diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index deae786..b531f0e 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -1,6 +1,6 @@ /* TUI display source/assembly window. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 491fcb1..01aee2f 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -1,6 +1,6 @@ /* General functions for the WDB TUI. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -67,7 +67,12 @@ show_tui_debug (struct ui_file *file, int from_tty, /* Tells whether the TUI is active or not. */ bool tui_active = false; -static bool tui_finish_init = true; + +/* Tells whether the TUI should do deferred curses initialization. + If TRIBOOL_TRUE, then yes. If TRIBOOL_FALSE. then no (because + initialization is already done). If TRIBOOL_UNKNOWN, then no (because + initialization failed). */ +static tribool tui_finish_init = TRIBOOL_TRUE; enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE; @@ -120,6 +125,19 @@ tui_rl_switch_mode (int notused1, int notused2) } else { + /* If we type "foo", entering it into the readline buffer + + (gdb) foo + ^ + and then switch to TUI and back, we may get back + + (gdb) foo + ^ + which is confusing because "foo" is no longer part of the + readline buffer. Fix this by clearing it before switching to + TUI. */ + rl_clear_visible_line (); + /* If tui_enable throws, we'll re-prep below. */ rl_deprep_terminal (); tui_enable (); @@ -392,7 +410,13 @@ tui_enable (void) /* To avoid to initialize curses when gdb starts, there is a deferred curses initialization. This initialization is made only once and the first time the curses mode is entered. */ - if (tui_finish_init) + if (tui_finish_init == TRIBOOL_UNKNOWN) + { + /* Initialization failed before, just throw a generic error, don't try + again. */ + error (_("Cannot enable the TUI")); + } + else if (tui_finish_init == TRIBOOL_TRUE) { WINDOW *w; SCREEN *s; @@ -412,6 +436,9 @@ tui_enable (void) if (!gdb_stderr->isatty ()) error (_("Cannot enable the TUI when output is not a terminal")); + /* Don't try initialization again. */ + tui_finish_init = TRIBOOL_UNKNOWN; + s = newterm (NULL, stdout, stdin); #ifdef __MINGW32__ /* The MinGW port of ncurses requires $TERM to be unset in order @@ -470,7 +497,7 @@ tui_enable (void) tui_set_win_focus_to (tui_src_win ()); keypad (tui_cmd_win ()->handle.get (), TRUE); wrefresh (tui_cmd_win ()->handle.get ()); - tui_finish_init = false; + tui_finish_init = TRIBOOL_FALSE; } else { @@ -604,9 +631,7 @@ tui_get_command_dimension (unsigned int *width, return true; } -void _initialize_tui (); -void -_initialize_tui () +INIT_GDB_FILE (tui) { struct cmd_list_element **tuicmd; diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 319bd2e..3a9d955 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -1,6 +1,6 @@ /* External/Public TUI Header File. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. |