aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
AgeCommit message (Collapse)AuthorFilesLines
2021-02-08gdb: return true in TuiWindow.is_valid only if TUI is enabledAndrew Burgess3-8/+17
If the user implements a TUI window in Python, and this window responds to GDB events and then redraws its window contents then there is currently an edge case which can lead to problems. The Python API documentation suggests that calling methods like erase or write on a TUI window (from Python code) will raise an exception if the window is not valid. And the description for is_valid says: This method returns True when this window is valid. When the user changes the TUI layout, windows no longer visible in the new layout will be destroyed. At this point, the gdb.TuiWindow will no longer be valid, and methods (and attributes) other than is_valid will throw an exception. From this I, as a user, would expect that if I did 'tui disable' to switch back to CLI mode, then the window would no longer be valid. However, this is not the case. When the TUI is disabled the windows in the TUI are not deleted, they are simply hidden. As such, currently, the is_valid method continues to return true. This means that if the users Python code does something like: def event_handler (e): global tui_window_object if tui_window_object->is_valid (): tui_window_object->erase () tui_window_object->write ("Hello World") gdb.events.stop.connect (event_handler) Then when a stop event arrives GDB will try to draw the TUI window, even when the TUI is disabled. This exposes two bugs. First, is_valid should be returning false in this case, second, if the user forgot to add the is_valid call, then I believe the erase and write calls should be throwing an exception (when the TUI is disabled). The solution to both of these issues is I think bound together, as it depends on having a working 'is_valid' check. There's a rogue assert added into tui-layout.c as part of this commit. While working on this commit I managed to break GDB such that TUI_CMD_WIN was nullptr, this was causing GDB to abort. I'm leaving the assert in as it might help people catch issues in the future. This patch is inspired by the work done here: https://sourceware.org/pipermail/gdb-patches/2020-December/174338.html gdb/ChangeLog: * python/py-tui.c (gdbpy_tui_window) <is_valid>: New member function. (REQUIRE_WINDOW): Call is_valid member function. (REQUIRE_WINDOW_FOR_SETTER): New define. (gdbpy_tui_is_valid): Call is_valid member function. (gdbpy_tui_set_title): Call REQUIRE_WINDOW_FOR_SETTER instead. * tui/tui-data.h (struct tui_win_info) <is_visible>: Check tui_active too. * tui/tui-layout.c (tui_apply_current_layout): Add an assert. * tui/tui.c (tui_enable): Move setting of tui_active earlier in the function. gdb/doc/ChangeLog: * python.texinfo (TUI Windows In Python): Extend description of TuiWindow.is_valid. gdb/testsuite/ChangeLog: * gdb.python/tui-window-disabled.c: New file. * gdb.python/tui-window-disabled.exp: New file. * gdb.python/tui-window-disabled.py: New file.
2021-02-08gdb/tui: don't add windows to global list from tui_layout:window::applyAndrew Burgess2-15/+27
This commit was inspired by this mailing list patch: https://sourceware.org/pipermail/gdb-patches/2021-January/174713.html Currently, calling tui_layout_window::apply will add the window from the layout object to the global tui_windows list. Unfortunately, when the user runs the 'winheight' command, this calls tui_adjust_window_height, which calls the tui_layout_base::adjust_size function, which can then call tui_layout_base::apply. The consequence of this is that when the user does 'winheight' duplicate copies of a window can be added to the global tui_windows list. The original patch fixed this by changing the apply function to only update the global list some of the time. This patch takes a different approach. The apply function no longer updates the global tui_windows list. Instead a new virtual function is added to tui_layout_base which is used to gather all the currently applied windows into a vector. Finally tui_apply_current_layout is updated to make use of this new function to update the tui_windows list. The benefits I see in this approach are, (a) the apply function now no longer touches global state, this solves the immediate problem, and (b) now that tui_windows is updated directly in the function tui_apply_current_layout, we can drop the saved_tui_windows global. gdb/ChangeLog: * tui-layout.c (saved_tui_windows): Delete. (tui_apply_current_layout): Don't make use of saved_tui_windows, call new get_windows member function instead. (tui_get_window_by_name): Check in tui_windows. (tui_layout_window::apply): Don't add to tui_windows. * tui-layout.h (tui_layout_base::get_windows): New member function. (tui_layout_window::get_windows): Likewise. (tui_layout_split::get_windows): Likewise. gdb/testsuite/ChangeLog: * gdb.tui/winheight.exp: Add more tests.
2021-02-08gdb/tui: restore delete of window objectsAndrew Burgess1-0/+1
In commit: commit f237f998d1168139d599c550d54169cd8f94052d Date: Mon Jan 25 18:43:19 2021 +0000 gdb/tui: remove special handling of locator/status window I accidentally remove a call to delete the tui window objects. Now every time GDB changes tui layout it is leaking windows. gdb/ChangeLog: * tui/tui-layout.c (tui_apply_current_layout): Restore the delete of the window objects.
2021-02-08gdb/tui: fix issue with handling the return characterAndrew Burgess3-35/+66
My initial goal was to fix our gdb/testsuite/lib/tuiterm.exp such that it would correctly support (some limited) scrolling of the command window. What I observe is that when sending commands to the tui command window in a test script with: Term::command "p 1" The command window would be left looking like this: (gdb) (gdb) p 1$1 = 1 (gdb) When I would have expected it to look like this: (gdb) p 1 $1 = 1 (gdb) Obviously a bug in our tuiterm.exp library, right??? Wrong! Turns out there's a bug in GDB. If in GDB I enable the tui and then type (slowly) the 'p 1\r' (the \r is pressing the return key at the end of the string), then you do indeed get the "expected" terminal output. However, if instead I copy the 'p 1\r' string and paste it into the tui in one go then I now see the same corrupted output as we do when using tuiterm.exp. It turns out the problem is that GDB fails when handling lots of input arriving quickly with a \r (or \n) on the end. The reason for this bug is as follows: When the tui is active the terminal is in no-echo mode, so characters sent to the terminal are not echoed out again. This means that when the user types \r, this is not echoed to the terminal. The characters read in are passed to readline and \r indicates that the command line is complete and ready to be processed. However, the \r is not included in readlines command buffer, and is NOT printed by readline when is displays its buffer to the screen. So, in GDB we have to manually spot the \r when it is read in and update the display. Printing a newline character to the output and moving the cursor to the next line. This is done in tui_getc_1. Now readline tries to reduce the number of write calls. So if we very quickly (as in paste in one go) the text 'p 1' to readline (this time with no \r on the end), then readline will fetch the fist character and add it to its internal buffer. But before printing the character out readline checks to see if there's more input incoming. As we pasted multiple characters, then yes, readline sees the ' ' and adds this to its buffer, and finally the '1', this too is added to the buffer. Now if at this point we take a break, readline sees there is no more input available, and so prints its buffer out. Now when we press \r the code in tui_getc_1 kicks in, adds a \n to the output and moves the cursor to the next line. But, if instead we paste 'p 1\r' in one go then readline adds 'p 1' to its buffer as before, but now it sees that there is still more input available. Now it fetches the '\r', but this triggers the newline behaviour, we print '\n' and move to the next line - however readline has not printed its buffer yet! So finally we end up on the next line. There's no more input available so readline prints its buffer, then GDB gets passed the buffer, handles it, and prints the result. The solution I think is to put of our special newline insertion code until we know that readline has finished printing its buffer. Handily we know when this is - the next thing readline does is pass us the command line buffer for processing. So all we need to do is hook in to the command line processing, and before we pass the command line to GDB's internals we do all of the magic print a newline and move the cursor to the next line stuff. Luckily, GDB's interpreter mechanism already provides the hooks we need to do this. So all I do here is move the newline printing code from tui_getc_1 into a new function, setup a new input_handler hook for the tui, and call my new newline printing function. After this I can enable the tui and paste in 'p 1\r' and see the correct output. Also the tuiterm.exp library will now see non-corrupted output. gdb/ChangeLog: * tui/tui-interp.c (tui_command_line_handler): New function. (tui_interp::resume): Register tui_command_line_handler as the input_handler. * tui/tui-io.c (tui_inject_newline_into_command_window): New function. (tui_getc_1): Delete handling of '\n' and '\r'. * tui-io.h (tui_inject_newline_into_command_window): Declare. gdb/testsuite/ChangeLog: * gdb.tui/scroll.exp: Tighten expected results. Remove comment about bug in GDB, update expected results, and add more tests.
2021-02-07Don't draw register sub windows outside the visible areaHannes Domani1-2/+12
If the regs window is not big enough to show all registers, the registers whose values changed are always drawn, even if they are not in the currently visible area. So this marks the invisible register sub windows with y=0, and skips their rerender call in check_register_values. gdb/ChangeLog: 2021-02-07 Hannes Domani <ssbssa@yahoo.de> * tui/tui-regs.c (tui_data_window::display_registers_from): Mark invisible register sub windows. (tui_data_window::check_register_values): Ignore invisible register sub windows.
2021-02-07Don't fill regs window with a negative number of spacesHannes Domani1-1/+2
Function n_spaces can't handle negative values, and returns an invalid pointer in this case. gdb/ChangeLog: 2021-02-07 Hannes Domani <ssbssa@yahoo.de> * tui/tui-regs.c (tui_data_item_window::rerender): Don't call n_spaces with a negative value.
2021-02-07Refresh regs window in display_registers_fromHannes Domani1-0/+2
Otherwise the register window is redrawn empty when scrolling or changing its size with winheight. gdb/ChangeLog: 2021-02-07 Hannes Domani <ssbssa@yahoo.de> * tui/tui-regs.c (tui_data_window::display_registers_from): Add refresh_window call.
2021-01-28gdb/tui: remove special handling of locator/status windowAndrew Burgess11-138/+217
The locator window, or status window as it is sometimes called is handled differently to all the other windows. The reason for this is that the class representing this window (tui_locator_window) does two jobs, first this class represents a window just like any other that has space on the screen and fills the space with content. The second job is that this class serves as a storage area to hold information about the current location that the TUI windows represent, so the class has members like 'addr' and 'line_no', for example which are used within this class, and others when they want to know which line/address the TUI windows should be showing to the user. Because of this dual purpose we must always have an instance of the tui_locator_window so that there is somewhere to store this location information. The result of this is that the locator window must never be deleted like other windows, which results in some special case code. In this patch I propose splitting the two roles of the tui_locator_window class. The tui_locator_window class will retain just its window drawing parts, and will be treated just like any other window. This should allow all special case code for this window to be deleted. The other role, that of tracking the current tui location will be moved into a new class (tui_location_tracker), of which there will be a single global instance. All of the places where we previously use the locator window to get location information will now be updated to get this from the tui_location_tracker. There should be no user visible changes after this commit. gdb/ChangeLog: * Makefile.in (SUBDIR_TUI_SRCS): Add tui/tui-location.c. (HFILES_NO_SRCDIR): Add tui/tui-location.h. * tui/tui-data.h (TUI_STATUS_WIN): Define. (tui_locator_win_info_ptr): Delete declaration. * tui/tui-disasm.c: Add 'tui/tui-location.h' include. (tui_disasm_window::set_contents): Fetch state from tui_location global. (tui_get_begin_asm_address): Likewise. * tui/tui-layout.c (tui_apply_current_layout): Remove special case for locator window. (get_locator_window): Delete. (initialize_known_windows): Treat locator window just like all the rest. * tui/tui-source.c: Add 'tui/tui-location.h' include. (tui_source_window::set_contents): Fetch state from tui_location global. (tui_source_window::showing_source_p): Likewise. * tui/tui-stack.c: Add 'tui/tui-location.h' include. (_locator): Delete. (tui_locator_win_info_ptr): Delete. (tui_locator_window::make_status_line): Fetch state from tui_location global. (tui_locator_window::rerender): Remove check of 'handle', reindent function body. (tui_locator_window::set_locator_fullname): Delete. (tui_locator_window::set_locator_info): Delete. (tui_update_locator_fullname): Delete. (tui_show_frame_info): Likewise. (tui_show_locator_content): Access window through TUI_STATUS_WIN. * tui/tui-stack.h (tui_locator_window::set_locator_info): Moved to tui/tui-location.h and renamed to tui_location_tracker::set_location. (tui_locator_window::set_locator_fullname): Moved to tui/tui-location.h and renamed to tui_location_tracker::set_fullname. (tui_locator_window::full_name): Delete. (tui_locator_window::proc_name): Delete. (tui_locator_window::line_no): Delete. (tui_locator_window::addr): Delete. (tui_locator_window::gdbarch): Delete. (tui_update_locator_fullname): Delete declaration. * tui/tui-wingeneral.c (tui_refresh_all): Removed special handling for locator window. * tui/tui-winsource.c: Add 'tui/tui-location.h' include. (tui_display_main): Call function on tui_location directly. * tui/tui.h (enum tui_win_type): Add STATUS_WIN. * tui/tui-location.c: New file. * tui/tui-location.h: New file.
2021-01-15gdb/tui: compare pointer to nullptr, not 0Andrew Burgess1-2/+2
Compare pointers to nullptr, not 0. I also fixed a trailing whitespace in the same function. There should be no user visible changes after this commit. gdb/ChangeLog: * tui/tui.c (tui_is_window_visible): Compare to nullptr, not 0.
2021-01-05Prevent flickering when redrawing the TUI source windowHannes Domani1-1/+3
tui_win_info::refresh_window simply calls wrefresh, which internally does a doupdate. This redraws the source background window without the source pad. Then prefresh of the source pad draws the actual source code on top, which flickers. By changing this to wnoutrefresh, the actual drawing on the screen is only done once in the following prefresh, without flickering. gdb/ChangeLog: 2021-01-05 Hannes Domani <ssbssa@yahoo.de> * tui/tui-winsource.c (tui_source_window_base::refresh_window): Call wnoutrefresh instead of tui_win_info::refresh_window.
2021-01-05Redraw both spaces between line numbers and source codeHannes Domani1-1/+3
There a 2 spaces between the numbers and source code, but only one of them was redrawn. So if you increase the source window height, the second space keeps the character of the border rectangle. With this both spaces are redrawn, so the border rectangle character is overwritten. gdb/ChangeLog: 2021-01-05 Hannes Domani <ssbssa@yahoo.de> * tui/tui-source.c (tui_source_window::show_line_number): Redraw second space after line number.
2021-01-05Fix TUI source window drawingHannes Domani1-2/+3
The smaxrow and smaxcol parameters of prefresh are the bottom right corner of the text area inclusive, not exclusive. And if the source window grows bigger in height, the pad has to grow as well. gdb/ChangeLog: 2021-01-05 Hannes Domani <ssbssa@yahoo.de> PR tui/26927 * tui/tui-winsource.c (tui_source_window_base::refresh_window): Fix source pad size in prefresh. (tui_source_window_base::show_source_content): Grow source pad if necessary.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker31-31/+31
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-11-29Don't delete the locator win infoHannes Domani1-1/+3
The locator win info is special because it is static, all the others are created dynamically. gdb/ChangeLog: 2020-11-29 Hannes Domani <ssbssa@yahoo.de> PR tui/26973 * tui/tui-layout.c (tui_apply_current_layout): Don't delete the static locator win info.
2020-11-02gdb, gdbserver, gdbsupport: fix leading space vs tabs issuesSimon Marchi7-98/+98
Many spots incorrectly use only spaces for indentation (for example, there are a lot of spots in ada-lang.c). I've always found it awkward when I needed to edit one of these spots: do I keep the original wrong indentation, or do I fix it? What if the lines around it are also wrong, do I fix them too? I probably don't want to fix them in the same patch, to avoid adding noise to my patch. So I propose to fix as much as possible once and for all (hopefully). One typical counter argument for this is that it makes code archeology more difficult, because git-blame will show this commit as the last change for these lines. My counter counter argument is: when git-blaming, you often need to do "blame the file at the parent commit" anyway, to go past some other refactor that touched the line you are interested in, but is not the change you are looking for. So you already need a somewhat efficient way to do this. Using some interactive tool, rather than plain git-blame, makes this trivial. For example, I use "tig blame <file>", where going back past the commit that changed the currently selected line is one keystroke. It looks like Magit in Emacs does it too (though I've never used it). Web viewers of Github and Gitlab do it too. My point is that it won't really make archeology more difficult. The other typical counter argument is that it will cause conflicts with existing patches. That's true... but it's a one time cost, and those are not conflicts that are difficult to resolve. I have also tried "git rebase --ignore-whitespace", it seems to work well. Although that will re-introduce the faulty indentation, so one needs to take care of fixing the indentation in the patch after that (which is easy). gdb/ChangeLog: * aarch64-linux-tdep.c: Fix indentation. * aarch64-ravenscar-thread.c: Fix indentation. * aarch64-tdep.c: Fix indentation. * aarch64-tdep.h: Fix indentation. * ada-lang.c: Fix indentation. * ada-lang.h: Fix indentation. * ada-tasks.c: Fix indentation. * ada-typeprint.c: Fix indentation. * ada-valprint.c: Fix indentation. * ada-varobj.c: Fix indentation. * addrmap.c: Fix indentation. * addrmap.h: Fix indentation. * agent.c: Fix indentation. * aix-thread.c: Fix indentation. * alpha-bsd-nat.c: Fix indentation. * alpha-linux-tdep.c: Fix indentation. * alpha-mdebug-tdep.c: Fix indentation. * alpha-nbsd-tdep.c: Fix indentation. * alpha-obsd-tdep.c: Fix indentation. * alpha-tdep.c: Fix indentation. * amd64-bsd-nat.c: Fix indentation. * amd64-darwin-tdep.c: Fix indentation. * amd64-linux-nat.c: Fix indentation. * amd64-linux-tdep.c: Fix indentation. * amd64-nat.c: Fix indentation. * amd64-obsd-tdep.c: Fix indentation. * amd64-tdep.c: Fix indentation. * amd64-windows-tdep.c: Fix indentation. * annotate.c: Fix indentation. * arc-tdep.c: Fix indentation. * arch-utils.c: Fix indentation. * arch/arm-get-next-pcs.c: Fix indentation. * arch/arm.c: Fix indentation. * arm-linux-nat.c: Fix indentation. * arm-linux-tdep.c: Fix indentation. * arm-nbsd-tdep.c: Fix indentation. * arm-pikeos-tdep.c: Fix indentation. * arm-tdep.c: Fix indentation. * arm-tdep.h: Fix indentation. * arm-wince-tdep.c: Fix indentation. * auto-load.c: Fix indentation. * auxv.c: Fix indentation. * avr-tdep.c: Fix indentation. * ax-gdb.c: Fix indentation. * ax-general.c: Fix indentation. * bfin-linux-tdep.c: Fix indentation. * block.c: Fix indentation. * block.h: Fix indentation. * blockframe.c: Fix indentation. * bpf-tdep.c: Fix indentation. * break-catch-sig.c: Fix indentation. * break-catch-syscall.c: Fix indentation. * break-catch-throw.c: Fix indentation. * breakpoint.c: Fix indentation. * breakpoint.h: Fix indentation. * bsd-uthread.c: Fix indentation. * btrace.c: Fix indentation. * build-id.c: Fix indentation. * buildsym-legacy.h: Fix indentation. * buildsym.c: Fix indentation. * c-typeprint.c: Fix indentation. * c-valprint.c: Fix indentation. * c-varobj.c: Fix indentation. * charset.c: Fix indentation. * cli/cli-cmds.c: Fix indentation. * cli/cli-decode.c: Fix indentation. * cli/cli-decode.h: Fix indentation. * cli/cli-script.c: Fix indentation. * cli/cli-setshow.c: Fix indentation. * coff-pe-read.c: Fix indentation. * coffread.c: Fix indentation. * compile/compile-cplus-types.c: Fix indentation. * compile/compile-object-load.c: Fix indentation. * compile/compile-object-run.c: Fix indentation. * completer.c: Fix indentation. * corefile.c: Fix indentation. * corelow.c: Fix indentation. * cp-abi.h: Fix indentation. * cp-namespace.c: Fix indentation. * cp-support.c: Fix indentation. * cp-valprint.c: Fix indentation. * cris-linux-tdep.c: Fix indentation. * cris-tdep.c: Fix indentation. * darwin-nat-info.c: Fix indentation. * darwin-nat.c: Fix indentation. * darwin-nat.h: Fix indentation. * dbxread.c: Fix indentation. * dcache.c: Fix indentation. * disasm.c: Fix indentation. * dtrace-probe.c: Fix indentation. * dwarf2/abbrev.c: Fix indentation. * dwarf2/attribute.c: Fix indentation. * dwarf2/expr.c: Fix indentation. * dwarf2/frame.c: Fix indentation. * dwarf2/index-cache.c: Fix indentation. * dwarf2/index-write.c: Fix indentation. * dwarf2/line-header.c: Fix indentation. * dwarf2/loc.c: Fix indentation. * dwarf2/macro.c: Fix indentation. * dwarf2/read.c: Fix indentation. * dwarf2/read.h: Fix indentation. * elfread.c: Fix indentation. * eval.c: Fix indentation. * event-top.c: Fix indentation. * exec.c: Fix indentation. * exec.h: Fix indentation. * expprint.c: Fix indentation. * f-lang.c: Fix indentation. * f-typeprint.c: Fix indentation. * f-valprint.c: Fix indentation. * fbsd-nat.c: Fix indentation. * fbsd-tdep.c: Fix indentation. * findvar.c: Fix indentation. * fork-child.c: Fix indentation. * frame-unwind.c: Fix indentation. * frame-unwind.h: Fix indentation. * frame.c: Fix indentation. * frv-linux-tdep.c: Fix indentation. * frv-tdep.c: Fix indentation. * frv-tdep.h: Fix indentation. * ft32-tdep.c: Fix indentation. * gcore.c: Fix indentation. * gdb_bfd.c: Fix indentation. * gdbarch.sh: Fix indentation. * gdbarch.c: Re-generate * gdbarch.h: Re-generate. * gdbcore.h: Fix indentation. * gdbthread.h: Fix indentation. * gdbtypes.c: Fix indentation. * gdbtypes.h: Fix indentation. * glibc-tdep.c: Fix indentation. * gnu-nat.c: Fix indentation. * gnu-nat.h: Fix indentation. * gnu-v2-abi.c: Fix indentation. * gnu-v3-abi.c: Fix indentation. * go32-nat.c: Fix indentation. * guile/guile-internal.h: Fix indentation. * guile/scm-cmd.c: Fix indentation. * guile/scm-frame.c: Fix indentation. * guile/scm-iterator.c: Fix indentation. * guile/scm-math.c: Fix indentation. * guile/scm-ports.c: Fix indentation. * guile/scm-pretty-print.c: Fix indentation. * guile/scm-value.c: Fix indentation. * h8300-tdep.c: Fix indentation. * hppa-linux-nat.c: Fix indentation. * hppa-linux-tdep.c: Fix indentation. * hppa-nbsd-nat.c: Fix indentation. * hppa-nbsd-tdep.c: Fix indentation. * hppa-obsd-nat.c: Fix indentation. * hppa-tdep.c: Fix indentation. * hppa-tdep.h: Fix indentation. * i386-bsd-nat.c: Fix indentation. * i386-darwin-nat.c: Fix indentation. * i386-darwin-tdep.c: Fix indentation. * i386-dicos-tdep.c: Fix indentation. * i386-gnu-nat.c: Fix indentation. * i386-linux-nat.c: Fix indentation. * i386-linux-tdep.c: Fix indentation. * i386-nto-tdep.c: Fix indentation. * i386-obsd-tdep.c: Fix indentation. * i386-sol2-nat.c: Fix indentation. * i386-tdep.c: Fix indentation. * i386-tdep.h: Fix indentation. * i386-windows-tdep.c: Fix indentation. * i387-tdep.c: Fix indentation. * i387-tdep.h: Fix indentation. * ia64-libunwind-tdep.c: Fix indentation. * ia64-libunwind-tdep.h: Fix indentation. * ia64-linux-nat.c: Fix indentation. * ia64-linux-tdep.c: Fix indentation. * ia64-tdep.c: Fix indentation. * ia64-tdep.h: Fix indentation. * ia64-vms-tdep.c: Fix indentation. * infcall.c: Fix indentation. * infcmd.c: Fix indentation. * inferior.c: Fix indentation. * infrun.c: Fix indentation. * iq2000-tdep.c: Fix indentation. * language.c: Fix indentation. * linespec.c: Fix indentation. * linux-fork.c: Fix indentation. * linux-nat.c: Fix indentation. * linux-tdep.c: Fix indentation. * linux-thread-db.c: Fix indentation. * lm32-tdep.c: Fix indentation. * m2-lang.c: Fix indentation. * m2-typeprint.c: Fix indentation. * m2-valprint.c: Fix indentation. * m32c-tdep.c: Fix indentation. * m32r-linux-tdep.c: Fix indentation. * m32r-tdep.c: Fix indentation. * m68hc11-tdep.c: Fix indentation. * m68k-bsd-nat.c: Fix indentation. * m68k-linux-nat.c: Fix indentation. * m68k-linux-tdep.c: Fix indentation. * m68k-tdep.c: Fix indentation. * machoread.c: Fix indentation. * macrocmd.c: Fix indentation. * macroexp.c: Fix indentation. * macroscope.c: Fix indentation. * macrotab.c: Fix indentation. * macrotab.h: Fix indentation. * main.c: Fix indentation. * mdebugread.c: Fix indentation. * mep-tdep.c: Fix indentation. * mi/mi-cmd-catch.c: Fix indentation. * mi/mi-cmd-disas.c: Fix indentation. * mi/mi-cmd-env.c: Fix indentation. * mi/mi-cmd-stack.c: Fix indentation. * mi/mi-cmd-var.c: Fix indentation. * mi/mi-cmds.c: Fix indentation. * mi/mi-main.c: Fix indentation. * mi/mi-parse.c: Fix indentation. * microblaze-tdep.c: Fix indentation. * minidebug.c: Fix indentation. * minsyms.c: Fix indentation. * mips-linux-nat.c: Fix indentation. * mips-linux-tdep.c: Fix indentation. * mips-nbsd-tdep.c: Fix indentation. * mips-tdep.c: Fix indentation. * mn10300-linux-tdep.c: Fix indentation. * mn10300-tdep.c: Fix indentation. * moxie-tdep.c: Fix indentation. * msp430-tdep.c: Fix indentation. * namespace.h: Fix indentation. * nat/fork-inferior.c: Fix indentation. * nat/gdb_ptrace.h: Fix indentation. * nat/linux-namespaces.c: Fix indentation. * nat/linux-osdata.c: Fix indentation. * nat/netbsd-nat.c: Fix indentation. * nat/x86-dregs.c: Fix indentation. * nbsd-nat.c: Fix indentation. * nbsd-tdep.c: Fix indentation. * nios2-linux-tdep.c: Fix indentation. * nios2-tdep.c: Fix indentation. * nto-procfs.c: Fix indentation. * nto-tdep.c: Fix indentation. * objfiles.c: Fix indentation. * objfiles.h: Fix indentation. * opencl-lang.c: Fix indentation. * or1k-tdep.c: Fix indentation. * osabi.c: Fix indentation. * osabi.h: Fix indentation. * osdata.c: Fix indentation. * p-lang.c: Fix indentation. * p-typeprint.c: Fix indentation. * p-valprint.c: Fix indentation. * parse.c: Fix indentation. * ppc-linux-nat.c: Fix indentation. * ppc-linux-tdep.c: Fix indentation. * ppc-nbsd-nat.c: Fix indentation. * ppc-nbsd-tdep.c: Fix indentation. * ppc-obsd-nat.c: Fix indentation. * ppc-ravenscar-thread.c: Fix indentation. * ppc-sysv-tdep.c: Fix indentation. * ppc64-tdep.c: Fix indentation. * printcmd.c: Fix indentation. * proc-api.c: Fix indentation. * producer.c: Fix indentation. * producer.h: Fix indentation. * prologue-value.c: Fix indentation. * prologue-value.h: Fix indentation. * psymtab.c: Fix indentation. * python/py-arch.c: Fix indentation. * python/py-bpevent.c: Fix indentation. * python/py-event.c: Fix indentation. * python/py-event.h: Fix indentation. * python/py-finishbreakpoint.c: Fix indentation. * python/py-frame.c: Fix indentation. * python/py-framefilter.c: Fix indentation. * python/py-inferior.c: Fix indentation. * python/py-infthread.c: Fix indentation. * python/py-objfile.c: Fix indentation. * python/py-prettyprint.c: Fix indentation. * python/py-registers.c: Fix indentation. * python/py-signalevent.c: Fix indentation. * python/py-stopevent.c: Fix indentation. * python/py-stopevent.h: Fix indentation. * python/py-threadevent.c: Fix indentation. * python/py-tui.c: Fix indentation. * python/py-unwind.c: Fix indentation. * python/py-value.c: Fix indentation. * python/py-xmethods.c: Fix indentation. * python/python-internal.h: Fix indentation. * python/python.c: Fix indentation. * ravenscar-thread.c: Fix indentation. * record-btrace.c: Fix indentation. * record-full.c: Fix indentation. * record.c: Fix indentation. * reggroups.c: Fix indentation. * regset.h: Fix indentation. * remote-fileio.c: Fix indentation. * remote.c: Fix indentation. * reverse.c: Fix indentation. * riscv-linux-tdep.c: Fix indentation. * riscv-ravenscar-thread.c: Fix indentation. * riscv-tdep.c: Fix indentation. * rl78-tdep.c: Fix indentation. * rs6000-aix-tdep.c: Fix indentation. * rs6000-lynx178-tdep.c: Fix indentation. * rs6000-nat.c: Fix indentation. * rs6000-tdep.c: Fix indentation. * rust-lang.c: Fix indentation. * rx-tdep.c: Fix indentation. * s12z-tdep.c: Fix indentation. * s390-linux-tdep.c: Fix indentation. * score-tdep.c: Fix indentation. * ser-base.c: Fix indentation. * ser-mingw.c: Fix indentation. * ser-uds.c: Fix indentation. * ser-unix.c: Fix indentation. * serial.c: Fix indentation. * sh-linux-tdep.c: Fix indentation. * sh-nbsd-tdep.c: Fix indentation. * sh-tdep.c: Fix indentation. * skip.c: Fix indentation. * sol-thread.c: Fix indentation. * solib-aix.c: Fix indentation. * solib-darwin.c: Fix indentation. * solib-frv.c: Fix indentation. * solib-svr4.c: Fix indentation. * solib.c: Fix indentation. * source.c: Fix indentation. * sparc-linux-tdep.c: Fix indentation. * sparc-nbsd-tdep.c: Fix indentation. * sparc-obsd-tdep.c: Fix indentation. * sparc-ravenscar-thread.c: Fix indentation. * sparc-tdep.c: Fix indentation. * sparc64-linux-tdep.c: Fix indentation. * sparc64-nbsd-tdep.c: Fix indentation. * sparc64-obsd-tdep.c: Fix indentation. * sparc64-tdep.c: Fix indentation. * stabsread.c: Fix indentation. * stack.c: Fix indentation. * stap-probe.c: Fix indentation. * stubs/ia64vms-stub.c: Fix indentation. * stubs/m32r-stub.c: Fix indentation. * stubs/m68k-stub.c: Fix indentation. * stubs/sh-stub.c: Fix indentation. * stubs/sparc-stub.c: Fix indentation. * symfile-mem.c: Fix indentation. * symfile.c: Fix indentation. * symfile.h: Fix indentation. * symmisc.c: Fix indentation. * symtab.c: Fix indentation. * symtab.h: Fix indentation. * target-float.c: Fix indentation. * target.c: Fix indentation. * target.h: Fix indentation. * tic6x-tdep.c: Fix indentation. * tilegx-linux-tdep.c: Fix indentation. * tilegx-tdep.c: Fix indentation. * top.c: Fix indentation. * tracefile-tfile.c: Fix indentation. * tracepoint.c: Fix indentation. * tui/tui-disasm.c: Fix indentation. * tui/tui-io.c: Fix indentation. * tui/tui-regs.c: Fix indentation. * tui/tui-stack.c: Fix indentation. * tui/tui-win.c: Fix indentation. * tui/tui-winsource.c: Fix indentation. * tui/tui.c: Fix indentation. * typeprint.c: Fix indentation. * ui-out.h: Fix indentation. * unittests/copy_bitwise-selftests.c: Fix indentation. * unittests/memory-map-selftests.c: Fix indentation. * utils.c: Fix indentation. * v850-tdep.c: Fix indentation. * valarith.c: Fix indentation. * valops.c: Fix indentation. * valprint.c: Fix indentation. * valprint.h: Fix indentation. * value.c: Fix indentation. * value.h: Fix indentation. * varobj.c: Fix indentation. * vax-tdep.c: Fix indentation. * windows-nat.c: Fix indentation. * windows-tdep.c: Fix indentation. * xcoffread.c: Fix indentation. * xml-syscall.c: Fix indentation. * xml-tdesc.c: Fix indentation. * xstormy16-tdep.c: Fix indentation. * xtensa-config.c: Fix indentation. * xtensa-linux-nat.c: Fix indentation. * xtensa-linux-tdep.c: Fix indentation. * xtensa-tdep.c: Fix indentation. gdbserver/ChangeLog: * ax.cc: Fix indentation. * dll.cc: Fix indentation. * inferiors.h: Fix indentation. * linux-low.cc: Fix indentation. * linux-nios2-low.cc: Fix indentation. * linux-ppc-ipa.cc: Fix indentation. * linux-ppc-low.cc: Fix indentation. * linux-x86-low.cc: Fix indentation. * linux-xtensa-low.cc: Fix indentation. * regcache.cc: Fix indentation. * server.cc: Fix indentation. * tracepoint.cc: Fix indentation. gdbsupport/ChangeLog: * common-exceptions.h: Fix indentation. * event-loop.cc: Fix indentation. * fileio.cc: Fix indentation. * filestuff.cc: Fix indentation. * gdb-dlfcn.cc: Fix indentation. * gdb_string_view.h: Fix indentation. * job-control.cc: Fix indentation. * signals.cc: Fix indentation. Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-10-19Don't erase TUI source window when switching focusTom Tromey2-7/+6
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-10-02gdb: give names to async event/signal handlersSimon Marchi1-1/+2
Assign names to async event/signal handlers. They will be used in debug messages when file handlers are invoked. Unlike in the previous patch, the names are not copied in the structure, since we don't need to (all names are string literals for the moment). gdb/ChangeLog: * async-event.h (create_async_signal_handler): Add name parameter. (create_async_event_handler): Likewise. * async-event.c (struct async_signal_handler) <name>: New field. (struct async_event_handler) <name>: New field. (create_async_signal_handler): Assign name. (create_async_event_handler): Assign name. * event-top.c (async_init_signals): Pass name when creating handler. * infrun.c (_initialize_infrun): Likewise. * record-btrace.c (record_btrace_push_target): Likewise. * record-full.c (record_full_open): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (remote_target::open_1): Likewise. * tui/tui-win.c (tui_initialize_win): Likewise. Change-Id: Icd9d9f775542ae5fc2cd148c12f481e7885936d5
2020-10-02gdb: give names to event loop file handlersSimon Marchi1-1/+1
Assign names to event loop file handlers. They will be used in debug messages when file handlers are invoked. In GDB, each UI used to get its own unique number, until commit cbe256847e19 ("Remove ui::num"). Re-introduce this field, and use it to make a unique name for the handler. I'm not too sure what goes on in ser-base.c, all I know is that it's what is used when debugging remotely. I've just named the main handler "serial". It would be good to have unique names there too. For instance when debugging with two different remote connections, we'd ideally want the handlers to have unique names. I didn't do it in this patch though. gdb/ChangeLog: * async-event.c (initialize_async_signal_handlers): Pass name to add_file_handler * event-top.c (ui_register_input_event_handler): Likewise. * linux-nat.c (linux_nat_target::async): Likewise. * run-on-main-thread.c (_initialize_run_on_main_thread): Likewise * ser-base.c (reschedule): Likewise. (ser_base_async): Likewise. * tui/tui-io.c: Likewise. * top.h (struct ui) <num>: New field. * top.c (highest_ui_num): New variable. (ui::ui): Initialize num. gdbserver/ChangeLog: * linux-low.cc (linux_process_target::async): Pass name to add_file_handler. * remote-utils.cc (handle_accept_event): Likewise. (remote_open): Likewise. gdbsupport/ChangeLog: * event-loop.h (add_file_handler): Add "name" parameter. * event-loop.cc (struct file_handler) <name>: New field. (create_file_handler): Add "name" parameter, assign it to file handler. (add_file_handler): Add "name" parameter. Change-Id: I9f1545f73888ebb6778eb653a618ca44d105f92c
2020-09-28Remove target_has_registers macroTom Tromey1-2/+2
This removes the target_has_registers object-like macro, replacing it with the underlying function. gdb/ChangeLog 2020-09-28 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_get_register) (tui_data_window::show_registers): Update. * thread.c (scoped_restore_current_thread::restore) (scoped_restore_current_thread::scoped_restore_current_thread): Update. * regcache-dump.c (regcache_print): Update. * python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb): Update. * mi/mi-main.c (mi_cmd_data_write_register_values): Update. * mep-tdep.c (current_me_module, current_options): Update. * linux-thread-db.c (thread_db_load): Update. * infcmd.c (registers_info, info_vector_command) (info_float_command): Update. * ia64-tdep.c (ia64_frame_prev_register) (ia64_sigtramp_frame_prev_register): Update. * ia64-libunwind-tdep.c (libunwind_frame_prev_register): Update. * gcore.c (derive_stack_segment): Update. * frame.c (get_current_frame, has_stack_frames): Update. * findvar.c (language_defn::read_var_value): Update. * arm-tdep.c (arm_pc_is_thumb): Update. * target.c (target_has_registers): Rename from target_has_registers_1. * target.h (target_has_registers): Remove macro. (target_has_registers): Rename from target_has_registers_1.
2020-09-28Remove target_has_stack macroTom Tromey1-1/+1
This removes the target_has_stack object-like macro, replacing it with the underlying function. gdb/ChangeLog 2020-09-28 Tom Tromey <tom@tromey.com> * windows-tdep.c (tlb_make_value): Update. * tui/tui-regs.c (tui_data_window::show_registers): Update. * thread.c (scoped_restore_current_thread::restore) (scoped_restore_current_thread::scoped_restore_current_thread) (thread_command): Update. * stack.c (backtrace_command_1, frame_apply_level_command) (frame_apply_all_command, frame_apply_command): Update. * infrun.c (siginfo_make_value, restore_infcall_control_state): Update. * gcore.c (derive_stack_segment): Update. * frame.c (get_current_frame, has_stack_frames): Update. * auxv.c (info_auxv_command): Update. * ada-tasks.c (ada_build_task_list): Update. * target.c (target_has_stack): Rename from target_has_stack_1. * target.h (target_has_stack): Remove macro. (target_has_stack): Rename from target_has_stack_1.
2020-09-28Remove target_has_memory macroTom Tromey1-1/+1
This removes the target_has_memory object-like macro, replacing it with the underlying function. gdb/ChangeLog 2020-09-28 Tom Tromey <tom@tromey.com> * target.c (target_has_memory): Rename from target_has_memory_1. * tui/tui-regs.c (tui_data_window::show_registers): Update. * thread.c (scoped_restore_current_thread::restore) (scoped_restore_current_thread::scoped_restore_current_thread): Update. * frame.c (get_current_frame, has_stack_frames): Update. * target.h (target_has_memory): Remove macro. (target_has_memory): Rename from target_has_memory_1.
2020-09-27Rewrite tui_putsTom Tromey1-12/+63
This rewrites tui_puts. It now writes as many bytes as possible in a call to waddnstr, letting curses handle multi-byte sequences properly. Note that tui_puts_internal remains. It is needed to handle computing the start line of the readline prompt, which is difficult to do properly in the case where redisplaying can also cause the command window to scroll. This might be possible to implement by reverting to single "character" output, by using mbsrtowcs for its side effects to find character boundaries in the input. I have not attempted this. gdb/ChangeLog 2020-09-27 Tom Tromey <tom@tromey.com> PR tui/25342: * tui/tui-io.c (tui_puts): Rewrite. Move earlier.
2020-09-27Use ISCNTRL in tui_copy_source_lineTom Tromey1-3/+4
This changes tui_copy_source_line to use ISCNTRL. This lets it work more nicely with UTF-8 input. Note that this still won't work for stateful multi-byte encodings; for that much more work would be required. However, I think this patch does not make gdb any worse in this scenario. gdb/ChangeLog 2020-09-27 Tom Tromey <tom@tromey.com> PR tui/25342: * tui/tui-winsource.c (tui_copy_source_line): Use ISNCTRL.
2020-09-27Use a curses pad for source and disassembly windowsTom Tromey6-68/+109
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-09-27Remove a call to show_source_line from TUITom Tromey1-1/+0
This removes a call to show_source_line from tui_source_window_base. This call isn't needed because this function already calls the 'refill' method if the state changed. gdb/ChangeLog 2020-09-27 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_source_window_base::set_is_exec_point_at): Don't call show_source_line.
2020-09-24Don't let TUI focus on locatorTom Tromey3-8/+37
PR tui/26638 notes that the C-x o binding can put the focus on the locator window. However, this is not useful and did not happen historically. This patch changes the TUI to skip this window when switching focus. gdb/ChangeLog 2020-09-24 Tom Tromey <tromey@adacore.com> PR tui/26638: * tui/tui-stack.h (struct tui_locator_window) <can_focus>: New method. * tui/tui-data.h (struct tui_win_info) <can_focus>: New method. * tui/tui-data.c (tui_next_win): Exclude non-focusable windows. (tui_prev_win): Rewrite. gdb/testsuite/ChangeLog 2020-09-24 Tom Tromey <tromey@adacore.com> PR tui/26638: * gdb.tui/list.exp: Check output of "focus next".
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-06[gdb/tui,c++17] Fix NULL string_view in tui_partial_win_by_nameTom de Vries1-13/+10
When building gdb with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17 and running test-case gdb.tui/new-layout.exp, we run into: ... UNRESOLVED: gdb.tui/new-layout.exp: left window box after shrink (ll corner) FAIL: gdb.tui/new-layout.exp: right window box after shrink (ll corner) ... In a minimal form, we run into an abort when issuing a winheight command: ... $ gdb -tui -ex "winheight src - 5" <tui stuff> Aborted (core dumped) $ ... with this backtrace at the abort: ... \#0 0x0000000000438db0 in std::char_traits<char>::length (__s=0x0) at /usr/include/c++/9/bits/char_traits.h:335 \#1 0x000000000043b72e in std::basic_string_view<char, \ std::char_traits<char> >::basic_string_view (this=0x7fffffffd4f0, \ __str=0x0) at /usr/include/c++/9/string_view:124 \#2 0x000000000094971b in tui_partial_win_by_name (name="src") at src/gdb/tui/tui-win.c:663 ... due to a NULL comparison which constructs a string_view object from NULL: ... 657 /* Answer the window represented by name. */ 658 static struct tui_win_info * 659 tui_partial_win_by_name (gdb::string_view name) 660 { 661 struct tui_win_info *best = nullptr; 662 663 if (name != NULL) ... In gdbsupport/gdb_string_view.h, we either use: - gdb's copy of libstdc++-v3/include/experimental/string_view, or - the standard implementation of string_view, when built with C++17 or later (which in gcc's case comes from libstdc++-v3/include/std/string_view) In the first case, there's support for constructing a string_view from a NULL pointer: ... /*constexpr*/ basic_string_view(const _CharT* __str) : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, _M_str{__str} { } ... but in the second case, there's not: ... __attribute__((__nonnull__)) constexpr basic_string_view(const _CharT* __str) noexcept : _M_len{traits_type::length(__str)}, _M_str{__str} { } ... Fix this by removing the NULL comparison altogether. Build on x86_64-linux with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17, and tested. gdb/ChangeLog: 2020-07-06 Tom de Vries <tdevries@suse.de> PR tui/26205 * tui/tui-win.c (tui_partial_win_by_name): Don't test for NULL name.
2020-07-01Make tui_win_info::name pure virtualTom Tromey2-4/+6
It seemed cleaner to me for tui_win_info::name to be pure virtual. This meant adding a name method to the locator window; but this too seems like an improvement. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_win_info) <name>: Now pure virtual. * tui/tui-stack.h (struct tui_locator_window) <name>: New method.
2020-07-01Remove tui_gen_win_infoTom Tromey5-93/+55
This merges the tui_gen_win_info base class with tui_win_info; renaming the resulting class to tui_win_info. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_win_info::refresh_window): Move from tui_gen_win_info. (tui_win_info::make_window): Merge with tui_gen_win_info::make_window. (tui_win_info::make_visible): Move from tui_gen_win_info. * tui/tui-win.c (tui_win_info::max_width): Move from tui_gen_win_info. * tui/tui-layout.h (class tui_layout_window) <m_window>: Change type. <window_factory>: Likewise. * tui/tui-layout.c (tui_win_info::resize): Move from tui_gen_win_info. (make_standard_window): Change return type. (get_locator_window, tui_get_window_by_name): Likewise. (tui_layout_window::apply): Remove a cast. * tui/tui-data.h (MIN_WIN_HEIGHT): Move earlier. (struct tui_win_info): Merge with tui_gen_win_info. (struct tui_gen_win_info): Remove.
2020-07-01Derive tui_locator_window from tui_win_infoTom Tromey1-1/+16
tui_locator_window is the last remaining concrete child class of tui_gen_win_info. It seems a bit cleaner to me to flatten the hierarchy a bit; this patch prepares for that by changing tui_locator_window to derive from tui_win_info. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window): Derive from tui_win_info. <do_scroll_horizontal, do_scroll_vertical>: New methods. <can_box>: New method.
2020-07-01Remove body of tui_locator_window constructorTom Tromey1-5/+1
The tui_locator_window constructor initializes the first character of two of its members. However, this is actually an error, since these were changed to be std::string. This removes the erroneous code. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window): Remove body.
2020-07-01Don't derive tui_data_item_window from tui_gen_win_infoTom Tromey3-78/+30
There's no deep reason that tui_data_item_window should derive from tui_gen_win_info -- it currently uses a curses window to render, but that isn't truly needed, and it adds some hacks to other parts of the TUI. This patch changes tui_data_item_window so that it doesn't have a base class, and updates the register window. This simplifies the code and enables a subsequent cleanup. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::display_registers_from) (tui_data_window::display_registers_from) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows): Update. (tui_data_window::refresh_window, tui_data_window::no_refresh): Remove. (tui_data_window::check_register_values): Update. (tui_data_item_window::rerender): Add parameters. Update. (tui_data_item_window::refresh_window): Remove. * tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: No longer virtual. * tui/tui-regs.h (struct tui_data_item_window): Don't derive from tui_gen_win_info. <refresh_window, max_height, min_height>: Remove. <rerender>: Add parameters. <x, y, visible>: New members. (struct tui_data_window) <refresh_window, no_refresh>: Remove. <m_item_width>: New member.
2020-07-01Rename tui_data_item_window::item_noTom Tromey2-4/+4
tui_data_item_window::item_no is misnamed -- it only can be used for a register, but it references a "display" number as well. (Based on other comments I've seen in the past -- most since deleted -- I think there were plans at one point to display variables in this window as well. However, this was never implemented.) This patch renames this member to be more correct. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group) (tui_data_window::check_register_values): Update. * tui/tui-regs.h (struct tui_data_item_window) <regno>: Rename from item_no.
2020-07-01Remove useless "if' from tui-regs.cTom Tromey1-7/+4
tui_data_window::show_register_group had a useless "if" -- the condition could never be false. This patch removes it. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group): Remove useless "if".
2020-07-01Remove tui_data_window::nameTom Tromey2-2/+0
The "name" member of tui_data_window was set, but never used. This removes it. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group): Update. * tui/tui-regs.h (struct tui_data_item_window) <name>: Remove.
2020-07-01Move some code out of tui-data.hTom Tromey4-26/+22
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-07-01Remove tui_expand_tabsTom Tromey4-73/+48
tui_expand_tabs only has a single caller. This patch removes this function, in favor of a tab-expanding variant of string_file. This simplifies the code somewhat. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <content>: Now a std::string. * tui/tui-regs.c (class tab_expansion_file): New. (tab_expansion_file::write): New method. (tui_register_format): Change return type. Use tab_expansion_file. (tui_get_register, tui_data_window::display_registers_from) (tui_data_item_window::rerender): Update. * tui/tui-io.h (tui_expand_tabs): Don't declare. * tui/tui-io.c (tui_expand_tabs): Remove.
2020-07-01Use complete_on_enum in tui_reggroup_completerTom Tromey1-9/+2
tui_reggroup_completer has an "XXXX" comment suggesting the use of complete_on_enum. This patch implements this suggestion. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum.
2020-06-17Remove unnecessary TUI declarationsTom Tromey2-7/+0
I found some unnecessary declarations (and one unused macro) in the TUI. This patch removes them. gdb/ChangeLog 2020-06-17 Tom Tromey <tom@tromey.com> * tui/tui-win.h (tui_scroll_forward, tui_scroll_backward) (tui_scroll_left, tui_scroll_right, struct tui_win_info): Don't declare. * tui/tui-data.h (MIN_CMD_WIN_HEIGHT): Remove.
2020-06-16Use macros for TUI window namesTom Tromey2-32/+33
Christian pointed out that tui-layout.c hard-codes various window names. This patch changes the code to use the macros from tui-data.h instead. For each window, I searched for uses of the name; but I only found any in tui-layout.c. This also adds a new macro to account for the "status" window. gdb/ChangeLog 2020-06-16 Tom Tromey <tom@tromey.com> * tui/tui-data.h (STATUS_NAME): New macro. * tui/tui-layout.c (tui_remove_some_windows) (initialize_known_windows, tui_register_window) (tui_layout_split::remove_windows, initialize_layouts) (tui_new_layout_command): Don't use hard-coded window names.
2020-06-16Fix crash when exiting TUI with gdb -tuiTom Tromey4-5/+18
PR tui/25348 points out that, when "gdb -tui" is used, then exiting the TUI will cause a crash. This happens because tui_setup_io stashes some readline variables -- but because this happens before readline is initialized, some of these are NULL. Then, when exiting the TUI, the NULL values are "restored", causing a crash in readline. This patch fixes the problem by ensuring that readline is initialized first. Back in commit 11061048d ("Give a name to the TUI SingleKey keymap"), a call to rl_initialize was removed from tui_initialize_readline; this patch resurrects the call, but moves it to the end of the function, so as not to remove the ability to modify the SingleKey map from .inputrc. gdb/ChangeLog 2020-06-16 Tom Tromey <tom@tromey.com> PR tui/25348: * tui/tui.c (tui_ensure_readline_initialized): Rename from tui_initialize_readline. Only run once. Call rl_initialize. * tui/tui.h (tui_ensure_readline_initialized): Rename from tui_initialize_readline. * tui/tui-io.c (tui_setup_io): Call tui_ensure_readline_initialized. * tui/tui-interp.c (tui_interp::init): Update.
2020-06-16Fix C-x 1 from gdb promptTom Tromey1-5/+6
Pedro pointed out on irc that C-x 1 from the gdb prompt will cause a crash. This happened because of a bug in remove_windows -- it would always remove all the windows from the layout. This patch fixes this bug, and also arranges to have C-x 1 preserve the status window. gdb/ChangeLog 2020-06-16 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (tui_layout_split::remove_windows): Fix logic. Also preserve the status window.
2020-05-03Update more calls to add_prefix_cmdTom Tromey1-18/+8
I looked at all the calls to add_prefix_cmd, and replaced them with calls to add_basic_prefix_cmd or add_show_prefix_cmd when appropriate. This makes gdb's command language a bit more regular. I don't think there's a significant downside. Note that this patch removes a couple of tests. The removed ones are completely redundant. gdb/ChangeLog 2020-05-03 Tom Tromey <tom@tromey.com> * breakpoint.c (catch_command, tcatch_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd, add_show_prefix_cmd. (set_breakpoint_cmd, show_breakpoint_cmd): Remove * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Remove. (add_internal_problem_command): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (set_mipsfpu_command): Remove. (_initialize_mips_tdep): Use add_basic_prefix_cmd. * dwarf2/index-cache.c (set_index_cache_command): Remove. (_initialize_index_cache): Use add_basic_prefix_cmd. * memattr.c (dummy_cmd): Remove. (_initialize_mem): Use add_basic_prefix_cmd, add_show_prefix_cmd. * tui/tui-win.c (set_tui_cmd, show_tui_cmd): Remove. (_initialize_tui_win): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-logging.c (set_logging_command): Remove. (_initialize_cli_logging): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_logging_command): Remove. * target.c (target_command): Remove. (add_target): Use add_basic_prefix_cmd. gdb/testsuite/ChangeLog 2020-05-03 Tom Tromey <tom@tromey.com> * gdb.base/sepdebug.exp: Remove "catch" test. * gdb.base/break.exp: Remove "catch" test. * gdb.base/default.exp: Update expected output.
2020-04-18Change get_objfile_arch to a method on objfileTom Tromey2-2/+2
This changes get_objfile_arch to be a new inline method, objfile::arch. To my surprise, this function came up while profiling DWARF psymbol reading. Making this change improved performance from 1.986 seconds to 1.869 seconds. Both measurements were done by taking the mean of 10 runs on a fixed copy of the gdb executable. gdb/ChangeLog 2020-04-18 Tom Tromey <tom@tromey.com> * xcoffread.c (enter_line_range, scan_xcoff_symtab): Update. * value.c (value_fn_field): Update. * valops.c (find_function_in_inferior) (value_allocate_space_in_inferior): Update. * tui/tui-winsource.c (tui_update_source_windows_with_line): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * symtab.c (lookup_global_or_static_symbol) (find_function_start_sal_1, skip_prologue_sal) (print_msymbol_info, find_gnu_ifunc, symbol_arch): Update. * symmisc.c (dump_msymbols, dump_symtab_1) (maintenance_print_one_line_table): Update. * symfile.c (init_entry_point_info, section_is_mapped) (list_overlays_command, simple_read_overlay_table) (simple_overlay_update_1): Update. * stap-probe.c (handle_stap_probe): Update. * stabsread.c (dbx_init_float_type, define_symbol) (read_one_struct_field, read_enum_type, read_range_type): Update. * source.c (info_line_command): Update. * python/python.c (gdbpy_source_objfile_script) (gdbpy_execute_objfile_script): Update. * python/py-type.c (save_objfile_types): Update. * python/py-objfile.c (py_free_objfile): Update. * python/py-inferior.c (python_new_objfile): Update. * psymtab.c (psym_find_pc_sect_compunit_symtab, dump_psymtab) (dump_psymtab_addrmap_1, maintenance_info_psymtabs) (maintenance_check_psymtabs): Update. * printcmd.c (info_address_command): Update. * objfiles.h (struct objfile) <arch>: New method, from get_objfile_arch. (get_objfile_arch): Don't declare. * objfiles.c (get_objfile_arch): Remove. (filter_overlapping_sections): Update. * minsyms.c (msymbol_is_function): Update. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines) (output_nondebug_symbol): Update. * mdebugread.c (parse_symbol, basic_type, parse_partial_symbols) (mdebug_expand_psymtab): Update. * machoread.c (macho_add_oso_symfile): Update. * linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap): Update. * linux-fork.c (checkpoint_command): Update. * linespec.c (convert_linespec_to_sals): Update. * jit.c (finalize_symtab): Update. * infrun.c (insert_exception_resume_from_probe): Update. * ia64-tdep.c (ia64_find_unwind_table): Update. * hppa-tdep.c (internalize_unwinds): Update. * gdbtypes.c (get_type_arch, init_float_type, objfile_type): Update. * gcore.c (call_target_sbrk): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read, elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2/read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab) (read_debug_names_from_section) (process_psymtab_comp_unit_reader, add_partial_symbol) (add_partial_subprogram, process_full_comp_unit) (read_file_scope, read_func_scope, read_lexical_block_scope) (read_call_site_scope, dwarf2_ranges_read) (dwarf2_record_block_ranges, dwarf2_add_field) (mark_common_block_symbol_computed, read_tag_pointer_type) (read_tag_string_type, dwarf2_init_float_type) (dwarf2_init_complex_target_type, read_base_type) (partial_die_info::read, partial_die_info::read) (read_attribute_value, dwarf_decode_lines_1, new_symbol) (dwarf2_fetch_die_loc_sect_off): Update. * dwarf2/loc.c (dwarf2_find_location_expression) (class dwarf_evaluate_loc_desc, rw_pieced_value) (dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval) (dwarf2_loc_desc_get_symbol_read_needs) (locexpr_describe_location_piece, locexpr_describe_location_1) (loclist_describe_location): Update. * dwarf2/index-write.c (write_debug_names): Update. * dwarf2/frame.c (dwarf2_build_frame_info): Update. * dtrace-probe.c (dtrace_process_dof): Update. * dbxread.c (read_dbx_symtab, dbx_end_psymtab) (process_one_symbol): Update. * ctfread.c (ctf_init_float_type, read_base_type): Update. * coffread.c (coff_symtab_read, enter_linenos, decode_base_type) (coff_read_enum_type): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * buildsym.c (buildsym_compunit::finish_block_internal): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, get_sal_arch): Update. * block.c (block_gdbarch): Update. * annotate.c (annotate_source_line): Update.
2020-04-17Replace most calls to help_list and cmd_show_listTom Tromey2-22/+5
Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-13Move event-loop.[ch] to gdbsupport/Tom Tromey4-4/+4
This moves event-loop.[ch] to gdbsupport/ and updates the uses in gdb. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * run-on-main-thread.c: Update include. * unittests/main-thread-selftests.c: Update include. * tui/tui-win.c: Update include. * tui/tui-io.c: Update include. * tui/tui-interp.c: Update include. * tui/tui-hooks.c: Update include. * top.h: Update include. * top.c: Update include. * ser-base.c: Update include. * remote.c: Update include. * remote-notif.c: Update include. * remote-fileio.c: Update include. * record-full.c: Update include. * record-btrace.c: Update include. * python/python.c: Update include. * posix-hdep.c: Update include. * mingw-hdep.c: Update include. * mi/mi-main.c: Update include. * mi/mi-interp.c: Update include. * main.c: Update include. * linux-nat.c: Update include. * interps.c: Update include. * infrun.c: Update include. * inf-loop.c: Update include. * event-top.c: Update include. * event-loop.c: Move to ../gdbsupport/. * event-loop.h: Move to ../gdbsupport/. * async-event.h: Update include. * Makefile.in (COMMON_SFILES, HFILES_NO_SRCDIR): Update. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.h: Move from ../gdb/. * event-loop.cc: Move from ../gdb/.
2020-04-13Introduce async-event.[ch]Tom Tromey1-0/+1
This patch splits out some gdb-specific code from event-loop, into new files async-event.[ch]. Strictly speaking this code could perhaps be put into gdbsupport/, but because gdbserver does not currently use it, it seemed better, for size reasons, to split it out. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * tui/tui-win.c: Include async-event.h. * remote.c: Include async-event.h. * remote-notif.c: Include async-event.h. * record-full.c: Include async-event.h. * record-btrace.c: Include async-event.h. * infrun.c: Include async-event.h. * event-top.c: Include async-event.h. * event-loop.h: Move some declarations to async-event.h. * event-loop.c: Don't include ser-event.h or top.h. Move some code to async-event.c. * async-event.h: New file. * async-event.c: New file. * Makefile.in (COMMON_SFILES): Add async-event.c. (HFILES_NO_SRCDIR): Add async-event.h.
2020-02-24[gdb/testsuite] Fix layout next/prev/regs help messageTom de Vries1-3/+3
With test-case gdb.gdb/unittest.exp, I run into: ... (gdb) maintenance selftest^M ... Running selftest help_doc_invariants.^M help doc broken invariant: command 'layout next' help doc first line is \ not terminated with a '.' character^M help doc broken invariant: command 'layout prev' help doc first line is \ not terminated with a '.' character^M help doc broken invariant: command 'layout regs' help doc first line is \ not terminated with a '.' character^M Self test failed: self-test failed at help-doc-selftests.c:95^M ... Fix this by adding the missing '.' character. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-02-24 Tom de Vries <tdevries@suse.de> * tui/tui-layout.c (_initialize_tui_layout): Fix help messages for commands layout next/prev/regs.
2020-02-22Fix cast in TUI_DISASM_WINTom Tromey1-1/+2
I noticed that the TUI_DISASM_WIN macro cast the disassembly window to a base type, rather than its correct type. This patch fixes this oversight. 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-data.h (TUI_DISASM_WIN): Cast to tui_disasm_window. Change-Id: Ied3dbac9ef3dc48ceb9e0850fe4ada3c316dd769