Commit Graph

98369 Commits

Author SHA1 Message Date
GDB Administrator 6cbb8e87ee Automatic date update in version.in 2019-07-19 00:00:39 +00:00
Nick Alcock 12a0b67d28 libctf: introduce ctf_func_type_{info,args}, ctf_type_aname_raw
The first two of these allow you to get function type info and args out
of the types section give a type ID: astonishingly, this was missing
from libctf before now: so even though types of kind CTF_K_FUNCTION were
supported, you couldn't find out anything about them.  (The existing
ctf_func_info and ctf_func_args only allow you to get info about
functions in the function section, i.e. given symbol table indexes, not
type IDs.)

The second of these allows you to get the raw undecorated name out of
the CTF section (strdupped for safety) without traversing subtypes to
build a full C identifier out of it.  It's useful for things that are
already tracking the type kind etc and just need an unadorned name.

include/
	* ctf-api.h (ECTF_NOTFUNC): Fix description.
	(ctf_func_type_info): New.
	(ctf_func_type_args): Likewise.
libctf/
	* ctf-types.c (ctf_type_aname_raw): New.
	(ctf_func_type_info): Likewise.
	(ctf_func_type_args): Likewise.
	* ctf-error.c (_ctf_errlist): Fix description.
2019-07-18 20:53:57 +01:00
Guillaume LABARTHE afe09f0b63 Fix for using named pipes on Windows
On Windows, passing a named pipe as terminal argument to the new-ui
command does not work.

The problem is that the new_ui_command function in top.c opens the
same tty three times, for stdin, stdout and stderr.  With Windows
named pipes, the second and third calls to open fail.

Opening the file only once and passing the same stream for stdin,
stdout and stderr makes it work.

Pedro says:

 I tried it on GNU/Linux and things still work.
 I ran all the MI tests with forced new-ui, with:

 $ make check TESTS="gdb.mi/*.exp" RUNTESTFLAGS="FORCE_MI_SEPARATE_UI=1"

 and saw no regressions.

gdb/ChangeLog:
2019-07-18  Guillaume LABARTHE  <guillaume.labarthe@gmail.com>

	* top.c (new_ui_command): Open specified terminal just once.
2019-07-18 17:20:04 +01:00
Tom Tromey cd215b2eb7 Constify main_name
This patch constifies the return type of main_name.  There is a
comment indicating that this wasn't possible at some point in the
past, but whatever the barrier was, it is gone now.

Tested by rebuilding.

gdb/ChangeLog
2019-07-18  Tom Tromey  <tromey@adacore.com>

	* symtab.c (main_name): Constify return type.
	* symfile.c (set_initial_language): Update.
	* symtab.h (main_name): Constify return type.
2019-07-18 09:31:12 -06:00
H.J. Lu 54d7dae59a ld -r: Don't merge with member of output section group
When doing a relocatable link, members of input section group are
placed in their own output sections.  We need to make sure that no
input sections are merged with member of output section group.

	PR ld/24819
	* emultempl/elf32.em (elf_orphan_compatible): Return FALSE for
	member of output section group when doing a relocatable link.
	* testsuite/ld-elf/pr24819.d: New file.
	* testsuite/ld-elf/pr24819.s: Likewise.
2019-07-18 08:01:54 -07:00
Alan Modra 71c4e95abe [PowerPC64] Use STN_UNDEF internally for edited relocs
It's not correct to use non-STT_TLS symbols with TLS relocation, not
that it matters much when editing relocs, but this edited reloc can be
output by --emit-relocs.  So don't use a symbol on the reloc.

	* elf64-ppc.c (ppc64_elf_relocate_section): Don't bother selecting
	a TLS section symbol for edited relocs.  Tighten TLS symbol/reloc
	match test.
2019-07-18 22:17:30 +09:30
Alan Modra 46e9995a20 [PowerPC64] Don't store TLS_EXPLICIT in tls_mask
This saves a bit in tls_mask, and fixes a bug that could be triggered
in the unlikely case that both @got (usual ELF style) and @toc
(PowerOpen style) code was used to set up args for __tls_get_addr.

	* elf64-ppc.c (TLS_EXPLICIT): Define as 256.
	(ppc64_elf_check_relocs): Don't store TLS_EXPLICIT even if char
	is more than 8 bits.
	(ppc64_elf_tls_optimize): Likewise.  Make tls_set, tls_clear, and
	tls_type vars unsigned int.
	(ppc64_elf_relocate_section): Use r_type rather than TLS_EXPLICIT
	to select r_type edit.
2019-07-18 22:17:30 +09:30
Alan Modra b00a0a86c4 [PowerPC] Rename TLS_TPRELGD to TLS_GDIE
Choose a better name, that reflects why the flag is set (GD to IE
optimisation) rather than what the flag produces (TPREL64 reloc on
a single GOT entry replacing a tls_index pair).

	* elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file.
	Correct comment.
	* elf64-ppc.c (TLS_GDIE): Likewise.
2019-07-18 22:17:30 +09:30
Alan Modra 0b1474281c [PowerPC64] correct tprel offset limit
I don't expect anyone will have hit this bug.  You'd need a TLS
segment of 2G before you'd notice.

	* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
	range of tp-relative offsets.
2019-07-18 22:17:29 +09:30
Jose E. Marchesi d0044bac9e gas: .lcomm gets an alignment argument in eBPF
gas/ChangeLog:

2019-07-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c: Make .lcomm to get a third argument with the
	alignment.
2019-07-18 13:12:33 +02:00
GDB Administrator f264fab3cd Automatic date update in version.in 2019-07-18 00:00:14 +00:00
Jose E. Marchesi e0b989a6d7 gas: support .half, .word and .dword directives in eBPF
This little patch adds support to the eBPF port of GAS for a few data
directives.  The names for the directives have been chosen to be
coherent with the suffixes used in eBPF instructions: b, h, w and dw
for 8, 16, 32 and 64-bit values respectively.

Documentation and tests included.
Tested in a x86_64 host.

gas/ChangeLog:

2019-07-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c (md_pseudo_table): .half, .word and .dword.
	* testsuite/gas/bpf/data.s: New file.
	* testsuite/gas/bpf/data.d: Likewise.
	* testsuite/gas/bpf/data-be.d: Likewise.
	* testsuite/gas/bpf/bpf.exp: Run data and data-be.
	* doc/c-bpf.texi (BPF Directives): New section.
2019-07-17 22:57:23 +02:00
Tom Tromey d8f68fcb93 Remove unnecessary "return"s
The TUI has some "return;" statements at the end of void-returning
functions.  There's no need for these, so this patch removes them.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_window)
	(tui_update_source_window_as_is)
	(tui_update_source_windows_with_line): Remove return.
	* tui/tui-disasm.c (tui_show_disassem)
	(tui_show_disassem_and_update_source): Remove return.
	* tui/tui.c (tui_reset): Remove return.
	* tui/tui-wingeneral.c
	(tui_check_and_display_highlight_if_needed): Remove return.
2019-07-17 12:19:26 -06:00
Tom Tromey ca5af91ed2 Fix an error in parse_scrolling_args
parse_scrolling_args combines two errors into one message, which also
happens to end with a newline.  This separates the errors and fixes
the message.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (parse_scrolling_args): Throw separate errors.
2019-07-17 12:19:25 -06:00
Tom Tromey 5104fe361d Move source window common to code to tui-winsource.[ch]
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-17 12:19:25 -06:00
Tom Tromey daa15dde72 Change make_invisible_and_set_new_height to be a method
This changes make_invisible_and_set_new_height to be a method on
tui_win_info.  I felt that this was cleaner.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_resize_all)
	(tui_source_window_base::update_tab_width)
	(tui_adjust_win_heights): Update.
	(tui_win_info::make_invisible_and_set_new_height): Rename from
	make_invisible_and_set_new_height.
	* tui/tui-data.h (struct tui_win_info)
	<make_invisible_and_set_new_height>: New method.
2019-07-17 12:19:24 -06:00
Tom Tromey bfad453707 Move tui_source_window to tui-source.h
This moves tui_source_window to tui-source.h.  In this case there were
no method definitions to be moved.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c: Update.
	* tui/tui-source.h (struct tui_source_window): Move from
	tui-data.h.
	* tui/tui-layout.c: Update.
	* tui/tui-disasm.c: Update.
	* tui/tui-data.h (struct tui_source_window): Move to
	tui-source.h.
2019-07-17 12:19:24 -06:00
Tom Tromey 88f7e87336 Move tui_disasm_window to tui-disasm.h
This moves tui_disasm_window to tui-disasm.h.  In this case there were
no method definitions to be moved.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-disasm.h (struct tui_disasm_window): Move from
	tui-data.h.
	* tui/tui-data.h (struct tui_disasm_window): Move to
	tui-disasm.h.
2019-07-17 12:19:23 -06:00
Tom Tromey 96bd6233af Move TUI data item window to tui-regs.h
The TUI data item window is only used by the TUI register window.  So,
this patch moves the relevant code to tui-regs.[ch].

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_item_window): Move from
	tui-data.h.
	* tui/tui-regs.c (tui_data_item_window): Move from tui-data.c.
	* tui/tui-data.h (struct tui_data_item_window): Move to
	tui-regs.h.
	* tui/tui-data.c (~tui_data_item_window): Move to tui-regs.c.
2019-07-17 12:19:23 -06:00
Tom Tromey ce38393b1a Move TUI command window code
Like the earlier change to the data window, this moves the TUI command
window code to tui-command.[ch], and removes the old "structuring"
comments from tui-command.c.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c: Update.
	* tui/tui-win.c (tui_cmd_window::do_make_visible_with_new_height)
	(tui_cmd_window::max_height): Move to tui-command.c.
	* tui/tui-layout.c: Update.
	* tui/tui-data.h (struct tui_cmd_window): Move to tui-command.h.
	* tui/tui-data.c (tui_cmd_window::clear_detail): Move to
	tui-command.c.
	* tui/tui-command.h (struct tui_cmd_window): Move from
	tui-data.h.
	* tui/tui-command.c: Remove "structuring" comments.
	(tui_cmd_window::clear_detail)
	(tui_cmd_window::do_make_visible_with_new_height)
	(tui_cmd_window::max_height): Move from elsewhere.
2019-07-17 12:19:22 -06:00
Tom Tromey 2d8b51cba3 Move tui_dispatch_ctrl_char to tui-io.c
tui_dispatch_ctrl_char is only called from a single spot in tui-io.c,
so move the function to that file and make it static.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.c (tui_dispatch_ctrl_char): Move from tui-command.c.
	Now static.
	* tui/tui-command.h (tui_dispatch_ctrl_char): Don't declare.
	* tui/tui-command.c (tui_dispatch_ctrl_char): Move to tui-io.c.
2019-07-17 12:19:22 -06:00
Tom Tromey 18ab23af8b Rearrange TUI data window code
An earlier patch caused tui-windata.h to be essentially empty.  And,
other earlier patches implemented TUI data window methods in any spot
that happened to be convenient at the time.

This patch rearranges all the data window code to be somewhat more
organized.  It moves tui_data_window to tui-regs.h, and moves the
implementation of all methods to tui-regs.c.  It then removes
tui-windata.h and tui-windata.c.

It also removes the "structuring" comments from tui-regs.c; these are
not the usual gdb style, and were out of date anyhow.  Finally, it
moves _initialize_tui_regs to the end of the file, per the usual gdb
convention.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c: Update.
	* tui/tui-wingeneral.c (tui_data_window::refresh_window): Move to
	tui-regs.c.
	* tui/tui-windata.h: Remove file.
	* tui/tui-windata.c: Remove file.
	* tui/tui-win.c (tui_data_window::set_new_height)
	(tui_data_window::do_make_visible_with_new_height): Move to
	tui-regs.c.
	* tui/tui-regs.h (struct tui_data_window): Move from tui-data.h.
	* tui/tui-regs.c: Remove "structuring" comments.
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_data_window::erase_data_content)
	(tui_data_window::display_all_data)
	(tui_data_window::refresh_all)
	(tui_data_window::do_scroll_vertical)
	(tui_data_window::clear_detail, tui_data_window::set_new_height)
	(tui_data_window::do_make_visible_with_new_height)
	(tui_data_window::refresh_window): Move from elsewhere.
	(_initialize_tui_regs): Move to end of file.
	* tui/tui-layout.c: Update.
	* tui/tui-hooks.c: Update.
	* tui/tui-data.h (struct tui_data_window): Move to tui-regs.h.
	* tui/tui-data.c (tui_data_window::clear_detail): Move to
	tui-regs.c.
	* Makefile.in (SUBDIR_TUI_SRCS): Remove tui-windata.c.
2019-07-17 12:19:21 -06:00
Tom Tromey 88b7e7ccb9 Fix flushing bug in tui_puts_internal
A while back I changed gdb not to flush in some places.  It turned out
that this broke the TUI a little.  An easy way to see it is to run
"gdb -tui -nx", then "file gdb" at the gdb prompt.  gdb will print the
usual "Reading symbols..." message -- but it won't appear on-screen
until the reading is complete.

This patch changes the TUI to do the equivalent of line buffering in
tui_puts_internal.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.c (tui_puts_internal): Call wrefresh if newline is
	seen.
2019-07-17 12:19:20 -06:00
Tom Tromey 0fcd37117e Remove has_locator method
Earlier changes made it obvious that the has_locator method can only
be called for source/disassembly windows.  Because the only reference
to this now occurs in methods on this object, we can remove the
has_locator method entirely, in favor of using the member directly.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_source_window_base::set_new_height)
	(tui_source_window_base::do_make_visible_with_new_height): Use
	m_has_locator field directly.
	* tui/tui-data.h (struct tui_win_info) <has_locator>: Remove
	method.
	(struct tui_source_window_base) <has_locator>: Likewise.
2019-07-17 12:19:20 -06:00
Tom Tromey 4a38112da0 Remove tui_make_visible and tui_make_invisible
tui_make_visible and tui_make_invisible are just wrappers for a method
call, so remove them and have the callers simply make the method call
themselves.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_visible, tui_make_invisible):
	Don't declare.
	* tui/tui-wingeneral.c (tui_make_visible, tui_make_invisible):
	Remove.
	* tui/tui-win.c (tui_source_window_base::set_new_height)
	(tui_source_window_base::set_new_height)
	(make_invisible_and_set_new_height)
	(tui_source_window_base::do_make_visible_with_new_height)
	(tui_source_window_base::do_make_visible_with_new_height):
	Update.
	* tui/tui-layout.c (show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-layout.c (show_layout): Update.
2019-07-17 12:19:19 -06:00
Tom Tromey 0912922656 Remove make_data_window
As with the previous patches, unifying the creation and
re-initialization cases for the data window lets us remove
make_data_window in favor of simply using "new".

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (make_data_window): Remove.
	(show_data): Unify creation and re-initialization cases.
2019-07-17 12:19:19 -06:00
Tom Tromey 4a8a5e84a7 Remove make_source_window and make_disasm_window
This unifies the remaining creation and re-initialization cases for
the source and disassembly windows.  Once this is done, it's clear
that make_source_window and make_disasm_window aren't needed any more,
so remove them.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (make_source_window, make_disasm_window):
	Remove.
	(show_data): Unify creation and re-initialization cases.
2019-07-17 12:19:18 -06:00
Tom Tromey 76d2be8e92 Remove make_command_window
This unifies the creation and re-initialization cases for the command
window.  When this is done, it becomes clear that make_command_window
isn't needed -- it can be replaced with a simple "new", so this is
removed as well.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (make_command_window): Remove.
	(show_source_disasm_command, show_source_or_disasm_and_command):
	Unify creation and re-initialization cases.
2019-07-17 12:19:18 -06:00
Tom Tromey 890b8bde7a Simplify show_source_or_disasm_and_command
This changes show_source_or_disasm_and_command to unify the creation
and re-initialization cases.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_or_disasm_and_command): Unify
	creation and re-initialization cases.
2019-07-17 12:19:17 -06:00
Tom Tromey 2cdfa11333 Change tui_get_register to return void
tui_get_register returns a tui_status, but nothing checks this, so it
can return void instead.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_get_register): Return void.
2019-07-17 12:19:17 -06:00
Tom Tromey 8e3cfd09e8 Simplify tui_gen_win_info::make_visible
I noticed that tui_gen_win_info::make_visible was much wordier than it
needed to be.  This simplifies it.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (tui_gen_win_info::make_visible):
	Simplify.
2019-07-17 12:19:16 -06:00
Tom Tromey f4e049775a Simplify show_source_disasm_command
This is the first of a few patches to further simplify window
(re-)initialization in tui-layout.c.  When changing the layout, a
window may be created or, if it already exists, simply resized.  These
two cases normally are identical, but this was obscured by the way the
code was written.  This patch changes show_source_disasm_command to
unify the creation and re-initialization cases.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command): Simplify window
	resetting.
2019-07-17 12:19:16 -06:00
Tom Tromey 0379b8837a Clean up tui_layout_command
tui_layout_command is a simple wrapper for tui_set_layout_by_name.
This removes the extra layer and cleans up the resulting function a
bit -- changing it to call error rather than return a result.  This
necessitated a small change to tui-regs.c, to avoid calling the
function that is being removed.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.h (tui_set_layout_by_name): Don't declare.
	* tui/tui-regs.c (tui_reg_layout): New function.
	(tui_show_registers, tui_reg_command): Use it.
	* tui/tui-layout.c (LAYOUT_USAGE): Remove.
	(tui_layout_command): Rename from tui_set_layout_by_name.  Change
	parameters.
	(tui_layout_command): Remove.
2019-07-17 12:19:15 -06:00
Tom Tromey b7fbad913e Change tui_set_layout to return void
tui_set_layout can't meaningfully be called with UNDEFINED_LAYOUT; and
instead of trying to handle this case, simply assert and have the
function return void.  No caller was checking the return value anyway.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.h (tui/tui-layout): Return void.
	* tui/tui-layout.c (tui_set_layout): Return void.  Add assert.
2019-07-17 12:19:15 -06:00
Tom Tromey 4e1e56b981 Remove reset_locator
reset_locator was introduced just a few patches ago, but it's already
time to remove it.  It consists of a call to the locator's "reset"
method, plus a call to tui_make_window; but the latter is redundant at
all the places that call reset_locator.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command, show_data):
	Update.
	(reset_locator): Remove.
	(show_source_or_disasm_and_command): Update.
2019-07-17 12:19:14 -06:00
Tom Tromey 1e0c09ba0b Remove the win_type parameter from tui_gen_win_info::reset
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-17 12:19:13 -06:00
Tom Tromey 1bf605de8e Introduce reset_locator function in tui-layout.c
init_and_make_win in tui-layout.c is now only called for the locator
-- earlier changes have made most of the cases here obsolete.  This
patch removes init_and_make_win and introduces a reset_locator
function.  Window creation is now much simpler to follow, because it
is no longer quite so dynamic.  (Though it will become even simpler in
coming patches.)

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command): Use
	reset_locator.
	(reset_locator): New function.
	(init_and_make_win): Remove.
	(show_source_or_disasm_and_command): Use reset_locator.
2019-07-17 12:19:13 -06:00
Tom Tromey 098f9ed48e Always create an execution info window for a source window
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-17 12:19:12 -06:00
Tom Tromey 801109578c Remove some dead code from tui_set_layout
tui_set_layout sets regs_populate using:

      regs_populate = (new_layout == SRC_DATA_COMMAND
		       || new_layout == DISASSEM_DATA_COMMAND);

Then later it checks this variable:

	  if (!regs_populate
	      && (new_layout == SRC_DATA_COMMAND
		  || new_layout == DISASSEM_DATA_COMMAND))

However, this is equivalent to "!regs_populate && regs_populate",
which can never be true.  So, remove the dead code and the variable.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (tui_set_layout): Remove regs_populate
	variable.
2019-07-17 12:19:12 -06:00
Tom Tromey cf82af058d Remove TUI data window special case
The TUI has a couple of special cases for updating the data window:
one in tui_rl_other_windowand one in tui_set_focus_command.  As part
of the project to remove references to globals, I wanted to remove
these calls; but when I did, some simple operations (like "C-x o")
would cause the register window to blank.

This fixes the underlying problem by arranging for the data window's
refresh_window method to call the superclass method first, and then to
refresh the child windows.  Then the special cases can be removed.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_rl_other_window): Update.
	* tui/tui-wingeneral.c (tui_data_window::refresh_window): Call
	superclass method first.  Always iterate over regs_content.
	(tui_unhighlight_win, tui_highlight_win): Use refresh_window
	method.
	* tui/tui-win.c (tui_set_focus_command): Update.
2019-07-17 12:19:11 -06:00
Tom Tromey 01aeb396d0 Remove tui_set_focus
tui_set_focus_command is a simple wrapper for tui_set_focus, so rename
the latter and remove the wrapper function.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_set_focus_command): Rename from
	tui_set_focus.  Call tui_enable.
	(tui_set_focus_command): Remove.
2019-07-17 12:19:10 -06:00
Tom Tromey fd6c75eecd Merge refresh and refresh_window methods
Earlier refactorings introduced the refresh and refresh_window
methods, following the previous TUI code.  However, these methods are
essentially the same, so this patch merges them.  It also removes some
redundant refresh_window calls, because the execution window is
updated automatically by the corresponding source (or disassembly)
window.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_show_exec_info_content): Don't call
	refresh_window.
	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Call
	touchwin.
	(tui_data_window::refresh_window): Call refresh_window on data
	items.  Always call superclass refresh_window.
	(tui_win_info::refresh): Remove.
	(tui_source_window_base::refresh_window): Update.
	(tui_refresh_all): Update.
	* tui/tui-layout.c (show_source_disasm_command): Remove call to
	refresh_window.
	(show_source_or_disasm_and_command): Likewise.
	* tui/tui-data.h (struct tui_win_info) <refresh>: Remove.
	(struct tui_source_window_base) <refresh>: Likewise.
2019-07-17 12:19:10 -06:00
Tom Tromey f6cc34a91c Remove tui_source_window::content_in_use
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-17 12:19:09 -06:00
Tom Tromey f31ec9af48 Simplify source window clearing
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-17 12:19:09 -06:00
Tom Tromey d1b6f1e5eb Remove UNDEFINED_ITEM define from TUI
The TUI defined UNDEFINED_ITEM, but only used it in a single spot.  I
think this isn't very useful, so this removes the define.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (UNDEFINED_ITEM): Remove define.
	(struct tui_data_item_window): Update.
2019-07-17 12:19:08 -06:00
Tom Tromey d9743a13e0 Remove unused TUI defines
This removes some #defines that were unused in the TUI.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (MAX_CONTENT_COUNT, TUI_NULL_STR)
	(DEFAULT_HISTORY_COUNT, WITH_LOCATOR, NO_LOCATOR): Remove
	defines.
2019-07-17 12:19:07 -06:00
Tom Tromey caf0bc4e8b Remove unused parameter from two TUI functions
The "display_prompt" parameter of tui_erase_source_content and
tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT
value, so remove the parameter.  Once this is done, the
EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so
remove those as well.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_erase_source_content)
	(tui_clear_source_content): Remove "display_prompt" parameter.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_update_source_windows_with_addr): Update.
	(tui_clear_source_content): Remove "display_prompt" parameter.
	(tui_erase_source_content): Likewise.  Simplify.
	(tui_show_source_content): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
	* tui/tui-stack.c (tui_show_frame_info): Update.
	* tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT):
	Remove defines.
2019-07-17 12:19:07 -06:00
Tom Tromey 9d391078d1 Add win_info parameter to tui_set_disassem_content
This adds a win_info parameter to tui_set_disassem_content, removing
uses of the TUI_DISASM_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_window_as_is): Update.
	* tui/tui-disasm.h (tui_set_disassem_content): Add win_info
	parameter.
	* tui/tui-disasm.c (tui_set_disassem_content): Add win_info
	parameter.
2019-07-17 12:19:06 -06:00
Tom Tromey a38da35d7b Move content_in_use to tui_source_window class
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-17 12:19:06 -06:00
Tom Tromey c2cd899466 Introduce tui_source_window_base::location_matches_p method
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-17 12:19:05 -06:00