aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-source.c
AgeCommit message (Collapse)AuthorFilesLines
2019-11-05Style disassembly in the TUITom Tromey1-106/+3
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-09-20Use make_unique_xstrdup in TUITom Tromey1-1/+1
This changes a couple of spots in the TUI to use make_unique_xstrdup. This simplifies the code slightly. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window::set_contents): Use make_unique_xstrdup. * tui/tui-disasm.c (tui_disasm_window::set_contents): Use make_unique_xstrdup.
2019-09-20Rename a private data member in tui_source_windowTom Tromey1-3/+3
This renames tui_source_window::fullname to add the "m_" prefix, as it is a private data member. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-source.h (struct tui_source_window) <m_fullname>: Rename from "fullname". * tui/tui-source.c (tui_source_window::set_contents) (tui_source_window::location_matches_p) (tui_source_window::maybe_update): Update.
2019-09-20Change members of tui_locator_window to std::stringTom Tromey1-2/+2
This changes two members of tui_locator_window to have type std::string. This removes a static limit. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN): Remove define. (struct tui_locator_window) <full_name, proc_name>: Now std::string. * tui/tui-stack.c (tui_locator_window::make_status_line) (tui_locator_window::set_locator_fullname) (tui_locator_window::set_locator_info): Update. * tui/tui-source.c (tui_source_window::set_contents) (tui_source_window::showing_source_p): Update.
2019-09-20Move "fullname" to tui_source_windowTom Tromey1-4/+3
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-3/+1
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-08-20Change tui_make_window to be a methodTom Tromey1-2/+1
I combined several small changes into one patch here. I believe I started by noticing that the "title" is not needed by tui_gen_win_info and could be self-managing (i.e. std::string). Moving this revealed that "can_box" is also a property of tui_win_info and not tui_gen_win_info; and this in turn caused the changes to tui_make_window and box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Don't declare. * tui/tui-wingeneral.c (box_win): Change type of win_info. (box_win): Update. (tui_gen_win_info::make_window): Rename from tui_make_window. (tui_win_info::make_window): New method. (tui_gen_win_info::make_visible): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-regs.c (tui_data_window::show_register_group): Update. (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <make_window>: Declare. <can_box>: Remove. <title>: Remove. (struct tui_win_info) <make_window>: Declare. <can_box>: Now virtual. <title>: New member. * tui/tui-data.c (~tui_gen_win_info): Don't free title. * tui/tui-command.c (tui_cmd_window::resize): Update.
2019-08-16Remove the TUI execution info windowTom Tromey1-1/+1
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-16Change tui_show_symtab_source to be a methodTom Tromey1-5/+5
This changes tui_show_symtab_source to be a method on tui_source_window. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_source_windows_with_addr) (tui_update_source_windows_with_line): Update. * tui/tui-source.h (struct tui_source_window) <show_symtab_source>: Declare. (tui_show_symtab_source): Don't declare. * tui/tui-source.c (tui_show_symtab_source): Rename from tui_show_symtab_source.
2019-08-16Introduce tui_source_window_base::set_contents methodTom Tromey1-18/+20
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_source_window to be a methodTom Tromey1-2/+1
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-1/+1
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-17/+5
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 separate visibility flagTom Tromey1-1/+1
TUI windows keep track of their visibility in a boolean field. However, this is not needed, because a window is visible if and only if it has an underlying curses handle. So, we can remove this separate field. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_is_window_visible): Update. * tui/tui-wingeneral.c (tui_make_window) (tui_gen_win_info::make_visible, tui_refresh_all): Update. * tui/tui-win.c (window_name_completer, tui_refresh_all_win) (tui_set_focus_command, tui_all_windows_info, update_tab_width) (tui_set_win_height_command, parse_scrolling_args): Update. * tui/tui-source.c (tui_source_window::style_changed): Update. * tui/tui-regs.c (tui_show_registers) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_check_register_values, tui_reg_command): Update. * tui/tui-disasm.c (tui_show_disassem): Update. * tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New method. <is_visible>: Remove field. * tui/tui-data.c (tui_next_win, tui_prev_win) (tui_delete_invisible_windows): Update.
2019-08-15Remove tui_alloc_source_bufferTom Tromey1-1/+0
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-1/+20
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-15Move contents of tui_show_frame_info to new methodTom Tromey1-0/+26
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-06Add file offsets to the source cacheTom Tromey1-1/+3
Currently, gdb stores the number of lines and an array of file offsets for the start of each line in struct symtab. This patch moves this information to the source cache. This has two benefits. First, it allows gdb to read a source file less frequently. Currently, a source file may be read multiple times: once when computing the file offsets, once when highlighting, and then pieces may be read again while printing source lines. With this change, the file is read once for its source text and file offsets; and then perhaps read again if it is evicted from the cache. Second, if multiple symtabs cover the same source file, then this will share the file offsets between them. I'm not sure whether this happens in practice. gdb/ChangeLog 2019-08-06 Tom Tromey <tromey@adacore.com> * annotate.c (annotate_source_line): Use g_source_cache. * source-cache.c (source_cache::get_plain_source_lines): Change parameters. Populate m_offset_cache. (source_cache::ensure): New method. (source_cache::get_line_charpos): New method. (extract_lines): Move lower. Change parameters. (source_cache::get_source_lines): Move lower. * source-cache.h (class source_cache): Update comment. <get_line_charpos>: New method. <get_source_lines>: Update comment. <clear>: Clear m_offset_cache. <get_plain_source_lines>: Change parameters. <ensure>: New method <m_offset_cache>: New member. * source.c (forget_cached_source_info_for_objfile): Update. (info_source_command): Use g_source_cache. (find_source_lines, open_source_file_with_line_charpos): Remove. (print_source_lines_base, search_command_helper): Use g_source_cache. * source.h (open_source_file_with_line_charpos): Don't declare. * symtab.h (struct symtab) <nlines, line_charpos>: Remove. * tui/tui-source.c (tui_source_window::do_scroll_vertical): Use g_source_cache.
2019-07-17Move source window common to code to tui-winsource.[ch]Tom Tromey1-9/+0
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 the win_type parameter from tui_gen_win_info::resetTom Tromey1-4/+3
tui_gen_win_info::reset has a window type parameter that is only used for an assertion. This made sense as a defensive measure when window creation was more dynamic -- it ensured that one did not make mistakes. However, there's no need for it any more, so this removes it. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window_base::reset): Remove win_type parameter. * tui/tui-layout.c (make_command_window, make_source_window) (make_disasm_window, make_data_window) (show_source_disasm_command, show_data, tui_gen_win_info::reset) (reset_locator, show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <reset>: Remove win_type parameter. (struct tui_source_window_base) <reset>: Likewise.
2019-07-17Always create an execution info window for a source windowTom Tromey1-0/+10
A source or disassembly window will always have an "execution info" window (the window along the side that displays breakpoint info), but this isn't immediately clear from the source. As a result, some code has checks to see whether the execution_info is NULL. This changes the source window base class to always instantiate an execution_info window, then updates the rest of the code. It also simplifies window creation in tui-layout.c. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_set_exec_info_content): Remove condition. * tui/tui-wingeneral.c (tui_source_window_base::make_visible): Remove condition. * tui/tui-source.c (tui_source_window_base::reset): New method. * tui/tui-layout.c (make_command_window): Don't call init_and_make_win. (make_source_window, make_disasm_window): Don't call make_source_or_disasm_window. (make_data_window): Don't call init_and_make_win. Change calling convention. (show_source_disasm_command, show_data): Simplify. (make_source_or_disasm_window): Remove. (show_source_or_disasm_and_command): Simplify. * tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual. (struct tui_source_window_base) <reset>: Likewise. <execution_info>: Remove initializer. * tui/tui-data.c (tui_source_window_base): Initialize execution_info.
2019-07-17Remove tui_source_window::content_in_useTom Tromey1-1/+1
Now that source window clearing has been simplified, we don't need a special flag to say whether the source window is in use -- we can simply check whether the contents are set. This patch implements this idea, removing the content_in_use field. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_clear_source_content) (tui_show_source_content): Update. * tui/tui-source.c (tui_source_window::showing_source_p): Check whether content is empty. * tui/tui-data.h (struct tui_source_window_base) <content_in_use>: Remove.
2019-07-17Simplify source window clearingTom Tromey1-63/+0
When a TUI source window is empty, it displays a "No Source Available" message. The function tui_set_source_content_nil also made sure to put this message into the window's "content" field. However, I believe this isn't really necessary. Instead, it's simpler to just empty the contents and let curses handle the refreshing. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_erase_source_content): Clear the window's contents. * tui/tui-source.h (tui_set_source_content_nil): Don't declare. * tui/tui-source.c (tui_set_source_content_nil): Remove.
2019-07-17Move content_in_use to tui_source_window classTom Tromey1-4/+3
From scanning the source now, it's clear that the content_in_use field is only used for the source window. This patch moves the field there, and changes it to be a bool at the same time. (A future patch will clean this up further, removing the field entirely.) gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_clear_source_content) (tui_show_source_content, tui_show_exec_info_content) (tui_clear_exec_info_content): Update. * tui/tui-stack.c (tui_show_locator_content): Update. (tui_show_frame_info): Update. * tui/tui-source.h (tui_source_window): Don't declare. * tui/tui-source.c (tui_source_window::showing_source_p): Rename from tui_source_is_displayed. * tui/tui-data.h (struct tui_gen_win_info) <content_in_use>: Remove field. (struct tui_source_window_base) <content_in_use>: New field. Now bool. (struct tui_source_window) <showing_source_p>: New method. (TUI_SRC_WIN): Change cast. * tui/tui-data.c (tui_initialize_static_data): Update.
2019-07-17Introduce tui_source_window_base::location_matches_p methodTom Tromey1-0/+10
This introduces the location_matches_p method, removing a spot that explicitly examines a window's type. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_breakpoint_info): Use location_matches_p. * tui/tui-source.c (tui_source_window::location_matches_p): New method. * tui/tui-disasm.c (tui_disasm_window::location_matches_p): New method. * tui/tui-data.h (struct tui_source_window_base) <location_matches_p>: New method. (struct tui_source_window, struct tui_disasm_window) <location_matches_p>: Likewise.
2019-07-17Make source windows be self-updatingTom Tromey1-0/+20
This changes the TUI source window to register itself on the source_styling_changed observable, and removes a bit of code from tui-hooks.c. This reduces the number of uses of the TUI_SRC_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window): New constructor. Add observer. (~tui_source_window): New destructor. (tui_source_window::style_changed): New method. * tui/tui-hooks.c (tui_redisplay_source): Remove. (tui_attach_detach_observers): Update. * tui/tui-data.h (struct tui_source_window): Make constructor not inline. Add destructor. (struct tui_source_window) <style_changed>: New method. <m_observable>: New member.
2019-07-17Remove some uses of TUI_WIN_SRCTom Tromey1-21/+21
This adds a 'win_info' parameter to a couple of functions. This reduces the number of references to the TUI_WIN_SRC global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr): Update. * tui/tui-source.h (tui_set_source_content) (tui_show_symtab_source): Add "win_info" parameter. * tui/tui-source.c (tui_set_source_content): Add "win_info" parameter. (tui_show_symtab_source): Likewise.
2019-07-04Fix TUI use of "has_break" fieldTom Tromey1-1/+1
The TUI uses the "has_break" in two different ways: sometimes as a boolean, and sometimes as flags. This patch changes the TUI to be more type-safe here, and fixes the code. I could not find a bug that this caused, so apparently this is just cosmetic. This deletes some code from tui_set_disassem_content. Whenver this is called, I believe the TUI updates the breakpoint information afterward, so this assignment is redundant; which is good because it is also incorrect. gdb/ChangeLog 2019-07-04 Tom Tromey <tom@tromey.com> PR tui/24724: * tui/tui-winsource.c (tui_clear_source_content): Update. (tui_source_window_base::set_is_exec_point_at): Fix comment. (tui_update_breakpoint_info): Update. (tui_set_exec_info_content): Update. * tui/tui-source.c (tui_set_source_content_nil): Update. * tui/tui-disasm.c (tui_set_disassem_content): Don't set has_break. * tui/tui-data.h (enum tui_bp_flag): New. (tui_bp_flags): New enum flags type. (struct tui_source_element) <break_mode>: Change type. Rename from has_break. (TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT) (TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): Don't define. Now enum constants. * tui/tui-winsource.h: Fix comment.
2019-06-25Remove NULL checks before xfreeTom Tromey1-2/+1
A couple of spots in the TUI did a NULL check before an xfree. This isn't necessary, and most other cases were removed from gdb a while ago. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_set_source_content): Don't check before xfree. * tui/tui-disasm.c (tui_disassemble): Don't check before xfree.
2019-06-25Remove union tui_which_elementTom Tromey1-29/+24
This removes union tui_which_element, instead moving the content directly into tui_source_window_base. This allows for the deletion of a fair amount of code. Now the TUI window hierarchy is more type-safe. In particular, there is never any confusion now about which members are in use by which subtype. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_update_source_window_as_is) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Change type of win_info. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_show_source_line) (tui_show_source_content, tui_source_window_base::refill) (tui_source_window_base::set_is_exec_point_at) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content): Update. (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Change type of win_info. Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (tui_source_window_base::do_make_visible_with_new_height): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil) (tui_source_window::do_scroll_vertical): Update. * tui/tui-layout.c (show_layout): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (tui_win_content): Remove. (struct tui_gen_win_info) <content, content_size>: Remove. (struct tui_source_element): Add initializers and destructor. (union tui_which_element, struct tui_win_element): Remove. (struct tui_source_window_base) <content>: New field. (struct tui_data_window): Remove destructor. (tui_alloc_content, tui_free_win_content) (tui_free_all_source_wins_content): Don't declare. * tui/tui-data.c (tui_initialize_static_data): Update. (init_content_element, tui_alloc_content): Remove. (~tui_gen_win_info): Update. (~tui_data_window, tui_free_all_source_wins_content) (tui_free_win_content, free_content, free_content_elements): Remove.
2019-06-25More type safety for TUI source window functionsTom Tromey1-1/+1
A few functions can only operate on a source or disassembly window. This patch adds a bit more type safety to a few of these functions. This simplifies a subsequent patch. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_clear_source_content) (tui_erase_source_content, tui_show_source_content): Change type of win_info. * tui/tui-winsource.c (tui_clear_source_content) (tui_erase_source_content, tui_show_source_content): Change type of win_info. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-source.h (tui_set_source_content_nil): Change type of win_info. * tui/tui-source.c (tui_set_source_content_nil): Change type of win_info. * tui/tui-layout.c (show_source_or_disasm_and_command): Update.
2019-06-25Use bool for is_exec_pointTom Tromey1-1/+1
This changes tui_source_element::is_exec_point to be a bool. I looked at also changing "has_break", but it turns out that this field is used inconsistently (sometimes as flags and sometimes as a bool), and so needs more invesstigation before it can be changed. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_clear_source_content) (tui_source_window_base::set_is_exec_point_at): Update. * tui/tui-source.c (tui_set_source_content_nil): Update. * tui/tui-data.h (struct tui_source_element) <is_exec_point>: Now a bool. * tui/tui-data.c (init_content_element): Update.
2019-06-25Separate out locator windowTom Tromey1-8/+4
This introduces a new subclass of tui_gen_win_info for the locator, letting us remove another element from union tui_which_element. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_refresh_all): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (tui_source_window_base::set_new_height): Update. * tui/tui-stack.c (tui_make_status_line): Change parameter type. Update. (tui_set_locator_fullname, tui_set_locator_info) (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_source_is_displayed): Update. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_get_begin_asm_address): Update. * tui/tui-data.h (struct tui_locator_element): Remove. (union tui_which_element) <locator>: Remove. (struct tui_locator_window): New. (tui_locator_win_info_ptr): Change return type. * tui/tui-data.c (_locator): Change type. (tui_locator_win_info_ptr): Change return type. (init_content_element): Remove LOCATOR_WIN case. Add assert. (tui_alloc_content): Add assert.
2019-06-25Remove tui_scroll_direction enumTom Tromey1-19/+10
The tui_scroll_direction enum is not really needed, because it's simple to adapt the various scrolling methods to use the sign of their argument as the direction in which to scroll. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_source_window_base::do_scroll_horizontal): Remove direction parameter. * tui/tui-windata.c (tui_data_window::do_scroll_vertical): Remove direction parameter. * tui/tui-win.c (tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_win_info::left_scroll) (tui_win_info::right_scroll): Update. * tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove direction parameter. * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Remove direction parameter. * tui/tui-data.h (enum tui_scroll_direction): Remove. (struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>: Remove direction parameter. (struct tui_source_window_base, struct tui_source_window) (struct tui_disasm_window, struct tui_data_window) (struct tui_cmd_window): Update.
2019-06-25Change tui_alloc_source_buffer return type to voidTom Tromey1-75/+74
tui_alloc_source_buffer can't actually fail, so change its return type to void and update the callers. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_alloc_source_buffer): Change return type to void. * tui/tui-winsource.c (tui_alloc_source_buffer): Change return type to void. * tui/tui-source.c (tui_set_source_content): Update. * tui/tui-disasm.c (tui_set_disassem_content): Update.
2019-06-25Derive tui_win_info from tui_gen_win_infoTom Tromey1-17/+16
This changes tui_win_info to derive from tui_gen_win_info, rather than having a tui_gen_win_info as a member. This removes a layer of member access from the entire TUI, which is why this patch is so large. This change will enable further removal of switches based on window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window, tui_enable) (tui_is_window_visible, tui_get_command_dimension): Update. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_erase_source_content) (tui_show_source_line, tui_source_window_base::refill) (tui_source_window_base::do_scroll_horizontal) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Update. * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win) (tui_check_and_display_highlight_if_needed) (tui_win_info::make_visible, tui_win_info::refresh) (tui_refresh_all): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_data_window::refresh_all) (tui_check_data_values): Update. * tui/tui-win.c (window_name_completer, tui_update_gdb_sizes) (tui_set_win_focus_to, tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_refresh_all_win) (tui_resize_all, tui_set_focus, tui_all_windows_info) (update_tab_width, tui_set_win_height, tui_adjust_win_heights) (tui_source_window_base::set_new_height) (tui_data_window::set_new_height) (make_invisible_and_set_new_height) (make_visible_with_new_height, new_height_ok) (parse_scrolling_args): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil, tui_source_is_displayed) (tui_source_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_display_reg_element_at_line) (tui_check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_default_win_height) (show_source_disasm_command, show_data, init_and_make_win) (show_source_or_disasm_and_command): Update. * tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts) (tui_redisplay_readline, tui_mld_flush) (tui_mld_erase_entire_line, tui_mld_getc, tui_cont_sig) (tui_getc): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: Now virtual. (struct tui_win_info): Derive from tui_gen_win_info. <~tui_win_info>: Mark as override. <generic>: Remove member. * tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win) (tui_prev_win, tui_partial_win_by_name, tui_win_info) (~tui_data_window, ~tui_win_info) (tui_free_all_source_wins_content): Update. * tui/tui-command.c (tui_refresh_cmd_win): Update.
2019-06-25Remove struct tui_source_infoTom Tromey1-3/+3
The tui_source_info struct is used as a member of the "detail" union in tui_win_info, and this member of the union is only used by source and disassembly windows. This patch removes tui_source_info and moves its members directly to tui_source_window_base. This simplifies the code by removing a layer of references from many places. In a few spots, a new cast was needed, but most of these will be removed by the end of the series. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_source_window) (tui_refill_source_window) (tui_source_window_base::do_scroll_horizontal) (tui_update_breakpoint_info, tui_set_exec_info_content) (tui_show_exec_info_content, tui_erase_exec_info_content) (tui_clear_exec_info_content): Update. * tui/tui-wingeneral.c (make_all_visible, tui_refresh_all): Update. * tui/tui-win.c (make_invisible_and_set_new_height) (make_visible_with_new_height): Update. * tui/tui-source.c (tui_set_source_content) (tui_show_symtab_source): Update. * tui/tui-layout.c (extract_display_start_addr) (show_source_disasm_command, show_data) (make_source_or_disasm_window) (show_source_or_disasm_and_command): Update. * tui/tui-disasm.c (tui_set_disassem_content): Simplify. (tui_disasm_window::do_scroll_vertical): Remove shadowing "gdbarch". * tui/tui-data.h (struct tui_source_info): Remove. Move contents to tui_source_window_base. (struct tui_win_info) <detail>: Remove source_info member. (struct tui_source_window_base) <has_locator>: Inline. Move contents from tui_source_info; rename has_locator member to m_has_locator. (TUI_SRC_WIN, TUI_DISASM_WIN): Add casts. * tui/tui-data.c (tui_source_window_base::has_locator): Move to header file. (tui_source_window_base::clear_detail, ~tui_source_window_base): Simplify. (tui_free_all_source_wins_content): Cast to tui_source_window_base.
2019-06-25Introduce methods for scrollingTom Tromey1-4/+4
This changes the TUI to use virtual methods on the various window types for scrolling. Window-specific functions for this purpose are renamed to be methods, and the generic tui_scroll function is removed as it is no longer called. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_horizontal_source_scroll): Don't declare. * tui/tui-winsource.c (tui_source_window_base::do_scroll_horizontal): Rename from tui_horizontal_source_scroll. * tui/tui-windata.h (tui_vertical_data_scroll): Don't declare. * tui/tui-windata.c (tui_data_window::do_scroll_vertical): Rename from tui_vertical_data_scroll. * tui/tui-win.h (tui_scroll): Don't declare. * tui/tui-win.c (tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_win_info::left_scroll) (tui_win_info::right_scroll): Rename and update. (tui_scroll_forward_command, tui_scroll_backward_command) (tui_scroll_left_command, tui_scroll_right_command): Update. (tui_scroll): Remove. * tui/tui-source.h: Don't declare tui_vertical_source_scroll. * tui/tui-source.c (tui_source_window::do_scroll_vertical): Rename from tui_vertical_source_scroll. * tui/tui-disasm.h (tui_vertical_disassem_scroll): Don't declare. * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Rename from tui_vertical_disassem_scroll. * tui/tui-data.h (struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>: New methods. <forward_scroll, backward_scroll, left_scroll, right_scroll>: Likewise. (struct tui_source_window_base): Add do_scroll_horizontal. (struct tui_source_window, struct tui_disasm_window): Add do_scroll_vertical. (struct tui_data_window, struct tui_cmd_window): Add do_scroll_horizontal and do_scroll_vertical. * tui/tui-command.c (tui_dispatch_ctrl_char): Use method calls.
2019-06-16Remove unnecessary casts of NULLTom Tromey1-2/+2
I noticed some unnecessary casts of NULL. This removes all the unnecessary ones, leaving only ones where we must ensure that NULL has pointer type for passing through varargs. I removed a couple of useless casts of 0 that I noticed while writing this. Tested by rebuilding. gdb/ChangeLog 2019-06-16 Tom Tromey <tom@tromey.com> * valops.c (value_cast, value_slice): Remove unnecessary cast. * breakpoint.c (stopin_command, stopat_command) (until_break_command, decode_location_default): Remove unnecessary cast. * utils.c (subset_compare): Remove unnecessary cast. * ada-lang.c (ada_update_initial_language): Remove unnecessary cast. * linespec.c (decode_line_with_last_displayed): Remove unnecessary cast. * infcmd.c (path_command): Remove unnecessary cast. * coffread.c (decode_type): Remove unnecessary cast. * xcoffread.c (read_xcoff_symtab): Remove unnecessary cast. * mipsread.c (mipscoff_symfile_read): Remove unnecessary cast. * tui/tui-stack.c (tui_show_locator_content) (tui_show_frame_info): Remove unnecessary cast. * tui/tui-win.c (tui_scroll_forward_command) (tui_scroll_backward_command, tui_set_focus, tui_set_win_height) (parse_scrolling_args): Remove unnecessary cast. * tui/tui-data.c (init_win_info, tui_del_window) (tui_free_window, tui_del_data_windows, tui_free_data_content) (free_content_elements): Remove unnecessary cast. * tui/tui-windata.c (tui_first_data_item_displayed): Remove unnecessary cast. * tui/tui-source.c (tui_set_source_content) (tui_vertical_source_scroll): Remove unnecessary cast. * tui/tui-layout.c (tui_default_win_height): Remove unnecessary cast. * tui/tui-io.c (tui_initialize_io): Remove unnecessary cast. * tui/tui-regs.c (tui_display_registers_from) (tui_display_register): Remove unnecessary cast. * tui/tui-wingeneral.c (tui_refresh_win, tui_delete_win) (tui_unhighlight_win, tui_highlight_win, tui_make_window) (make_visible): Remove unnecessary cast. * tui/tui-winsource.c (tui_erase_source_content) (tui_update_breakpoint_info, tui_set_exec_info_content): Remove unnecessary cast. * ax-gdb.c (agent_command_1): Remove unnecessary cast. * cli/cli-setshow.c (cmd_show_list): Remove unnecessary cast. * stabsread.c (read_type, read_array_type, read_range_type): Remove unnecessary cast. * mdebugread.c (mdebug_build_psymtabs): Remove unnecessary cast. (parse_symbol, parse_type, upgrade_type, parse_external) (parse_partial_symbols, psymtab_to_symtab_1, cross_ref): Remove unnecessary cast. * gdb_bfd.c (gdb_bfd_map_section): Remove unnecessary cast.
2019-03-18Fix scrolling right in the TUIHannes Domani1-10/+20
This commit fixes two issues in scrolling right in the TUI: #1 - Scrolling right with the arrow keys, the first keypress doesn't do anything. The problem is that copy_source_line() checks if (column < first_col), and because of the ++column directly before, it basically starts with 1 instead of 0. #2 - Scrolling right handles TABS and escaped characters as single characters, which just looks weird. The problem is that there's a spot that misses handling TABS. gdb/ChangeLog: 2019-03-18 Hannes Domani <ssbssa@yahoo.de> * tui/tui-source.c (copy_source_line): Fix handling of 'column'. Handle tabs.
2019-02-17Fix some valgrind errors in the TUITom Tromey1-16/+5
The styling series introduced some new errors in the TUI -- the series changed how source lines are allocated, without updating tui_set_source_content_nil. There are several failures but a typical one looks like: ==6274== Use of uninitialised value of size 8 ==6274== at 0x4E4A095: wclrtoeol (in /usr/lib64/libncursesw.so.6.1) ==6274== by 0x4E47617: waddch (in /usr/lib64/libncursesw.so.6.1) ==6274== by 0x8325CB: tui_puts_internal(_win_st*, char const*, int*) (tui-io.c:393) ==6274== by 0x82E89D: tui_file::puts(char const*) (tui-file.c:39) ==6274== by 0x84BF5F: vfprintf_unfiltered(ui_file*, char const*, __va_list_tag*) (utils.c:2026) This patch rewrites tui_set_source_content_nil, fixing the bug. This was also reported as PR tui/24197. Verified by running valgrind before and after on x86-64 Fedora 29. gdb/ChangeLog 2019-02-17 Tom Tromey <tom@tromey.com> PR tui/24197: * tui/tui-source.c (tui_set_source_content_nil): Rewrite.
2019-01-21Remove duplicate or commented-out #includesTom Tromey1-1/+0
I wrote a little script to detect duplicate or commented-out #includes and ran it on gdb. This patch is the result. Tested by rebuilding. gdb/ChangeLog 2019-01-21 Tom Tromey <tom@tromey.com> * ui-out.c: Fix includes. * tui/tui-source.c: Fix includes. * target.c: Fix includes. * remote.c: Fix includes. * regcache.c: Fix includes. * python/py-block.c: Fix includes. * printcmd.c: Fix includes. * or1k-tdep.c: Fix includes. * mi/mi-main.c: Fix includes. * m32r-tdep.c: Fix includes. * csky-tdep.c: Fix includes. * compile/compile-cplus-types.c: Fix includes. * cli/cli-interp.c: Fix includes. gdb/gdbserver/ChangeLog 2019-01-21 Tom Tromey <tom@tromey.com> * tracepoint.c: Fix includes. * remote-utils.c: Fix includes. * linux-x86-low.c: Fix includes. gdb/stubs/ChangeLog 2019-01-21 Tom Tromey <tom@tromey.com> * ia64vms-stub.c: Fix includes.
2019-01-03Use xstrdup in tui_set_source_contentTom Tromey1-7/+1
valgrind pointed out that the string copy in tui_set_source_content was not allocating space for the trailing \0: ==3941== Invalid write of size 1 ==3941== at 0x4C3239F: strcpy (vg_replace_strmem.c:512) ==3941== by 0x72036B: strcpy (string_fortified.h:90) ==3941== by 0x72036B: tui_set_source_content(symtab*, int, int) (tui-source.c:203) Looking closer, I don't think there's a need to check the line width here, so this patch changes it to use xstrdup. Tested by re-running the TUI under valgrind. There are still other valgrind reports from TUI code, but this one is gone. gdb/ChangeLog 2019-01-03 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_set_source_content): Use xstrdup.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-12-28Highlight source code using GNU Source HighlightTom Tromey1-161/+141
This changes gdb to highlight source using GNU Source Highlight, if it is available. This affects the output of the "list" command and also the TUI source window. No new test because I didn't see a way to make it work when Source Highlight is not found. gdb/ChangeLog 2018-12-28 Tom Tromey <tom@tromey.com> * utils.h (can_emit_style_escape): Declare. * utils.c (can_emit_style_escape): No longer static. * cli/cli-style.c (set_style_enabled): New function. (_initialize_cli_style): Use it. * tui/tui-winsource.c (tui_show_source_line): Use tui_puts. (tui_alloc_source_buffer): Change how source lines are allocated. * tui/tui-source.c (copy_source_line): New function. (tui_set_source_content): Use source cache. * tui/tui-io.h (tui_puts): Update. * tui/tui-io.c (tui_puts_internal): Add window parameter. (tui_puts): Likewise. (tui_redisplay_readline): Update. * tui/tui-data.c (free_content_elements): Change how source window contents are freed. * source.c (forget_cached_source_info): Clear the source cache. (print_source_lines_base): Use the source cache. * source-cache.h: New file. * source-cache.c: New file. * configure.ac: Check for GNU Source Highlight library. * configure: Update. * config.in: Update. * Makefile.in (SRCHIGH_LIBS, SRCHIGH_CFLAGS): New variables. (INTERNAL_CFLAGS_BASE): Add SRCHIGH_CFLAGS. (CLIBS): Add SRCHIGH_LIBS. (COMMON_SFILES): Add source-cache.c. (HFILES_NO_SRCDIR): Add source-cache.h.
2018-11-09Return scoped_fd from open_source_file and find_and_open_sourceTom Tromey1-27/+20
This changes open_source_file and find_and_open_source to return scoped_fd, then updates the callers as appropriate, including using scoped_fd::to_file. Tested by the buildbot. gdb/ChangeLog 2018-11-09 Tom Tromey <tom@tromey.com> * common/scoped_fd.h (class scoped_fd): Add move constructor and move assignment operator. * psymtab.c (psymtab_to_fullname): Update. * source.h (open_source_file): Return scoped_fd. (find_and_open_source): Likewise. * source.c (open_source_file): Return scoped_fd. (get_filename_and_charpos): Update. (print_source_lines_base): Update. Use scoped_fd::to_file. (forward_search_command): Likewise. (reverse_search_command): Likewise. (find_and_open_source): Return scoped_fd. * tui/tui-source.c (tui_set_source_content): Update. Use gdb_file_up.
2018-10-19Deprecate and replace the "tabset" commandTom Tromey1-4/+4
The "tabset" command sets the tab width as used by the TUI for source and disassembly display. This command has long seemed to be misnamed to me. It is more in keeping with gdb design to call it "set tui tab-width". Also, making this change allows for the corresponding "show" command to work. gdb/ChangeLog 2018-10-19 Tom Tromey <tom@tromey.com> PR tui/18388: * NEWS: Mention tabset deprecation. * tui/tui-win.c (tui_tab_width, internal_tab_width): New globals. (update_tab_width): New function. (tui_set_tab_width, tui_show_tab_width): New functions. (tui_set_tab_width_command): Use update_tab_width. (_initialize_tui_win): Move to end of file. Deprecate "tabset". Add new "set tui tab-width" command. * tui/tui-source.c (tui_set_source_content): Update. * tui/tui-disasm.c (tui_set_disassem_content): Update. * tui/tui-data.h (tui_default_tab_len, tui_set_default_tab_len): Don't declare. (tui_tab_width): Declare. * tui/tui-data.c (default_tab_len, tui_default_tab_len) (tui_set_default_tab_len): Remove. gdb/doc/ChangeLog 2018-10-19 Tom Tromey <tom@tromey.com> PR tui/18388: * gdb.texinfo (TUI Commands): Remove tabset documentation. (TUI Configuration): Document "set tui tab-width".
2018-10-15Remove unnecessary casts from TUITom Tromey1-1/+1
This removes a number of unnecessary casts from the TUI. Some were found with -Wuseless-cast (which, I think, can't easily be enabled for gdb); and some were found by inspection. Tested by rebuilding on x86-64 Fedora 28. I'm checking this in. gdb/ChangeLog 2018-10-15 Tom Tromey <tom@tromey.com> * tui/tui.c (strcat_to_buf): Remove casts. * tui/tui-winsource.c (tui_show_source_line) (tui_set_is_exec_point_at, tui_line_is_displayed): Remove casts. * tui/tui-wingeneral.c (tui_refresh_win, box_win): Remove casts. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_display_data_from) (tui_refresh_data_win, tui_vertical_data_scroll): Remove casts. * tui/tui-win.c (tui_set_win_height) (make_invisible_and_set_new_height, parse_scrolling_args): Remove casts. * tui/tui-win.c (tui_resize_all): Remove casts. (tui_scroll_backward_command, tui_set_focus) (tui_set_tab_width_command): Likewise. * tui/tui-source.c (tui_vertical_source_scroll): Remove cast. * tui/tui-regs.c (tui_show_register_group): Remove cast. * tui/tui-layout.c (tui_set_layout_by_name): Remove cast. * tui/tui-disasm.c (tui_vertical_disassem_scroll): Remove cast. * tui/tui-data.c (tui_partial_win_by_name, tui_free_win_content): Remove casts.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files