aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-winsource.h
AgeCommit message (Collapse)AuthorFilesLines
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-10-19Don't erase TUI source window when switching focusTom Tromey1-3/+2
PR tui/26719 points out that switching the focus can erase the TUI source window. This is a regression introduced by the patch to switch the source window to using a pad. This patch fixes the bug by arranging to call prefresh whenever the window is refreshed. 2020-10-19 Tom Tromey <tromey@adacore.com> PR tui/26719 * tui/tui-winsource.h (struct tui_source_window_base) <refresh_window>: Rename from refresh_pad. * tui/tui-winsource.c (tui_source_window_base::refresh_window): Rename from refresh_pad. (tui_source_window_base::show_source_content) (tui_source_window_base::do_scroll_horizontal): Update. gdb/testsuite/ChangeLog 2020-10-19 Tom Tromey <tromey@adacore.com> PR tui/26719 * gdb.tui/list.exp: Check source window contents after focus change.
2020-09-27Use a curses pad for source and disassembly windowsTom Tromey1-11/+30
This changes the TUI source and disassembly windows to use a curses pad for their text. This is an important step toward properly handling non-ASCII characters, because it makes it easy to scroll horizontally without needing gdb to also understand multi-byte character boundaries -- this can be wholly delegated to curses. Horizontal scrolling is probably also faster now, because no re-rendering is required. gdb/ChangeLog 2020-09-27 Tom Tromey <tom@tromey.com> * unittests/tui-selftests.c: Update. * tui/tui-winsource.h (struct tui_source_window_base) <extra_margin, show_line_number, refresh_pad>: New methods. <m_max_length, m_pad>: New members. (tui_copy_source_line): Update. * tui/tui-winsource.c (tui_copy_source_line): Remove line_no, first_col, line_width, ndigits parameters. Add length. (tui_source_window_base::show_source_line): Write to pad. Line number now 0-based. (tui_source_window_base::refresh_pad): New method. (tui_source_window_base::show_source_content): Write to pad. Call refresh_pad. (tui_source_window_base::do_scroll_horizontal): Call refresh_pad, not refill. (tui_source_window_base::update_exec_info): Call show_line_number. * tui/tui-source.h (struct tui_source_window) <extra_margin>: New method. <m_digits>: New member. * tui/tui-source.c (tui_source_window::set_contents): Set m_digits and m_max_length. (tui_source_window::show_line_number): New method. * tui/tui-io.h (tui_puts): Fix comment. * tui/tui-disasm.c (tui_disasm_window::set_contents): Set m_max_length.
2020-07-23[gdb/tui] Fix Wmaybe-uninitialized warning in tui-winsource.cTom de Vries1-0/+5
When compiling with CFLAGS/CXXFLAGS="-O0 -g -Wall" and using g++ 11.0.0, we run into: ... src/gdb/tui/tui-winsource.c: In function \ 'void tui_update_all_breakpoint_info(breakpoint*)': src/gdb/tui/tui-winsource.c:427:58: warning: '<unknown>' may be used \ uninitialized [-Wmaybe-uninitialized] 427 | for (tui_source_window_base *win : tui_source_windows ()) | ^ In file included from src/gdb/tui/tui-winsource.c:38: src/gdb/tui/tui-winsource.h:236:30: note: by argument 1 of type \ 'const tui_source_windows*' to 'tui_source_window_iterator \ tui_source_windows::begin() const' declared here 236 | tui_source_window_iterator begin () const | ^~~~~ src/gdb/tui/tui-winsource.c:427:58: note: '<anonymous>' declared here 427 | for (tui_source_window_base *win : tui_source_windows ()) | ^ ... The warning doesn't make sense for an empty struct, PR gcc/96295 has been filed about that. For now, work around the warning by defining a default constructor. Build on x86_64-linux. gdb/ChangeLog: 2020-07-23 Tom de Vries <tdevries@suse.de> PR tui/26282 * tui/tui-winsource.h (struct tui_source_windows::tui_source_windows): New default constructor.
2020-07-01Move some code out of tui-data.hTom Tromey1-0/+17
This moves some code out of tui-data.h, to more closely related places. Some unused forward declarations are also removed. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (SINGLE_KEY): Move from tui-data.h * tui/tui-winsource.h (enum tui_line_or_address_kind) (struct tui_line_or_address): Move from tui-data.h. * tui/tui-win.c (DEFAULT_TAB_LEN): Move from tui-data.h. * tui/tui-data.h (DEFAULT_TAB_LEN): Move to tui-win.c. (tui_cmd_window, tui_source_window_base, tui_source_window) (tui_disasm_window): Don't declare. (enum tui_line_or_address_kind, struct tui_line_or_address): Move to tui-winsource.h. (SINGLE_KEY): Move to tui-stack.c.
2020-02-22Make some tui_source_window_base members "protected"Tom Tromey1-8/+15
This renames a few members of tui_source_window_base, and makes them "protected". 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (extract_display_start_addr): Rewrite. * tui/tui-disasm.h (struct tui_disasm_window) <display_start_addr>: Declare. * tui/tui-source.h (struct tui_source_window) <display_start_addr>: Declare. * tui/tui-winsource.h (struct tui_source_window_base) <show_source_line, display_start_addr>: New methods. <m_horizontal_offset, m_start_line_or_addr, m_gdbarch, m_content>: Rename and move to protected section. * tui/tui-winsource.c (tui_source_window_base::update_source_window) (tui_source_window_base::do_erase_source_content): Update. (tui_source_window_base::show_source_line): Now a method. (tui_source_window_base::show_source_content) (tui_source_window_base::tui_source_window_base) (tui_source_window_base::rerender) (tui_source_window_base::refill) (tui_source_window_base::do_scroll_horizontal) (tui_source_window_base::set_is_exec_point_at) (tui_source_window_base::update_breakpoint_info) (tui_source_window_base::update_exec_info): Update. * tui/tui-source.c (tui_source_window::set_contents) (tui_source_window::showing_source_p) (tui_source_window::do_scroll_vertical) (tui_source_window::location_matches_p) (tui_source_window::line_is_displayed): Update. (tui_source_window::display_start_addr): New method. * tui/tui-disasm.c (tui_disasm_window::set_contents) (tui_disasm_window::do_scroll_vertical) (tui_disasm_window::location_matches_p): Update. (tui_disasm_window::display_start_addr): New method. Change-Id: I74d72b9da5f458664427db643a108634690c6e19
2020-02-22TUI windows do not need to store their typeTom Tromey1-1/+1
TUI windows no longer need to store their type -- there's only a single spot that uses this information, and it can be changed to use dynamic_cast. (It could be cleaned up even more, by using a virtual method, but I haven't done so.) This patch removes the "type" field from tui_gen_win_info, and this in turn allows removing a couple of enumerator constants. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>: Remove constants. * tui/tui-winsource.h (struct tui_source_window_base) <tui_source_window_base>: Remove parameter. * tui/tui-winsource.c (tui_source_window_base::tui_source_window_base): Remove parameter. (tui_source_window_base::refill): Update. * tui/tui-stack.h (struct tui_locator_window) <tui_locator_window>: Update. * tui/tui-source.h (struct tui_source_window) <tui_source_window>: Default the constructor. * tui/tui-regs.h (struct tui_data_item_window) <tui_data_item_window>: Default the constructor. (struct tui_data_window) <tui_data_window>: Likewise. * tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>: Default the constructor. * tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>: Default the constructor. <type>: Remove. (struct tui_win_info) <tui_win_info>: Default the constructor. * tui/tui-data.c (tui_win_info::tui_win_info): Remove. * tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>: Default the constructor. Change-Id: I594cd07d2e0bba71ad594a6fb263904ce2febcd6
2020-02-22Change TUI window iterationTom Tromey1-10/+16
This changes the TUI to track all the instantiated windows in a new global vector. After this, iteration over TUI windows is done by simply iterating over this vector. This approach makes it simpler to define new window types. In particular, a subsequent patch will add the ability to define a TUI window from Python. Note that this series will not remove tui_win_list. This will continue to exist in parallel, only because it was simpler to leave this alone. Perhaps it could still be removed in the future. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_iterator) <inner_iterator>: New etytypedef. <tui_source_window_iterator>: Take "end" parameter. <tui_source_window_iterator>: Take iterator. <operator*, advance>: Update. <m_iter>: Change type. <m_end>: New field. (struct tui_source_windows) <begin, end>: Update. * tui/tui-layout.c (tui_windows): New global. (tui_apply_current_layout): Clear tui_windows. (tui_layout_window::apply): Update tui_windows. * tui/tui-data.h (tui_windows): Declare. (all_tui_windows): Now inline function. (class tui_window_iterator, struct all_tui_windows): Remove. Change-Id: I6ab77976d6326f427178f725434f8f82046e0bbf
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-12-20Simplify tui_update_source_windows_with_lineTom Tromey1-2/+1
This changes tui_update_source_windows_with_line to take a symtab_and_line, rather than separate parameters, and then updates the caller. gdb/ChangeLog 2019-12-20 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_show_source): Update. * tui/tui-winsource.h (tui_update_source_windows_with_line): Update. * tui/tui-winsource.c (tui_update_source_windows_with_line): Take a symtab_symbol_info, not a separate symtab and line. Simplify. Change-Id: I8803a0a6fd2938ceee859aea53a57ce582f3e80d
2019-12-20Use symtab_and_line when updating TUI windowsTom Tromey1-6/+3
This changes a few TUI source window methods to take a symtab_and_line rather than separate symtab and tui_line_or_address parameters. A symtab_and_line already incorporates the same information, so this seemed simpler. Also, it helps avoid the problem that the source and disassembly windows need different information -- both forms are present in the SAL. gdb/ChangeLog 2019-12-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_contents, update_source_window_as_is, update_source_window>: Take a sal, not a separate symtab and tui_line_or_address. * tui/tui-winsource.c (tui_source_window_base::update_source_window) (tui_source_window_base::update_source_window_as_is): Take a sal, not a separate symtab and tui_line_or_address. (tui_update_source_windows_with_addr) (tui_update_source_windows_with_line) (tui_source_window_base::rerender) (tui_source_window_base::refill): Update. * tui/tui-source.h (struct tui_source_window) <set_contents>: Take a sal, not a separate symtab and tui_line_or_address. * tui/tui-source.c (tui_source_window::set_contents): Take a sal, not a separate symtab and tui_line_or_address. (tui_source_window::maybe_update): Update. * tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Take a sal, not a separate symtab and tui_line_or_address. * tui/tui-disasm.c (tui_disasm_window::set_contents): Take a sal, not a separate symtab and tui_line_or_address. (tui_disasm_window::do_scroll_vertical) (tui_disasm_window::maybe_update): Update. Change-Id: I6974a03589930a0f910c657ef50b7f6f7397c87d
2019-12-20Change tui_source_window_base::set_contents to return boolTom Tromey1-4/+3
This changes tui_source_window_base::set_contents to return bool, rather than tui_status. It also changes one implementation of set_contents to use early returns rather than a variable, which IMO makes it easier to follow. gdb/ChangeLog 2019-12-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_contents>: Return bool. * tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is): Update. * tui/tui-source.h (struct tui_source_window) <set_contents>: Return bool. * tui/tui-source.c (tui_source_window::set_contents): Return bool. Simplify. * tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Return bool. * tui/tui-disasm.c (tui_disasm_window::set_contents): Return bool. Change-Id: I8c5212400cd7aadf35760c22d5344cd3b9435674
2019-12-20Simplify tui_source_window_base::maybe_update methodTom Tromey1-2/+1
tui_source_window_base::maybe_update takes a symtab_and_line, plus a separate line number and PC. Because a symtab_and_line already holds a line number and a PC, it is possible to remove these extra parameters. gdb/ChangeLog 2019-12-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <maybe_update>: Remove line_no and addr parameters. * tui/tui-stack.c (tui_show_frame_info): Set PC on sal. Update. * tui/tui-source.h (struct tui_source_window) <maybe_update>: Update. * tui/tui-source.c (tui_source_window::maybe_update): Remove line_no and addr parameters. * tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>: Update. * tui/tui-disasm.c (tui_disasm_window::maybe_update): Remove line_no and addr parameters. Change-Id: I33d8e1a669a179544edb4197f5f7c5429dfc368e
2019-12-01Allow using less horizontal space in TUI source windowTom Tromey1-3/+7
The source window currently uses a field width of 6 for line numbers, and it further aligns to the next tab stop. This seemed a bit wasteful of horizontal space to me, so I changed that in an earlier patch. However, that change wasn't universally popular. This patch instead adds the option to use less horizontal space in the TUI source window. gdb/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_copy_source_line): Add "ndigits" parameter. * tui/tui-winsource.c (tui_copy_source_line): Add "ndigits" parameter. * tui/tui-win.h (compact_source): Declare. * tui/tui-win.c (compact_source): New global. (tui_set_compact_source, tui_show_compact_source): New functions. (_initialize_tui_win): Add "compact-source" setting. * tui/tui-source.c (tui_source_window::set_contents): Handle compact_source setting. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. * NEWS: Document new setting. gdb/doc/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Configuration): Document new setting. Change-Id: I46ce9a68b12c9c79332d510f9c14b3c84b7efadd
2019-11-05Style disassembly in the TUITom Tromey1-3/+21
This patch changes the TUI disassembly window to style its contents. The styling should be identical to what is seen in the CLI. This involved a bit of rearrangement, so that the source and disassembly windows could share both the copy_source_line utility function, and the ability to react to changes in "set style enabled". This version introduces a new function to strip the styling from the address string when computing the length. As a byproduct, it also removes the unused "insn_size" computation from tui_disasm_window::set_contents. gdb/ChangeLog 2019-11-05 Tom Tromey <tom@tromey.com> * tui/tui-source.h (struct tui_source_window): Inline constructor. Remove destructor. <style_changed, m_observable>: Move to superclass. * tui/tui-winsource.h (tui_copy_source_line): Declare. (struct tui_source_window_base): Move private members to end. <style_changed, m_observable>: Move from tui_source_window. * tui/tui-winsource.c (tui_copy_source_line): Move from tui-source.c. Rename from copy_source_line. Add special handling for negative line number. (tui_source_window_base::style_changed): Move from tui_source_window. (tui_source_window_base): Register observer. (~tui_source_window_base): New. * tui/tui-source.c (copy_source_line): Move to tui-winsource.c; rename. (tui_source_window::set_contents): Use tui_copy_source_line. (tui_source_window::tui_source_window): Move to tui-source.h. (tui_source_window::~tui_source_window): Remove. (tui_source_window::style_changed): Move to superclass. * tui/tui-disasm.c (tui_disassemble): Create string file with styling, when possible. Add "addr_size" parameter. (tui_disasm_window::set_contents): Use tui_copy_source_line. Don't compute maximum size. (len_without_escapes): New function Change-Id: I8722635eeecbbb1633d943a65b856404c2d467b0
2019-11-05Change tui_source_element::line to have type std::stringTom Tromey1-1/+1
This changes tui_source_element::line to be of type std::string. This reduces the number of copies made. gdb/ChangeLog 2019-11-05 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_element) <line>: Now a std::string. * tui/tui-winsource.c (tui_show_source_line): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. Change-Id: Id600f3e1d386a2911f187366e05e2ec599068dd2
2019-10-21Remove tui_exec_info_contentTom Tromey1-2/+0
I happened to notice that the tui_exec_info_content typedef is unused. This patch removes it. Tested by rebuilding. gdb/ChangeLog 2019-10-21 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_exec_info_content): Remove typedef. Change-Id: I768edc482366e830eb4528c799686bb27518cdcb
2019-09-20Simplify tui_source_window_base::show_source_contentTom Tromey1-2/+3
tui_source_window_base::show_source_content is not used outside the class any more, so this makes it private. Examining the callers shows that it can't be called without source contents, so it can be simplified as well. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_source_content>: Now private. * tui/tui-winsource.c (tui_source_window_base::show_source_content): Don't handle empty content case.
2019-09-20Move "fullname" to tui_source_windowTom Tromey1-4/+1
The "fullname" field in tui_source_window_base is only used by one subclass. This patch moves the field to that subclass, and changes it to be a unique_xmalloc_ptr. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <~tui_source_window_base>: Don't declare. <fullname>: Remove. * tui/tui-winsource.c (~tui_source_window_base): Remove. * tui/tui-source.h (struct tui_source_window) <fullname>: New member. * tui/tui-source.c (tui_source_window::set_contents): Update. (tui_source_window::location_matches_p) (tui_source_window::maybe_update): Update.
2019-09-20Change tui_source_element::line to be a unique_xmalloc_ptrTom Tromey1-8/+2
This changes tui_source_element::line to be a unique_xmalloc_ptr, removing some manual memory management. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (~tui_source_element): Remove. (tui_source_element): Update. (struct tui_source_element) <line>: Now a unique_xmalloc_ptr. * tui/tui-winsource.c (tui_show_source_line): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update.
2019-09-20Remove tui_clear_source_windows_detailTom Tromey1-2/+0
The calls to tui_clear_source_windows_detail in tui_add_win_to_layout aren't needed, because (after the resize unification) resizing will update the window contents. Removing these calls lets us remove several other things as well. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-data.h (tui_clear_source_windows_detail): Don't declare. * tui/tui-layout.c (tui_add_win_to_layout): Don't call tui_clear_source_windows_detail. * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::clear_detail): Remove. * tui/tui-data.c (tui_clear_source_windows_detail): Remove.
2019-08-30Remove tui_win_info::refresh_allTom Tromey1-2/+0
The TUI has two duplicate "re-render this window" methods, "rerender" and "refresh_all". They differ only slightly in semantics, so I wanted to see if they could be unified. After looking into this, I decided that refresh_all was not needed. There are 4 calls to tui_refresh_all_win (the only caller of this method): 1. tui_enable. This sets the layout, which renders the windows. 2. tui_cont_sig. Here, I think it's sufficient to simply redraw the current window contents from the curses backing store, because gdb state didn't change while it was suspended 3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's explicitly enough to just refresh the screen (as above). 4. tui_refresh_all_command. This is the command equivalent of C-l. So, this patch removes this method entirely and simplifies tui_refresh_all_win. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <refresh_all>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Remove. * tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or tui_show_locator_content. * tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't declare. * tui/tui-regs.c (tui_data_window::refresh_all): Remove. * tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't declare.
2019-08-16Remove the TUI execution info windowTom Tromey1-17/+0
The TUI execution info window is unusual in that it is always linked to a source or disassembly window. Even updates of its content are handled by the source window, so it really has no life of its own. This patch removes this window entirely and puts its functionality directly into the source window. This simplifies the code somewhat. This is a user-visible change, because now the box around the source (or disassembly) window encloses the execution info as well. I consider this an improvement as well, though. Note that this patch caused ncurses to start emitting the "CSI Z" sequence, so I've added this to the test suite terminal implementation. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <EXEC_INFO_WIN>: Remove. * tui/tui-winsource.h (struct tui_exec_info_window): Remove. (struct tui_source_window_base) <make_visible, refresh_window, resize>: Remove methods. <execution_info>: Remove field. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content) (tui_show_source_line, tui_source_window_base) (~tui_source_window_base): Update. (tui_source_window_base::resize) (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Remove. (tui_source_window_base::update_exec_info): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. gdb/testsuite/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_csi_Z): New proc. * gdb.tui/basic.exp: Update window positions. * gdb.tui/empty.exp: Update window positions.
2019-08-16Introduce tui_source_window_base::set_contents methodTom Tromey1-0/+5
This introduces the tui_source_window_base::set_contents method and implements it in the subclasses. This removes a check of the window type. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_contents>: Declare. * tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is): Update. * tui/tui-source.h (struct tui_source_window) <set_contents>: Declare. (tui_set_source_content): Don't declare. * tui/tui-source.c (tui_source_window::set_contents): Rename from tui_set_source_content. * tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Declare. (tui_set_disassem_content): Don't declare. * tui/tui-disasm.c (tui_disasm_window::set_contents): Rename from tui_set_disassem_content.
2019-08-16Change tui_update_breakpoint_info to be a methodTom Tromey1-9/+8
This changes tui_update_breakpoint_info to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_breakpoint_info>: Declare. (tui_update_breakpoint_info): Don't declare. * tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is) (tui_update_all_breakpoint_info): Update. (tui_source_window_base::update_breakpoint_info): Rename from tui_update_breakpoint_info. (tui_source_window_base::update_exec_info): Update.
2019-08-16Change tui_update_source_window to be a methodTom Tromey1-3/+3
This changes tui_update_source_window to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_source_window>: Declare. (tui_update_source_window): Don't declare. * tui/tui-winsource.c (tui_source_window_base::update_source_window): Rename from tui_update_source_window. (tui_source_window_base::rerender): Update. * tui/tui-source.c (tui_source_window::maybe_update): Update. * tui/tui-disasm.c (tui_show_disassem) (tui_show_disassem_and_update_source) (tui_disasm_window::maybe_update): Update.
2019-08-16Change tui_update_source_window_as_is to be a methodTom Tromey1-3/+4
This changes tui_update_source_window_as_is to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_source_window_as_is>: Declare. (tui_update_source_window_as_is): Don't declare. * tui/tui-winsource.c (tui_update_source_window): Update (tui_source_window_base::update_source_window_as_is): Rename from tui_update_source_window_as_is. (tui_source_window_base::refill): Update. * tui/tui-source.c (tui_show_symtab_source): Update. * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Update.
2019-08-16Remove "noerror" parameter from some TUI functionsTom Tromey1-4/+2
A few TUI functions take a "noerror" parameter. This is only checked in one spot: in tui_set_source_content, if noerror is false, and if an error occurs, then the function will call print_sys_errmsg. This seems misguided to me, so this patch removes that code and this parameter. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_update_source_window) (tui_update_source_window_as_is): Remove "noerror" parameter. * tui/tui-winsource.c (tui_update_source_window) (tui_update_source_window_as_is): Remove "noerror" parameter. (tui_update_source_windows_with_addr) (tui_update_source_windows_with_line) (tui_source_window_base::rerender) (tui_source_window_base::refill): Update. * tui/tui-source.h (tui_set_source_content) (tui_show_symtab_source): Remove "noerror" parameter. * tui/tui-source.c (tui_set_source_content): Remove "noerror" parameter. (tui_show_symtab_source): Likewise. (tui_source_window::maybe_update): Update. * tui/tui-disasm.c (tui_show_disassem) (tui_show_disassem_and_update_source) (tui_disasm_window::do_scroll_vertical) (tui_disasm_window::maybe_update): Update.
2019-08-16Remove m_has_locatorTom Tromey1-2/+0
The previous patch removed the only use of m_has_locator, so this member can now be removed. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <m_has_locator>: Remove. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update.
2019-08-15TUI resize unificationTom Tromey1-3/+2
The TUI currently has two different ways to resize a window: the resize method, and the methods make_invisible_and_set_new_height and make_visible_with_new_height. There's no deep reason to have two different ways to resize a window, so this patch unifies them, leaving just the "resize" method. This also changes the locator to be handled more like an ordinary window and less like an adjunct of the associated source window. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before calling update_cmdwin_start_line. * tui/tui-winsource.h (struct tui_source_window_base) <do_make_visible_with_new_height, set_new_height>: Don't declare. <rerender>: Declare. * tui/tui-winsource.c (tui_source_window_base::update_tab_width): Call rerender. (tui_source_window_base::set_new_height): Remove. (tui_source_window_base::rerender): Rename from do_make_visible_with_new_height. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use resize method. (tui_win_info::make_invisible_and_set_new_height) (tui_win_info::make_visible_with_new_height): Remove. * tui/tui-stack.h (struct tui_locator_window) <rerender>: Declare. * tui/tui-stack.c (tui_locator_window::rerender): New method. * tui/tui-regs.h (struct tui_data_window) <set_new_height, do_make_visible_with_new_height>: Don't declare. <rerender>: Declare. * tui/tui-regs.c (tui_data_window::rerender): Rename from set_new_height. (tui_data_window::do_make_visible_with_new_height): Remove. * tui/tui-layout.c (show_source_disasm_command, show_data): Don't call tui_show_locator_content. (tui_gen_win_info::resize): Call rerender. (show_source_or_disasm_and_command): Don't call tui_show_locator_content. * tui/tui-data.h (struct tui_gen_win_info) <rerender>: New method. (struct tui_win_info) <rerender>: Declare. <set_new_height, make_invisible_and_set_new_height, make_visible_with_new_height>: Don't declare. * tui/tui-data.c (tui_win_list::rerender): New method. * tui/tui-command.h (struct tui_cmd_window) <do_make_visible_with_new_height>: Don't declare. * tui/tui-command.c (tui_cmd_window::do_make_visible_with_new_height): Remove. gdb/testsuite/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * gdb.tui/empty.exp: Enable resizing tests.
2019-08-15Change TUI source window iterationTom Tromey1-0/+70
Currently the TUI does separate bookkeeping to track which source windows exist. It seems better to me to just refer to the list of windows for this, so this patch removes the special handling and instead adds a new iterator. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_iterator): New. (struct tui_source_windows): New. * tui/tui-winsource.c (tui_display_main): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (new_height_ok, parse_scrolling_args): Update. * tui/tui-layout.c (show_layout, show_data): Update. * tui/tui-data.h (tui_source_windows, tui_clear_source_windows) (tui_add_to_source_windows): Don't declare. * tui/tui-data.c (source_windows, tui_source_windows) (tui_clear_source_windows, tui_add_to_source_windows): Remove.
2019-08-15Rename the "reset" method to "resize"Tom Tromey1-2/+2
tui_gen_win_info::reset really just resizes the window. This patch renames it to reflect this. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <resize>: Rename from reset. * tui/tui-winsource.c (tui_source_window_base::resize): Rename. * tui/tui-layout.c (show_source_disasm_command, show_data): Update. (tui_gen_win_info::resize): Rename. (show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from reset.
2019-08-15Remove tui_clear_source_contentTom Tromey1-1/+0
tui_clear_source_content is not needed. Instead, the callers can call erase_source_content, which is also changed to clear the content vector. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_clear_source_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is): Don't call tui_clear_source_content. (tui_clear_source_content): Remove. (tui_source_window_base::do_erase_source_content): Hoist call to content.clear(). * tui/tui-stack.c (tui_show_frame_info): Don't call tui_clear_source_content.
2019-08-15Turn tui_erase_source_content into a methodTom Tromey1-1/+6
This changes tui_erase_source_content into a method on tui_source_window_base. The bulk of the work is moved into a helper method, so that the callers can each pass the string appropriate to the particular window class. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <do_erase_source_content>: New method. <erase_source_content>: New method. (tui_erase_source_content): Don't declare. * tui/tui-winsource.c (tui_clear_source_content): Update. (tui_source_window_base::do_erase_source_content): Rename from tui_erase_source_content. (tui_source_window_base::show_source_content): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-source.h (struct tui_source_window) <erase_source_content>: New method. * tui/tui-disasm.h (struct tui_disasm_window) <erase_source_content>: New method.
2019-08-15Remove tui_alloc_source_bufferTom Tromey1-3/+11
There is no longer any need for tui_alloc_source_buffer. The two callers of this function immediately change the contents of the window, undoing the work done by this function. This required adding a move constructor to tui_source_element -- a mildly surprising find, but without this, resizing the vector will cause crashes. This issue was masked earlier because tui_alloc_source_buffer handled this. Note that a patch for this bug was submitted here: https://sourceware.org/ml/gdb-patches/2019-08/msg00094.html That patch is better, IMO, but the author as yet hasn't responded to a request for a ChangeLog entry. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare. (struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move constructor. * tui/tui-winsource.c (tui_alloc_source_buffer): Remove. * tui/tui-source.c (tui_set_source_content): Update. * tui/tui-disasm.c (tui_set_disassem_content): Update.
2019-08-15Change tui_line_is_displayed to be a methodTom Tromey1-3/+0
This changes tui_line_is_displayed to be a method on tui_source_window, now that it is obvious that it can only be called for this type. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_line_is_displayed): Don't declare. * tui/tui-winsource.c (tui_line_is_displayed): Move to tui-source.c. * tui/tui-source.h (struct tui_source_window) <line_is_displayed>: Declare. * tui/tui-source.c (tui_source_window::line_is_displayed): New method. (tui_source_window::maybe_update): Update.
2019-08-15Change tui_addr_is_displayed into a methodTom Tromey1-3/+0
This changes tui_addr_is_displayed to be a method on tui_disasm_window, now that it is obvious that it can only be called for this type. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_addr_is_displayed): Don't declare. * tui/tui-winsource.c (tui_addr_is_displayed): Move to tui-disasm.c. * tui/tui-disasm.h (struct tui_disasm_window) <addr_is_displayed>: Declare. * tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): New method. (tui_disasm_window::maybe_update): Update.
2019-08-15Move contents of tui_show_frame_info to new methodTom Tromey1-0/+6
This moves much of the body of tui_show_frame_info to a new method on tui_source_window_base. This removes a check for the type of a window. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <maybe_update>: Declare. * tui/tui-stack.c (tui_show_frame_info): Call maybe_update method. * tui/tui-source.h (struct tui_source_window) <maybe_update>: Declare. * tui/tui-source.c (tui_source_window::maybe_update): New method. * tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>: Declare. * tui/tui-disasm.c (tui_disasm_window::maybe_update): New method.
2019-08-13Don't track the contents of the execution info windowTom Tromey1-22/+0
The curses library keeps track of the contents of each window, and can redraw the screen as needed. This means that in most cases is no need for the TUI windows to also keep track of their contents. This patch removes content tracking from the execution window, leaving that to curses. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) <~tui_exec_info_window, maybe_allocate_content, get_content, m_content>: Remove. (struct tui_source_window_base) <set_exec_info_content, show_exec_info_content>: Don't declare. * tui/tui-winsource.c (tui_exec_info_window::maybe_allocate_content): Remove. (tui_source_window_base::update_exec_info): Rename from set_exec_info_content. (tui_source_window_base::show_exec_info_content) (tui_source_window_base::update_exec_info): Remove.
2019-08-13Remove tui_clear_exec_info_contentTom Tromey1-1/+0
After the previous patch, all calls to tui_clear_exec_info_content come just after a call to tui_clear_source_content. Because these two windows are linked, I think it makes sense to have tui_clear_source_content simply do the work. So, this patch removes tui_clear_exec_info_content. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_clear_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr, tui_erase_source_content): Update. (tui_clear_exec_info_content): Remove.
2019-08-13Remove tui_erase_exec_info_contentTom Tromey1-1/+0
One call to tui_erase_exec_info_content can be removed. This call is not needed because the function in question then immediately sets the execution info window contents. Once this is done, tui_clear_exec_info_content is just a wrapper for the only call to tui_erase_exec_info_content, so tui_erase_exec_info_content can be renamed and the wrapper function removed. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_erase_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Don't call tui_erase_exec_info_content. (tui_clear_exec_info_content): Rename from tui_erase_exec_info_content. (tui_clear_exec_info_content): Delete.
2019-08-13Turn tui_show_exec_info_content into a methodTom Tromey1-1/+3
This changes tui_show_exec_info_content to be a method on tui_source_window_base. As it is only called by other methods on this class, it can be private. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_exec_info_content>: Declare. (tui_show_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::show_exec_info_content): Rename from tui_show_exec_info_content. (tui_source_window_base::update_exec_info): Update.
2019-08-13Move code to tui-winsource.hTom Tromey1-0/+41
This moves code related to the execution info window from tui-data.h to tui-winsource.h. It fits better here because the execution info is conceptually part of the source and disassembly windows, and tui-winsource.h is where this common class lives. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element) (TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS) (TUI_EXECINFO_SIZE, tui_exec_info_content): Move ... * tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS) (TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content): ... here.
2019-08-13Change tui_update_exec_info to be a methodTom Tromey1-1/+1
This changes tui_update_exec_info to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_exec_info>: Declare. (tui_update_exec_info): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_source_window_base::refresh_all) (tui_update_all_breakpoint_info): Update. (tui_source_window_base::update_exec_info): Rename from tui_update_exec_info. * tui/tui-stack.c (tui_show_frame_info): Update.
2019-08-13Change tui_set_exec_info_content to be a methodTom Tromey1-1/+2
This changes tui_set_exec_info_content to bea method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_exec_info_content>: Declare. (tui_set_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::set_exec_info_content): Rename from tui_set_exec_info_content. (tui_update_exec_info): Update.
2019-08-13Change tui_show_source_content to be a methodTom Tromey1-1/+2
This changes tui_show_source_content to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_source_content>: Declare. (tui_show_source_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is): Update. (tui_source_window_base::show_source_content): Rename from tui_show_source_content. (tui_source_window_base::refresh_all): Update. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update.
2019-08-13clear_detail can only be called on TUI source windowsTom Tromey1-1/+1
The clear_detail method can only be called on source windows, so remove definitions from the base of the class hierarchy, leaving only a single non-virtual method. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: No longer "override". * tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove. * tui/tui-regs.c (tui_data_window::clear_detail): Remove. * tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove. * tui/tui-command.h (struct tui_cmd_window) <clear_detail>: Remove. * tui/tui-command.c (tui_cmd_window::clear_detail): Remove.
2019-07-17Move source window common to code to tui-winsource.[ch]Tom Tromey1-1/+81
Like the previous rearranging patches, this moves the source and disassembly window base class code to tui-winsource.[ch]. The execution info window is also moved, because it is associated with this base class. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) (struct tui_source_window_base): Move from tui-data.h. * tui/tui-winsource.c: Move many method definitions from elsewhere. Remove "structuring" comments. * tui/tui-wingeneral.c (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Move to tui-winsource.c. * tui/tui-win.c (tui_source_window_base::refresh_all) (tui_source_window_base::update_tab_width) (tui_source_window_base::set_new_height) (tui_source_window_base::do_make_visible_with_new_height): Move to tui-winsource.c. * tui/tui-source.h: Update. * tui/tui-source.c (tui_source_window_base::reset): Move to tui-winsource.c. * tui/tui-disasm.h: Update. * tui/tui-data.h (struct tui_exec_info_window): Move to tui-winsource.h. (struct tui_source_window_base): Likewise. * tui/tui-data.c (tui_source_window_base::clear_detail) (tui_source_window_base, ~tui_source_window_base): Move to tui-winsource.c.
2019-07-17Remove unused parameter from two TUI functionsTom Tromey1-2/+2
The "display_prompt" parameter of tui_erase_source_content and tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT value, so remove the parameter. Once this is done, the EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so remove those as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_erase_source_content) (tui_clear_source_content): Remove "display_prompt" parameter. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr): Update. (tui_clear_source_content): Remove "display_prompt" parameter. (tui_erase_source_content): Likewise. Simplify. (tui_show_source_content): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT): Remove defines.
2019-07-17Remove deleted breakpoint from TUI displayTom Tromey1-6/+13
PR tui/24722 points out that deleting a breakpoint does not cause the "b" to be removed from the breakpoint display. The issue here was that the breakpoint still exists at the moment the breakpoint-deleted observer is notified. This fixes the problem by specially handling the case where a breakpoint is being removed. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> PR tui/24722: * tui/tui-winsource.h (tui_update_all_breakpoint_info) (tui_update_breakpoint_info): Add "being_deleted" parameter. * tui/tui-winsource.c (tui_update_source_window_as_is): Update. (tui_update_all_breakpoint_info): Add "being_deleted" parameter. (tui_update_breakpoint_info): Likewise. * tui/tui-hooks.c (tui_event_create_breakpoint) (tui_event_delete_breakpoint, tui_event_modify_breakpoint): Update.