Commit Graph

98038 Commits

Author SHA1 Message Date
Alan Modra 60d53d7f03 PowerPC notoc call stub tests
* testsuite/ld-powerpc/callstub-1.d,
	* testsuite/ld-powerpc/callstub-1.s: New test.
	* testsuite/ld-powerpc/callstub-2.d,
	* testsuite/ld-powerpc/callstub-2.s: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2019-06-28 10:16:17 +09:30
GDB Administrator 0c823d25a6 Automatic date update in version.in 2019-06-28 00:00:56 +00:00
H.J. Lu e395f487b3 i386: Check vector length for scatter/gather prefetch instructions
Since not all vector lengths are supported by scatter/gather prefetch
instructions, decode them only with supported vector lengths.

gas/

	PR binutils/24719
	* testsuite/gas/i386/disassem.s: Add test for vgatherpf0dps
	with invalid vector length.
	* testsuite/gas/i386/x86-64-disassem.s: Likewise.
	* testsuite/gas/i386/disassem.d: Updated.
	* testsuite/gas/i386/x86-64-disassem.d: Likewise.

opcodes/

	PR binutils/24719
	* i386-dis-evex-len.h: Add EVEX_LEN_0F38C6_REG_1_PREFIX_2,
	EVEX_LEN_0F38C6_REG_2_PREFIX_2, EVEX_LEN_0F38C6_REG_5_PREFIX_2,
	EVEX_LEN_0F38C6_REG_6_PREFIX_2, EVEX_LEN_0F38C7_R_1_P_2_W_0,
	EVEX_LEN_0F38C7_R_1_P_2_W_1, EVEX_LEN_0F38C7_R_2_P_2_W_0,
	EVEX_LEN_0F38C7_R_2_P_2_W_1, EVEX_LEN_0F38C7_R_5_P_2_W_0,
	EVEX_LEN_0F38C7_R_5_P_2_W_1, EVEX_LEN_0F38C7_R_6_P_2_W_0 and
	EVEX_LEN_0F38C7_R_6_P_2_W_1.
	* i386-dis-evex-prefix.h: Update PREFIX_EVEX_0F38C6_REG_1,
	PREFIX_EVEX_0F38C6_REG_2, PREFIX_EVEX_0F38C6_REG_5 and
	PREFIX_EVEX_0F38C6_REG_6 entries.
	* i386-dis-evex-w.h: Update EVEX_W_0F38C7_R_1_P_2,
	EVEX_W_0F38C7_R_2_P_2, EVEX_W_0F38C7_R_5_P_2 and
	EVEX_W_0F38C7_R_6_P_2 entries.
	* i386-dis.c: Add EVEX_LEN_0F38C6_REG_1_PREFIX_2,
	EVEX_LEN_0F38C6_REG_2_PREFIX_2, EVEX_LEN_0F38C6_REG_5_PREFIX_2,
	EVEX_LEN_0F38C6_REG_6_PREFIX_2, EVEX_LEN_0F38C7_R_1_P_2_W_0,
	EVEX_LEN_0F38C7_R_1_P_2_W_1, EVEX_LEN_0F38C7_R_2_P_2_W_0,
	EVEX_LEN_0F38C7_R_2_P_2_W_1, EVEX_LEN_0F38C7_R_5_P_2_W_0,
	EVEX_LEN_0F38C7_R_5_P_2_W_1, EVEX_LEN_0F38C7_R_6_P_2_W_0 and
	EVEX_LEN_0F38C7_R_6_P_2_W_1 enums.
2019-06-27 13:39:32 -07:00
Tom Tromey 1b7f24cd6b Change arm_objfile_data_key to use type-safe registry
After seeing Simon's patch to change arm_per_objfile to use new and
delete, I realized it is now simple to change arm_objfile_data_key to
use the type-safe registry.

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

	* arm-tdep.c (arm_objfile_data_key): Move lower.  Change type to
	objfile_key.
	(arm_find_mapping_symbol, arm_record_special_symbol)
	(_initialize_arm_tdep): Update.
	(arm_objfile_data_free): Remove.
2019-06-27 08:01:18 -06:00
Tom Tromey 3d507ff23b Fix two buglets in cp_print_value_fields patch
Pedro and Tom both pointed out issues in the cp_print_value_fields
patch, aka the fix for PR c++/20020.

This patch addresses both issues.  Tested on x86-64 Fedora 29.

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

	* cp-valprint.c (cp_print_value_fields): Pass opts, not options,
	to cp_print_static_field.

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

	* gdb.cp/constexpr-field.exp: Use setup_xfail.
2019-06-27 07:51:52 -06:00
Barnaby Wilk s ba85f98c42 This fixes a bug in the ARm assembler where an immediate operand larger than 4 bits (0xF) could be passed to the SMC (Secure Monitor Call) instruction.
For example, this code is invalid:
smc #0x6951

The code would previously check for and encode for up to 16 bit immediate values, however
this immediate should instead be only a 4 bit value
(as documented herehttps://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf  ).

Fixed this by adding range checks in the relevant areas and also removing code that would
encode more than the first 4 bits of the immediate (code that is now redundant, as any immediate operand
larger than 0xF would error now anyway).

gas	* config/tc-arm.c (do_smc): Add range check for immediate operand.
	(do_t_smc): Add range check for immediate operand. Remove
	obsolete immediate encoding.
	(md_apply_fix): Fix range check. Remove obsolete immediate encoding.
	* testsuite/gas/arm/arch6zk.d: Fix test.
	* testsuite/gas/arm/arch6zk.s: Fix test.
	* testsuite/gas/arm/smc-bad.d: New test.
	* testsuite/gas/arm/smc-bad.l: New test.
	* testsuite/gas/arm/smc-bad.s: New test.
	* testsuite/gas/arm/thumb32.d: Fix test.
	* testsuite/gas/arm/thumb32.s: Fix test.
2019-06-27 14:06:02 +01:00
Jan Beulich 5ceb1f4d80 x86: add missing test
These files were mistakenly left out of commit c1dc7af521.
2019-06-27 12:40:08 +02:00
Jan Beulich 2b7bcc8740 x86: fold AVX scalar to/from int conversion insns
There's no point doing a separate decode of the VEX.L bit - both decoded
forms are identical.
2019-06-27 08:50:28 +02:00
Jan Beulich c1dc7af521 x86: allow VEX et al encodings in 16-bit (protected) mode
These encodings aren't valid in real and VM86 modes, but they are very
well usable in 16-bit protected mode.

A few adjustments in the disassembler tables are needed where Ev or Gv
were wrongly used. Additionally an adjustment is needed to avoid
printing "addr32" when that's already recognizable by the use of %eiz.

Furthermore the Iq operand template was wrong for XOP:0Ah encoding
insns: They're having a uniform 32-bit immediate. Drop Iq and introduce
Id instead.

Clone a few existing test cases to exercise assembler and disassembler.
2019-06-27 08:49:40 +02:00
Jim Wilson 65bd27298d Fix a few non-dash safe xstormy16 shell scripts.
Noticed by a customer while looking at a tangentially related problem.  The
gas testsuite for xstormy16 has two scripts that have a typo on the first
line, they are missing the !.  They also use shell syntax that doesn't work
on a system where /bin/sh is dash.  So I fixed the typo, changed the shell
to bash, and made them executable, so that they now work when run directly
even if /bin/sh is dash.

	gas/
	* testsuite/gas/xstormy16/allinsn.sh: Change first line to
	#!/bin/bash and make it executable.
	* testsuite/gas/xstormy16/gcc.sh: Likewise.
2019-06-26 18:12:55 -07:00
Jim Wilson d7560e2df5 RISC-V: Make objdump disassembly work right for binary files.
Without the ELF header to set info->endian, it ends up as BFD_UNKNOWN_ENDIAN
which gets printed as big-endian.  But RISC-V instructions are always little
endian, so we can set endian_code correctly, and then set display_endian from
that.  This is similar to how the aarch64 support works, but without the
support for constant pools, as we don't have that on RISC-V.

	opcodes/
	PR binutils/24739
	* riscv-dis.c (riscv_disasemble_insn): Set info->endian_code.
	Set info->display_endian to info->endian_code.
2019-06-26 17:17:09 -07:00
GDB Administrator 696d5b3801 Automatic date update in version.in 2019-06-27 00:00:18 +00:00
Lili Cui aa108c0c46 i386: Document memory size reference in assembler
* doc/c-i386.texi: Document x/y/z instruction sufffixes in AT&T
	syntax and xmmword/ymmword/zmmword/fword/tbyte/oword ptr in
	Intel syntax.
2019-06-26 15:13:55 -07:00
Nick Clifton a68aa5d302 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.
2019-06-26 17:03:32 +01:00
Tom Tromey 762c164d75 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.
2019-06-26 09:50:55 -06:00
Alan Hayward aa2f9bcf23 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.
2019-06-26 15:48:12 +01:00
Alan Hayward 3426ae5760 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.
2019-06-26 14:11:07 +01:00
Tom de Vries 8af58ffe5d [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.
2019-06-26 15:04:05 +02:00
Tom de Vries 22e217527d [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.
2019-06-26 05:52:47 +02:00
GDB Administrator a93cbd6e69 Automatic date update in version.in 2019-06-26 00:00:18 +00:00
Simon Marchi 4838e44c8f 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.
2019-06-25 14:22:30 -04:00
Simon Marchi 54cc7474d4 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.
2019-06-25 14:22:23 -04:00
Philippe Waroquiers b65b566cdc 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.
2019-06-25 19:15:16 +02:00
Faraz Shahbazker 9b444f9533 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.
2019-06-25 09:29:55 -07:00
Tom de Vries 5c2c8c694d [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.
2019-06-25 16:42:46 +02:00
Tom Tromey c2fc64f54e 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".
2019-06-25 07:48:52 -06:00
Tom Tromey fb54fa768d 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.
2019-06-25 07:48:51 -06:00
Tom Tromey f7952c5774 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.
2019-06-25 07:48:51 -06:00
Tom Tromey 17568d782d 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.
2019-06-25 07:48:51 -06:00
Tom Tromey 53e7cdbaa1 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.
2019-06-25 07:48:50 -06:00
Tom Tromey 7908abbf18 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.
2019-06-25 07:48:50 -06:00
Tom Tromey 02c28df011 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.
2019-06-25 07:48:49 -06:00
Tom Tromey 6658b1bf6c 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.
2019-06-25 07:48:49 -06:00
Tom Tromey 21e1c91ef9 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.
2019-06-25 07:48:48 -06:00
Tom Tromey 115ac53b85 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.
2019-06-25 07:48:48 -06:00
Tom Tromey eaf9738bed 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.
2019-06-25 07:48:48 -06:00
Tom Tromey 31ca47237f 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.
2019-06-25 07:48:47 -06:00
Tom Tromey 41bcff7fee 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.
2019-06-25 07:48:47 -06:00
Tom Tromey d2802c3342 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.
2019-06-25 07:48:46 -06:00
Tom Tromey dd835f8b70 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.
2019-06-25 07:48:46 -06:00
Tom Tromey bd7db367c4 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.
2019-06-25 07:48:45 -06:00
Tom Tromey 3add462fff 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.
2019-06-25 07:48:45 -06:00
Tom Tromey 489e9d8b7b 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.
2019-06-25 07:48:44 -06:00
Tom Tromey c3fabb7d69 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.
2019-06-25 07:48:44 -06:00
Tom Tromey bbc228ee05 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.
2019-06-25 07:48:44 -06:00
Tom Tromey 5fcee43a96 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.
2019-06-25 07:48:43 -06:00
Tom Tromey d83f1fe65d 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.
2019-06-25 07:48:43 -06:00
Tom Tromey 17374de40e 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.
2019-06-25 07:48:42 -06:00
Tom Tromey f936bca26d 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.
2019-06-25 07:48:42 -06:00
Tom Tromey d6ba6a1164 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.
2019-06-25 07:48:41 -06:00