deliverable/binutils-gdb.git
4 years agoEnsure that when attempting to process an ARM Mach-O file with unknown relocs, that...
Nick Clifton [Wed, 26 Jun 2019 16:03:32 +0000 (17:03 +0100)] 
Ensure that when attempting to process an ARM Mach-O file with unknown relocs, that a suitable error message is displayed.

PR 24703
binutils* bucomm.c (bfd_nonfatal): If no bfd error code has been set then
indicate this in the output.
(bfd_nonfatal_message): Likewise.

bfd * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add error
messages for failures.
* mach-o.c (bfd_mach_o_canonicalize_relocs): Set an bfd error code
if returning an error value.

4 years agoRemove lookup_minimal_symbol_solib_trampoline
Tom Tromey [Wed, 26 Jun 2019 15:48:32 +0000 (09:48 -0600)] 
Remove lookup_minimal_symbol_solib_trampoline

lookup_minimal_symbol_solib_trampoline is unused, so this patch
removes it.  The last use was apparently removed in
commit 61a12cfa ("Remove HPUX").

gdb/ChangeLog
2019-06-26  Tom Tromey  <tromey@adacore.com>

* minsyms.c (lookup_minimal_symbol_solib_trampoline): Remove.
* minsyms.h (lookup_minimal_symbol_solib_trampoline): Don't
declare.

4 years agoAArch64: Add missing CPSR flags
Alan Hayward [Wed, 26 Jun 2019 14:48:12 +0000 (15:48 +0100)] 
AArch64: Add missing CPSR flags

Add all the CPSR flags for Armv8.1-A through to Armv8.4-A.

In addition, document all the existing flags, and remove
the superfluous empty spaces.

gdb/ChangeLog:

* features/aarch64-core.c (create_feature_aarch64_core):
Regenerate.
* features/aarch64-core.xml: Add cpsr flags.

4 years agoArm: Allow version strings in the triplet regexp
Alan Hayward [Wed, 26 Jun 2019 13:10:08 +0000 (14:10 +0100)] 
Arm: Allow version strings in the triplet regexp

On Arm, the OS may use the full version string for the arch name when
installing the compiler, for example armv7hl-redhat-linux-gnueabi-gcc.

Implement gdbarch_gnu_triplet_regexp for Arm to allow this to be detected.
Ensure that other Arm targets (eg iwmmxt) are not affected.

This fixes the compile/ set of tests on those systems.

gdb/ChangeLog:

2019-06-26  Alan Hayward  <alan.hayward@arm.com>

* arm-tdep.c (arm_gnu_triplet_regexp): New function.
(arm_gdbarch_init): Add arm_gnu_triplet_regexp.

4 years ago[gdb/testsuite] Compile varval twice, once without bad DWARF
Tom de Vries [Wed, 26 Jun 2019 13:04:05 +0000 (15:04 +0200)] 
[gdb/testsuite] Compile varval twice, once without bad DWARF

When we run gdb.dwarf2/varval.exp with board cc-with-dwz, we run into:
...
gdb compile failed, dwz: varval: Couldn't find DIE referenced by \
  DW_OP_GNU_variable_value
cc-with-tweaks.sh: dwz did not modify varval.
UNTESTED: gdb.dwarf2/varval.exp: failed to prepare
...

The problem is that varval contains some bad DWARF, which has been added
intentionally to test GDB, but that bad DWARF causes dwz to error out, which
has the consequence that the test-case remains untested with cc-with-dwz,
while the test-case contains also correct DWARF that does not occur in any
other test, and which we would really like to test with board cc-with-dwz.

Fix this by compiling varval twice, once without and once with the bad DWARF,
such that we have at least:
...
PASS: gdb.dwarf2/varval.exp: print varval
PASS: gdb.dwarf2/varval.exp: print varval2
PASS: gdb.dwarf2/varval.exp: print constval
PASS: gdb.dwarf2/varval.exp: print mixedval
PASS: gdb.dwarf2/varval.exp: print pointerval
PASS: gdb.dwarf2/varval.exp: print *pointerval
PASS: gdb.dwarf2/varval.exp: print structval
PASS: gdb.dwarf2/varval.exp: print untypedval
gdb compile failed, dwz: varval: Couldn't find DIE referenced by \
  DW_OP_GNU_variable_value
cc-with-tweaks.sh: dwz did not modify varval.
UNTESTED: gdb.dwarf2/varval.exp: failed to prepare
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-26  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/varval.exp: Compile twice, once without bad DWARF.

4 years ago[gdb/testsuite] Add back missing debug for index-cache.exp
Tom de Vries [Wed, 26 Jun 2019 03:52:47 +0000 (05:52 +0200)] 
[gdb/testsuite] Add back missing debug for index-cache.exp

The proc prepare_for_testing has "debug" as default argument for the options
parameter.

In the commit c596f180a1 "[gdb/testsuite] Compile index-cache.c with
-Wl,--build-id", by setting the options argument we've effectively dropped
"debug".  This causes index-cache.exp to not contain any debug info anymore on
most systems (though not on openSUSE), which causes index-cache.exp FAILs.

Fix this by adding back the missing "debug" option.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-26  Tom de Vries  <tdevries@suse.de>

* gdb.base/index-cache.exp: Add back missing debug option.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Jun 2019 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoarm-tdep: sort mapping symbols after parsing all minimal symbols
Simon Marchi [Tue, 25 Jun 2019 18:22:30 +0000 (14:22 -0400)] 
arm-tdep: sort mapping symbols after parsing all minimal symbols

Somebody on IRC reported a while ago that loading a big ARM program in
GDB was very slow.  Their profiling pointed out that a big amount of
time was spent in

    VEC_safe_insert (arm_mapping_symbol_s, *map_p, idx, &new_map_sym);

I was able to verify this as well.

ARM mapping symbols are special ELF symbols named $a, $d and $t
indicating that symbols starting at this address up to the next mapping
symbol (in terms of address) are of type "ARM code", "data" and "Thumb
code", respectively.  GDB records these symbols in vectors (one for each
section) in arm-tdep.c.  These vectors are sorted by symbol address, to
allow for quick lookup.  The current approach is to insert new symbols
at the right position to keep the vectors sorted at all time.  This is
done based on the assumption that mapping symbols come already almost
sorted from the binary, as explains this comment in
arm_record_special_symbol:

  /* Assume that most mapping symbols appear in order of increasing
     value.  If they were randomly distributed, it would be faster to
     always push here and then sort at first use.  */

Well, it turns out this is not the case.  The original reporter
mentioned that mapping symbols in their binaries are not nearly sorted,
and this is not my experience either (at least in the binary used in the
benchmark below).  So if the values don't come nearly sorted, doing
insertions to keep the vectors sorted ends up being of the order of
number_of_mapping_symbols ^ 2.

This patch changes it just like the comment above says, to just append
to the vector in arm_record_special_symbol and sort the vector on first
use.

Benchmark
=========

I have done some benchmarks using an --enable-targets=all GDB, compiled
with -O2, running on x86-64 and parsing file
dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug from this package:

  https://launchpad.net/ubuntu/+source/firefox/66.0.3+build1-0ubuntu1/+build/16608691/+files/firefox-dbg_66.0.3+build1-0ubuntu1_armhf.deb

This file is the separate debug info for libxul.so (part of firefox) for
ARM.

I have added some traces to measure the execution time of just
elf_symtab_read and ran GDB like this:

  ./gdb --data-directory=data-directory -nx -batch  .../path/to/usr/lib/debug/.build-id/65/dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug

Since the new code sorts the vectors on first use, it would be difficult
to benchmark it as-is and be fair, since the "before" version does more
work in elf_symtab_read.  So I have actually benchmarked a version of
the patch that did sort all the vectors at the end of elf_symtab_read,
so the sorting would be considered in the measured execution time.

Here's the measured execution time of elf_symtab_read, averaged on 3
runs:

  insert sorted (before): 28.678s
  sort after (after):      1.760s

And here's the total execution time of the command above (just one run).
The time is now mostly spent in reading DWARF.

  insert sorted: 71.12s user 2.71s system 99% cpu 1:14.03 total
  sort after:    46.42s user 2.60s system 99% cpu  49.147 total

I tried for fun on my Raspberry Pi 3, the run time of
elf_symtab_read goes from ~259s to ~9s, reading the same file.

gdb/ChangeLog:

* arm-tdep.c (struct arm_per_objfile) <section_maps_sorted>: New
field.
(arm_find_mapping_symbol): Sort mapping symbol vectors on first
use.
(arm_record_special_symbol): Don't insert new symbol in sorted
position, push it at the end.

4 years agoarm-tdep: replace arm_mapping_symbol VEC with std::vector
Simon Marchi [Tue, 25 Jun 2019 18:22:23 +0000 (14:22 -0400)] 
arm-tdep: replace arm_mapping_symbol VEC with std::vector

This patch replaces VEC (arm_mapping_symbol) with an std::vector.  No
functional changes intended.

gdb/ChangeLog:

* arm-tdep.c (struct arm_mapping_symbol) (operator <): New.
(arm_mapping_symbol_s): Remove.
(DEF_VEC_O(arm_mapping_symbol_s)): Remove.
(arm_mapping_symbol_vec): New typedef.
(struct arm_per_objfile): Add constructor.
<section_maps>: Change type to
std::unique_ptr<arm_mapping_symbol_vec[]>.
(arm_compare_mapping_symbols): Remove.
(arm_find_mapping_symbol): Adjust to section_maps type change.
(arm_objfile_data_free): Call delete on arm_per_objfile.
(arm_record_special_symbol): Adjust to section_maps type change.
Allocate arm_per_objfile with new.

4 years agoFix alias command not detecting non matching prefix & sometimes asserting.
Philippe Waroquiers [Sun, 23 Jun 2019 13:34:15 +0000 (15:34 +0200)] 
Fix alias command not detecting non matching prefix & sometimes asserting.

alias_command does not detect that the prefixes of the alias command and the
aliased command are not matching: it is comparing the alias prefix
with itself, instead of comparing it with the aliased command prefix.

This causes either the alias command to silently do nothing,
or to have GDB asserting:
    (gdb) alias assigne imprime limite-elements = set print elements
    ../../binutils-gdb/gdb/cli/cli-cmds.c:1552: internal-error: void alias_command(const char*, int): Assertion `c_command != NULL && c_command != (struct cmd_list_element *) -1' failed.
    A problem internal to GDB has been detected,

Fix the logic, and update gdb.base/alias.exp to test these cases.

gdb/ChangeLog
2019-06-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* cli/cli-cmds.c (alias_command): Compare the alias prefix
with the command prefix.

gdb/testsuite/ChangeLog
2019-06-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/alias.exp: Test non matching/non existing prefixes.

4 years agoMIPS/gas: Fix order of instructions in LI macro expansion
Faraz Shahbazker [Wed, 19 Jun 2019 22:55:04 +0000 (15:55 -0700)] 
MIPS/gas: Fix order of instructions in LI macro expansion

When MTHC1 instruction is paired with MTC1 to write a value to a
64-bit FPR, the MTC1 must be executed first, because the semantic
definition of MTC1 is not aware that software will be using an MTHC1
to complete the operation, and sets the upper half of the 64-bit FPR
to an UNPREDICTABLE value[1].

Fix the order of MTHC1 and MTC1 instructions in LI macro expansion.
Modify the expansions to exploit moves from $zero directly by-passing
the use of $AT, where ever possible.

[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
     Instruction Set Manual", Wave Computing, Inc., Document
     Number: MD00086, Revision 5.04, December 11, 2013, Section 3.2
     "Alphabetical List of Instructions", pp. 217.

gas/
* config/tc-mips.c (macro) <M_LI>: Re-order MTHC1 with
respect to MTC1 and use $0 for either part where possible.
* testsuite/gas/mips/li-d.s: Add test cases for non-zero
words in double precision constants.
* testsuite/gas/mips/li-d.d: Update reference output.
* testsuite/gas/mips/micromips@isa-override-1.d: Likewise.
* testsuite/gas/mips/mips32r2@isa-override-1.d: Likewise.
* testsuite/gas/mips/mips64r2@isa-override-1.d: Likewise.

4 years ago[gdb/testsuite] Regenerate dw2-restrict.S
Tom de Vries [Tue, 25 Jun 2019 14:42:46 +0000 (16:42 +0200)] 
[gdb/testsuite] Regenerate dw2-restrict.S

When running gdb.dwarf2/dw2-restrict.exp with board cc-with-dwz, we run into:
...
dwz: dw2-restrict: DW_AT_stmt_list not DW_FORM_sec_offset or DW_FORM_data4
...

The problem is that the DW_AT_stmt_list is encoded using DW_FORM_addr, while
DW_FORM_sec_offset or DW_FORM_data4 would be appropriate.  The test-case uses
a dw2-restrict.S which was generated using clang 2.9, which contained a bug
( https://bugs.llvm.org/show_bug.cgi?id=9995 ) causing this problem.

Fix this by regenerating using clang 5.0.1.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-25  Tom de Vries  <tdevries@suse.de>

PR testsuite/24727
* gdb.dwarf2/dw2-restrict.S: Regenerate using clang 5.0.1.

4 years agoTidy tui_delete_win
Tom Tromey [Sun, 23 Jun 2019 22:38:06 +0000 (16:38 -0600)] 
Tidy tui_delete_win

tui_delete_win does its own NULL check, so ~tui_gen_win_info does not
need to do it.  Also, tui_delete_win has an extraneous "return".

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_delete_win): Remove "return".
* tui/tui-data.c (~tui_gen_win_info): Remove "if".

4 years agoMake tui_gen_win_info constructor protected
Tom Tromey [Sun, 23 Jun 2019 22:34:39 +0000 (16:34 -0600)] 
Make tui_gen_win_info constructor protected

Now that all the window types have their own concrete classes, the
tui_gen_win_info constructor can be protected.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (init_and_make_win): Assert on unrecognized
type.
* tui/tui-data.h (struct tui_gen_win_info): Make constructor
protected.

4 years agoFix latent bug in set_is_exec_point_at
Tom Tromey [Sun, 23 Jun 2019 22:07:12 +0000 (16:07 -0600)] 
Fix latent bug in set_is_exec_point_at

valgrind pointed out that the TUI was using uninitialized memory in
set_is_exec_point_at.  The bug is a missing check against LOA_ADDRESS,
causing gdb to examine the uninitialized bits of the "addr" field.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c
(tui_source_window_base::set_is_exec_point_at): Add check against
LOA_ADDRESS.

4 years agoRemove NULL checks before xfree
Tom Tromey [Sun, 23 Jun 2019 20:28:11 +0000 (14:28 -0600)] 
Remove NULL checks before xfree

A couple of spots in the TUI did a NULL check before an xfree.  This
isn't necessary, and most other cases were removed from gdb a while
ago.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-source.c (tui_set_source_content): Don't check before
xfree.
* tui/tui-disasm.c (tui_disassemble): Don't check before xfree.

4 years agoRemove union tui_which_element
Tom Tromey [Sun, 23 Jun 2019 20:27:04 +0000 (14:27 -0600)] 
Remove union tui_which_element

This removes union tui_which_element, instead moving the content
directly into tui_source_window_base.  This allows for the deletion of
a fair amount of code.  Now the TUI window hierarchy is more
type-safe.  In particular, there is never any confusion now about
which members are in use by which subtype.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_update_source_window_as_is)
(tui_alloc_source_buffer, tui_line_is_displayed)
(tui_addr_is_displayed): Change type of win_info.
* tui/tui-winsource.c (tui_update_source_window_as_is)
(tui_clear_source_content, tui_show_source_line)
(tui_show_source_content, tui_source_window_base::refill)
(tui_source_window_base::set_is_exec_point_at)
(tui_source_window_base::set_is_exec_point_at)
(tui_update_breakpoint_info, tui_set_exec_info_content): Update.
(tui_alloc_source_buffer, tui_line_is_displayed)
(tui_addr_is_displayed): Change type of win_info.  Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
(tui_source_window_base::do_make_visible_with_new_height):
Update.
* tui/tui-source.c (tui_set_source_content)
(tui_set_source_content_nil)
(tui_source_window::do_scroll_vertical): Update.
* tui/tui-layout.c (show_layout): Update.
* tui/tui-disasm.c (tui_set_disassem_content)
(tui_disasm_window::do_scroll_vertical): Update.
* tui/tui-data.h (tui_win_content): Remove.
(struct tui_gen_win_info) <content, content_size>: Remove.
(struct tui_source_element): Add initializers and destructor.
(union tui_which_element, struct tui_win_element): Remove.
(struct tui_source_window_base) <content>: New field.
(struct tui_data_window): Remove destructor.
(tui_alloc_content, tui_free_win_content)
(tui_free_all_source_wins_content): Don't declare.
* tui/tui-data.c (tui_initialize_static_data): Update.
(init_content_element, tui_alloc_content): Remove.
(~tui_gen_win_info): Update.
(~tui_data_window, tui_free_all_source_wins_content)
(tui_free_win_content, free_content, free_content_elements):
Remove.

4 years agoMore type safety for TUI source window functions
Tom Tromey [Sun, 23 Jun 2019 18:21:34 +0000 (12:21 -0600)] 
More type safety for TUI source window functions

A few functions can only operate on a source or disassembly window.
This patch adds a bit more type safety to a few of these functions.
This simplifies a subsequent patch.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_clear_source_content)
(tui_erase_source_content, tui_show_source_content): Change type
of win_info.
* tui/tui-winsource.c (tui_clear_source_content)
(tui_erase_source_content, tui_show_source_content): Change type
of win_info.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
* tui/tui-source.h (tui_set_source_content_nil): Change type of
win_info.
* tui/tui-source.c (tui_set_source_content_nil): Change type of
win_info.
* tui/tui-layout.c (show_source_or_disasm_and_command): Update.

4 years agoUse bool for is_exec_point
Tom Tromey [Sun, 23 Jun 2019 16:25:03 +0000 (10:25 -0600)] 
Use bool for is_exec_point

This changes tui_source_element::is_exec_point to be a bool.  I looked
at also changing "has_break", but it turns out that this field is used
inconsistently (sometimes as flags and sometimes as a bool), and so
needs more invesstigation before it can be changed.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_clear_source_content)
(tui_source_window_base::set_is_exec_point_at): Update.
* tui/tui-source.c (tui_set_source_content_nil): Update.
* tui/tui-data.h (struct tui_source_element) <is_exec_point>: Now
a bool.
* tui/tui-data.c (init_content_element): Update.

4 years agoFix "auxiliary" typo
Tom Tromey [Sun, 23 Jun 2019 14:27:55 +0000 (08:27 -0600)] 
Fix "auxiliary" typo

The TUI has a function called tui_win_is_auxillary, but the word
should actually be spelled "auxiliary".  This fixes the typo.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Update.
* tui/tui-win.c (make_invisible_and_set_new_height): Update.
* tui/tui-layout.c (init_and_make_win): Update.
* tui/tui.h (enum tui_win_type): Update.
* tui/tui-data.h (tui_win_is_auxiliary): Rename from
tui_win_is_auxillary.
* tui/tui-data.c (tui_win_is_auxiliary): Rename from
tui_win_is_auxillary.

4 years agoSeparate out data window
Tom Tromey [Sat, 22 Jun 2019 18:49:06 +0000 (12:49 -0600)] 
Separate out data window

This removes "data_window" from union tui_which_element and updates
the uses.  It also changes how tui_data_window refers to the register
data, and changes it not to need the "content" field at all (though as
this is in a base class, it can't yet be removed).

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_data_window::refresh_window): Update.
* tui/tui-windata.c (tui_data_window::first_data_item_displayed)
(tui_delete_data_content_windows, tui_display_all_data)
(tui_data_window::do_scroll_vertical, tui_display_data_from):
Update.
* tui/tui-win.c (tui_data_window::set_new_height): Simplify.
* tui/tui-regs.c (tui_last_regs_line_no)
(tui_line_from_reg_element_no, tui_first_reg_element_no_inline)
(tui_show_registers): Update.
(tui_show_register_group): Return void.  Update.
(tui_display_registers_from, tui_display_reg_element_at_line)
(tui_display_registers_from_line, tui_check_register_values):
Update.
* tui/tui-data.h (union tui_which_element) <data_window>: Remove
member.
(struct tui_data_window) <regs_content>: Now a std::vector.
<regs_content_count>: Remove.
(tui_add_content_elements, tui_free_data_content): Don't declare.
* tui/tui-data.c (tui_data_window::clear_detail): Update.
(init_content_element): Remove DATA_WIN case.  Add assert.
(tui_add_content_elements): Remove.
(tui_data_window): Update.
(tui_free_data_content): Remove.
(free_content_elements): Remove DATA_WIN case.

4 years agoRemove "data_content" and "data_content_count" from TUI data window
Tom Tromey [Sat, 22 Jun 2019 18:07:13 +0000 (12:07 -0600)] 
Remove "data_content" and "data_content_count" from TUI data window

The TUI has some stub code for adding data other than registers to the
data window.  However, it doesn't do anything, and apparently never
has.  This removes the dead code.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.c (tui_data_item_window): Update.
* tui/tui-windata.h (tui_check_data_values): Don't declare.
* tui/tui-windata.c (tui_display_all_data)
(tui_display_data_from_line): Update.
(tui_check_data_values): Remove.
* tui/tui-regs.c (tui_show_register_group)
(tui_display_reg_element_at_line): Update.
* tui/tui-hooks.c (tui_register_changed)
(tui_refresh_frame_and_register_information): Call
tui_check_register_values.
* tui/tui-data.h (struct tui_data_window) <data_content,
data_content_count, data_type>: Remove.
(enum tui_data_type): Remove.

4 years agoTurn tui_first_data_item_displayed into a method
Tom Tromey [Sat, 22 Jun 2019 17:55:33 +0000 (11:55 -0600)] 
Turn tui_first_data_item_displayed into a method

tui_first_data_item_displayed is only called from tui_data_window
methods, so turn it into a method as well.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-windata.h (tui_first_data_item_displayed): Don't
declare.
* tui/tui-windata.c (tui_data_window::first_data_item_displayed):
Rename from tui_first_data_item_displayed.  Update.
(tui_data_window::refresh_all)
(tui_data_window::do_scroll_vertical): Update.
* tui/tui-data.h (struct tui_data_window)
<first_data_item_displayed>: Declare new method.

4 years agoRemove tui_init_generic_part
Tom Tromey [Sat, 22 Jun 2019 17:45:58 +0000 (11:45 -0600)] 
Remove tui_init_generic_part

tui_init_generic_part has a single caller, so simply inline it there.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (tui_init_generic_part): Don't declare.
* tui/tui-data.c (tui_init_generic_part): Remove, moving
contents...
(tui_initialize_static_data): ...here.

4 years agoSeparate out data item window
Tom Tromey [Sat, 22 Jun 2019 06:20:39 +0000 (00:20 -0600)] 
Separate out data item window

This introduces a new subclass of tui_gen_win_info for the data item
windows, letting us remove another element from tui_which_element.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_show_registers, tui_show_register_group)
(tui_display_registers_from, tui_check_register_values): Update.
(tui_display_register): Remove win_info parameter; update.
(tui_get_register): Change type of parameters.
* tui/tui-data.h (struct tui_data_element): Remove.
(union tui_which_element) <data>: Remove.
<data_window>: Change type.
(struct tui_data_item_window): New.
* tui/tui-data.c (init_content_element): Remove DATA_ITEM_WIN
case.  Add assert.
(~tui_data_item_window): New destructor.
(free_content_elements): Remove DATA_ITEM_WIN case.

4 years agoRemove two unused enum constants from tui_win_type
Tom Tromey [Sat, 22 Jun 2019 06:00:11 +0000 (00:00 -0600)] 
Remove two unused enum constants from tui_win_type

This removes a couple of unused constants from enum tui_win_type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui.h (enum tui_win_type) <MAX_WINDOWS, UNDEFINED_WIN>:
Remove.

4 years agoRemove command from tui_which_element
Tom Tromey [Fri, 21 Jun 2019 12:16:06 +0000 (06:16 -0600)] 
Remove command from tui_which_element

union tui_which_element has a "command" member, but it is never used.
This removes it.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_command_element): Remove.
(union tui_which_element) <command>: Remove.
* tui/tui-data.c (init_content_element): Remove CMD_WIN case.  Add
assert.
(free_content_elements): Remove CMD_WIN case.

4 years agoRemove layout_def::split
Tom Tromey [Fri, 21 Jun 2019 12:12:48 +0000 (06:12 -0600)] 
Remove layout_def::split

The "split" field in struct layout_def is never used, so this patch
removes it.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (tui_set_layout): Update.
* tui/tui-data.h (struct tui_layout_def) <split>: Remove.
* tui/tui-data.c (layout_def): Update.

4 years agoSeparate out locator window
Tom Tromey [Fri, 21 Jun 2019 02:16:07 +0000 (20:16 -0600)] 
Separate out locator window

This introduces a new subclass of tui_gen_win_info for the locator,
letting us remove another element from union tui_which_element.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_refresh_all): Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
(tui_source_window_base::set_new_height): Update.
* tui/tui-stack.c (tui_make_status_line): Change parameter type.
Update.
(tui_set_locator_fullname, tui_set_locator_info)
(tui_show_frame_info): Update.
* tui/tui-source.c (tui_set_source_content)
(tui_source_is_displayed): Update.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Update.
* tui/tui-disasm.c (tui_set_disassem_content)
(tui_get_begin_asm_address): Update.
* tui/tui-data.h (struct tui_locator_element): Remove.
(union tui_which_element) <locator>: Remove.
(struct tui_locator_window): New.
(tui_locator_win_info_ptr): Change return type.
* tui/tui-data.c (_locator): Change type.
(tui_locator_win_info_ptr): Change return type.
(init_content_element): Remove LOCATOR_WIN case.  Add assert.
(tui_alloc_content): Add assert.

4 years agoSeparate out execution-info window
Tom Tromey [Fri, 21 Jun 2019 01:59:06 +0000 (19:59 -0600)] 
Separate out execution-info window

This pulls the EXEC_INFO_WIN case out into its own subclass of
tui_gen_win_info.  This lets us remove an element from
union tui_which_element.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c
(tui_exec_info_window::maybe_allocate_content): New method.
(tui_set_exec_info_content, tui_show_exec_info_content): Update.
* tui/tui-layout.c (init_and_make_win): Add EXEC_INFO_WIN case.
(make_source_or_disasm_window): Add cast.
* tui/tui-data.h (union tui_which_element) <simple_string>:
Remove.
(struct tui_source_info): New.
(struct tui_source_window_base) <execution_info>: Change type.
* tui/tui-data.c (init_content_element): Remove EXEC_INFO_WIN
case, and add assert.
(tui_alloc_content): Add assert.

4 years agoRemove tui_alloc_win_info
Tom Tromey [Thu, 20 Jun 2019 21:31:00 +0000 (15:31 -0600)] 
Remove tui_alloc_win_info

There is only a single caller of tui_alloc_win_info, and we're going
to add more "new" cases to that caller, so remove tui_alloc_win_info
and inline it into init_and_make_win.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (tui_alloc_win_info): Don't declare.
* tui/tui-layout.c (init_and_make_win): Use "new" directly.
* tui/tui-data.c (tui_alloc_win_info): Remove.

4 years agoDon't check window type in tui_set_win_focus_to
Tom Tromey [Thu, 20 Jun 2019 21:22:53 +0000 (15:22 -0600)] 
Don't check window type in tui_set_win_focus_to

This changes tui_set_win_focus_to so that it no longer checks the
window type.  Instead, now tui_unhighlight_win also checks whether the
window can be highlighted.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_set_win_focus_to): Don't check window type.
* tui/tui-wingeneral.c (tui_unhighlight_win): Check
can_highlight.

4 years agoIntroduce tui_win_info::make_visible_with_new_height
Tom Tromey [Tue, 18 Jun 2019 03:11:56 +0000 (21:11 -0600)] 
Introduce tui_win_info::make_visible_with_new_height

This changes make_visible_with_new_height to be a method on
tui_win_info, letting us remove a spot that checks the window type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_source_window_base::update_tab_width): Call
make_visible_with_new_height method.
(tui_win_info::make_visible_with_new_height): New method.
(tui_source_window_base::do_make_visible_with_new_height)
(tui_data_window::do_make_visible_with_new_height)
(tui_cmd_window::do_make_visible_with_new_height): New methods.
(make_visible_with_new_height): Remove.
(tui_resize_all, tui_adjust_win_heights): Use
make_visible_with_new_height method.
* tui/tui-data.h (struct tui_win_info)
<do_make_visible_with_new_height, make_visible_with_new_height>:
New methods.
(struct tui_source_window_base, struct tui_data_window)
(struct tui_cmd_window) <do_make_visible_with_new_height>: New
methods.

4 years agoIntroduce tui_win_info::update_tab_width
Tom Tromey [Tue, 18 Jun 2019 00:48:00 +0000 (18:48 -0600)] 
Introduce tui_win_info::update_tab_width

This introduces a new tui_win_info::update_tab_width method, and
changes the TUI to call it.  This fixes another spot that was checking
the window type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_source_window_base::update_tab_width): New
method.
(update_tab_width): Call update_tab_width method.
* tui/tui-data.h (struct tui_win_info)
(struct tui_source_window_base) <update_tab_width>: New methods.

4 years agoIntroduce enum tui_box
Tom Tromey [Mon, 17 Jun 2019 23:15:23 +0000 (17:15 -0600)] 
Introduce enum tui_box

This adds a new enum to the TUI, replacing two #define constants,
providing better type safety.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.h (tui_make_window): Change type of "box_it"
parameter.
* tui/tui-wingeneral.c (tui_make_window): Change type of "box_it"
parameter.
(tui_gen_win_info::make_visible): Update.
* tui/tui-layout.c (init_and_make_win): Change type of "box_it"
parameter.
* tui/tui-data.h (enum tui_box): New enum.
(BOX_WINDOW, DONT_BOX_WINDOW): Remove defines.

4 years agoRemove some TUI static allocations
Tom Tromey [Mon, 17 Jun 2019 21:45:14 +0000 (15:45 -0600)] 
Remove some TUI static allocations

The TUI statically allocates the "execution_info" for the source and
disassembly windows.  However, there's no deep reason to do this, and
this approach makes it harder to allow multiple such windows.

This patch removes the static data and changes the code to simply
allocate these windows as needed.  This required pushing some code
into the tui_gen_win_info destructor, but that seems like a good idea
anyhow.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (make_source_or_disasm_window): Always use
init_and_make_win for EXEC_INFO_WIN.
* tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: No
longer inline.
(struct tui_win_info) <~tui_win_info>: Inline.
(tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
Don't declare.
* tui/tui-data.c (source_win, disasm_win): Remove globals.
(tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
Remove.
(tui_initialize_static_data): Update.
(~tui_gen_win_info): Handle more cleanup here.
(~tui_source_window_base): Delete "execution_info".
(~tui_win_info): Move code to ~tui_gen_win_info; remove.

4 years agoIntroduce tui_gen_win_info::reset method
Tom Tromey [Mon, 17 Jun 2019 20:08:44 +0000 (14:08 -0600)] 
Introduce tui_gen_win_info::reset method

This introduces the tui_gen_win_info::reset method and changes various
places to use it.  This led to the realization that the can_highlight
member only needs to be set during construction, so this patch makes
that change as well.  Finally, init_and_make_win is drastically
simplified.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (make_command_window): Don't set
can_highlight.
(show_source_disasm_command): Call the reset method.
(show_data): Don't set can_highlight.  Call the reset method.
(tui_gen_win_info::reset): Rename from init_gen_win_info
(init_and_make_win): Simplify.  Return tui_gen_win_info.
(show_source_or_disasm_and_command): Call the reset method.
* tui/tui-data.h (struct tui_gen_win_info) <reset>: New method.
(struct tui_cmd_window): Set can_highlight.

4 years agoMove make_visible method to tui_gen_win_info
Tom Tromey [Mon, 17 Jun 2019 19:19:15 +0000 (13:19 -0600)] 
Move make_visible method to tui_gen_win_info

This moves the make_visible method from tui_win_info to its base
class, tui_gen_win_info.  This allows the removal of another window
type check.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Rename
from make_visible.
(tui_make_visible, tui_make_invisible): Rewrite.
(tui_win_info::make_visible): Remove.
(tui_source_window_base::make_visible): Update.
* tui/tui-data.h (struct tui_gen_win_info) <make_visible>: New
method.  Moved from...
(struct tui_win_info) <make_visible>: ...here.

4 years agoRemove tui_scroll_direction enum
Tom Tromey [Mon, 17 Jun 2019 18:56:39 +0000 (12:56 -0600)] 
Remove tui_scroll_direction enum

The tui_scroll_direction enum is not really needed, because it's
simple to adapt the various scrolling methods to use the sign of their
argument as the direction in which to scroll.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c
(tui_source_window_base::do_scroll_horizontal): Remove direction
parameter.
* tui/tui-windata.c (tui_data_window::do_scroll_vertical): Remove
direction parameter.
* tui/tui-win.c (tui_win_info::forward_scroll)
(tui_win_info::backward_scroll, tui_win_info::left_scroll)
(tui_win_info::right_scroll): Update.
* tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove
direction parameter.
* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Remove
direction parameter.
* tui/tui-data.h (enum tui_scroll_direction): Remove.
(struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>:
Remove direction parameter.
(struct tui_source_window_base, struct tui_source_window)
(struct tui_disasm_window, struct tui_data_window)
(struct tui_cmd_window): Update.

4 years agoChange more TUI functions to take a tui_source_window_base
Tom Tromey [Mon, 17 Jun 2019 18:51:29 +0000 (12:51 -0600)] 
Change more TUI functions to take a tui_source_window_base

Several more TUI functions should only be called with a source or
disassembly window.  This patch changes these functions so that this
can be caught at compile time.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_set_exec_info_content)
(tui_show_exec_info_content, tui_erase_exec_info_content)
(tui_clear_exec_info_content, tui_update_exec_info): Change
argument to tui_source_window_base.
* tui/tui-winsource.c (tui_set_exec_info_content)
(tui_show_exec_info_content, tui_erase_exec_info_content)
(tui_clear_exec_info_content, tui_update_exec_info): Change
argument to tui_source_window_base.

4 years agoChange tui_set_exec_info_content to return void
Tom Tromey [Sun, 16 Jun 2019 23:51:34 +0000 (17:51 -0600)] 
Change tui_set_exec_info_content to return void

tui_set_exec_info_content can't return an error, so change it to
return void instead.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_set_exec_info_content): Return void.
* tui/tui-winsource.c (tui_set_exec_info_content): Return void.

4 years agoRemove NULL check from tui_set_exec_info_content
Tom Tromey [Sun, 16 Jun 2019 23:51:01 +0000 (17:51 -0600)] 
Remove NULL check from tui_set_exec_info_content

tui_set_exec_info_content ensures that the window's "execution_info"
is allocated, so the NULL check here is redundant and can be removed.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_set_exec_info_content): Remove NULL
check.

4 years agoChange tui_alloc_source_buffer return type to void
Tom Tromey [Sun, 16 Jun 2019 23:49:41 +0000 (17:49 -0600)] 
Change tui_alloc_source_buffer return type to void

tui_alloc_source_buffer can't actually fail, so change its return type
to void and update the callers.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_alloc_source_buffer): Change return
type to void.
* tui/tui-winsource.c (tui_alloc_source_buffer): Change return
type to void.
* tui/tui-source.c (tui_set_source_content): Update.
* tui/tui-disasm.c (tui_set_disassem_content): Update.

4 years agoIntroduce tui_gen_win_info::name method
Tom Tromey [Sun, 16 Jun 2019 22:35:31 +0000 (16:35 -0600)] 
Introduce tui_gen_win_info::name method

This removes tui_win_name and replaces it with a method on
tui_gen_win_info, removing another spot that switched on window type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (window_name_completer, tui_set_focus)
(tui_all_windows_info): Use name method.
* tui/tui-data.h (struct tui_gen_win_info)
(struct tui_source_window, struct tui_disasm_window)
(struct tui_data_window, struct tui_cmd_window) <name>: New
method.
(tui_win_name): Don't declare.
* tui/tui-data.c (tui_partial_win_by_name): Use name method.
(tui_win_name): Remove.

4 years agoChange tui_update_source_window for better type safety
Tom Tromey [Sun, 16 Jun 2019 22:31:37 +0000 (16:31 -0600)] 
Change tui_update_source_window for better type safety

tui_update_source_window can only be called for source and disassembly
windows, so change the argument type to enforce this at compile time.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_update_source_window)
(tui_update_source_window_as_is): Change parameter type.
* tui/tui-winsource.c (tui_update_source_window): Change win_info
to be a tui_source_window_base.
(tui_update_source_window_as_is): Likewise.
* tui/tui-win.c (make_visible_with_new_height): Update.

4 years agoIntroduce refresh_window method
Tom Tromey [Sun, 16 Jun 2019 22:28:12 +0000 (16:28 -0600)] 
Introduce refresh_window method

This replaces tui_refresh_win with a new refresh_window method.  This
removes another spot that was checking the window's type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_erase_source_content)
(tui_show_source_content, tui_show_exec_info_content)
(tui_erase_exec_info_content): Use refresh_window method.
* tui/tui-wingeneral.h (tui_refresh_win): Don't declare.
* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Rename
from tui_refresh_win.
(tui_data_window::refresh_window): New method.
(tui_win_info::refresh, tui_source_window_base::refresh)
(tui_refresh_all): Use refresh_window method.
* tui/tui-stack.c (tui_show_locator_content): Call refresh_window
method.
* tui/tui-regs.c (tui_display_register): Call refresh_window
method.
* tui/tui-layout.c (show_source_disasm_command)
(show_source_or_disasm_and_command): Call refresh_window method.
* tui/tui-data.h (struct tui_gen_win_info)
(struct tui_data_window, struct tui_cmd_window) <refresh_window>:
New method.

4 years agoDerive tui_win_info from tui_gen_win_info
Tom Tromey [Sun, 16 Jun 2019 22:03:54 +0000 (16:03 -0600)] 
Derive tui_win_info from tui_gen_win_info

This changes tui_win_info to derive from tui_gen_win_info, rather than
having a tui_gen_win_info as a member.  This removes a layer of member
access from the entire TUI, which is why this patch is so large.  This
change will enable further removal of switches based on window type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_rl_other_window, tui_enable)
(tui_is_window_visible, tui_get_command_dimension): Update.
* tui/tui-winsource.c (tui_update_source_window_as_is)
(tui_clear_source_content, tui_erase_source_content)
(tui_show_source_line, tui_source_window_base::refill)
(tui_source_window_base::do_scroll_horizontal)
(tui_source_window_base::set_is_exec_point_at)
(tui_update_breakpoint_info, tui_set_exec_info_content)
(tui_alloc_source_buffer, tui_line_is_displayed)
(tui_addr_is_displayed): Update.
* tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win)
(tui_check_and_display_highlight_if_needed)
(tui_win_info::make_visible, tui_win_info::refresh)
(tui_refresh_all): Update.
* tui/tui-windata.c (tui_first_data_item_displayed)
(tui_delete_data_content_windows, tui_erase_data_content)
(tui_display_all_data, tui_data_window::refresh_all)
(tui_check_data_values): Update.
* tui/tui-win.c (window_name_completer, tui_update_gdb_sizes)
(tui_set_win_focus_to, tui_win_info::forward_scroll)
(tui_win_info::backward_scroll, tui_refresh_all_win)
(tui_resize_all, tui_set_focus, tui_all_windows_info)
(update_tab_width, tui_set_win_height, tui_adjust_win_heights)
(tui_source_window_base::set_new_height)
(tui_data_window::set_new_height)
(make_invisible_and_set_new_height)
(make_visible_with_new_height, new_height_ok)
(parse_scrolling_args): Update.
* tui/tui-stack.c (tui_show_frame_info): Update.
* tui/tui-source.c (tui_set_source_content)
(tui_set_source_content_nil, tui_source_is_displayed)
(tui_source_window::do_scroll_vertical): Update.
* tui/tui-regs.c (tui_show_registers, tui_show_register_group)
(tui_display_registers_from, tui_display_reg_element_at_line)
(tui_check_register_values, tui_reg_command): Update.
* tui/tui-layout.c (tui_default_win_height)
(show_source_disasm_command, show_data, init_and_make_win)
(show_source_or_disasm_and_command): Update.
* tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts)
(tui_redisplay_readline, tui_mld_flush)
(tui_mld_erase_entire_line, tui_mld_getc, tui_cont_sig)
(tui_getc): Update.
* tui/tui-disasm.c (tui_set_disassem_content)
(tui_disasm_window::do_scroll_vertical): Update.
* tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>:
Now virtual.
(struct tui_win_info): Derive from tui_gen_win_info.
<~tui_win_info>: Mark as override.
<generic>: Remove member.
* tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win)
(tui_prev_win, tui_partial_win_by_name, tui_win_info)
(~tui_data_window, ~tui_win_info)
(tui_free_all_source_wins_content): Update.
* tui/tui-command.c (tui_refresh_cmd_win): Update.

4 years agoUse new and delete for tui_gen_win_info
Tom Tromey [Sun, 16 Jun 2019 21:56:24 +0000 (15:56 -0600)] 
Use new and delete for tui_gen_win_info

This changes tui_gen_win_info to be allocated with new and destroyed
with delete.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (init_and_make_win): Use new.
* tui/tui-data.h (struct tui_gen_win_info): Add constructor,
destructor, initializers.
(tui_alloc_generic_win_info): Don't declare.
* tui/tui-data.c (_locator): Add argument to constructor.
(source_win, disasm_win): New globals.
(exec_info): Remove.
(tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
Update.
(tui_alloc_generic_win_info): Remove.
(init_content_element): Use new.
(tui_win_info::tui_win_info): Update.
(free_content_elements) <case DATA_WIN>: Use delete.

4 years agoChange tui_which_element::data_window to be a pointer
Tom Tromey [Sun, 16 Jun 2019 21:53:36 +0000 (15:53 -0600)] 
Change tui_which_element::data_window to be a pointer

A coming patch will add a constructor to tui_gen_win_info.  However,
because the tui_which_element union contains an object of this type,
first something must be done here in order to avoid having a union
with a member that has a constructor.  This patch changes this element
to be a pointer instead.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_refresh_win): Update.
* tui/tui-windata.c (tui_first_data_item_displayed)
(tui_delete_data_content_windows): Update.
* tui/tui-win.c (tui_data_window::set_new_height): Update.
* tui/tui-regs.c (tui_show_registers, tui_show_register_group)
(tui_display_registers_from, tui_check_register_values): Update.
* tui/tui-data.h (union tui_which_element) <data_window>: Now a
pointer.
* tui/tui-data.c (init_content_element): Update.  Allocate the new
window.
(tui_free_data_content): Update.
(free_content_elements) <case DATA_WIN>: Free the window.

4 years agoIntroduce set_highlight method
Tom Tromey [Sun, 16 Jun 2019 21:28:03 +0000 (15:28 -0600)] 
Introduce set_highlight method

This introduces the tui_win_info::set_highlight method, and changes
the highlighting-related code to use bool rather than int.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win):
Update.
* tui/tui-layout.c (make_command_window)
(show_source_disasm_command, show_data, init_and_make_win)
(show_source_or_disasm_and_command): Update.
* tui/tui-data.h (struct tui_win_info) <set_highlight>: New
method.
<can_highight, is_highlighted>: Now bool.
(tui_set_win_highlight): Don't declare.
* tui/tui-data.c (tui_set_win_highlight): Remove.

4 years agoRemove redundant check from make_visible
Tom Tromey [Sun, 16 Jun 2019 21:17:52 +0000 (15:17 -0600)] 
Remove redundant check from make_visible

This removes a check of the window type from make_visible.  This
function already checks that the window type is not CMD_WIN near the
top, so this condition can never be false.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (make_visible): Remove check of window
type.

4 years agoIntroduce max_height method
Tom Tromey [Sun, 16 Jun 2019 21:16:52 +0000 (15:16 -0600)] 
Introduce max_height method

This introduces the tui_win_info::max_height method and changes
new_height_ok to use it, rather than checking the window type
directly.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_win_info::max_height)
(tui_cmd_window::max_height): New methods.
(new_height_ok): Call max_height.
* tui/tui-data.h (struct tui_win_info, struct tui_cmd_window)
<max_height>: New method.

4 years agoIntroduce set_new_height method
Tom Tromey [Sun, 16 Jun 2019 21:12:25 +0000 (15:12 -0600)] 
Introduce set_new_height method

This introduces tui_win_info::set_new_height and implements it in the
subclasses as appropriate.  This removes another switch on the window
type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_source_window_base::set_new_height)
(tui_data_window::set_new_height): New methods.
(make_invisible_and_set_new_height): Call set_new_height method.
* tui/tui-data.h (struct tui_win_info)
(struct tui_source_window_base, struct tui_data_window)
<set_new_height>: New method.

4 years agoIntroduce the refresh_all method
Tom Tromey [Sun, 16 Jun 2019 20:52:08 +0000 (14:52 -0600)] 
Introduce the refresh_all method

This introduces the tui_win_info::refresh_all method and implements it
as needed in subclasses.  The name and comment are a bit of a guess on
my part.  The main benefit of this patch is removing another switch on
the type of the window.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_rl_other_window): Call the refresh_all method.
* tui/tui-windata.c (tui_data_window::refresh_all): Rename from
tui_refresh_data_win.
* tui/tui-win.c (tui_source_window_base::refresh_all): New
method.
(tui_refresh_all_win): Call the refresh_all method.
(tui_set_focus): Likewise.
* tui/tui-data.h (struct tui_win_info) <refresh_all>: New method.
(struct tui_source_window_base, struct tui_data_window) <refresh>:
Likewise.

4 years agoIntroduce two TUI source window methods
Tom Tromey [Sun, 16 Jun 2019 20:43:56 +0000 (14:43 -0600)] 
Introduce two TUI source window methods

This adds two methods to the TUI source window.  These are just
renamings of existing functions.  It also changes the source window
list to have a more precise type, letting the code be more type-safe.
This will be useful again later.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_refill_source_window)
(tui_set_is_exec_point_at): Don't declare.
* tui/tui-winsource.c (tui_update_source_windows_with_addr)
(tui_source_window_base::refill): Rename from
tui_refill_source_window.
(tui_source_window_base::do_scroll_horizontal): Update.
(tui_source_window_base::set_is_exec_point_at): Rename from
tui_set_is_exec_point_at.
(tui_update_all_breakpoint_info): Update.
* tui/tui-stack.c (tui_show_frame_info): Update.
* tui/tui-layout.c (show_data): Add cast.
* tui/tui-hooks.c (tui_redisplay_source): Call refill method.
* tui/tui-data.h (struct tui_source_window_base) <refill,
set_is_exec_point_at>: New methods.
(tui_source_windows, tui_add_to_source_windows): Update types.
(tui_add_to_source_windows): Remove redundant declaration.
* tui/tui-data.c (source_windows): Store tui_source_window_base.
(tui_source_windows): Change return type.
(tui_clear_source_windows_detail): Update.
(tui_add_to_source_windows): Change type of parameter.
(tui_free_all_source_wins_content): Update.

4 years agoIntroduce the refresh method
Tom Tromey [Sun, 16 Jun 2019 20:27:28 +0000 (14:27 -0600)] 
Introduce the refresh method

This adds tui_win_info::refresh and updates tui_source_window_base to
implement it as well.  This lets us simplify tui_refresh_all, removing
a check of the window type.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_win_info::refresh)
(tui_source_window_base::refresh): New methods.
(tui_refresh_all): Call the refresh method.
* tui/tui-data.h (struct tui_win_info)
(struct tui_source_window_base) <refresh>: New method.

4 years agoUse bool for visibility
Tom Tromey [Sun, 16 Jun 2019 20:24:42 +0000 (14:24 -0600)] 
Use bool for visibility

This changes the visibility-related functions and data members in the
TUI to use bool rather than int.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui.h (tui_is_window_visible): Return bool.
* tui/tui.c (tui_is_window_visible): Return bool.
* tui/tui-wingeneral.c (tui_make_window, make_visible)
(tui_make_visible, tui_make_invisible)
(tui_win_info::make_visible)
(tui_source_window_base::make_visible, make_all_visible)
(tui_make_all_visible, tui_make_all_invisible): Update.
* tui/tui-windata.c (tui_delete_data_content_windows): Update.
* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: Now
bool.
(struct tui_win_info, struct tui_source_window_base)
(struct tui_cmd_window) <make_visible>: Change parameter to bool.
* tui/tui-data.c (tui_init_generic_part): Update.

4 years agoIntroduce make_visible method
Tom Tromey [Sun, 16 Jun 2019 20:22:21 +0000 (14:22 -0600)] 
Introduce make_visible method

This introduceds the make_visible to tui_win_info and overrides it in
subclasses as appropriate.  This allows the removal of the
tui_win_is_source_type, as it is no longer used.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_win_info::make_visible)
(tui_source_window_base::make_visible): New methods.
(make_all_visible): Make method call.
* tui/tui-data.h (struct tui_win_info) <make_visible>: New method.
(struct tui_source_window_base, struct tui_cmd_window): Override
make_visible.
(tui_win_is_source_type): Don't declare.
* tui/tui-data.c (tui_win_is_source_type): Remove.

4 years agoRemove an unneeded NULL check
Tom Tromey [Sun, 16 Jun 2019 20:14:10 +0000 (14:14 -0600)] 
Remove an unneeded NULL check

show_source_or_disasm_and_command will either create or reset the
source window, so the final NULL check is not necessary.  This patch
removes it.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (show_source_or_disasm_and_command): Remove
NULL check.

4 years agoInline constructors and initializers
Tom Tromey [Sun, 16 Jun 2019 20:06:18 +0000 (14:06 -0600)] 
Inline constructors and initializers

This inlines the constructors and initializers for tui_cmd_window and
tui_data_window.  This makes the code a bit simpler.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_data_window, struct tui_cmd_window):
Inline constructor.  Add initializers for members.
* tui/tui-data.c (tui_data_window, tui_cmd_window): Remove
constructors; now inline in class.

4 years agoChange tui_data_window::display_regs to bool
Tom Tromey [Sun, 16 Jun 2019 20:04:11 +0000 (14:04 -0600)] 
Change tui_data_window::display_regs to bool

This changes tui_data_window::display_regs to bool and updates the
uses.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_show_registers): Update.
* tui/tui-data.h (struct tui_data_window) <display_regs>: Now
bool.
* tui/tui-data.c (tui_data_window::clear_detail)
(tui_data_window): Update.

4 years agoRemove struct tui_data_info
Tom Tromey [Sun, 16 Jun 2019 20:03:04 +0000 (14:03 -0600)] 
Remove struct tui_data_info

Like the previous two patches, this removes struct tui_data_info in
favor of inlining its contents into tui_data_window.  This was the
last member of the tui_win_info detail union, so that is removed.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-windata.c (tui_display_all_data)
(tui_display_data_from_line, tui_display_data_from)
(tui_check_data_values, tui_data_window::do_scroll_vertical):
Update.
* tui/tui-regs.c (tui_last_regs_line_no)
(tui_line_from_reg_element_no, tui_first_reg_element_no_inline)
(tui_show_registers, tui_show_register_group)
(tui_display_registers_from, tui_display_reg_element_at_line)
(tui_display_registers_from_line, tui_check_register_values)
(tui_reg_next, tui_reg_prev): Update.
* tui/tui-layout.c (tui_set_layout, show_data): Update.
* tui/tui-data.h (struct tui_data_info): Remove.  Move contents to
tui_data_window.
(struct tui_win_info) <detail>: Remove.  Add new fields from
tui_data_info.
(TUI_DATA_WIN): Add cast.
* tui/tui-data.c (tui_data_window::clear_detail, tui_data_window)
(~tui_data_window): Simplify.

4 years agoRemove struct tui_command_info
Tom Tromey [Sun, 16 Jun 2019 19:55:51 +0000 (13:55 -0600)] 
Remove struct tui_command_info

Like the previous patch, this removes tui_command_info in favor of
putting it elements directly into tui_cmd_window.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (show_source_disasm_command)
(show_source_or_disasm_and_command): Update.
* tui/tui-io.c (update_cmdwin_start_line)
(tui_redisplay_readline): Update.
* tui/tui-data.h (struct tui_command_info): Remove.
(struct tui_win_info) <detail>: Remove command_info member.
(struct tui_data_window) <start_line>: New member, from
tui_command_info.
(TUI_CMD_WIN): Add casts.

4 years agoRemove struct tui_source_info
Tom Tromey [Sun, 16 Jun 2019 19:46:18 +0000 (13:46 -0600)] 
Remove struct tui_source_info

The tui_source_info struct is used as a member of the "detail" union
in tui_win_info, and this member of the union is only used by source
and disassembly windows.  This patch removes tui_source_info and moves
its members directly to tui_source_window_base.  This simplifies the
code by removing a layer of references from many places.  In a few
spots, a new cast was needed, but most of these will be removed by the
end of the series.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_update_source_window)
(tui_refill_source_window)
(tui_source_window_base::do_scroll_horizontal)
(tui_update_breakpoint_info, tui_set_exec_info_content)
(tui_show_exec_info_content, tui_erase_exec_info_content)
(tui_clear_exec_info_content): Update.
* tui/tui-wingeneral.c (make_all_visible, tui_refresh_all):
Update.
* tui/tui-win.c (make_invisible_and_set_new_height)
(make_visible_with_new_height): Update.
* tui/tui-source.c (tui_set_source_content)
(tui_show_symtab_source): Update.
* tui/tui-layout.c (extract_display_start_addr)
(show_source_disasm_command, show_data)
(make_source_or_disasm_window)
(show_source_or_disasm_and_command): Update.
* tui/tui-disasm.c (tui_set_disassem_content): Simplify.
(tui_disasm_window::do_scroll_vertical): Remove shadowing
"gdbarch".
* tui/tui-data.h (struct tui_source_info): Remove.  Move contents
to tui_source_window_base.
(struct tui_win_info) <detail>: Remove source_info member.
(struct tui_source_window_base) <has_locator>: Inline.
Move contents from tui_source_info; rename has_locator member to
m_has_locator.
(TUI_SRC_WIN, TUI_DISASM_WIN): Add casts.
* tui/tui-data.c (tui_source_window_base::has_locator): Move to
header file.
(tui_source_window_base::clear_detail, ~tui_source_window_base):
Simplify.
(tui_free_all_source_wins_content): Cast to
tui_source_window_base.

4 years agoIntroduce has_locator method
Tom Tromey [Sun, 16 Jun 2019 17:37:49 +0000 (11:37 -0600)] 
Introduce has_locator method

This changes tui_win_has_locator to be a method on tui_win_info, and
changes the locator code to use bool rather than int.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (make_invisible_and_set_new_height)
(make_visible_with_new_height): Call has_locator method.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Update for bool change.
* tui/tui-data.h (struct tui_source_info) <has_locator>: Now bool.
(tui_win_info) <has_locator>: New method.
(struct tui_source_window_base) <has_locator>: New method.
(tui_win_has_locator): Don't declare.
* tui/tui-data.c (tui_source_window_base::has_locator): Rename
from tui_win_has_locator.
(tui_source_window_base): Use false, not FALSE.

4 years agoRemove tui_clear_win_detail
Tom Tromey [Sun, 16 Jun 2019 17:29:45 +0000 (11:29 -0600)] 
Remove tui_clear_win_detail

An earlier patch changed the context of the sole call to
tui_clear_win_detail to make it clear that this can never be called
with a NULL window pointer.  So, remove tui_clear_win_detail in favor
of calling the method directly.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (tui_clear_win_detail): Don't declare.
* tui/tui-data.c (tui_clear_source_windows_detail): Call the
clear_detail method directly.
(tui_clear_win_detail): Remove.

4 years agoDon't use TUI_DISASM_WIN in tui_disasm_window method
Tom Tromey [Sun, 16 Jun 2019 22:31:56 +0000 (16:31 -0600)] 
Don't use TUI_DISASM_WIN in tui_disasm_window method

The previous patch made it clear that the diassembly window scrolling
method was written to assume there could only ever be a single
disassembly window.  This changes that spot to use "this" rather than
the TUI_DISASM_WIN global.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Use
"this", not TUI_DISASM_WIN.

4 years agoIntroduce methods for scrolling
Tom Tromey [Sun, 16 Jun 2019 17:22:38 +0000 (11:22 -0600)] 
Introduce methods for scrolling

This changes the TUI to use virtual methods on the various window
types for scrolling.  Window-specific functions for this purpose are
renamed to be methods, and the generic tui_scroll function is removed
as it is no longer called.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_horizontal_source_scroll):  Don't
declare.
* tui/tui-winsource.c
(tui_source_window_base::do_scroll_horizontal): Rename from
tui_horizontal_source_scroll.
* tui/tui-windata.h (tui_vertical_data_scroll): Don't declare.
* tui/tui-windata.c (tui_data_window::do_scroll_vertical): Rename
from tui_vertical_data_scroll.
* tui/tui-win.h (tui_scroll): Don't declare.
* tui/tui-win.c (tui_win_info::forward_scroll)
(tui_win_info::backward_scroll, tui_win_info::left_scroll)
(tui_win_info::right_scroll): Rename and update.
(tui_scroll_forward_command, tui_scroll_backward_command)
(tui_scroll_left_command, tui_scroll_right_command): Update.
(tui_scroll): Remove.
* tui/tui-source.h: Don't declare tui_vertical_source_scroll.
* tui/tui-source.c (tui_source_window::do_scroll_vertical): Rename
from tui_vertical_source_scroll.
* tui/tui-disasm.h (tui_vertical_disassem_scroll): Don't declare.
* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Rename
from tui_vertical_disassem_scroll.
* tui/tui-data.h (struct tui_win_info) <do_scroll_vertical,
do_scroll_horizontal>: New methods.
<forward_scroll, backward_scroll, left_scroll, right_scroll>:
Likewise.
(struct tui_source_window_base): Add do_scroll_horizontal.
(struct tui_source_window, struct tui_disasm_window): Add
do_scroll_vertical.
(struct tui_data_window, struct tui_cmd_window): Add
do_scroll_horizontal and do_scroll_vertical.
* tui/tui-command.c (tui_dispatch_ctrl_char): Use method calls.

4 years agoCreate tui_disasm_window
Tom Tromey [Sun, 16 Jun 2019 17:08:43 +0000 (11:08 -0600)] 
Create tui_disasm_window

This introduces the new tui_disasm_window class, which represents a
disassembly window.  It shares a lot of behavior with the source
window, so a new tui_source_window_base class is also created.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_source_window_base): New struct.
(struct tui_source_window): Derive from tui_source_window_base.
(struct tui_disasm_window): New struct.
* tui/tui-data.c (tui_source_window_base::clear_detail): Rename
from tui_source_window::clear_detail.
(tui_source_window_base): Rename from tui_source_window.
(~tui_source_window_base): Rename from ~tui_source_window.
(tui_alloc_win_info): Create a tui_disasm_window.

4 years agoSplit the tui_win_info destructor
Tom Tromey [Sun, 16 Jun 2019 16:52:27 +0000 (10:52 -0600)] 
Split the tui_win_info destructor

This patch adds destructors to tui_source_window and tui_data_window,
and splits ~tui_win_info as appropriate.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_source_window)
(struct tui_data_window): Declare destructors.
* tui/tui-data.c (~tui_source_window, ~tui_data_window): New
destructors.
(tui_win_info): Simplify.

4 years agoRemove tui_list
Tom Tromey [Sun, 16 Jun 2019 16:49:45 +0000 (10:49 -0600)] 
Remove tui_list

This removes the tui_list type in favor of a std::vector.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_display_main)
(tui_update_source_windows_with_addr)
(tui_update_all_breakpoint_info): Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
(new_height_ok, parse_scrolling_args): Update.
* tui/tui-stack.c (tui_show_frame_info): Update.
* tui/tui-data.h (struct tui_list): Remove.
(tui_source_windows): Return a reference to a std::vector.
* tui/tui-data.c (source_windows): Now a std::vector.
(tui_source_windows): Change return type.
(tui_clear_source_windows): Rewrite.
(tui_clear_source_windows_detail, tui_add_to_source_windows)
(tui_free_all_source_wins_content): Rewrite.

4 years agoIntroduce tui_win_info::clear_detail method
Tom Tromey [Sun, 16 Jun 2019 16:42:09 +0000 (10:42 -0600)] 
Introduce tui_win_info::clear_detail method

This introduces the clear_detail method and updates the various
subclasses of tui_win_info to implement it.  A subsequent patch will
remove tui_clear_win_detail, but that isn't done for now because at
this point it isn't readily obvious that the NULL check is not needed.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_win_info, struct tui_source_window)
(struct tui_data_window, struct tui_cmd_window): Declare
clear_detail method.
* tui/tui-data.c (tui_source_window::clear_detail)
(tui_cmd_window::clear_detail, tui_data_window::clear_detail): New
methods.
(tui_clear_win_detail): Simplify.

4 years agoSimplify source and disassembly window creation
Tom Tromey [Sun, 16 Jun 2019 16:37:25 +0000 (10:37 -0600)] 
Simplify source and disassembly window creation

Similar to the previous patch, neither make_source_window nor
make_disasm_window could be called when *win_info_ptr was non-NULL.
This patch simplifies the functions by removing the parameter and
having them return their results directly.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (make_source_window, make_disasm_window)
(make_source_or_disasm_window): Remove win_info_ptr parameter.
Return the new window.
(show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Update.

4 years agoSimplify command window creation
Tom Tromey [Sun, 16 Jun 2019 16:32:35 +0000 (10:32 -0600)] 
Simplify command window creation

make_command_window is never called when *win_info_ptr is non-NULL, so
this patch simplifies the function by removing the parameter and
having it return its result directly.  This in turn makes it more
obvious that a NULL check in show_source_disasm_command can be
removed.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (make_command_window): Remove win_info_ptr
parameter.  Return the new window.
(show_source_disasm_command): Update and remove NULL check.
(show_source_or_disasm_and_command): Update.

4 years agoRemove an unnecessary NULL check from the TUI
Tom Tromey [Sun, 16 Jun 2019 16:23:10 +0000 (10:23 -0600)] 
Remove an unnecessary NULL check from the TUI

In init_and_make_win, opaque_win_info can't be NULL after a new window
is allocated.  This patch removes an unnecessary NULL check.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (init_and_make_win): Remove NULL check.

4 years agoCreate subclasses for different window types
Tom Tromey [Sun, 16 Jun 2019 16:13:13 +0000 (10:13 -0600)] 
Create subclasses for different window types

This changes the TUI so that each different major window type has its
own subclass.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_win_info): Make constructor
protected.  Make destructor virtual.  Add initializers.
(tui_source_window, tui_data_window, tui_cmd_window): New
classes.
* tui/tui-data.c (tui_win_info): Rename from init_win_info.  Now a
constructor.  Add "type" parameter.
(tui_source_window, tui_data_window, tui_cmd_window): New
constructors.
(tui_alloc_win_info): Instantiate the appropriate subclass.

4 years agoAdd destructor to tui_win_info
Tom Tromey [Sun, 16 Jun 2019 15:43:21 +0000 (09:43 -0600)] 
Add destructor to tui_win_info

This changes tui_free_window into a destructor for tui_free_window and
then updates the users.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_resize_all): Use delete.
* tui/tui-data.h (struct tui_win_info) <~tui_win_info>: Declare
destructor.
(tui_free_window): Don't declare.
* tui/tui-data.c (~tui_win_info): Rename from tui_free_window.
Update.

4 years agoUse new and delete for TUI windows
Tom Tromey [Sun, 16 Jun 2019 15:41:06 +0000 (09:41 -0600)] 
Use new and delete for TUI windows

This changes tui_win_info to use new and delete, rather than XNEW and
xfree.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_win_info): Add constructor.
* tui/tui-data.c (tui_alloc_win_info): Use new.
(tui_free_window): Use delete.

4 years agold/plugins: avoid shadowing a C library symbol
Jan Beulich [Tue, 25 Jun 2019 10:02:23 +0000 (12:02 +0200)] 
ld/plugins: avoid shadowing a C library symbol

With my (oldish) gcc/glibc combination I'm seeing

.../ld/plugin.c: In function \91get_lto_kind\92:
.../ld/plugin.c:664: error: declaration of \91index\92 shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
.../ld/plugin.c: In function \91get_lto_resolution\92:
.../ld/plugin.c:685: error: declaration of \91index\92 shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
.../ld/plugin.c: In function \91get_lto_visibility\92:
.../ld/plugin.c:711: error: declaration of \91index\92 shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here

4 years agobfd/elf-properties: avoid shadowing a C library symbol
Jan Beulich [Tue, 25 Jun 2019 10:01:50 +0000 (12:01 +0200)] 
bfd/elf-properties: avoid shadowing a C library symbol

With my (oldish) gcc/glibc combination I'm seeing

.../bfd/elf-properties.c: In function \91elf_find_and_remove_property\92:
.../bfd/elf-properties.c:244: error: declaration of \91remove\92 shadows a global declaration
/usr/include/stdio.h:157: error: shadowed declaration is here

4 years agoreadelf: avoid shadowing a libiberty symbol
Jan Beulich [Tue, 25 Jun 2019 09:09:22 +0000 (11:09 +0200)] 
readelf: avoid shadowing a libiberty symbol

With my (oldish) gcc I'm seeing

.../binutils/readelf.c: In function \91dump_ctf_indent_lines\92:
.../binutils/readelf.c:13851: error: declaration of \91spaces\92 shadows a global declaration
.../binutils/../include/libiberty.h:253: error: shadowed declaration is here

4 years agoobjdump: avoid shadowing a libiberty symbol
Jan Beulich [Tue, 25 Jun 2019 09:08:53 +0000 (11:08 +0200)] 
objdump: avoid shadowing a libiberty symbol

With my (oldish) gcc I'm seeing

.../binutils/objdump.c: In function \91dump_ctf_indent_lines\92:
.../binutils/objdump.c:3210: error: declaration of \91spaces\92 shadows a global declaration
.../binutils/../include/libiberty.h:253: error: shadowed declaration is here

4 years agox86: correct / adjust debug printing
Jan Beulich [Tue, 25 Jun 2019 07:41:33 +0000 (09:41 +0200)] 
x86: correct / adjust debug printing

For quite some time we've been using combinations of bits for
specifying various registers in operands and templates. I think it was
Alan who had indicated that likely the debug printing would need
adjustment as a result. Here we go.

Accumulator handling for GPRs gets changed to match that for FPU regs.
For this to work, OPERAND_TYPE_ACC{32,64} get repurposed, with their
original uses replaced by direct checks of the two bits of interest,
which is cheaper than operand_type_equal() invocations.

For SIMD registers nothing similar appears to be needed, as respective
operands get stripped from the (copy of the) template before pt() is
reached.

The type change on pi() is to silence a compiler diagnostic. Arguably
its other parameter could also be const-qualified.

4 years agox86: document certain command line options as "dangerous"
Jan Beulich [Tue, 25 Jun 2019 07:40:44 +0000 (09:40 +0200)] 
x86: document certain command line options as "dangerous"

Errata BT36, BT41, and BT230 mean that gas may, when using one ofthese
options, produce code that causes #UD on (at least) SandyBridge systems.

4 years agox86: drop dqa_mode
Jan Beulich [Tue, 25 Jun 2019 07:28:33 +0000 (09:28 +0200)] 
x86: drop dqa_mode

I assume this mode was needed when EVEX.W handling wasn't really correct
yet for other than 64-bit mode. It's clearly not needed anymore. Its
elimination also allows dropping the EVEX.W split of VCVT{,U}SI2SS. (For
the record, the dropped mode would have been wrong if used in any table
entry not already guaranteeing EVEX.W=1.)

4 years agox86: don't open code is_any_vex_encoding()
Jan Beulich [Tue, 25 Jun 2019 07:27:49 +0000 (09:27 +0200)] 
x86: don't open code is_any_vex_encoding()

4 years agox86: simplify OP_I64()
Jan Beulich [Tue, 25 Jun 2019 07:27:05 +0000 (09:27 +0200)] 
x86: simplify OP_I64()

The only meaningful difference from OP_I() is the handling of the
VEX.W=1 case in 64-bit mode for bytemode being v_mode. Funnel
everything else into OP_I(), and drop no longer needed local
variables.

4 years agox86: fix (dis)assembly of certain SSE2 insns in 16-bit mode
Jan Beulich [Tue, 25 Jun 2019 07:25:26 +0000 (09:25 +0200)] 
x86: fix (dis)assembly of certain SSE2 insns in 16-bit mode

MOVNTI was wrongly assembled with a 66h prefix. Add IgnoreSize to
address this. It and the scalar to/from integer conversion insns also
were also wrongly using Ev / Gv, leading to 16-bit register names being
printed when 32-bit ones were meant.

Clone the 32-bit SSE2 test to cover both assembler and disassembler.

4 years agox86-64: also optimize ANDQ with immediate fitting in 7 bits
Jan Beulich [Tue, 25 Jun 2019 07:23:48 +0000 (09:23 +0200)] 
x86-64: also optimize ANDQ with immediate fitting in 7 bits

The same reasoning applies here as did/does for immediates fitting in
31 bits.

4 years agox86: add CVT{,T}PS2PI cases to xmmwords test
Jan Beulich [Tue, 25 Jun 2019 07:22:38 +0000 (09:22 +0200)] 
x86: add CVT{,T}PS2PI cases to xmmwords test

I've (not so) recently noticed this further pair which should be tested
here.

4 years agoFix logical expression in last commit
Alan Modra [Tue, 25 Jun 2019 07:26:16 +0000 (16:56 +0930)] 
Fix logical expression in last commit

* config/tc-ppc.c (ppc_handle_align): Add parentheses.

4 years agoPowerPC nops
Alan Modra [Tue, 25 Jun 2019 00:42:58 +0000 (10:12 +0930)] 
PowerPC nops

This patch corrects ppc rs_align_code handling to choose the alignment
nops based on the machine in force at the alignment directive rather
than the machine at the end of file.

* config/tc-ppc.h (ppc_nop_select): Declare.
(NOP_OPCODE): Define.
* config/tc-ppc.c (ppc_elf_end, ppc_xcoff_end): Zero ppc_cpu.
(ppc_nop_encoding_for_rs_align_code): New enum.
(ppc_nop_select): New function.
(ppc_handle_align): Don't use ppc_cpu here.  Get nop type from frag.
* testsuite/gas/ppc/groupnop.d,
* testsuite/gas/ppc/groupnop.s: New test.
* testsuite/gas/ppc/ppc.exp: Run it.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Jun 2019 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoRISC-V: Enable lui relaxation for CODE and MERGE sections.
Jim Wilson [Mon, 24 Jun 2019 20:50:10 +0000 (13:50 -0700)] 
RISC-V: Enable lui relaxation for CODE and MERGE sections.

2019-06-24  Ilia Diachkov  <ilia.diachkov@optimitech.com>
bfd/
* elfnn-riscv.c (_bfd_riscv_relax_lui): Delete early exit when
SEC_MERGE or SEC_CODE flags are set.
(_bfd_riscv_relax_section): New local symtype.  Set sym_sec and
symtype consistently.  Don't include sec_addr (sym_sec) in symval.
Add check for SEC_INFO_TYPE_MERGE and call _bfd_merged_section_offset.
Add sec_addr (sym_sec) after handling merge sections.

4 years agoelf: Remove the property after reporting its removal
H.J. Lu [Mon, 24 Jun 2019 18:08:40 +0000 (11:08 -0700)] 
elf: Remove the property after reporting its removal

commit d2ef37ebd9f771d06edf1fdea37970f60b242b2d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Dec 7 08:30:30 2018 -0800

    elf: Report property change when merging properties

failed to remove the property after reporting it has been removed.  This
patch corrects it.

bfd/

PR ld/24721
* elf-properties.c (elf_merge_gnu_property_list): Remove the
property after reporting property removal.

ld/

PR ld/24721
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
* testsuite/ld-x86-64/pr24721-x32.d: New file.
* testsuite/ld-x86-64/pr24721.d: Likewise.
* testsuite/ld-x86-64/pr24721.map: Likewise.
* testsuite/ld-x86-64/pr24721a.s: Likewise.
* testsuite/ld-x86-64/pr24721b.s: Likewise.

4 years ago[gdb/testsuite] Fix label reference in implptr-64bit.exp
Tom de Vries [Mon, 24 Jun 2019 16:26:10 +0000 (18:26 +0200)] 
[gdb/testsuite] Fix label reference in implptr-64bit.exp

When running gdb.dwarf2/implptr-64bit.exp with board cc-with-dwz-m, we run into:
...
dwz: dwz.c:2363: checksum_die: \
  Assertion `\
    ((!op_multifile && !rd_multifile && !fi_multifile) || cu != die_cu (ref)) \
    && (!op_multifile || cu->cu_chunk == die_cu (ref)->cu_chunk)' failed.
cc-with-tweaks.sh: line 218: 13030 Aborted  \
  $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null
...
In other words, PR dwz/24170.

The trigger for the dwz PR is when intra-CU references are encoded using
section-relative encoding DW_FORM_ref_addr, but could have been encoded using
CU-relative encoding DW_FORM_ref4.

Fix the intra-CU '%' label reference in implptr-64bit.exp.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/implptr-64bit.exp: Fix intra-CU '%' label reference.

4 years ago[gdb/testsuite] Fix DW_AT_decl_file in gdb.trace tests
Tom de Vries [Mon, 24 Jun 2019 11:29:23 +0000 (13:29 +0200)] 
[gdb/testsuite] Fix DW_AT_decl_file in gdb.trace tests

When running gdb.trace/{entry-values.exp,unavailable-dwarf-piece.exp} with
board cc-with-dwz, we run into two failures related to the DW_AT_decl_file
attribute:
- The encoding DW_FOR_sdata is used for DW_AT_decl_file, while the attribute
  is required to have a an "unsigned integer constant" value.
- The DW_AT_decl_file attributes refer to a file with index one, while there's
  no such file.

Fix this by using DW_FOR_udata and the value 0, meaning "no file specified".

Tested on x86_64-linux with board native-gdbserver.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

* gdb.trace/entry-values.exp: Use DW_FORM_udata instead of
DW_FOR_sdata for DW_AT_decl_file.  Use 0 for DW_AT_decl_file.
* gdb.trace/unavailable-dwarf-piece.exp: Same.

4 years ago[gdb/testsuite] Fix inter-cu refs in inlined_subroutine-inheritance.exp
Tom de Vries [Mon, 24 Jun 2019 10:20:39 +0000 (12:20 +0200)] 
[gdb/testsuite] Fix inter-cu refs in inlined_subroutine-inheritance.exp

When running gdb.dwarf2/inlined_subroutine-inheritance.exp with board
cc-with-dwz, we run into:
...
dwz: inlined_subroutine-inheritance: Couldn't find DIE referenced by \
  DW_AT_abstract_origin
...

The problem is that the DW_AT_abstract_origin attributes refer to DIEs in
other CUs, while the references are encoded using the cu-relative encoding
DW_FORM_ref4.

Fix this by forcing the references to use DW_FORM_ref_addr.

Tested on x86_64-linux.

Tested with commit c24bdb023c "Introduce dwarf2_cu::get_builder" reverted,
and verified that the test-case fails in the same way before and after this
patch.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/inlined_subroutine-inheritance.exp:

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Jun 2019 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoPR24704, Internal error building skiboot for powerpc64-linux-gnu
Alan Modra [Sun, 23 Jun 2019 02:58:39 +0000 (12:28 +0930)] 
PR24704, Internal error building skiboot for powerpc64-linux-gnu

While the skiboot linker script bears some culpability in this PR,
it's also true that the GOT indirect to GOT relative optimisation for
16-bit offsets isn't safe.  At least, it isn't safe to remove the GOT
entry based on distance between the GOT pointer and symbol calculated
from the preliminary layout.  So this patch removes that optimisation,
and reduces the range allowed for 32-bit and 34-bit offsets.

PR 24704
bfd/
* elf64-ppc.c (R_PPC64_GOT16_DS): Don't set has_gotrel.
(ppc64_elf_edit_toc): Don't remove R_PPC64_GOT16_DS got entries.
Reduce range of offsets allowed for other GOT relocs.
ld/
* testsuite/ld-powerpc/elfv2exe.d: Update.
* testsuite/ld-powerpc/elfv2so.d: Update.

This page took 0.053837 seconds and 4 git commands to generate.