]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
4 years agocpu,opcodes,gas: use %r0 and %r6 instead of %a and %ctf in eBPF disassembler
Jose E. Marchesi [Fri, 19 Jul 2019 13:35:43 +0000 (15:35 +0200)] 
cpu,opcodes,gas: use %r0 and %r6 instead of %a and %ctf in eBPF disassembler

This patch changes the eBPF CPU description to prefer the register
names %r0 and %r6 instead of %a and %ctx when disassembling.  This
matches better with the current practice, vs. cBPF.

It also updates the GAS tests in order to reflect this change.
Tested in a x86_64 host.

cpu/ChangeLog:

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

* bpf.cpu (h-gpr): when disassembling, use %r0 and %r6 instead of
%a and %ctx.

opcodes/ChangeLog:

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

* bpf-desc.c: Regenerated.

gas/ChangeLog:

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

* testsuite/gas/bpf/alu.d: Use %r6 instead of %ctx.
* testsuite/gas/bpf/lddw-be.d: Likewise.
* testsuite/gas/bpf/lddw.d: Likewise.
* testsuite/gas/bpf/alu-be.d: Likewise.
* testsuite/gas/bpf/alu32.d: Likewise.

4 years agogas: make .lcomm to accept an optional aligmnet in eBPF targets
Jose E. Marchesi [Fri, 19 Jul 2019 13:35:02 +0000 (15:35 +0200)] 
gas: make .lcomm to accept an optional aligmnet in eBPF targets

Tested in a x86_64 host.

gas/ChangeLog:

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

* config/tc-bpf.c (pe_lcomm_internal): Adapted from tc-i386.c.
(pe_lcomm): Likewise.
(md_pseudo_table): Use pe_lcomm to implement .lcomm.

4 years ago[AArch64] Rename +bitperm to +sve2-bitperm
Richard Sandiford [Fri, 19 Jul 2019 11:18:02 +0000 (12:18 +0100)] 
[AArch64] Rename +bitperm to +sve2-bitperm

After some discussion, we've decided to rename the +bitperm feature
flag to +sve2-bitperm, so that it's consistent with the other SVE2
feature flags.  The associated internal macros already used
"SVE2_BITPERM", so only the feature flag itself needs to change.

2019-07-19  Richard Sandiford  <richard.sandiford@arm.com>

gas/
* doc/c-aarch64.texi: Remame the +bitperm extension to +sve2-bitperm.
* config/tc-aarch64.c (aarch64_features): Likewise.
* testsuite/gas/aarch64/illegal-sve2-aes.d: Update accordingly.
* testsuite/gas/aarch64/illegal-sve2-sha3.d: Likewise.
* testsuite/gas/aarch64/illegal-sve2-sm4.d: Likewise.
* testsuite/gas/aarch64/illegal-sve2.d: Likewise.
* testsuite/gas/aarch64/sve2.d: Likewise.

4 years ago[PowerPC64] pc-relative TLS relocations
Alan Modra [Fri, 19 Jul 2019 06:06:58 +0000 (15:36 +0930)] 
[PowerPC64] pc-relative TLS relocations

This patch supports using pcrel instructions in TLS code sequences.  A
number of new relocations are needed, gas operand modifiers to
generate those relocations, and new TLS optimisation.  For
optimisation it turns out that the new pcrel GD and LD sequences can
be distinguished from the non-pcrel GD and LD sequences by there being
different relocations on the new sequence.  The final "add ra,rb,13"
on IE sequences similarly needs a new relocation, or as I chose, a
modification of R_PPC64_TLS.  On pcrel IE code, the R_PPC64_TLS points
one byte into the "add" instruction rather than being on the
instruction boundary.

GD:
 pla 3,z@got@tlsgd@pcrel   # R_PPC64_GOT_TLSGD34
 bl __tls_get_addr@notoc(z@tlsgd) # R_PPC64_TLSGD and R_PPC64_REL24_NOTOC
  edited to IE
   pld 3,z@got@tprel@pcrel
   add 3,3,13
  edited to LE
   paddi 3,13,z@tprel
   nop

LD:
 pla 3,z@got@tlsld@pcrel   # R_PPC64_GOT_TLSLD34
 bl __tls_get_addr@notoc(z@tlsld) # R_PPC64_TLSLD and R_PPC64_REL24_NOTOC
 ..
 paddi 9,3,z2@dtprel
 pld 10,z3@got@dtprel@pcrel
 add 10,10,3
  edited to LE
   paddi 3,13,0x1000
   nop

IE:
 pld 9,z@got@tprel@pcrel   # R_PPC64_GOT_TPREL34
 add 3,9,z@tls@pcrel   # R_PPC64_TLS at insn+1
 ldx 4,9,z@tls@pcrel
 lwax 5,9,z@tls@pcrel
 stdx 5,9,z@tls@pcrel
  edited to LE
  paddi 9,13,z@tprel
  nop
  ld 4,0(9)
  lwa 5,0(9)
  std 5,0(9)

LE:
 paddi 10,13,z@tprel

include/
* elf/ppc64.h (R_PPC64_TPREL34, R_PPC64_DTPREL34),
(R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34),
(R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define.
(IS_PPC64_TLS_RELOC): Include new tls relocs.
bfd/
* reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34),
(BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34),
(BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34),
(BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs.
* elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs.
(ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs.
(must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64.
(ppc64_elf_check_relocs): Support pcrel tls relocs.
(ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Map "tls@pcrel", "got@tlsgd@pcrel",
"got@tlsld@pcrel", "got@tprel@pcrel", and "got@dtprel@pcrel".
(fixup_size, md_assemble): Handle pcrel tls relocs.
(ppc_force_relocation, ppc_fix_adjustable): Likewise.
(md_apply_fix, tc_gen_reloc): Likewise.
ld/
* testsuite/ld-powerpc/tlsgd.d,
* testsuite/ld-powerpc/tlsgd.s,
* testsuite/ld-powerpc/tlsie.d,
* testsuite/ld-powerpc/tlsie.s,
* testsuite/ld-powerpc/tlsld.d,
* testsuite/ld-powerpc/tlsld.s: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.

4 years ago[PowerPC] Rename testcase
Alan Modra [Fri, 19 Jul 2019 05:00:36 +0000 (14:30 +0930)] 
[PowerPC] Rename testcase

Just making room for a new tlsld test.

* testsuite/ld-powerpc/tlsldopt.d: Rename from tlsld.d.
* testsuite/ld-powerpc/tlsldopt.s: Rename from tlsld.s.
* testsuite/ld-powerpc/tlsldopt32.d: Rename from tlsld32.d.
* testsuite/ld-powerpc/tlsldopt32.s: Rename from tlsld32.s.
* testsuite/ld-powerpc/powerpc.exp: Update.

4 years agoRe: ld -r: Don't merge with member of output section group
Alan Modra [Fri, 19 Jul 2019 07:37:36 +0000 (17:07 +0930)] 
Re: ld -r: Don't merge with member of output section group

PR 24819
* testsuite/ld-elf/pr24819.d: xfail for genelf targets.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 19 Jul 2019 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agolibctf: introduce ctf_func_type_{info,args}, ctf_type_aname_raw
Nick Alcock [Thu, 18 Jul 2019 17:44:21 +0000 (18:44 +0100)] 
libctf: introduce ctf_func_type_{info,args}, ctf_type_aname_raw

The first two of these allow you to get function type info and args out
of the types section give a type ID: astonishingly, this was missing
from libctf before now: so even though types of kind CTF_K_FUNCTION were
supported, you couldn't find out anything about them.  (The existing
ctf_func_info and ctf_func_args only allow you to get info about
functions in the function section, i.e. given symbol table indexes, not
type IDs.)

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

include/
* ctf-api.h (ECTF_NOTFUNC): Fix description.
(ctf_func_type_info): New.
(ctf_func_type_args): Likewise.
libctf/
* ctf-types.c (ctf_type_aname_raw): New.
(ctf_func_type_info): Likewise.
(ctf_func_type_args): Likewise.
* ctf-error.c (_ctf_errlist): Fix description.

4 years agoFix for using named pipes on Windows
Guillaume LABARTHE [Thu, 18 Jul 2019 16:20:04 +0000 (17:20 +0100)] 
Fix for using named pipes on Windows

On Windows, passing a named pipe as terminal argument to the new-ui
command does not work.

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

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

Pedro says:

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

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

 and saw no regressions.

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

* top.c (new_ui_command): Open specified terminal just once.

4 years agoConstify main_name
Tom Tromey [Thu, 18 Jul 2019 15:29:15 +0000 (09:29 -0600)] 
Constify main_name

This patch constifies the return type of main_name.  There is a
comment indicating that this wasn't possible at some point in the
past, but whatever the barrier was, it is gone now.

Tested by rebuilding.

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

* symtab.c (main_name): Constify return type.
* symfile.c (set_initial_language): Update.
* symtab.h (main_name): Constify return type.

4 years agold -r: Don't merge with member of output section group
H.J. Lu [Thu, 18 Jul 2019 15:01:45 +0000 (08:01 -0700)] 
ld -r: Don't merge with member of output section group

When doing a relocatable link, members of input section group are
placed in their own output sections.  We need to make sure that no
input sections are merged with member of output section group.

PR ld/24819
* emultempl/elf32.em (elf_orphan_compatible): Return FALSE for
member of output section group when doing a relocatable link.
* testsuite/ld-elf/pr24819.d: New file.
* testsuite/ld-elf/pr24819.s: Likewise.

4 years ago[PowerPC64] Use STN_UNDEF internally for edited relocs
Alan Modra [Thu, 18 Jul 2019 01:42:40 +0000 (11:12 +0930)] 
[PowerPC64] Use STN_UNDEF internally for edited relocs

It's not correct to use non-STT_TLS symbols with TLS relocation, not
that it matters much when editing relocs, but this edited reloc can be
output by --emit-relocs.  So don't use a symbol on the reloc.

* elf64-ppc.c (ppc64_elf_relocate_section): Don't bother selecting
a TLS section symbol for edited relocs.  Tighten TLS symbol/reloc
match test.

4 years ago[PowerPC64] Don't store TLS_EXPLICIT in tls_mask
Alan Modra [Thu, 18 Jul 2019 01:34:06 +0000 (11:04 +0930)] 
[PowerPC64] Don't store TLS_EXPLICIT in tls_mask

This saves a bit in tls_mask, and fixes a bug that could be triggered
in the unlikely case that both @got (usual ELF style) and @toc
(PowerOpen style) code was used to set up args for __tls_get_addr.

* elf64-ppc.c (TLS_EXPLICIT): Define as 256.
(ppc64_elf_check_relocs): Don't store TLS_EXPLICIT even if char
is more than 8 bits.
(ppc64_elf_tls_optimize): Likewise.  Make tls_set, tls_clear, and
tls_type vars unsigned int.
(ppc64_elf_relocate_section): Use r_type rather than TLS_EXPLICIT
to select r_type edit.

4 years ago[PowerPC] Rename TLS_TPRELGD to TLS_GDIE
Alan Modra [Thu, 18 Jul 2019 01:28:01 +0000 (10:58 +0930)] 
[PowerPC] Rename TLS_TPRELGD to TLS_GDIE

Choose a better name, that reflects why the flag is set (GD to IE
optimisation) rather than what the flag produces (TPREL64 reloc on
a single GOT entry replacing a tls_index pair).

* elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file.
Correct comment.
* elf64-ppc.c (TLS_GDIE): Likewise.

4 years ago[PowerPC64] correct tprel offset limit
Alan Modra [Thu, 18 Jul 2019 01:01:44 +0000 (10:31 +0930)] 
[PowerPC64] correct tprel offset limit

I don't expect anyone will have hit this bug.  You'd need a TLS
segment of 2G before you'd notice.

* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
range of tp-relative offsets.

4 years agogas: .lcomm gets an alignment argument in eBPF
Jose E. Marchesi [Wed, 17 Jul 2019 21:18:41 +0000 (23:18 +0200)] 
gas: .lcomm gets an alignment argument in eBPF

gas/ChangeLog:

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

* config/tc-bpf.c: Make .lcomm to get a third argument with the
alignment.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Jul 2019 00:00:14 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogas: support .half, .word and .dword directives in eBPF
Jose E. Marchesi [Wed, 17 Jul 2019 20:57:23 +0000 (22:57 +0200)] 
gas: support .half, .word and .dword directives in eBPF

This little patch adds support to the eBPF port of GAS for a few data
directives.  The names for the directives have been chosen to be
coherent with the suffixes used in eBPF instructions: b, h, w and dw
for 8, 16, 32 and 64-bit values respectively.

Documentation and tests included.
Tested in a x86_64 host.

gas/ChangeLog:

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

* config/tc-bpf.c (md_pseudo_table): .half, .word and .dword.
* testsuite/gas/bpf/data.s: New file.
* testsuite/gas/bpf/data.d: Likewise.
* testsuite/gas/bpf/data-be.d: Likewise.
* testsuite/gas/bpf/bpf.exp: Run data and data-be.
* doc/c-bpf.texi (BPF Directives): New section.

4 years agoRemove unnecessary "return"s
Tom Tromey [Thu, 4 Jul 2019 16:09:36 +0000 (10:09 -0600)] 
Remove unnecessary "return"s

The TUI has some "return;" statements at the end of void-returning
functions.  There's no need for these, so this patch removes them.

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

* tui/tui-winsource.c (tui_update_source_window)
(tui_update_source_window_as_is)
(tui_update_source_windows_with_line): Remove return.
* tui/tui-disasm.c (tui_show_disassem)
(tui_show_disassem_and_update_source): Remove return.
* tui/tui.c (tui_reset): Remove return.
* tui/tui-wingeneral.c
(tui_check_and_display_highlight_if_needed): Remove return.

4 years agoFix an error in parse_scrolling_args
Tom Tromey [Tue, 2 Jul 2019 23:31:44 +0000 (17:31 -0600)] 
Fix an error in parse_scrolling_args

parse_scrolling_args combines two errors into one message, which also
happens to end with a newline.  This separates the errors and fixes
the message.

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

* tui/tui-win.c (parse_scrolling_args): Throw separate errors.

4 years agoMove source window common to code to tui-winsource.[ch]
Tom Tromey [Tue, 2 Jul 2019 23:07:02 +0000 (17:07 -0600)] 
Move source window common to code to tui-winsource.[ch]

Like the previous rearranging patches, this moves the source and
disassembly window base class code to tui-winsource.[ch].  The
execution info window is also moved, because it is associated with
this base class.

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

* tui/tui-winsource.h (struct tui_exec_info_window)
(struct tui_source_window_base): Move from tui-data.h.
* tui/tui-winsource.c: Move many method definitions from
elsewhere.  Remove "structuring" comments.
* tui/tui-wingeneral.c (tui_source_window_base::make_visible)
(tui_source_window_base::refresh_window): Move to
tui-winsource.c.
* tui/tui-win.c (tui_source_window_base::refresh_all)
(tui_source_window_base::update_tab_width)
(tui_source_window_base::set_new_height)
(tui_source_window_base::do_make_visible_with_new_height): Move to
tui-winsource.c.
* tui/tui-source.h: Update.
* tui/tui-source.c (tui_source_window_base::reset): Move to
tui-winsource.c.
* tui/tui-disasm.h: Update.
* tui/tui-data.h (struct tui_exec_info_window): Move to
tui-winsource.h.
(struct tui_source_window_base): Likewise.
* tui/tui-data.c (tui_source_window_base::clear_detail)
(tui_source_window_base, ~tui_source_window_base): Move to
tui-winsource.c.

4 years agoChange make_invisible_and_set_new_height to be a method
Tom Tromey [Tue, 2 Jul 2019 23:05:49 +0000 (17:05 -0600)] 
Change make_invisible_and_set_new_height to be a method

This changes make_invisible_and_set_new_height to be a method on
tui_win_info.  I felt that this was cleaner.

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

* tui/tui-win.c (tui_resize_all)
(tui_source_window_base::update_tab_width)
(tui_adjust_win_heights): Update.
(tui_win_info::make_invisible_and_set_new_height): Rename from
make_invisible_and_set_new_height.
* tui/tui-data.h (struct tui_win_info)
<make_invisible_and_set_new_height>: New method.

4 years agoMove tui_source_window to tui-source.h
Tom Tromey [Tue, 2 Jul 2019 21:55:01 +0000 (15:55 -0600)] 
Move tui_source_window to tui-source.h

This moves tui_source_window to tui-source.h.  In this case there were
no method definitions to be moved.

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

* tui/tui.c: Update.
* tui/tui-source.h (struct tui_source_window): Move from
tui-data.h.
* tui/tui-layout.c: Update.
* tui/tui-disasm.c: Update.
* tui/tui-data.h (struct tui_source_window): Move to
tui-source.h.

4 years agoMove tui_disasm_window to tui-disasm.h
Tom Tromey [Tue, 2 Jul 2019 21:54:08 +0000 (15:54 -0600)] 
Move tui_disasm_window to tui-disasm.h

This moves tui_disasm_window to tui-disasm.h.  In this case there were
no method definitions to be moved.

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

* tui/tui-disasm.h (struct tui_disasm_window): Move from
tui-data.h.
* tui/tui-data.h (struct tui_disasm_window): Move to
tui-disasm.h.

4 years agoMove TUI data item window to tui-regs.h
Tom Tromey [Tue, 2 Jul 2019 21:51:00 +0000 (15:51 -0600)] 
Move TUI data item window to tui-regs.h

The TUI data item window is only used by the TUI register window.  So,
this patch moves the relevant code to tui-regs.[ch].

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

* tui/tui-regs.h (struct tui_data_item_window): Move from
tui-data.h.
* tui/tui-regs.c (tui_data_item_window): Move from tui-data.c.
* tui/tui-data.h (struct tui_data_item_window): Move to
tui-regs.h.
* tui/tui-data.c (~tui_data_item_window): Move to tui-regs.c.

4 years agoMove TUI command window code
Tom Tromey [Tue, 2 Jul 2019 21:48:59 +0000 (15:48 -0600)] 
Move TUI command window code

Like the earlier change to the data window, this moves the TUI command
window code to tui-command.[ch], and removes the old "structuring"
comments from tui-command.c.

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

* tui/tui.c: Update.
* tui/tui-win.c (tui_cmd_window::do_make_visible_with_new_height)
(tui_cmd_window::max_height): Move to tui-command.c.
* tui/tui-layout.c: Update.
* tui/tui-data.h (struct tui_cmd_window): Move to tui-command.h.
* tui/tui-data.c (tui_cmd_window::clear_detail): Move to
tui-command.c.
* tui/tui-command.h (struct tui_cmd_window): Move from
tui-data.h.
* tui/tui-command.c: Remove "structuring" comments.
(tui_cmd_window::clear_detail)
(tui_cmd_window::do_make_visible_with_new_height)
(tui_cmd_window::max_height): Move from elsewhere.

4 years agoMove tui_dispatch_ctrl_char to tui-io.c
Tom Tromey [Tue, 2 Jul 2019 21:43:00 +0000 (15:43 -0600)] 
Move tui_dispatch_ctrl_char to tui-io.c

tui_dispatch_ctrl_char is only called from a single spot in tui-io.c,
so move the function to that file and make it static.

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

* tui/tui-io.c (tui_dispatch_ctrl_char): Move from tui-command.c.
Now static.
* tui/tui-command.h (tui_dispatch_ctrl_char): Don't declare.
* tui/tui-command.c (tui_dispatch_ctrl_char): Move to tui-io.c.

4 years agoRearrange TUI data window code
Tom Tromey [Tue, 2 Jul 2019 21:41:08 +0000 (15:41 -0600)] 
Rearrange TUI data window code

An earlier patch caused tui-windata.h to be essentially empty.  And,
other earlier patches implemented TUI data window methods in any spot
that happened to be convenient at the time.

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

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

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

* tui/tui.c: Update.
* tui/tui-wingeneral.c (tui_data_window::refresh_window): Move to
tui-regs.c.
* tui/tui-windata.h: Remove file.
* tui/tui-windata.c: Remove file.
* tui/tui-win.c (tui_data_window::set_new_height)
(tui_data_window::do_make_visible_with_new_height): Move to
tui-regs.c.
* tui/tui-regs.h (struct tui_data_window): Move from tui-data.h.
* tui/tui-regs.c: Remove "structuring" comments.
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_data_window::erase_data_content)
(tui_data_window::display_all_data)
(tui_data_window::refresh_all)
(tui_data_window::do_scroll_vertical)
(tui_data_window::clear_detail, tui_data_window::set_new_height)
(tui_data_window::do_make_visible_with_new_height)
(tui_data_window::refresh_window): Move from elsewhere.
(_initialize_tui_regs): Move to end of file.
* tui/tui-layout.c: Update.
* tui/tui-hooks.c: Update.
* tui/tui-data.h (struct tui_data_window): Move to tui-regs.h.
* tui/tui-data.c (tui_data_window::clear_detail): Move to
tui-regs.c.
* Makefile.in (SUBDIR_TUI_SRCS): Remove tui-windata.c.

4 years agoFix flushing bug in tui_puts_internal
Tom Tromey [Tue, 2 Jul 2019 21:18:27 +0000 (15:18 -0600)] 
Fix flushing bug in tui_puts_internal

A while back I changed gdb not to flush in some places.  It turned out
that this broke the TUI a little.  An easy way to see it is to run
"gdb -tui -nx", then "file gdb" at the gdb prompt.  gdb will print the
usual "Reading symbols..." message -- but it won't appear on-screen
until the reading is complete.

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

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

* tui/tui-io.c (tui_puts_internal): Call wrefresh if newline is
seen.

4 years agoRemove has_locator method
Tom Tromey [Mon, 1 Jul 2019 20:44:29 +0000 (14:44 -0600)] 
Remove has_locator method

Earlier changes made it obvious that the has_locator method can only
be called for source/disassembly windows.  Because the only reference
to this now occurs in methods on this object, we can remove the
has_locator method entirely, in favor of using the member directly.

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

* tui/tui-win.c (tui_source_window_base::set_new_height)
(tui_source_window_base::do_make_visible_with_new_height): Use
m_has_locator field directly.
* tui/tui-data.h (struct tui_win_info) <has_locator>: Remove
method.
(struct tui_source_window_base) <has_locator>: Likewise.

4 years agoRemove tui_make_visible and tui_make_invisible
Tom Tromey [Mon, 1 Jul 2019 20:41:28 +0000 (14:41 -0600)] 
Remove tui_make_visible and tui_make_invisible

tui_make_visible and tui_make_invisible are just wrappers for a method
call, so remove them and have the callers simply make the method call
themselves.

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

* tui/tui-wingeneral.h (tui_make_visible, tui_make_invisible):
Don't declare.
* tui/tui-wingeneral.c (tui_make_visible, tui_make_invisible):
Remove.
* tui/tui-win.c (tui_source_window_base::set_new_height)
(tui_source_window_base::set_new_height)
(make_invisible_and_set_new_height)
(tui_source_window_base::do_make_visible_with_new_height)
(tui_source_window_base::do_make_visible_with_new_height):
Update.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Update.
* tui/tui-layout.c (show_layout): Update.

4 years agoRemove make_data_window
Tom Tromey [Mon, 1 Jul 2019 20:37:38 +0000 (14:37 -0600)] 
Remove make_data_window

As with the previous patches, unifying the creation and
re-initialization cases for the data window lets us remove
make_data_window in favor of simply using "new".

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

* tui/tui-layout.c (make_data_window): Remove.
(show_data): Unify creation and re-initialization cases.

4 years agoRemove make_source_window and make_disasm_window
Tom Tromey [Mon, 1 Jul 2019 20:37:04 +0000 (14:37 -0600)] 
Remove make_source_window and make_disasm_window

This unifies the remaining creation and re-initialization cases for
the source and disassembly windows.  Once this is done, it's clear
that make_source_window and make_disasm_window aren't needed any more,
so remove them.

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

* tui/tui-layout.c (make_source_window, make_disasm_window):
Remove.
(show_data): Unify creation and re-initialization cases.

4 years agoRemove make_command_window
Tom Tromey [Mon, 1 Jul 2019 20:26:42 +0000 (14:26 -0600)] 
Remove make_command_window

This unifies the creation and re-initialization cases for the command
window.  When this is done, it becomes clear that make_command_window
isn't needed -- it can be replaced with a simple "new", so this is
removed as well.

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

* tui/tui-layout.c (make_command_window): Remove.
(show_source_disasm_command, show_source_or_disasm_and_command):
Unify creation and re-initialization cases.

4 years agoSimplify show_source_or_disasm_and_command
Tom Tromey [Mon, 1 Jul 2019 06:55:14 +0000 (00:55 -0600)] 
Simplify show_source_or_disasm_and_command

This changes show_source_or_disasm_and_command to unify the creation
and re-initialization cases.

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

* tui/tui-layout.c (show_source_or_disasm_and_command): Unify
creation and re-initialization cases.

4 years agoChange tui_get_register to return void
Tom Tromey [Mon, 1 Jul 2019 06:51:20 +0000 (00:51 -0600)] 
Change tui_get_register to return void

tui_get_register returns a tui_status, but nothing checks this, so it
can return void instead.

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

* tui/tui-regs.c (tui_get_register): Return void.

4 years agoSimplify tui_gen_win_info::make_visible
Tom Tromey [Mon, 1 Jul 2019 05:30:28 +0000 (23:30 -0600)] 
Simplify tui_gen_win_info::make_visible

I noticed that tui_gen_win_info::make_visible was much wordier than it
needed to be.  This simplifies it.

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

* tui/tui-wingeneral.c (tui_gen_win_info::make_visible):
Simplify.

4 years agoSimplify show_source_disasm_command
Tom Tromey [Mon, 1 Jul 2019 02:46:18 +0000 (20:46 -0600)] 
Simplify show_source_disasm_command

This is the first of a few patches to further simplify window
(re-)initialization in tui-layout.c.  When changing the layout, a
window may be created or, if it already exists, simply resized.  These
two cases normally are identical, but this was obscured by the way the
code was written.  This patch changes show_source_disasm_command to
unify the creation and re-initialization cases.

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

* tui/tui-layout.c (show_source_disasm_command): Simplify window
resetting.

4 years agoClean up tui_layout_command
Tom Tromey [Mon, 1 Jul 2019 02:43:32 +0000 (20:43 -0600)] 
Clean up tui_layout_command

tui_layout_command is a simple wrapper for tui_set_layout_by_name.
This removes the extra layer and cleans up the resulting function a
bit -- changing it to call error rather than return a result.  This
necessitated a small change to tui-regs.c, to avoid calling the
function that is being removed.

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

* tui/tui.h (tui_set_layout_by_name): Don't declare.
* tui/tui-regs.c (tui_reg_layout): New function.
(tui_show_registers, tui_reg_command): Use it.
* tui/tui-layout.c (LAYOUT_USAGE): Remove.
(tui_layout_command): Rename from tui_set_layout_by_name.  Change
parameters.
(tui_layout_command): Remove.

4 years agoChange tui_set_layout to return void
Tom Tromey [Mon, 1 Jul 2019 02:34:57 +0000 (20:34 -0600)] 
Change tui_set_layout to return void

tui_set_layout can't meaningfully be called with UNDEFINED_LAYOUT; and
instead of trying to handle this case, simply assert and have the
function return void.  No caller was checking the return value anyway.

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

* tui/tui-layout.h (tui/tui-layout): Return void.
* tui/tui-layout.c (tui_set_layout): Return void.  Add assert.

4 years agoRemove reset_locator
Tom Tromey [Mon, 1 Jul 2019 02:32:35 +0000 (20:32 -0600)] 
Remove reset_locator

reset_locator was introduced just a few patches ago, but it's already
time to remove it.  It consists of a call to the locator's "reset"
method, plus a call to tui_make_window; but the latter is redundant at
all the places that call reset_locator.

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

* tui/tui-layout.c (show_source_disasm_command, show_data):
Update.
(reset_locator): Remove.
(show_source_or_disasm_and_command): Update.

4 years agoRemove the win_type parameter from tui_gen_win_info::reset
Tom Tromey [Sat, 29 Jun 2019 13:32:47 +0000 (07:32 -0600)] 
Remove the win_type parameter from tui_gen_win_info::reset

tui_gen_win_info::reset has a window type parameter that is only used
for an assertion.  This made sense as a defensive measure when window
creation was more dynamic -- it ensured that one did not make
mistakes.  However, there's no need for it any more, so this removes
it.

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

* tui/tui-source.c (tui_source_window_base::reset): Remove
win_type parameter.
* tui/tui-layout.c (make_command_window, make_source_window)
(make_disasm_window, make_data_window)
(show_source_disasm_command, show_data, tui_gen_win_info::reset)
(reset_locator, show_source_or_disasm_and_command): Update.
* tui/tui-data.h (struct tui_gen_win_info) <reset>: Remove
win_type parameter.
(struct tui_source_window_base) <reset>: Likewise.

4 years agoIntroduce reset_locator function in tui-layout.c
Tom Tromey [Sat, 29 Jun 2019 05:56:25 +0000 (23:56 -0600)] 
Introduce reset_locator function in tui-layout.c

init_and_make_win in tui-layout.c is now only called for the locator
-- earlier changes have made most of the cases here obsolete.  This
patch removes init_and_make_win and introduces a reset_locator
function.  Window creation is now much simpler to follow, because it
is no longer quite so dynamic.  (Though it will become even simpler in
coming patches.)

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

* tui/tui-layout.c (show_source_disasm_command): Use
reset_locator.
(reset_locator): New function.
(init_and_make_win): Remove.
(show_source_or_disasm_and_command): Use reset_locator.

4 years agoAlways create an execution info window for a source window
Tom Tromey [Sat, 29 Jun 2019 05:54:25 +0000 (23:54 -0600)] 
Always create an execution info window for a source window

A source or disassembly window will always have an "execution info"
window (the window along the side that displays breakpoint info), but
this isn't immediately clear from the source.  As a result, some code
has checks to see whether the execution_info is NULL.

This changes the source window base class to always instantiate an
execution_info window, then updates the rest of the code.  It also
simplifies window creation in tui-layout.c.

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

* tui/tui-winsource.c (tui_set_exec_info_content): Remove
condition.
* tui/tui-wingeneral.c (tui_source_window_base::make_visible):
Remove condition.
* tui/tui-source.c (tui_source_window_base::reset): New method.
* tui/tui-layout.c (make_command_window): Don't call
init_and_make_win.
(make_source_window, make_disasm_window): Don't call
make_source_or_disasm_window.
(make_data_window): Don't call init_and_make_win.  Change calling
convention.
(show_source_disasm_command, show_data): Simplify.
(make_source_or_disasm_window): Remove.
(show_source_or_disasm_and_command): Simplify.
* tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual.
(struct tui_source_window_base) <reset>: Likewise.
<execution_info>: Remove initializer.
* tui/tui-data.c (tui_source_window_base): Initialize
execution_info.

4 years agoRemove some dead code from tui_set_layout
Tom Tromey [Sat, 29 Jun 2019 05:35:31 +0000 (23:35 -0600)] 
Remove some dead code from tui_set_layout

tui_set_layout sets regs_populate using:

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

Then later it checks this variable:

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

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

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

* tui/tui-layout.c (tui_set_layout): Remove regs_populate
variable.

4 years agoRemove TUI data window special case
Tom Tromey [Sat, 29 Jun 2019 05:32:05 +0000 (23:32 -0600)] 
Remove TUI data window special case

The TUI has a couple of special cases for updating the data window:
one in tui_rl_other_windowand one in tui_set_focus_command.  As part
of the project to remove references to globals, I wanted to remove
these calls; but when I did, some simple operations (like "C-x o")
would cause the register window to blank.

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

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

* tui/tui.c (tui_rl_other_window): Update.
* tui/tui-wingeneral.c (tui_data_window::refresh_window): Call
superclass method first.  Always iterate over regs_content.
(tui_unhighlight_win, tui_highlight_win): Use refresh_window
method.
* tui/tui-win.c (tui_set_focus_command): Update.

4 years agoRemove tui_set_focus
Tom Tromey [Sat, 29 Jun 2019 05:23:37 +0000 (23:23 -0600)] 
Remove tui_set_focus

tui_set_focus_command is a simple wrapper for tui_set_focus, so rename
the latter and remove the wrapper function.

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

* tui/tui-win.c (tui_set_focus_command): Rename from
tui_set_focus.  Call tui_enable.
(tui_set_focus_command): Remove.

4 years agoMerge refresh and refresh_window methods
Tom Tromey [Sat, 29 Jun 2019 05:17:24 +0000 (23:17 -0600)] 
Merge refresh and refresh_window methods

Earlier refactorings introduced the refresh and refresh_window
methods, following the previous TUI code.  However, these methods are
essentially the same, so this patch merges them.  It also removes some
redundant refresh_window calls, because the execution window is
updated automatically by the corresponding source (or disassembly)
window.

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

* tui/tui-winsource.c (tui_show_exec_info_content): Don't call
refresh_window.
* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Call
touchwin.
(tui_data_window::refresh_window): Call refresh_window on data
items.  Always call superclass refresh_window.
(tui_win_info::refresh): Remove.
(tui_source_window_base::refresh_window): Update.
(tui_refresh_all): Update.
* tui/tui-layout.c (show_source_disasm_command): Remove call to
refresh_window.
(show_source_or_disasm_and_command): Likewise.
* tui/tui-data.h (struct tui_win_info) <refresh>: Remove.
(struct tui_source_window_base) <refresh>: Likewise.

4 years agoRemove tui_source_window::content_in_use
Tom Tromey [Sat, 29 Jun 2019 04:57:37 +0000 (22:57 -0600)] 
Remove tui_source_window::content_in_use

Now that source window clearing has been simplified, we don't need a
special flag to say whether the source window is in use -- we can
simply check whether the contents are set.  This patch implements this
idea, removing the content_in_use field.

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

* tui/tui-winsource.c (tui_clear_source_content)
(tui_show_source_content): Update.
* tui/tui-source.c (tui_source_window::showing_source_p): Check
whether content is empty.
* tui/tui-data.h (struct tui_source_window_base) <content_in_use>:
Remove.

4 years agoSimplify source window clearing
Tom Tromey [Sat, 29 Jun 2019 04:55:45 +0000 (22:55 -0600)] 
Simplify source window clearing

When a TUI source window is empty, it displays a "No Source Available"
message.  The function tui_set_source_content_nil also made sure to
put this message into the window's "content" field.

However, I believe this isn't really necessary.  Instead, it's simpler
to just empty the contents and let curses handle the refreshing.

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

* tui/tui-winsource.c (tui_erase_source_content): Clear the
window's contents.
* tui/tui-source.h (tui_set_source_content_nil): Don't declare.
* tui/tui-source.c (tui_set_source_content_nil): Remove.

4 years agoRemove UNDEFINED_ITEM define from TUI
Tom Tromey [Sat, 29 Jun 2019 04:51:20 +0000 (22:51 -0600)] 
Remove UNDEFINED_ITEM define from TUI

The TUI defined UNDEFINED_ITEM, but only used it in a single spot.  I
think this isn't very useful, so this removes the define.

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

* tui/tui-data.h (UNDEFINED_ITEM): Remove define.
(struct tui_data_item_window): Update.

4 years agoRemove unused TUI defines
Tom Tromey [Sat, 29 Jun 2019 04:49:10 +0000 (22:49 -0600)] 
Remove unused TUI defines

This removes some #defines that were unused in the TUI.

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

* tui/tui-data.h (MAX_CONTENT_COUNT, TUI_NULL_STR)
(DEFAULT_HISTORY_COUNT, WITH_LOCATOR, NO_LOCATOR): Remove
defines.

4 years agoRemove unused parameter from two TUI functions
Tom Tromey [Sat, 29 Jun 2019 04:48:33 +0000 (22:48 -0600)] 
Remove unused parameter from two TUI functions

The "display_prompt" parameter of tui_erase_source_content and
tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT
value, so remove the parameter.  Once this is done, the
EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so
remove those as well.

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

* tui/tui-winsource.h (tui_erase_source_content)
(tui_clear_source_content): Remove "display_prompt" parameter.
* tui/tui-winsource.c (tui_update_source_window_as_is)
(tui_update_source_windows_with_addr): Update.
(tui_clear_source_content): Remove "display_prompt" parameter.
(tui_erase_source_content): Likewise.  Simplify.
(tui_show_source_content): Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
* tui/tui-stack.c (tui_show_frame_info): Update.
* tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT):
Remove defines.

4 years agoAdd win_info parameter to tui_set_disassem_content
Tom Tromey [Fri, 28 Jun 2019 22:58:16 +0000 (16:58 -0600)] 
Add win_info parameter to tui_set_disassem_content

This adds a win_info parameter to tui_set_disassem_content, removing
uses of the TUI_DISASM_WIN global.

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

* tui/tui-winsource.c (tui_update_source_window_as_is): Update.
* tui/tui-disasm.h (tui_set_disassem_content): Add win_info
parameter.
* tui/tui-disasm.c (tui_set_disassem_content): Add win_info
parameter.

4 years agoMove content_in_use to tui_source_window class
Tom Tromey [Fri, 28 Jun 2019 22:44:23 +0000 (16:44 -0600)] 
Move content_in_use to tui_source_window class

From scanning the source now, it's clear that the content_in_use field
is only used for the source window.  This patch moves the field there,
and changes it to be a bool at the same time.  (A future patch will
clean this up further, removing the field entirely.)

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

* tui/tui-winsource.c (tui_clear_source_content)
(tui_show_source_content, tui_show_exec_info_content)
(tui_clear_exec_info_content): Update.
* tui/tui-stack.c (tui_show_locator_content): Update.
(tui_show_frame_info): Update.
* tui/tui-source.h (tui_source_window): Don't declare.
* tui/tui-source.c (tui_source_window::showing_source_p): Rename
from tui_source_is_displayed.
* tui/tui-data.h (struct tui_gen_win_info) <content_in_use>:
Remove field.
(struct tui_source_window_base) <content_in_use>: New field.  Now
bool.
(struct tui_source_window) <showing_source_p>: New method.
(TUI_SRC_WIN): Change cast.
* tui/tui-data.c (tui_initialize_static_data): Update.

4 years agoIntroduce tui_source_window_base::location_matches_p method
Tom Tromey [Fri, 28 Jun 2019 21:19:10 +0000 (15:19 -0600)] 
Introduce tui_source_window_base::location_matches_p method

This introduces the location_matches_p method, removing a spot that
explicitly examines a window's type.

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

* tui/tui-winsource.c (tui_update_breakpoint_info): Use
location_matches_p.
* tui/tui-source.c (tui_source_window::location_matches_p): New
method.
* tui/tui-disasm.c (tui_disasm_window::location_matches_p): New
method.
* tui/tui-data.h (struct tui_source_window_base)
<location_matches_p>: New method.
(struct tui_source_window, struct tui_disasm_window)
<location_matches_p>: Likewise.

4 years agoRemove tui_set_win_height
Tom Tromey [Fri, 28 Jun 2019 21:01:11 +0000 (15:01 -0600)] 
Remove tui_set_win_height

tui_set_win_height_command is just a simple wrapper for
tui_set_win_height, so rename the latter and remove the wrapper.

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

* tui/tui-win.c (tui_set_win_height_command): Rename from
tui_set_win_height.
(tui_set_win_height_command): Remove.

4 years agoMake source windows be self-updating
Tom Tromey [Fri, 28 Jun 2019 20:48:45 +0000 (14:48 -0600)] 
Make source windows be self-updating

This changes the TUI source window to register itself on the
source_styling_changed observable, and removes a bit of code from
tui-hooks.c.  This reduces the number of uses of the TUI_SRC_WIN
global.

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

* tui/tui-source.c (tui_source_window): New constructor.  Add
observer.
(~tui_source_window): New destructor.
(tui_source_window::style_changed): New method.
* tui/tui-hooks.c (tui_redisplay_source): Remove.
(tui_attach_detach_observers): Update.
* tui/tui-data.h (struct tui_source_window): Make constructor not
inline.  Add destructor.
(struct tui_source_window) <style_changed>: New method.
<m_observable>: New member.

4 years agoFix comment typos
Tom Tromey [Thu, 27 Jun 2019 22:05:25 +0000 (16:05 -0600)] 
Fix comment typos

This fixes a couple of comment typos that I noticed.

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

* tui/tui-data.c (tui_clear_source_windows_detail): Fix typo.
* tui/tui-win.c (tui_resize_all): Fix typo.

4 years agoIntroduce TUI window iterator
Tom Tromey [Thu, 27 Jun 2019 22:04:26 +0000 (16:04 -0600)] 
Introduce TUI window iterator

This introduces an iterator class and a range adapter to make it
simpler to iterate over TUI windows.

One explicit iteration remains, in tui-win.c, because that spot is
deleting windows as well.

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

* tui/tui-wingeneral.h (tui_refresh_all): Update.
* tui/tui-wingeneral.c (make_all_visible): Use foreach.
(tui_refresh_all): Remove "list" parameter.  Use foreach.
* tui/tui-win.c (window_name_completer): Use foreach.
(tui_refresh_all_win, tui_rehighlight_all, tui_all_windows_info)
(update_tab_width): Likewise.
* tui/tui-layout.c (show_layout): Update.
* tui/tui-data.h (class tui_window_iterator): New.
(struct all_tui_windows): New.
* tui/tui-data.c (tui_partial_win_by_name): Use foreach.

4 years agoMinor tui_reg_next / tui_reg_prev cleanup
Tom Tromey [Thu, 27 Jun 2019 01:45:53 +0000 (19:45 -0600)] 
Minor tui_reg_next / tui_reg_prev cleanup

This changes tui_reg_next and tui_reg_prev so that they don't need to
reference the TUI_DATA_WIN globals.

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

* tui/tui-regs.c (tui_reg_next, tui_reg_prev): Add "current_group"
parameter.  Don't reference globals.
(tui_reg_command): Update.

4 years agoSimplify tui_show_registers
Tom Tromey [Wed, 26 Jun 2019 22:26:39 +0000 (16:26 -0600)] 
Simplify tui_show_registers

tui_show_registers keeps a local status variable, but it is not
actually needed.  This rearranges the function to remove the variable.

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

* tui/tui-regs.c (tui_show_registers): Simplify.

4 years agoParameterize tui_show_register_group with window
Tom Tromey [Wed, 26 Jun 2019 22:25:40 +0000 (16:25 -0600)] 
Parameterize tui_show_register_group with window

This changes tui_show_register_group not to reference the TUI_DATA_WIN
global, instead leaving that to its caller.

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

* tui/tui-regs.c (tui_show_registers): Update.
(tui_show_register_group): Add win_info parameter.

4 years agoIntroduce tui_data_window::display_reg_element_at_line method
Tom Tromey [Wed, 26 Jun 2019 22:15:46 +0000 (16:15 -0600)] 
Introduce tui_data_window::display_reg_element_at_line method

This changes tui_display_reg_element_at_line to be a method on
tui_data_window, allowing for the removal of some uses of the
TUI_DATA_WIN global.

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

* tui/tui-regs.c (tui_data_window::display_reg_element_at_line):
Rename from tui_display_reg_element_at_line.
(tui_data_window::display_registers_from_line): Update.
* tui/tui-data.h (struct tui_data_window)
<display_reg_element_at_line>: New method.

4 years agoIntroduce two more tui_data_window methods
Tom Tromey [Wed, 26 Jun 2019 22:13:39 +0000 (16:13 -0600)] 
Introduce two more tui_data_window methods

This changes tui_display_registers_from and
tui_display_registers_from_line to be methods on tui_data_window,
allowing for the removal of more uses of the TUI_DATA_WIN global.

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

* tui/tui-regs.h (tui_display_registers_from)
(tui_display_registers_from_line): Don't declare.
* tui/tui-windata.c (tui_data_window::display_all_data)
(tui_data_window::refresh_all)
(tui_data_window::do_scroll_vertical): Update.
* tui/tui-regs.c (tui_data_window::display_registers_from): Rename
from tui_display_registers_from.
(tui_display_reg_element_at_line): Update.
(tui_data_window::display_registers_from_line): Rename from
tui_display_registers_from_line.
* tui/tui-data.h (struct tui_data_window) <display_registers_from,
display_registers_from_line>: New methods.

4 years agoIntroduce tui_data_window::erase_data_content method
Tom Tromey [Wed, 26 Jun 2019 22:07:45 +0000 (16:07 -0600)] 
Introduce tui_data_window::erase_data_content method

This changes tui_erase_data_content to be a method on tui_data_window,
allowing for the removal of some uses of the TUI_DATA_WIN global.

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

* tui/tui-windata.h (tui_erase_data_content): Don't declare.
* tui/tui-windata.c (tui_data_window::erase_data_content): Rename
from tui_erase_data_content.
(tui_data_window::display_all_data)
(tui_data_window::refresh_all)
(tui_data_window::do_scroll_vertical): Update.
* tui/tui-regs.c (tui_show_registers): Update.
* tui/tui-data.h (struct tui_data_window) <erase_data_content>:
New method.

4 years agoIntroduce tui_data_window::delete_data_content_windows method
Tom Tromey [Wed, 26 Jun 2019 22:04:37 +0000 (16:04 -0600)] 
Introduce tui_data_window::delete_data_content_windows method

This changes tui_delete_data_content_windows to be a method on
tui_data_window, removing some uses of the TUI_DATA_WIN global.

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

* tui/tui-windata.h (tui_delete_data_content_windows): Don't
declare.
* tui/tui-windata.c
(tui_data_window::delete_data_content_windows): Rename from
tui_delete_data_content_windows.
(tui_data_window::display_all_data)
(tui_data_window::do_scroll_vertical): Update.
* tui/tui-data.h (struct tui_data_window)
<delete_data_content_windows>: New method.

4 years agoDon't declare unimplemented functions
Tom Tromey [Wed, 26 Jun 2019 22:03:12 +0000 (16:03 -0600)] 
Don't declare unimplemented functions

A couple of functions were declared but never defined.  This removes
the declarations.

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

* tui/tui-windata.h (tui_refresh_data_win): Don't declare.
* tui/tui-regs.h (tui_first_reg_element_inline): Don't declare.

4 years agoIntroduce tui_data_window::display_all_data method
Tom Tromey [Wed, 26 Jun 2019 22:02:36 +0000 (16:02 -0600)] 
Introduce tui_data_window::display_all_data method

This changes tui_display_all_data to be a method on tui_data_window.
This helps cluster uses of the TUI_DATA_WIN global.

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

* tui/tui-windata.h (tui_display_all_data): Don't declare.
* tui/tui-windata.c (tui_data_window::display_all_data): Rename
from tui_display_all_data.
* tui/tui-win.c
(tui_data_window::do_make_visible_with_new_height): Update.
* tui/tui-regs.c (tui_show_registers): Update.
* tui/tui-layout.c (tui_set_layout): Update.
* tui/tui-data.h (struct tui_data_window) <display_all_data>: New
method.

4 years agoRemove tui_display_data_from
Tom Tromey [Wed, 26 Jun 2019 22:00:05 +0000 (16:00 -0600)] 
Remove tui_display_data_from

tui_display_data_from is only called from a single place.  Inlining it
there lets us remove some uses of the TUI_DATA_WIN global.

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

* tui/tui-windata.h (tui_display_data_from): Don't declare.
* tui/tui-windata.c (tui_display_data_from): Remove.
(tui_data_window::refresh_all): Update.

4 years agoRemove tui_display_data_from_line
Tom Tromey [Wed, 26 Jun 2019 21:56:56 +0000 (15:56 -0600)] 
Remove tui_display_data_from_line

tui_display_data_from_line is just a wrapper for
tui_display_registers_from_line, so remove it.  Also, nothing passed 0
as the "force_display" parameter to tui_display_registers_from_line,
so remove that parameter as well.

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

* tui/tui-windata.h (tui_display_data_from_line): Don't declare.
* tui/tui-windata.c (tui_display_data_from_line): Remove.
(tui_display_data_from, tui_data_window::do_scroll_vertical): Call
tui_display_registers_from_line.
* tui/tui-regs.h (tui_display_registers_from_line): Update.
* tui/tui-regs.c (tui_display_registers_from_line): Remove
"force_display" parameter.

4 years agoIntroduce tui_data_window::first_reg_element_no_inline
Tom Tromey [Wed, 26 Jun 2019 21:49:00 +0000 (15:49 -0600)] 
Introduce tui_data_window::first_reg_element_no_inline

This changes tui_first_reg_element_no_inline to be a method on
tui_data_window.  This again moves uses of the TUI_DATA_WIN global
from this function into other functions that are already using the
global.

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

* tui/tui-regs.h (tui_first_reg_element_no_inline): Don't
declare.
* tui/tui-regs.c (tui_data_window::first_reg_element_no_inline):
Rename from tui_first_reg_element_no_inline.
(tui_display_reg_element_at_line)
(tui_display_registers_from_line): Update.
* tui/tui-data.h (struct tui_data_window)
<first_reg_element_no_inline>: New method.

4 years agoIntroduce tui_data_window::line_from_reg_element_no method
Tom Tromey [Wed, 26 Jun 2019 21:46:38 +0000 (15:46 -0600)] 
Introduce tui_data_window::line_from_reg_element_no method

This changes tui_line_from_reg_element_no to be a method on
tui_data_window, allowing for the removal of some uses of the
TUI_DATA_WIN global.  (Actually, in this particular patch, the number
of uses is not decreased, but rather the uses are moved to spots that
are already using the global, i.e., increasing the clustering.)

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

* tui/tui-windata.c (tui_display_data_from)
(tui_data_window::do_scroll_vertical): Update.
* tui/tui-regs.h (tui_line_from_reg_element_no): Don't declare.
* tui/tui-regs.c (tui_data_window::line_from_reg_element_no):
Rename from tui_line_from_reg_element_no.
(tui_display_registers_from_line): Update.
* tui/tui-data.h (struct tui_data_window)
<line_from_reg_element_no>: New method.

4 years agoIntroduce tui_data_window::last_regs_line_no method
Tom Tromey [Wed, 26 Jun 2019 21:44:51 +0000 (15:44 -0600)] 
Introduce tui_data_window::last_regs_line_no method

This changes tui_last_regs_line_no into a method on tui_data_window,
allowing the removal of uses of the TUI_DATA_WIN global.

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

* tui/tui-regs.h (tui_last_regs_line_no): Don't declare.
* tui/tui-regs.c (tui_data_window::last_regs_line_no): Rename from
tui_last_regs_line_no.
(tui_display_reg_element_at_line)
(tui_display_registers_from_line): Update.
* tui/tui-data.h (struct tui_data_window) <last_regs_line_no>: New
method.

4 years agoRemove deleted breakpoint from TUI display
Tom Tromey [Mon, 24 Jun 2019 03:25:46 +0000 (21:25 -0600)] 
Remove deleted breakpoint from TUI display

PR tui/24722 points out that deleting a breakpoint does not cause the
"b" to be removed from the breakpoint display.  The issue here was
that the breakpoint still exists at the moment the breakpoint-deleted
observer is notified.  This fixes the problem by specially handling
the case where a breakpoint is being removed.

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

PR tui/24722:
* tui/tui-winsource.h (tui_update_all_breakpoint_info)
(tui_update_breakpoint_info): Add "being_deleted" parameter.
* tui/tui-winsource.c (tui_update_source_window_as_is): Update.
(tui_update_all_breakpoint_info): Add "being_deleted" parameter.
(tui_update_breakpoint_info): Likewise.
* tui/tui-hooks.c (tui_event_create_breakpoint)
(tui_event_delete_breakpoint, tui_event_modify_breakpoint):
Update.

4 years agoConsolidate "if"s in tui_show_frame_info
Tom Tromey [Mon, 24 Jun 2019 03:00:01 +0000 (21:00 -0600)] 
Consolidate "if"s in tui_show_frame_info

tui_show_frame_info has two parallel "if"s with the same condition and
no intervening code.  The second "if" perhaps wasn't obviously
identical, but earlier refactorings made it clearer, by pointing out
that only source and disassembly windows can be handled here.  This
merges the two statements.

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

* tui/tui-stack.c (tui_show_frame_info): Consolidate "if"s.

4 years agoRemove some uses of TUI_WIN_SRC
Tom Tromey [Mon, 24 Jun 2019 02:57:09 +0000 (20:57 -0600)] 
Remove some uses of TUI_WIN_SRC

This adds a 'win_info' parameter to a couple of functions.  This
reduces the number of references to the TUI_WIN_SRC global.

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

* tui/tui-winsource.c (tui_update_source_window_as_is)
(tui_update_source_windows_with_addr): Update.
* tui/tui-source.h (tui_set_source_content)
(tui_show_symtab_source): Add "win_info" parameter.
* tui/tui-source.c (tui_set_source_content): Add "win_info"
parameter.
(tui_show_symtab_source): Likewise.

4 years agoCheck can_highlight in tui_check_and_display_highlight_if_needed
Tom Tromey [Mon, 24 Jun 2019 02:48:59 +0000 (20:48 -0600)] 
Check can_highlight in tui_check_and_display_highlight_if_needed

tui_check_and_display_highlight_if_needed currently checks the
window's type; but this can be replaced with a check of
"can_highlight", making it more polymorphically-correct.

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

* tui/tui-wingeneral.c
(tui_check_and_display_highlight_if_needed): Check can_highlight.

4 years agoIntroduce can_scroll method
Tom Tromey [Mon, 24 Jun 2019 02:39:57 +0000 (20:39 -0600)] 
Introduce can_scroll method

This introduces a "can_scroll" method, removing a spot that explicitly
checks a window's type.

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

* tui/tui-data.h (struct tui_win_info) <can_scroll>: New method.
(struct tui_cmd_window) <can_scroll>: New method.
* tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll
method.

4 years agoRename field_int to field_signed
Tom Tromey [Wed, 17 Jul 2019 14:34:23 +0000 (08:34 -0600)] 
Rename field_int to field_signed

This renames ui_out::field_int to field_signed, and field_fmt_int to
field_fmt_signed; and changes the type of the "value" parameter from
int to LONGEST.

Tested by the buildbot.

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

* ui-out.h (class ui_out) <field_signed, field_fmt_signed,
do_field_signed>: Rename.  Change type of "value".
* ui-out.c (ui_out::field_signed): Rename from field_int.
Change type of "value".
(ui_out::field_fmt_signed): Rename from field_fmt_int.  Change
type of "value".
* tui/tui-out.h (class tui_ui_out) <do_field_signed>: Rename from
do_field_int.  Change type of "value".
* tui/tui-out.c (tui_ui_out::do_field_signed): Rename from
do_field_int.  Change type of "value".
* tracepoint.c (trace_status_mi, tfind_1)
(print_one_static_tracepoint_marker): Update.
* thread.c (print_thread_info_1, print_selected_thread_frame):
Update.
* stack.c (print_frame, print_frame_info): Update.
* spu-tdep.c (info_spu_signal_command, info_spu_dma_cmdlist):
Update.
* source.c (print_source_lines_base): Update.
* skip.c (info_skip_command): Update.
* record-btrace.c (btrace_ui_out_decode_error)
(btrace_call_history_src_line): Update.
* python/py-framefilter.c (py_print_single_arg, py_print_frame):
Update.
* progspace.c (print_program_space): Update.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Update.
* mi/mi-out.h (class mi_ui_out) <do_field_signed>: Rename from
do_field_int.  Change type of "value".
* mi/mi-out.c (mi_ui_out::do_table_begin)
(mi_ui_out::do_table_header): Update.
(mi_ui_out::do_field_signed): Rename from do_field_int.  Change
type of "value".
* mi/mi-main.c (mi_cmd_thread_list_ids, print_one_inferior)
(mi_cmd_data_list_changed_registers, output_register)
(mi_cmd_data_read_memory, mi_load_progress)
(mi_cmd_trace_frame_collected): Update.
* mi/mi-interp.c (mi_on_normal_stop_1, mi_output_solib_attribs):
Update.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
(mi_cmd_var_delete, mi_cmd_var_info_num_children)
(mi_cmd_var_list_children, varobj_update_one): Update.
* mi/mi-cmd-stack.c (mi_cmd_stack_info_depth)
(mi_cmd_stack_list_args, list_arg_or_local): Update.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Update.
* inferior.c (print_inferior): Update.
* gdb_bfd.c (print_one_bfd): Update.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Update.
* darwin-nat-info.c (darwin_debug_regions_recurse): Update.
* cli-out.h (class cli_ui_out) <do_field_signed>: Rename from
do_field_int.  Change type of "value".
* cli-out.c (cli_ui_out::do_field_signed): Rename from
do_field_int.  Change type of "value".
* breakpoint.c (watchpoint_check, print_breakpoint_location)
(print_one_breakpoint_location, print_it_catch_fork)
(print_one_catch_fork, print_it_catch_vfork)
(print_one_catch_vfork, print_it_catch_solib)
(print_it_catch_exec, print_it_ranged_breakpoint)
(print_mention_watchpoint, print_mention_masked_watchpoint)
(bkpt_print_it, update_static_tracepoint): Update.
* break-catch-throw.c (print_it_exception_catchpoint): Update.
* break-catch-syscall.c (print_it_catch_syscall): Update.
* ada-tasks.c (print_ada_task_info): Update.
* ada-lang.c (print_it_exception, print_mention_exception):
Update.

4 years agogdb: Remove a non-const reference parameter
Andrew Burgess [Tue, 2 Jul 2019 11:06:06 +0000 (12:06 +0100)] 
gdb: Remove a non-const reference parameter

Non-const reference parameter should be avoided according to the GDB
coding standard:

  https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead

This commit updates the gdbarch method gdbarch_stap_adjust_register,
and the one implementation i386_stap_adjust_register to avoid using a
non-const reference parameter.

I've also removed the kfail from the testsuite for bug 24541, as this
issue is now resolved.

gdb/ChangeLog:

PR breakpoints/24541
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh: Adjust return type and parameter types for
'stap_adjust_register'.
(i386_stap_adjust_register): Adjust signature and return new
register name.
* stap-probe.c (stap_parse_register_operand): Adjust use of
'gdbarch_stap_adjust_register'.

gdb/testsuite/ChangeLog:

PR breakpoints/24541
* gdb.mi/mi-catch-cpp-exceptions.exp: Remove kfail due to 24541.

4 years agoRemove a VEC from s390-linux-nat.c
Tom Tromey [Mon, 15 Jul 2019 17:52:02 +0000 (11:52 -0600)] 
Remove a VEC from s390-linux-nat.c

This removes a use of VEC fro s390-linux-nat.c, replacing it with
std::vector.

Tested using the Fedora-s390x-m64 buildbot builder.

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

* s390-linux-nat.c (s390_watch_area): Remove typedef.  Don't
declare VEC.
(struct s390_debug_reg_state) <watch_areas, break_areas>: Now
std::vector.
(struct s390_process_info): Add initializers.
(s390_add_process): Use new.
(s390_linux_nat_target::low_forget_process): Use delete.
(s390_linux_nat_target::low_new_fork)
(s390_linux_nat_target::stopped_by_watchpoint)
(s390_linux_nat_target::low_prepare_to_resume)
(s390_linux_nat_target::insert_watchpoint)
(s390_linux_nat_target::insert_hw_breakpoint)
(s390_linux_nat_target::remove_watchpoint)
(s390_linux_nat_target::remove_hw_breakpoint): Update.

4 years agox86: replace "anymem" checks where possible
Jan Beulich [Wed, 17 Jul 2019 07:16:31 +0000 (09:16 +0200)] 
x86: replace "anymem" checks where possible

Once operand parsing has completed, the simpler check of Operand_Mem can
be used in places where i.types[] got passed to operand_type_check().
Note that this has shown a couple of omissions of adjusting i.flags[]
when playing with i.op[] / i.types[] / i.tm.operand_types[].  Not all of
them get added here, just all of the ones needed in process_operands().

4 years agox86: drop stale Mem enumerator
Jan Beulich [Wed, 17 Jul 2019 07:15:49 +0000 (09:15 +0200)] 
x86: drop stale Mem enumerator

This was supposed to also be removed by c48dadc9a8 ('x86: drop "mem"
operand type attribute').  It's odd enough that this hasn't caused
build issues, considering the careful use of OTunused (apparently to
avoid "missing initializer" warnings).

To avoid such happening again introduce compile time consistency
checks.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Jul 2019 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agox86: make RegMem an opcode modifier
Jan Beulich [Tue, 16 Jul 2019 07:31:36 +0000 (09:31 +0200)] 
x86: make RegMem an opcode modifier

... instead of an operand type bit: It's an insn property, not an
operand one.  There's just one actual change to be made to the
templates: Most are now required to have the (unswapped) destination go
into ModR/M.rm, so VMOVD template needs its opcode adjusted accordingly
and its operands swapped.  {,V}MOVS{S,D}, otoh, are left alone in this
regard, as otherwise generated code would differ from what we've been
producing so far (which I don't think is wanted).

Take the opportunity and add a missing IgnoreSize to pextrb (leading to
an error in 16-bit mode), and take the liberty to once again drop stray
IgnoreSize attributes from lines changed and neighboring related ones.

4 years agox86: fold SReg{2,3}
Jan Beulich [Tue, 16 Jul 2019 07:30:29 +0000 (09:30 +0200)] 
x86: fold SReg{2,3}

They're the only exception to there generally being no mix of register
kinds possible in an insn operand template, and there being two bits per
operand for their representation is also quite wasteful, considering the
low number of uses.  Fold both bits and deal with the little bit of
fallout.

Also take the liberty and drop dead code trying to set REX_B: No segment
register has RegRex set on it.

Additionally I was quite surprised that PUSH/POP with the permitted
segment registers is not covered by the test cases.  Add the missing
pieces.

4 years agoFix build for aarch64, arm, and riscv FreeBSD native targets.
John Baldwin [Tue, 16 Jul 2019 00:21:36 +0000 (17:21 -0700)] 
Fix build for aarch64, arm, and riscv FreeBSD native targets.

Remove unused gdbarch argument to helper functions originally
copied from mips-fbsd-nat.c.  Include regcache.h previously
included from defs.h via gdbarch.h.

gdb/ChangeLog:

* aarch64-fbsd-nat.c: Include regcache.h.
(getregs_supplies, getfpregs_supplies): Remove unused gdbarch
argument.
(aarch64_fbsd_nat_target::fetch_registers)
(aarch64_fbsd_nat_target::store_registers): Remove gdbarch
variable.
* arm-fbsd-nat.c, riscv-fbsd-nat.c: Likewise.

4 years agoAdd include of gdbarch.h.
John Baldwin [Tue, 16 Jul 2019 00:21:36 +0000 (17:21 -0700)] 
Add include of gdbarch.h.

gdb/ChangeLog:

* fbsd-nat.c: Include gdbarch.h.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Jul 2019 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix a FIXME in mi-out.c
Tom Tromey [Tue, 2 Jul 2019 15:13:53 +0000 (09:13 -0600)] 
Fix a FIXME in mi-out.c

This removes a FIXME comment from mi_ui_out::do_field_int, by
replacing a printf with a use of plongest.

2019-07-15  Tom Tromey  <tromey@adacore.com>

* mi/mi-out.c (mi_ui_out::do_field_int): Use plongest.

4 years agoIntroduce field_unsigned
Tom Tromey [Mon, 1 Jul 2019 18:14:48 +0000 (12:14 -0600)] 
Introduce field_unsigned

This adds field_unsigned and changes various places using field_fmt
with "%u" to use this instead.  This also replaces an existing
equivalent helper function in record-btrace.c.

2019-07-15  Tom Tromey  <tromey@adacore.com>

* mi/mi-out.h (class mi_ui_out) <do_field_unsigned>: Declare.
* mi/mi-out.c (mi_ui_out::do_field_unsigned): New method.
* cli-out.h (class cli_ui_out) <do_field_unsigned>: Declare.
* cli-out.c (cli_ui_out::do_field_int): New method.
* ui-out.c (ui_out::field_unsigned): New method.
* symfile.c (generic_load): Use field_unsigned.
(print_transfer_performance): Likewise.
* record-btrace.c (ui_out_field_uint): Remove.
(btrace_call_history_insn_range, btrace_call_history): Use
field_unsigned.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use
field_unsigned.
* ui-out.h (class ui_out) <field_unsigned>: New method.
<do_field_unsigned>: Likewise.

4 years agoUse field_string in more places
Tom Tromey [Mon, 1 Jul 2019 18:08:15 +0000 (12:08 -0600)] 
Use field_string in more places

This replaces uses of field_fmt with a "%s" format string to use
field_string instead.  Also, one use of "%9lx" is replaced with a call
to phex_nz; the '9' is dropped as it is implicit in the field width.

2019-07-15  Tom Tromey  <tromey@adacore.com>

* mi/mi-main.c (list_available_thread_groups): Use field_string.
* mi/mi-interp.c (mi_memory_changed): Use field_string.
* target.c (flash_erase_command): Use field_string.
* infrun.c (print_signal_received_reason): Use field_string.
* i386-tdep.c (i386_mpx_print_bounds): Use field_string.
* breakpoint.c (maybe_print_thread_hit_breakpoint): Use
field_string.
* ada-tasks.c (print_ada_task_info): Use field_string.

4 years agoUse field_core_addr in more places
Tom Tromey [Mon, 1 Jul 2019 18:02:37 +0000 (12:02 -0600)] 
Use field_core_addr in more places

This changes a few spots that use field_fmt to use field_core_addr
instead.

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

* target.c (flash_erase_command): Use field_core_addr.
* symfile.c (generic_load): Use field_core_addr.
* sparc64-linux-tdep.c (sparc64_linux_handle_segmentation_fault):
Use field_core_addr.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Use
field_core_addr.

4 years agocpu,opcodes,gas: fix explicit arguments to eBPF ldabs instructions
Jose E. Marchesi [Mon, 15 Jul 2019 14:00:28 +0000 (16:00 +0200)] 
cpu,opcodes,gas: fix explicit arguments to eBPF ldabs instructions

This patch fixes the eBPF CPU description in order to reflect the
right explicit arguments passed to the ldabs{b,h,w,dw} instructions,
updates the corresponding GAS tests, and updates the BPF section of
the GAS manual.

cpu/ChangeLog:

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

* bpf.cpu (dlabs): New pmacro.
(dlind): Likewise.

opcodes/ChangeLog:

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

* bpf-desc.c: Regenerate.
* bpf-opc.c: Likewise.
* bpf-opc.h: Likewise.

gas/ChangeLog:

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

* testsuite/gas/bpf/mem.s: ldabs instructions do not take a `src'
register as an argument.
* testsuite/gas/bpf/mem.d: Updated accordingly.
* testsuite/gas/bpf/mem-be.d: Likewise.
* doc/c-bpf.texi (BPF Opcodes): Update to reflect the correct
explicit arguments to ldabs and ldind instructions.

4 years agoFix __bss_start assertion failure in _bfd_elf_fix_symbol_flags
Alan Modra [Fri, 12 Jul 2019 05:58:19 +0000 (15:28 +0930)] 
Fix __bss_start assertion failure in _bfd_elf_fix_symbol_flags

> Building LLVM 6.0 on FreeBSD/powerpc (devel/llvm60 port) the assertion
> in the subject trips (displays twice) when linking libLTO.so.1.  The
> issue has been filed in FreeBSD's bugzilla, at
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237068 .  It appears
> the 'llvm::hashing::detail::get_execution_seed()::seed@@JL_LLVM_6.0'
> symbol is being weakly aliased to an indirect symbol
> __bss_start@@JL_LLVM_6.0.  Since __bss_start@@JL_LLVM_6.0 is an
> indirect symbol, it fails the assertion.

I haven't looked under a debugger at your testcase but I think I know
what is going on here.  You have a shared library with a weakly
defined llvm::hashing::detail::get_execution_seed()::seed which
happens to be at the same location as __bss_start in that library.  At
the time the linker loads symbols for that library, it sees they are
both versioned and thus introduces non-versioned indirect symbols for
them.  The linker considers the symbols as possibly being aliases,
setting up h->u.alias and h->is_weakalias such that
__bss_start@@JL_LLVM_6.0 is the definition.  No real problem so far,
the definition is bfd_link_hash_defined, except that the zero size, no
type __bss_start symbol possibly should not be considered an alias in
the first place.

Later, __bss_start as defined by the linker script is entered into the
linker symbol table.  This is similar to __bss_start being defined by
a regular object file in that ELF symbol resolution rules say that the
value of __bss_start in the library is overridden by __bss_start in
the executable/library being produced.  So to accomplish the override,
ld flips __bss_start from being an indirect symbol pointing at
__bss_start@@JL_LLVM_6.0 to __bss_start@@JL_LLVM_6.0 being an indirect
symbol pointing at __bss_start.  That's how we get an unexpected
indirect symbol and hit the assert.

What should happen I think, is for the def->def_regular code above the
assert to run in this case.  The symbols are no longer aliases.

* elflink.c (_bfd_elf_fix_symbol_flags): If the def for an
alias is no longer bfd_link_hash_defined, clear the alias.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Jul 2019 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agocpu,opcodes,gas: fix arguments to ldabs and ldind eBPF instructions
Jose E. Marchesi [Sun, 14 Jul 2019 12:45:31 +0000 (14:45 +0200)] 
cpu,opcodes,gas: fix arguments to ldabs and ldind eBPF instructions

The eBPF non-generic load instructions ldind{b,h,w,dw} and
ldabs{b,h,w,dw} do not take an explicit destination register as an
argument.  Instead, they put the loaded value in %r0, implicitly.

This patch fixes the CPU BPF description to not expect a 'dst'
argument in these arguments, regenerates the corresponding files in
opcodes, and updates the impacted GAS tests.

Tested in a x86-64 host.

cpu/ChangeLog:

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

* bpf.cpu (dlsi): ldabs and ldind instructions do not take an
explicit 'dst' argument.

opcodes/ChangeLog:

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

* bpf-desc.c: Regenerate.
* bpf-opc.c: Likewise.

gas/ChangeLog:

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

* testsuite/gas/bpf/mem.s: Do not use explicit arguments for
ldabs and ldind instructions.
* testsuite/gas/bpf/mem.d: Updated accordingly.
* testsuite/gas/bpf/mem-be.d: Likewise.

4 years ago[gdb/testsuite] Fix unterminated string in gdb.objc/basicclass.exp
Tom de Vries [Sun, 14 Jul 2019 11:23:04 +0000 (13:23 +0200)] 
[gdb/testsuite] Fix unterminated string in gdb.objc/basicclass.exp

The test-case gdb.objc/basicclass.exp contains an unterminated string,
introduced in refactoring commit fa43b1d7ca "after gdb_run_cmd, gdb_expect ->
gdb_test_multiple/gdb_test".

Fix the unterminated string.

gdb/testsuite/ChangeLog:

2019-07-14  Tom de Vries  <tdevries@suse.de>

PR testsuite/24760
* gdb.objc/basicclass.exp: Fix unterminated string.

4 years agoadjust src-release following the renaming of gdb/common/ to gdb/gdbsupport/
Joel Brobecker [Sun, 14 Jul 2019 01:00:32 +0000 (18:00 -0700)] 
adjust src-release following the renaming of gdb/common/ to gdb/gdbsupport/

A recent change renamed the common/ directory into gdbsupport/ in gdb.
This causes problems in the getver function in the src-release script
which doesn't find the create-version.sh script anymore. As a result,
it falls back on using the version.in file verbatim, meaning that
the "DATE" placeholder doesn't get replaced with the snapshot date,
and the "-git" suffix doesn't get stripped. More precisely, we get
snapshots called "gdb-8.3.50-DATE-git.tar" instead of (e.g.)
"gdb-8.3-20190712.tar".

This commit fixes the issue by adding support for this situation.
I left the support for $tool/common/create-version.sh, because
the sim still uses that directory structure.

ChangeLog:

        * src-release (getver): If $tool/gdbsupport/create-version.sh
        exists, use that to determine the version number.