binutils-gdb.git
5 years ago[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if true
Tom de Vries [Mon, 26 Aug 2019 16:48:02 +0000 (18:48 +0200)]
[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if true

The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests
need to be skipped, while tcl interprets 0 as false rather than true, which is
confusing.

Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need
to be skipped.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe
* tests need to be skipped.
* gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests.
* gdb.mi/mi-catch-cpp-exceptions.exp: Update call to
mi_skip_libstdcxx_probe_tests.

5 years agoUse raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning...
Sergio Durigan Junior [Sun, 25 Aug 2019 16:10:35 +0000 (12:10 -0400)]
Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning: invalid escape sequence")

The way unrecognized escape sequences are handled has changed in
Python 3.8: users now see a SyntaxWarning message, which will
eventually become a SyntaxError in future versions of Python:

  (gdb) source /blabla/gdb.python/py-xmethods/py-xmethods.py
  /blabla/gdb.python/py-xmethods/py-xmethods.py:204: SyntaxWarning: invalid escape seque
  nce \+
    'operator\+',
  /blabla/gdb.python/py-xmethods/py-xmethods.py:211: SyntaxWarning: invalid escape seque
  nce \+
    'operator\+\+',

One of our testcases, gdb.python/py-xmethods.exp, contains strings in
the form of "operator\+".  This is not recognized by Python, but is
still needed by the testsuite to work properly.  The solution is
simple: we just have to make sure these strings are marked as
raw (i.e, r"").  This is what this patch does.  I took the opportunity
to also convert other strings to raw, which, in two cases, allowed the
removal of an extra backslash.

I tested this using Python 3.7 and Python 3.8, and everything works
fine.

I think I could push this as obvious, but decided to send it to
gdb-patches just in case.

gdb/testsuite/ChangeLog:
2019-08-26  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.python/py-xmethods.exp: Use raw strings when passing
arguments to SimpleXMethodMatcher.

5 years agoPR24938, Null Pointer Dereference in debug.c:debug_write_type
Alan Modra [Mon, 26 Aug 2019 09:36:28 +0000 (19:06 +0930)]
PR24938, Null Pointer Dereference in debug.c:debug_write_type

PR 24938
* debug.c (debug_write_type): Call empty_type for NULL type here..
(debug_write_type): ..rather than in just one case here.

5 years agoRISC-V: Improve li expansion for better code density.
Kito Cheng [Tue, 20 Aug 2019 09:47:58 +0000 (17:47 +0800)]
RISC-V: Improve li expansion for better code density.

li is a pseudo instruction in RISC-V, it might expand to more than one
instructions if the immediate value can't fit addi or lui, but the
assembler will always using 4-byte instructions during expansion.

For example:

 li a0, 0x12345001

will expand into

 12345537 lui a0,0x12345
 00150513 addi a0,a0,1

but addi could be compress into

 0505 addi a0,a0,1

It because load_const use macro_build to emit instructions,
and macro_build call append_insn, and expect it will compress
it if possible, but the fact is append_insn never compress anything,

So this patch redirect the li expansion flow to normal instruction
emission flow via md_assemble, added md_assemblef as an wrapper for
that for easier emit instruction with printf-style argument to build
instruction.

gas/ChangeLog:

* tc-riscv.c (md_assemblef): New.
(load_const) Use md_assemblef instead of macro_build to emit
instructions.
* testsuite/gas/riscv/li32.d: New.
* testsuite/gas/riscv/li32.s: Ditto.
* testsuite/gas/riscv/li64.d: Ditto.
* testsuite/gas/riscv/li64.s: Ditto.

5 years agodwarf2read: fix compilation issue with gcc 4.8
Simon Marchi [Mon, 26 Aug 2019 01:30:02 +0000 (21:30 -0400)]
dwarf2read: fix compilation issue with gcc 4.8

gcc 4.8 (and probably other versions too) doesn't like that the local
variable symbol_linkage has the same name as the enum class defined in
the same context:

      CXX    dwarf2read.o
    /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c: In member function ‘dwarf2_per_cu_data* dw2_debug_names_iterator::next()’:
    /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c:5850:22: error: ‘symbol_linkage’ is not a class, namespace, or enumeration
       } symbol_linkage = symbol_linkage::unknown;
                      ^

Rename the local variable to avoid this.

This problem was originally reported with the Netbsd builder on the
buildbot, which uses gcc 5.5, I believe.  I am not able to test it on
that builder right now, but chances are that the fix will work there
too.

gdb/ChangeLog:

* dwarf2read.c (dw2_debug_names_iterator::next): Rename local
variable symbol_linkage to symbol_linkage_.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Aug 2019 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agodwarf2read: replace gdb::optional<bool> with enum
Simon Marchi [Sun, 25 Aug 2019 22:09:47 +0000 (18:09 -0400)]
dwarf2read: replace gdb::optional<bool> with enum

gdb::optional<bool> is dangerous, because it's easy to do:

  if (opt_bool)

when you actually meant

  if (*opt_bool)

or vice-versa.  The first checks if the optional is set, the second
checks if the wrapped bool is true.

Replace it with an enum that explicitly defines the three possible
states.

gdb/ChangeLog:

* dwarf2read.c (dw2_debug_names_iterator::next): Use enum to
represent whether the symbol is static, dynamic, or we don't
know.

5 years agoConvert the RX target to make use of target descriptions.
Yoshinori Sato [Tue, 20 Aug 2019 15:24:37 +0000 (00:24 +0900)]
Convert the RX target to make use of target descriptions.

gdb/ChangeLog

2019-08-25  Yoshinori Sato <ysato@users.sourceforge.jp>

* gdb/rx-tdep.c (rx_register_names): New.
(rx_register_name): Delete.
(rx_psw_type): Delete.
(rx_fpsw_type): Delete.
(rx_register_type): Delete.
(rx_gdbarch_init): Convert target-descriptions.
(_initialize_rx_tdep): Add initialize_tdesc_rx.
* gdb/features/Makefile: Add rx.xml.
* gdb/features/rx.xml: New.
* gdb/features/rx.c: Generated.
* gdb/NEWS: Mention target description support.

gdb/doc/ChangeLog:

2019-08-25  Yoshinori Sato <ysato@users.sourceforge.jp>

* gdb.texinfo (Standard Target Features): Add RX Features sub-section.

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Aug 2019 00:01:30 +0000 (00:01 +0000)]
Automatic date update in version.in

5 years agoFix compile warning in symtab.c
Christian Biesinger [Fri, 9 Aug 2019 19:25:15 +0000 (14:25 -0500)]
Fix compile warning in symtab.c

My compiler (g++ 8.2) can't tell that *bsc_ptr and *slot_ptr are
only used in the cases when it does get initialized. Just initialize
the vars earlier to avoid the warning, there does not seem to be a
downside to it.

../../gdb/symtab.c: In function ‘block_symbol lookup_static_symbol(const char*, domain_enum)’:
../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     xfree (slot->value.not_found.name);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/symtab.c:2578:29: note: ‘slot’ was declared here
   struct symbol_cache_slot *slot;
                             ^~~~
../../gdb/symtab.c:1405:3: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (bsc == NULL)
   ^~
../../gdb/symtab.c:2577:30: note: ‘bsc’ was declared here
   struct block_symbol_cache *bsc;
                              ^~~
../../gdb/symtab.c: In function ‘block_symbol lookup_global_symbol(const char*, const block*, domain_enum)’:
../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     xfree (slot->value.not_found.name);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/symtab.c:2658:29: note: ‘slot’ was declared here
   struct symbol_cache_slot *slot;
                             ^~~~
../../gdb/symtab.c:1409:14: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       ++bsc->collisions;
         ~~~~~^~~~~~~~~~
../../gdb/symtab.c:2657:30: note: ‘bsc’ was declared here
   struct block_symbol_cache *bsc;
                              ^~~

gdb/ChangeLog:

2019-08-22  Christian Biesinger  <cbiesinger@google.com>

* symtab.c (symbol_cache_lookup): Always initialize *bsc_ptr and *slot_ptr.

5 years agoPowerPC64 segfault in ppc64_elf_edit_toc
Alan Modra [Sat, 24 Aug 2019 00:29:03 +0000 (09:59 +0930)]
PowerPC64 segfault in ppc64_elf_edit_toc

Found on a GOT reference to __ehdr_start, which is tweaked to be
undefined weak at some stages of linking.  SYMBOL_REFERENCES_LOCAL
isn't a sufficient test.

* elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak
symbols from GOT optimisation.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Aug 2019 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMove gdb-dlfcn.[ch] to gdbsupport/
Sergio Durigan Junior [Wed, 21 Aug 2019 20:22:45 +0000 (16:22 -0400)]
Move gdb-dlfcn.[ch] to gdbsupport/

I need to use 'gdb_dlopen' inside 'gdbsupport/', but it's not yet
supported there.  This commit moves 'gdb-dlfcn.[ch]' to 'gdbsupport/',
which makes it available also on gdbserver.

gdb/ChangeLog:
2019-08-23  Sergio Durigan Junior  <sergiodj@redhat.com>

* configure.ac: Don't check for 'dlfcn.h' (moved to
gdbsupport/common.m4).
* Makefile.in (COMMON_SFILES): Move 'gdb-dlfcn.c' to
'gdbsupport/'.
(HFILES_NO_SRCDIR): Likewise, for 'gdb-dlfcn.h'.
* compile/compile-c-support.c: Include
'gdbsupport/gdb-dlfcn.h'.
* gdbsupport/common.m4: Check for 'dlfcn.h'.
* gdb-dlfcn.c: Move to...
* gdbsupport/gdb-dlfcn.c: ... here.
* gdb-dlfcn.h: Move to...
* gdbsupport/gdb-dlfcn.h: ... here.

gdb/gdbserver/ChangeLog:
2019-08-23  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (SFILES): Add 'gdbsupport/gdb-dlfcn.c'.
(OBS): Add 'gdbsupport/gdb-dlfcn.o'.
* config.in: Regenerate.
* configure: Regenerate.

5 years agoFix bug in nios2 prologue analysis.
Sandra Loosemore [Fri, 23 Aug 2019 15:18:54 +0000 (08:18 -0700)]
Fix bug in nios2 prologue analysis.

The nios2 prologue analyzer was mistakenly using an unsigned int field
to represent a 32-bit signed value.  This caused problems with an
incorrect conversion being applied to negative values when they were
automatically promoted for addition to a 64-bit CORE_ADDR value.

This patch fixes test failures in gdb.base/large-frame.exp and
gdb.dwarf2/dw2-ref-missing-frame.exp.  Normally the nios2 backend
prefers to use the dwarf2 unwinder so the prologue analyzer is only
invoked if there is no dwarf2 information.

2019-08-23  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* nios2-tdep.c (struct reg_value): Improve comments.  Make
the offset field signed.

5 years agoor1k: Fix incorrect value in PLT GOT entries, causing infinite loop
Stafford Horne [Fri, 23 Aug 2019 13:25:55 +0000 (22:25 +0900)]
or1k: Fix incorrect value in PLT GOT entries, causing infinite loop

The PLT GOT entry should point to the first PLT entry which contains the
runtime linker function.  It was pointing back to the symbol PLT entry
causing an infinite loop.

I found this when testing the OpenRISC glibc port which uses the runtime
dynamic linker.  It seems other libc's we use so far have not been
making use of the initial PLT GOT entries.

bfd/ChangeLog:

* elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for
PLT GOT entries.

5 years agoStop the BFD library from failing when encountering a second set of relocs for the...
Nick Clifton [Fri, 23 Aug 2019 12:22:02 +0000 (13:22 +0100)]
Stop the BFD library from failing when encountering a second set of relocs for the same section.

PR 24456
* elf.c (bfd_section_from_shdr): Issue an informative warning
message and continue processing other sections after encountering
a reloc section for a section which already has other relocs
associated with it.

5 years agoPR24933, Memory leak in elf_x86_64_get_synthetic_symtab
Alan Modra [Fri, 23 Aug 2019 09:46:25 +0000 (19:16 +0930)]
PR24933, Memory leak in elf_x86_64_get_synthetic_symtab

PR 24933
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
on error without freeing plts[] contents.

5 years agoUpdated Swedish translation for the gas sub-directory.
Nick Clifton [Fri, 23 Aug 2019 09:46:46 +0000 (10:46 +0100)]
Updated Swedish translation for the gas sub-directory.

2019-08-23  Nick Clifton  <nickc@redhat.com>

* po/sv.po: Updated Swedish translation.

5 years agoPrevent a potential illegal memory access in the DWARF parser when processing a corru...
Nick Clifton [Fri, 23 Aug 2019 09:37:51 +0000 (10:37 +0100)]
Prevent a potential illegal memory access in the DWARF parser when processing a corrupt file.

PR 24829
* dwarf.c (check_uvalue): New function.  Ensures that a block's
size is valid.
(read_and_display_attr_value): Use check_value when processsing
DW_FORM_block<n> attributes.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Aug 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMake GDB compile with Python 3 on MinGW
Christian Biesinger [Tue, 13 Aug 2019 19:48:05 +0000 (14:48 -0500)]
Make GDB compile with Python 3 on MinGW

PyFile_FromString and PyFile_AsFile have been removed in Python 3.
There is no obvious replacement that works here, and we can't just
pass our FILE* to a DLL in Windows because it may use a different
C runtime.

So we just call a Python function which reads and executes file
contents. Care must be taken to execute it in the context of
__main__.

Tested by inverting the ifdef and running the testsuite on Debian
Linux (even without the patch, I failed at running the testsuite
on Windows). I did test with both Python 2 and 3.

gdb/ChangeLog:

2019-08-22  Christian Biesinger  <cbiesinger@google.com>

* python/lib/gdb/__init__.py (_execute_file): New function.
* python/python.c (python_run_simple_file): Call gdb._execute_file
on Windows.

5 years ago[gdb/testsuite] Make gdb_test message more informative in multi-term-settings.exp
Tom de Vries [Thu, 22 Aug 2019 14:54:59 +0000 (16:54 +0200)]
[gdb/testsuite] Make gdb_test message more informative in multi-term-settings.exp

This racy fail message, reported in PR24929:
...
FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: \
  stop with control-c
...
does not make clear which gdb_test fails here:
...
    if {$expect_ttou} {
       gdb_test "" "Quit" "stop with control-c"
    } else {
       gdb_test "" "received signal SIGINT.*" "stop with control-c"
    }
...

Fix this by making the gdb_test message argument more informative.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-22  Tom de Vries  <tdevries@suse.de>

* gdb.multi/multi-term-settings.exp (coretest): Make gdb_test messages
more informative.

5 years agoArm: Add support for missing CPUs
Dennis Zhang [Thu, 22 Aug 2019 14:21:32 +0000 (15:21 +0100)]
Arm: Add support for missing CPUs

This patch adds support for following CPUs:
Cortex-M35P, Cortex-A77, Cortex-A76AE.

Related specifications can be found at https://developer.arm.com/ip-products/processors.

gas/ChangeLog:

* config/tc-arm.c: New entries for Cortex-M35P, Cortex-A77,
and Cortex-A76AE.
* doc/c-arm.texi: Document new processors.
* testsuite/gas/arm/cpu-cortex-a76ae.d: New test.
* testsuite/gas/arm/cpu-cortex-a77.d: New test.
* testsuite/gas/arm/cpu-cortex-m35p.d: New test.

bfd/ChangeLog:

* cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.

5 years agoFix an illegal memory access when dumping corrupt x86_64 PE unwind data.
Nick Clifton [Thu, 22 Aug 2019 13:37:03 +0000 (14:37 +0100)]
Fix an illegal memory access when dumping corrupt x86_64 PE unwind data.

PR 24922
* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add checks before
reading data from extra records.

5 years agooops - omitted changelog entry from previous delta.
Nick Clifton [Thu, 22 Aug 2019 12:16:28 +0000 (13:16 +0100)]
oops - omitted changelog entry from previous delta.

5 years agoPrevent a floating point exception in the dwarf parser when a CU or TU table does...
Nick Clifton [Thu, 22 Aug 2019 12:11:18 +0000 (13:11 +0100)]
Prevent a floating point exception in the dwarf parser when a CU or TU table does not have any columns.

PR 24921
* dwarf.c (process_cu_tu_index): Handle the case where a table
does not have any columns.

5 years agoFix the assembler's floating point number parser so that it can correctly handle...
Bosco Garc?a [Thu, 22 Aug 2019 11:54:06 +0000 (12:54 +0100)]
Fix the assembler's floating point number parser so that it can correctly handle numbers encoded as a leading decimal point, followed by zeroes, followed by a non-zero sequence.

* atof-generic.c (atof_generic): Do not ignore leading zeros if
they appear after a decimal point.
* testsuite/gas/all/float.s: Extend test to include a number with
a leading decimal point followed by several zeroes.
* testsuite/gas/i386/fp.s: Likewise.
* testsuite/gas/i386/fp.d: Update expected output.

5 years agogdb/fortran: Remove some dead code from the parser
Andrew Burgess [Thu, 22 Aug 2019 09:07:00 +0000 (10:07 +0100)]
gdb/fortran: Remove some dead code from the parser

The Fortran parser contains some code that looks like it was probably
inherited from the C/C++ parser as it checks to see if the current
language is C++, which should never be true when we're in the Fortran
parser.

gdb/ChangeLog:

* f-exp.y (yylex): Remove is_a_field_of_this local variable, and
all uses as this was never set to anything but a zero value.

5 years agoAArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).
Tamar Christina [Thu, 22 Aug 2019 10:35:35 +0000 (11:35 +0100)]
AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).

This patch fixes a few linker crashes due to TLS code reaching an assert when it
shouldn't.

The first scenario is with weak TLS symbols that remain weak during linking.  In
this case the mid-end would not have seen a TLS symbol and so wouldn't have
allocated the TLS section.  We currently assert here and the linker crashes with
a not very useful message.

This patch changes this to return the value 0 for the TLS symbol in question
emulating what lld and gold and other BFD targets do.  However because weak TLS
is implementation defined and we don't define any behavior for it I also emit a
warning to the user to inform them of such.

Secondly when a strong TLS reference is undefined. The linker crashes even after
it correctly reported that there is an undefined reference.  This changes it so
that it gracefully exits and reports a useful error.

bfd/ChangeLog:

PR ld/24601
* elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS.
Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation.
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it.
* elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning
for weak TLS.

ld/ChangeLog:

PR ld/24601
* testsuite/ld-aarch64/aarch64-elf.exp (undef-tls, weak-tls): New.
* testsuite/ld-aarch64/undef-tls.d: New test.
* testsuite/ld-aarch64/undef-tls.s: New test.
* testsuite/ld-aarch64/weak-tls.d: New test.
* testsuite/ld-aarch64/weak-tls.s: New test.

5 years agoImplement a float16 directive for assembling 16 bit IEEE 754 floating point numbers...
Barnaby Wilks [Thu, 22 Aug 2019 10:13:23 +0000 (11:13 +0100)]
Implement a float16 directive for assembling 16 bit IEEE 754 floating point numbers for the AArch64 assembler.

The syntax of the directive is:

     .float16 <0-n decimal numbers>
e.g.
     .float16 0.5
     .float16 10.2, NaN, 452.09

The floats will always be encoded using the binary16 format as described in the
IEEE 754-2008 standard. There is no need to support Arm's alternative half-precision
format since AArch64 only supports the IEEE format.

gas * config/tc-aarch64.c: Add float16 directive and add "Hh" to
acceptable float characters.
* doc/c-aarch64.texi: Documentation for float16 directive.
* testsuite/gas/aarch64/float16-be.d: New test.
* testsuite/gas/aarch64/float16-le.d: New test.
* testsuite/gas/aarch64/float16.s: New test.
* NEWS: Add NEWS entry.

5 years ago[AArch64][gas] Update MTE system register encodings
Kyrylo Tkachov [Thu, 22 Aug 2019 09:20:01 +0000 (10:20 +0100)]
[AArch64][gas] Update MTE system register encodings

The MTE specification adjusted the encoding of the TFSRE0_EL1, TFSR_EL1, TFSR_EL2, TFSR_EL3, TFSR_EL12 system registers.
This patch brings binutils up to date.

The references for the encodings are at:
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsre0_el1 (also contains TFSR_EL12 description)
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el1
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el2
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el3

Tested check-gas for aarch64-none-elf.

opcodes/

* aarch64-opc.c (aarch64_sys_regs): Update encoding of tfsre0_el1,
tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12.
(aarch64_sys_reg_supported_p): Update checks for the above.

gas/

    * testsuite/gas/aarch64/sysreg-4.d: Update expected disassembly for
    tfsre0_el1, tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12 system registers.

5 years agoARM CMSE symbols
Alan Modra [Thu, 22 Aug 2019 01:51:48 +0000 (11:21 +0930)]
ARM CMSE symbols

This patch removes use of st_target_internal to cache the result of
comparing symbol names against CMSE_PREFIX.  The problem with setting
a bit in st_target_internal in swap_symbol_in is that calling
bfd_elf_sym_name from swap_symbol_in requires symtab_hdr, and you
don't know for sure whether swap_symbol_in is operating on dynsyms
(and thus elf_tdata (abfd)->dynsymtab_hdr should be used) or on the
normal symtab (thus elf_tdata (abfd)->symtab_hdr).  You can make an
educated guess based on abfd->flags & DYNAMIC but that relies on
knowing a lot about calls to bfd_elf_get_elf_syms, and is fragile in
the face of possible future changes.

include/
* elf/arm.h (ARM_GET_SYM_CMSE_SPCL, ARM_SET_SYM_CMSE_SPCL): Delete.
bfd/
* elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL,
instead recognize CMSE_PREFIX in symbol name.
(elf32_arm_gc_mark_extra_sections): Likewise.
(elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL.
(elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Aug 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoFix nullptr in with_command_1
Pedro Alves [Wed, 21 Aug 2019 20:11:33 +0000 (21:11 +0100)]
Fix nullptr in with_command_1

Running 'with' without arguments crashes GDB.  This fixes it.

gdb/ChangeLog:
2019-08-21  Bogdan Harjoc  <harjoc@gmail.com>

* cli/cli-cmds.c (with_command_1): Error out if no arguments.

gdb/testsuite/ChangeLog:
2019-08-21  Pedro Alves  <palves@redhat.com>

* gdb.base/with.exp: Test "with" with no arguments.

5 years agoFix g++ 9.1 build breakage
Christian Biesinger [Wed, 21 Aug 2019 20:03:53 +0000 (15:03 -0500)]
Fix g++ 9.1 build breakage

gdb/ChangeLog:

2019-08-21  Christian Biesinger  <cbiesinger@google.com>

* tui/tui-data.h (tui_gen_win_info): Add an =default
move constructor, required by some GCC versions.

5 years agogdb/djgpp: Add Hygon Dhyana processor support
Jinke Fan [Wed, 15 May 2019 09:34:57 +0000 (17:34 +0800)]
gdb/djgpp: Add Hygon Dhyana processor support

Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between
AMD and Haiguang Information Technology Co.,Ltd., which aims at
providing high performance x86 processors for the China server market.
Its first generation processor codename is Dhyana, which originates
from AMD technology and shares most of the architecture with AMD's
family 17h, but with different CPU Vendor ID("HygonGenuine")/Family
series number(Family 18h).

gdb/ChangeLog:
2019-08-21  Jinke Fan  <fanjinke51@yeah.net>

* go32-nat.c (go32_sysinfo): Add hygon_p.

5 years ago[gdb/testsuite] Stabilize gdb-caching-proc.exp test order
Tom de Vries [Wed, 21 Aug 2019 09:49:33 +0000 (11:49 +0200)]
[gdb/testsuite] Stabilize gdb-caching-proc.exp test order

The test-case gdb-caching-proc.exp tests each gdb_caching_proc in
gdb/testsuite/lib/*.exp.  However, the order of .exp file being tested can
change from run to run, because of using glob.

Fix this by sorting the glob result.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-21  Tom de Vries  <tdevries@suse.de>

* gdb.base/gdb-caching-proc.exp: Sort files.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Aug 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoChange some tui_data_window methods to be private
Tom Tromey [Sun, 14 Jul 2019 14:25:43 +0000 (08:25 -0600)]
Change some tui_data_window methods to be private

Turning various calls into methods has made it possible to now change
some tui_data_window methods to be private.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window) <last_regs_line_no,
line_from_reg_element_no, first_reg_element_no_inline,
display_all_data, delete_data_content_windows,
erase_data_content>: Now private.

5 years agoRemove some defines from tui-data.h
Tom Tromey [Sun, 14 Jul 2019 00:30:53 +0000 (18:30 -0600)]
Remove some defines from tui-data.h

This removes the HILITE and NO_HILITE defines from tui-data.h, in
favor of simply passing a bool to box_win.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (box_win): Change type of highlight_flag.
(tui_unhighlight_win, tui_highlight_win)
(tui_win_info::make_window): Update.
* tui/tui-data.h (HILITE, NO_HILITE): Remove.

5 years agoMove some defines to tui-stack.c
Tom Tromey [Sun, 14 Jul 2019 00:29:57 +0000 (18:29 -0600)]
Move some defines to tui-stack.c

Some #defines in tui-data.h are only used in tui-stack.c, so move them
there.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
(MAX_PID_WIDTH): Move to tui-stack.c.
* tui/tui-stack.c (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
(MAX_PID_WIDTH): Move from tui-data.h.

5 years agoChange tui_make_window to be a method
Tom Tromey [Sat, 13 Jul 2019 22:47:31 +0000 (16:47 -0600)]
Change tui_make_window to be a method

I combined several small changes into one patch here.  I believe I
started by noticing that the "title" is not needed by tui_gen_win_info
and could be self-managing (i.e. std::string).  Moving this revealed
that "can_box" is also a property of tui_win_info and not
tui_gen_win_info; and this in turn caused the changes to
tui_make_window and box_win.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.h (tui_make_window): Don't declare.
* tui/tui-wingeneral.c (box_win): Change type of win_info.
(box_win): Update.
(tui_gen_win_info::make_window): Rename from tui_make_window.
(tui_win_info::make_window): New method.
(tui_gen_win_info::make_visible): Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* tui/tui-regs.c (tui_data_window::show_register_group): Update.
(tui_data_window::display_registers_from): Update.
* tui/tui-layout.c (tui_gen_win_info::resize): Update.
* tui/tui-data.h (struct tui_gen_win_info) <make_window>:
Declare.
<can_box>: Remove.
<title>: Remove.
(struct tui_win_info) <make_window>: Declare.
<can_box>: Now virtual.
<title>: New member.
* tui/tui-data.c (~tui_gen_win_info): Don't free title.
* tui/tui-command.c (tui_cmd_window::resize): Update.

5 years agoRemove tui_data_window::display_regs
Tom Tromey [Sat, 13 Jul 2019 22:36:07 +0000 (16:36 -0600)]
Remove tui_data_window::display_regs

There's no need for tui_data_window::display_regs any more (if there
ever was).  All the paths through data window construction will end up
setting this to true.  This patch removes the member.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window) <display_regs>: Remove.
* tui/tui-regs.c (tui_data_window::show_registers): Update.
(tui_data_window::check_register_values): Update.

5 years agoRemove indirection from tui_data_window::regs_content
Tom Tromey [Sat, 13 Jul 2019 22:24:48 +0000 (16:24 -0600)]
Remove indirection from tui_data_window::regs_content

tui_data_window::regs_content is currently a vector of unique_ptr.
However, due to the way this is managed now, there is no need to keep
the pointers -- it can simply be a vector of the objects themselves.
This patch removes this extra layer of indirection.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window): Use
DISABLE_COPY_AND_ASSIGN.
<regs_content>: Change type, removing unique_ptr.
<tui_data_window>: Add move constructor.
* tui/tui-regs.c (tui_data_window::show_registers)
(tui_data_window::show_register_group)
(tui_data_window::display_registers_from)
(tui_data_window::display_registers_from)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_data_window::rerender, tui_data_window::refresh_window)
(tui_data_window::check_register_values): Update.

5 years agoAdd two methods to tui_data_window
Tom Tromey [Sat, 13 Jul 2019 22:19:11 +0000 (16:19 -0600)]
Add two methods to tui_data_window

This changes tui_show_registers and tui_show_register_group to be
methods on tui_data_window.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window) <show_registers,
show_register_group>: Declare.
(tui_show_register_group): Don't declare.
* tui/tui-regs.c (tui_data_window::show_registers): Rename from
tui_show_registers.
(tui_data_window::show_register_group): Rename from
tui_show_register_group.
(tui_data_window::check_register_values, tui_reg_command):
Update.
* tui/tui-layout.c (tui_set_layout): Update.

5 years agoChange tui_check_register_values to be a method
Tom Tromey [Sat, 13 Jul 2019 22:15:30 +0000 (16:15 -0600)]
Change tui_check_register_values to be a method

This changes tui_check_register_values to be a method on
tui_data_window.  An additional check in tui_register_changed is
needed, because TUI_DATA_WIN could be NULL at this point.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window) <check_register_values>:
Declare.
(tui_check_register_values): Don't declare.
* tui/tui-regs.c (tui_data_window::check_register_values): Rename
from tui_check_register_values.
* tui/tui-hooks.c (tui_register_changed): Update.

5 years agoRearrange tui-regs.c some more
Tom Tromey [Sat, 13 Jul 2019 22:08:33 +0000 (16:08 -0600)]
Rearrange tui-regs.c some more

This moves tui_reg_layout later in tui-regs.c, closer to where it is
used.

It also changes tui_show_registers not to enable the TUI or change the
layout -- this is already done by this point by all the callers.

2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_reg_layout): Move later.
(tui_show_registers): Don't enable TUI mode or change layout.

5 years agoChange tui_data_item_window::content to be a unique_xmalloc_ptr
Tom Tromey [Sat, 13 Jul 2019 22:01:34 +0000 (16:01 -0600)]
Change tui_data_item_window::content to be a unique_xmalloc_ptr

This changes tui_data_item_window::content to be a unique_xmalloc_ptr
and fixes up the fallout.  It also removes a parameter from
tui_expand_tabs, as it was only ever given one value.

This also removes some tab-handling code from
tui_data_window::display_registers_from.  Because the content can only
be set by tui_register_format, and because that calls tui_expand_tabs,
it's not possible to see a tab here.

gdb/ChangeLog
2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_item_window)
<~tui_data_item_window>: Remove.
<content>: Now a unique_xmalloc_ptr.
* tui/tui-regs.c (tui_register_format): Return a
unique_xmalloc_ptr.
(tui_get_register): Update.
(~tui_data_item_window): Remove.
(tui_data_window::display_registers_from, tui_display_register):
Update.
* tui/tui-io.h (tui_expand_tabs): Update.
* tui/tui-io.c (tui_expand_tabs): Return a unique_xmalloc_ptr.
Remove "col" parameter.

5 years agoRemove tui_data_item_window::value
Tom Tromey [Sat, 13 Jul 2019 21:55:48 +0000 (15:55 -0600)]
Remove tui_data_item_window::value

The field tui_data_item_window::value is not used, so remove it.

gdb/ChangeLog
2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_item_window) <value>: Remove
field.
* tui/tui-regs.c (~tui_data_item_window): Update.

5 years agoMinor rearrangement in tui-regs.c
Tom Tromey [Sat, 13 Jul 2019 21:55:02 +0000 (15:55 -0600)]
Minor rearrangement in tui-regs.c

This moves a couple of functions earlier in tui-regs.c.  Previously
they were in the "command" section of the file, but really they belong
in the "window implementation" section.

gdb/ChangeLog
2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_register_format, tui_get_register): Move
earlier.

5 years agoRemove NULL check from tui_reg_command
Tom Tromey [Sat, 13 Jul 2019 21:53:44 +0000 (15:53 -0600)]
Remove NULL check from tui_reg_command

tui_reg_command has an unnecessary NULL check.  The preceding call to
tui_reg_layout will ensure the window exists.  This patch removes the
check.

gdb/ChangeLog
2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_reg_command): Remove NULL check.

5 years agoSome i18n fixes for the TUI
Tom Tromey [Sat, 13 Jul 2019 21:45:14 +0000 (15:45 -0600)]
Some i18n fixes for the TUI

The TUI has a few #defines that hold user-visible strings.  As these
are only used in a single spot, this patch removes the defines,
preferring direct use of the string where needed.  Furthermore, now
the strings are wrapped in _(), which is friendlier for i18n purposes.

gdb/ChangeLog
2019-08-20  Tom Tromey  <tom@tromey.com>

* tui/tui-source.h (struct tui_source_window): Update.
* tui/tui-regs.c (tui_show_registers): Update.
* tui/tui-disasm.h (struct tui_disasm_window): Update.
* tui/tui-data.h (NO_SRC_STRING, NO_DISASSEM_STRING)
(NO_REGS_STRING): Remove defines.

5 years agoRemove test files for a different patch accidentally committed with patch for ARM...
Nick Clifton [Tue, 20 Aug 2019 16:33:44 +0000 (17:33 +0100)]
Remove test files for a different patch accidentally committed with patch for ARM CPU additions.

5 years agoAdds support for following CPUs to the ARM and Aarch64 assemblers: Cortex-A77, Cortex...
Dennis Zhang [Tue, 20 Aug 2019 16:13:29 +0000 (17:13 +0100)]
Adds support for following CPUs to the ARM and Aarch64 assemblers: Cortex-A77, Cortex-A76AE, Cortex-A34, Cortex-A65, and Cortex-A65AE.

Related specifications can be found at
https://developer.arm.com/ip-products/processors.

gas * NEWS: Mention the Arm and AArch64 new processors.
* config/tc-aarch64.c: New entries for Cortex-A34, Cortex-A65,
Cortex-A77, cortex-A65AE, and Cortex-A76AE.
* doc/c-aarch64.texi: Document new CPUs.
* testsuite/gas/aarch64/cpu-cortex-a34.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a65.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a65ae.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a76ae.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a77.d: New test.
* testsuite/gas/aarch64/nop-asm.s: New test.

bfd * cpu-aarch64.c: New entries for Cortex-A34, Cortex-A65,
 Cortex-A77, cortex-A65AE, and Cortex-A76AE.

5 years agoArm: Fix performance issue with thumb-2 tailcalls
Tamar Christina [Tue, 20 Aug 2019 15:34:26 +0000 (16:34 +0100)]
Arm: Fix performance issue with thumb-2 tailcalls

We currently use a padding NOP after a Thumb to Arm interworking veneer (BX pc).
The NOP is never executed but may result in a performance penalty on some cores.

For this reason this patch changes the NOPs after Thumb to Arm veneers into B .-2
and adds a note to this in the source code for future reference.

bfd/ChangeLog:

* elf32-arm.c (elf32_thumb2_plt_entry, elf32_arm_plt_thumb_stub,
elf32_arm_stub_long_branch_v4t_thumb_thumb,
elf32_arm_stub_long_branch_v4t_thumb_arm,
elf32_arm_stub_short_branch_v4t_thumb_arm,
elf32_arm_stub_long_branch_v4t_thumb_arm_pic,
elf32_arm_stub_long_branch_v4t_thumb_thumb_pic,
elf32_arm_stub_long_branch_v4t_thumb_tls_pic): Change nop to branch to
previous instruction.

ld/ChangeLog:

* testsuite/ld-arm/cortex-a8-fix-b-plt.d: Update Testcase.
* testsuite/ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise.
* testsuite/ld-arm/cortex-a8-fix-bcc-plt.d: Likewise.
* testsuite/ld-arm/farcall-cond-thumb-arm.d: Likewise.
* testsuite/ld-arm/farcall-mixed-app.d: Likewise.
* testsuite/ld-arm/farcall-mixed-app2.d: Likewise.
* testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm-short.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm.d: Likewise.
* testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
* testsuite/ld-arm/farcall-thumb-thumb.d: Likewise.
* testsuite/ld-arm/fix-arm1176-on.d: Likewise.
* testsuite/ld-arm/ifunc-10.dd: Likewise.
* testsuite/ld-arm/ifunc-2.dd: Likewise.
* testsuite/ld-arm/ifunc-4.dd: Likewise.
* testsuite/ld-arm/ifunc-6.dd: Likewise.
* testsuite/ld-arm/ifunc-8.dd: Likewise.
* testsuite/ld-arm/jump-reloc-veneers-long.d: Likewise.
* testsuite/ld-arm/mixed-app.d: Likewise.
* testsuite/ld-arm/thumb2-b-interwork.d: Likewise.
* testsuite/ld-arm/tls-longplt.d: Likewise.
* testsuite/ld-arm/tls-thumb1.d: Likewise.

5 years ago[gdb/testsuite] Clean up stale exec in gdb_compile_pascal
Tom de Vries [Tue, 20 Aug 2019 15:18:09 +0000 (17:18 +0200)]
[gdb/testsuite] Clean up stale exec in gdb_compile_pascal

When running a pascal test with the stabs target board:
...
$ test=gdb.pascal/case-insensitive-symbols.exp
$ cd build/gdb/testsuite
$ make check RUNTESTFLAGS="$test --target_board=stabs"
...
we get:
...
nr of untested testcases         1
nr of unsupported tests          1
...
due to:
...
Error: Illegal parameter: -gstabs+^M
Error: /usr/bin/ppcx64 returned an error exitcode^M
...

OTOH, when running the same pascal test without the stabs target board:
...
$ make check RUNTESTFLAGS="$test"
...
we get:
...
nr of expected passes            20
...

But when subsequently again running with the stabs target board:
...
$ make check RUNTESTFLAGS="$test --target_board=stabs"
...
we now get:
...
nr of expected passes            20
...

The problem is that gdb_compile_pascal determines success based on existence
of the exec after compilation:
...
    if ![file exists $destfile] {
        unsupported "Pascal compilation failed: $result"
        return "Pascal compilation failed."
    }
...
without removing the exec before compilation, which allows a stale exec to
make it seem as if compilation has succeeded.

Fix this by removing the stale exec before compilation.

gdb/testsuite/ChangeLog:

2019-08-20  Tom de Vries  <tdevries@suse.de>

* lib/pascal.exp (gdb_compile_pascal): Remove $destfile before
compilation.

5 years agoImprove remote attach round-trips without btrace
Conrad Meyer [Mon, 19 Aug 2019 07:02:19 +0000 (00:02 -0700)]
Improve remote attach round-trips without btrace

For remotes which do not support btrace at all, we can save several
round trips for each thread.  This is especially significant when your
remote is a kernel with 100s or 1000s of threads and latency is
intercontinental.

Previously, with target, remote, and infrun debugging enabled, one
might see:

    Sending packet: $Hg18aee#43...Ack
    Packet received: OK
    Sending packet: $Hg186f7#eb...Ack
    Packet received: OK
    remote:target_xfer_partial (24, , 0x805454000, 0x0, 0x0, 4096) = -1, 0

repeated for all non-exited threads.

Afterwards, if the remote does not specify 'qXfer:btrace-conf:read+'
in qSupported stub features, these unnecessary thread switches are
avoided.

gdb/ChangeLog:

* remote.c (remote_target::remote_btrace_maybe_reopen): Avoid
unnecessary thread walk if remote doesn't support the packet.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Aug 2019 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMIPS/gas: Fix misaligned address errors to disregard ISA mode bit
Faraz Shahbazker [Tue, 13 Aug 2019 05:32:20 +0000 (05:32 +0000)]
MIPS/gas: Fix misaligned address errors to disregard ISA mode bit

gas/
* config/tc-mips.c (fix_bad_misaligned_address): New function.
(fix_validate_branch): Call fix_bad_misaligned address_to
calculate the target address.
(md_apply_fix): Likewise.
(md_convert_frag): Update misaligned address calculation to
disregard ISA mode bit.

5 years agoMIPS/gas: Retain ISA mode bit for labels with .insn annotation
Faraz Shahbazker [Mon, 5 Aug 2019 23:38:46 +0000 (23:38 +0000)]
MIPS/gas: Retain ISA mode bit for labels with .insn annotation

gas/
* config/tc-mips.c (mips_move_labels): Retain ISA mode bit
when moving labels in text segments.
(mips_align): Indicate text mode when aligning labels in
text segments.
* gas/testsuite/gas/mips/insn-isa-mode.d: New test.
* gas/testsuite/gas/mips/insn-isa-mode.s: New test source.
* gas/testsuite/gas/mips/mips.exp: Run the new test.

5 years agoFix indentation in value_has_field
Tom Tromey [Mon, 19 Aug 2019 18:46:03 +0000 (12:46 -0600)]
Fix indentation in value_has_field

value_has_field had a mis-indented line.  This fixes it.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tromey@adacore.com>

* python/py-value.c (value_has_field): Fix indentation.

5 years agoFix Fortran regression with variables in nested functions
Tom Tromey [Tue, 13 Aug 2019 17:39:58 +0000 (11:39 -0600)]
Fix Fortran regression with variables in nested functions

Sergio pointed out that commit commit aa3b6533 ("Allow nested function
displays") regressed a few gdb.fortran tests.  I was able to reproduce
these failures with gcc head.

The bug is that some spots calling contained_in will in fact do the
wrong thing if nested functions are considered as contained.  In the
particular case of the Fortran regression, it was the call in
block_innermost_frame, being called from get_hosting_frame -- in this
case, the caller is specifically trying to avoid the nested case.

This patch fixes the problem by adding an "allow_nested" parameter to
contained_in, essentially reverting the change for most callers.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tromey@adacore.com>

* printcmd.c (do_one_display, info_display_command): Update.
* block.h (contained_in): Return bool.  Add allow_nested
parameter.
* block.c (contained_in): Return bool.  Add allow_nested
parameter.

5 years agoAdd Rust support to source highlighting
Tom Tromey [Mon, 24 Jun 2019 22:02:47 +0000 (16:02 -0600)]
Add Rust support to source highlighting

Currently, no release of GNU Source Highlight supports Rust.  However,
I've checked in a patch to do so there, and I plan to make a new
release sometime this summer.

This patch prepares gdb for that by adding support for Rust to the
source highlighting code.

Because Source Highlight will throw an exception if the language is
unrecognized, this also changes gdb to ignore exceptions here.  This
will cause gdb to fall back to un-highlighted source text.

This updates gdb's configure script to reject the combination of
Source Highlight and -static-libstdc++.  This is done because it's not
possible to use -static-libstdc++ and then catch exceptions from a
shared library.

Tested with the current and development versions of Source Highlight.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.
* configure.ac: Disallow the combination of -static-libstdc++ and
source highlight.
* source-cache.c (get_language_name): Handle rust.
(source_cache::get_source_lines): Ignore highlighting exceptions.

5 years agoAdd --with-static-standard-libraries to the top level
Tom Tromey [Fri, 26 Jul 2019 21:42:25 +0000 (15:42 -0600)]
Add --with-static-standard-libraries to the top level

gdb should normally not be linked with -static-libstdc++.  Currently
this has not caused problems, but it's incompatible with catching an
exception thrown from a shared library -- and a subsequent patch
changes gdb to do just this.

This patch adds a new --with-static-standard-libraries flag to the
top-level configure.  It defaults to "auto", which means enabled if
gcc is being built, and disabled otherwise.

ChangeLog
2019-08-19  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.
* configure.ac: Add --with-static-standard-libraries.

5 years agoFix N^2 behavior in _bfd_dwarf2_find_symbol_bias
Tom Tromey [Thu, 15 Aug 2019 13:33:20 +0000 (07:33 -0600)]
Fix N^2 behavior in _bfd_dwarf2_find_symbol_bias

A customer reported a case where addr2line was very slow.  We tracked
this down to some N^2 behavior in _bfd_dwarf2_find_symbol_bias in the
unusual case where no function can be found.

This patch fixes the bug, and reduces the runtime for a particular
request from 127 seconds to 1 second.

bfd/ChangeLog
2019-08-19  Tom Tromey  <tromey@adacore.com>

* dwarf2.c (_bfd_dwarf2_find_symbol_bias): Create hash table
holding symbols.

5 years agoPR24898, An out-of-bounds read occured in display_data
Alan Modra [Mon, 19 Aug 2019 10:54:35 +0000 (20:24 +0930)]
PR24898, An out-of-bounds read occured in display_data

Given 32-bit pointers and a 64-bit bfd_size_type, it is relatively
easy to construct a value of augmentation_data_len (eg. 0x100000000)
that won't fail pointer checks but will print without bounds.

PR 24898
* dwarf.c (display_debug_frames): Use the read_cie check and error
for augmentation data length.

5 years agoPowerPC64 ha/lo insn checks
Alan Modra [Mon, 19 Aug 2019 08:04:03 +0000 (17:34 +0930)]
PowerPC64 ha/lo insn checks

These are done in ppc64_elf_edit_toc, which now also garbage collects
unused GOT entries.  The checks for legitimate instructions weren't
being done for the GOT relocs, unless the file also happened to have a
toc section.

* elf64-ppc.c (struct ppc64_elf_obj_tdata): Rename has_gotrel
to has_optrel.
(struct _ppc64_elf_section_data): Likewise.
(ppc64_elf_check_relocs): Set has_optrel for more relocs.
(ppc64_elf_edit_toc): Do ha/lo insn checks in GOT loop rather
than TOC loop.  Check PLT16 insns too.

5 years agoFloat16: Fix test failures for non ELF targets
Barnaby Wilks [Thu, 15 Aug 2019 16:21:59 +0000 (16:21 +0000)]
Float16: Fix test failures for non ELF targets

The tests were failing due to md_atof trying to do word-wise endian
switching on the float16 (for little-endian targets sometimes
multi word values have their word order changed).
However since a float16 is only 1 word wide, it would end up writing
incorrect data, as you cannot switch the word order of just one word.

* config/tc-arm.c (md_atof): Add precision check.  Formatting.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Aug 2019 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Aug 2019 00:01:39 +0000 (00:01 +0000)]
Automatic date update in version.in

5 years agoPR24911, Heap overflow issue in qsort_r, dwarf.c
Alan Modra [Sat, 17 Aug 2019 08:31:05 +0000 (18:01 +0930)]
PR24911, Heap overflow issue in qsort_r, dwarf.c

The actual args to this function are "pointers to pointers to
debug_info".

PR 24911
* dwarf.c (comp_addr_base): Dereference args.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Aug 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie
Tom de Vries [Fri, 16 Aug 2019 21:48:28 +0000 (23:48 +0200)]
[gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie

When running gdb.base/compare-sections.exp with target board -fPIE/-pie, we
get:
...
FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r
...

The test expects the read-only sections to have the same contents as in the
file:
...
    # Assume startup code doesn't change read-only sections.
    compare_sections "-r"
...
but that's not the case for PIE executables.

Fix this by allowing mismatched read-only sections for PIE executables.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-16  Tom de Vries  <tdevries@suse.de>

* gdb.base/compare-sections.exp ("after run to main"): Allow
mismatched read-only sections for PIE executables.

5 years agox86-64: Move PIC check for PC-relative relocations back
H.J. Lu [Fri, 16 Aug 2019 21:25:15 +0000 (14:25 -0700)]
x86-64: Move PIC check for PC-relative relocations back

commit 83924b3846361f2f76f9a6e7b5afa01c0eebbd4f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 5 18:45:23 2019 -0800

    x86-64: Restore PIC check for PCREL reloc against protected symbol

moved PIC check for PC-relative relocations to elf_x86_64_check_relocs.
Since linker defined symbols may not be processed at the time, we need
to move the check back to elf_x86_64_relocate_section.

bfd/

PR ld/24905
* elf64-x86-64.c (elf_x86_64_check_relocs): Move PIC check for
PC-relative relocations back to ...
(elf_x86_64_relocate_section): Here.

ld/

PR ld/24905
* testsuite/ld-x86-64/pr24905-x32.d: New file.
* testsuite/ld-x86-64/pr24905.d: Likewise.
* testsuite/ld-x86-64/pr24905.s: Likewise.
* testsuite/ld-x86-64/pr24905.t: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr24905 and pr24905-x32.

5 years agoRemove the TUI execution info window
Tom Tromey [Sat, 13 Jul 2019 00:18:10 +0000 (18:18 -0600)]
Remove the TUI execution info window

The TUI execution info window is unusual in that it is always linked
to a source or disassembly window.  Even updates of its content are
handled by the source window, so it really has no life of its own.

This patch removes this window entirely and puts its functionality
directly into the source window.  This simplifies the code somewhat.

This is a user-visible change, because now the box around the source
(or disassembly) window encloses the execution info as well.  I
consider this an improvement as well, though.

Note that this patch caused ncurses to start emitting the "CSI Z"
sequence, so I've added this to the test suite terminal
implementation.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui.h (enum tui_win_type) <EXEC_INFO_WIN>: Remove.
* tui/tui-winsource.h (struct tui_exec_info_window): Remove.
(struct tui_source_window_base) <make_visible, refresh_window,
resize>: Remove methods.
<execution_info>: Remove field.
* tui/tui-winsource.c (tui_source_window_base::do_erase_source_content)
(tui_show_source_line, tui_source_window_base)
(~tui_source_window_base): Update.
(tui_source_window_base::resize)
(tui_source_window_base::make_visible)
(tui_source_window_base::refresh_window): Remove.
(tui_source_window_base::update_exec_info): Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.

gdb/testsuite/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* lib/tuiterm.exp (_csi_Z): New proc.
* gdb.tui/basic.exp: Update window positions.
* gdb.tui/empty.exp: Update window positions.

5 years agoRemove useless assignment from tui_remove_hooks
Tom Tromey [Fri, 12 Jul 2019 05:24:03 +0000 (23:24 -0600)]
Remove useless assignment from tui_remove_hooks

tui_remove_hooks clears deprecated_query_hook, but nothing in the TUI
ever sets it; so remove the assignment.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-hooks.c (tui_remove_hooks): Don't set
deprecated_query_hook.

5 years agoChange tui_show_symtab_source to be a method
Tom Tromey [Fri, 12 Jul 2019 02:00:07 +0000 (20:00 -0600)]
Change tui_show_symtab_source to be a method

This changes tui_show_symtab_source to be a method on
tui_source_window.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line): Update.
* tui/tui-source.h (struct tui_source_window)
<show_symtab_source>: Declare.
(tui_show_symtab_source): Don't declare.
* tui/tui-source.c (tui_show_symtab_source): Rename from
tui_show_symtab_source.

5 years agoIntroduce tui_source_window_base::set_contents method
Tom Tromey [Fri, 12 Jul 2019 00:42:20 +0000 (18:42 -0600)]
Introduce tui_source_window_base::set_contents method

This introduces the tui_source_window_base::set_contents method and
implements it in the subclasses.  This removes a check of the window
type.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<set_contents>: Declare.
* tui/tui-winsource.c
(tui_source_window_base::update_source_window_as_is): Update.
* tui/tui-source.h (struct tui_source_window) <set_contents>:
Declare.
(tui_set_source_content): Don't declare.
* tui/tui-source.c (tui_source_window::set_contents): Rename from
tui_set_source_content.
* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>:
Declare.
(tui_set_disassem_content): Don't declare.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Rename from
tui_set_disassem_content.

5 years agoChange tui_update_breakpoint_info to be a method
Tom Tromey [Fri, 12 Jul 2019 00:27:02 +0000 (18:27 -0600)]
Change tui_update_breakpoint_info to be a method

This changes tui_update_breakpoint_info to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<update_breakpoint_info>: Declare.
(tui_update_breakpoint_info): Don't declare.
* tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is)
(tui_update_all_breakpoint_info): Update.
(tui_source_window_base::update_breakpoint_info): Rename from
tui_update_breakpoint_info.
(tui_source_window_base::update_exec_info): Update.

5 years agoChange tui_update_source_window to be a method
Tom Tromey [Fri, 12 Jul 2019 00:24:07 +0000 (18:24 -0600)]
Change tui_update_source_window to be a method

This changes tui_update_source_window to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<update_source_window>: Declare.
(tui_update_source_window): Don't declare.
* tui/tui-winsource.c
(tui_source_window_base::update_source_window): Rename from
tui_update_source_window.
(tui_source_window_base::rerender): Update.
* tui/tui-source.c (tui_source_window::maybe_update): Update.
* tui/tui-disasm.c (tui_show_disassem)
(tui_show_disassem_and_update_source)
(tui_disasm_window::maybe_update): Update.

5 years agoChange tui_update_source_window_as_is to be a method
Tom Tromey [Fri, 12 Jul 2019 00:22:06 +0000 (18:22 -0600)]
Change tui_update_source_window_as_is to be a method

This changes tui_update_source_window_as_is to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<update_source_window_as_is>: Declare.
(tui_update_source_window_as_is): Don't declare.
* tui/tui-winsource.c (tui_update_source_window): Update
(tui_source_window_base::update_source_window_as_is): Rename from
tui_update_source_window_as_is.
(tui_source_window_base::refill): Update.
* tui/tui-source.c (tui_show_symtab_source): Update.
* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical):
Update.

5 years agoRemove "noerror" parameter from some TUI functions
Tom Tromey [Fri, 12 Jul 2019 00:19:28 +0000 (18:19 -0600)]
Remove "noerror" parameter from some TUI functions

A few TUI functions take a "noerror" parameter.  This is only checked
in one spot: in tui_set_source_content, if noerror is false, and if an
error occurs, then the function will call print_sys_errmsg.

This seems misguided to me, so this patch removes that code and this
parameter.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (tui_update_source_window)
(tui_update_source_window_as_is): Remove "noerror" parameter.
* tui/tui-winsource.c (tui_update_source_window)
(tui_update_source_window_as_is): Remove "noerror" parameter.
(tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line)
(tui_source_window_base::rerender)
(tui_source_window_base::refill): Update.
* tui/tui-source.h (tui_set_source_content)
(tui_show_symtab_source): Remove "noerror" parameter.
* tui/tui-source.c (tui_set_source_content): Remove "noerror"
parameter.
(tui_show_symtab_source): Likewise.
(tui_source_window::maybe_update): Update.
* tui/tui-disasm.c (tui_show_disassem)
(tui_show_disassem_and_update_source)
(tui_disasm_window::do_scroll_vertical)
(tui_disasm_window::maybe_update): Update.

5 years agoRemove separate visibility flag
Tom Tromey [Fri, 12 Jul 2019 00:03:45 +0000 (18:03 -0600)]
Remove separate visibility flag

TUI windows keep track of their visibility in a boolean field.
However, this is not needed, because a window is visible if and only
if it has an underlying curses handle.  So, we can remove this
separate field.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_is_window_visible): Update.
* tui/tui-wingeneral.c (tui_make_window)
(tui_gen_win_info::make_visible, tui_refresh_all): Update.
* tui/tui-win.c (window_name_completer, tui_refresh_all_win)
(tui_set_focus_command, tui_all_windows_info, update_tab_width)
(tui_set_win_height_command, parse_scrolling_args): Update.
* tui/tui-source.c (tui_source_window::style_changed): Update.
* tui/tui-regs.c (tui_show_registers)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_check_register_values, tui_reg_command): Update.
* tui/tui-disasm.c (tui_show_disassem): Update.
* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
method.
<is_visible>: Remove field.
* tui/tui-data.c (tui_next_win, tui_prev_win)
(tui_delete_invisible_windows): Update.

5 years agoRemove m_has_locator
Tom Tromey [Wed, 10 Jul 2019 03:22:38 +0000 (21:22 -0600)]
Remove m_has_locator

The previous patch removed the only use of m_has_locator, so this
member can now be removed.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<m_has_locator>: Remove.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Update.

5 years agoFix detection of missing plugin for LTO objects.
Martin Liska [Fri, 16 Aug 2019 11:14:36 +0000 (13:14 +0200)]
Fix detection of missing plugin for LTO objects.

2019-08-16  Martin Liska  <mliska@suse.cz>

PR ld/24912
* elflink.c: Report error only for not relocatable.
* linker.c (_bfd_generic_link_add_one_symbol): Do not handle
here lto_slim_object as it's handled in caller.
2019-08-16  Martin Liska  <mliska@suse.cz>

PR ld/24912
* object.cc (big_endian>::do_layout): Do not report error,
but only set a flag.
(big_endian>::do_add_symbols): Report error only for when
relocatable.

5 years agoMove [PAC] into a new MI field addr_flags
Alan Hayward [Fri, 16 Aug 2019 09:19:18 +0000 (10:19 +0100)]
Move [PAC] into a new MI field addr_flags

Add a new print_pc which prints both the PC and a new field addr_flags.
Call this wherever the PC is printed in stack.c.

Add a new gdbarch method get_pc_address_flags to obtain the addr_flag
contents. By default returns an empty string, on AArch64 this returns
PAC if the address has been masked in the frame.

Document this in the manual and NEWS file.

gdb/ChangeLog:

* NEWS (Other MI changes): New subsection.
* aarch64-tdep.c (aarch64_get_pc_address_flags): New function.
(aarch64_gdbarch_init): Add aarch64_get_pc_address_flags.
* arch-utils.c (default_get_pc_address_flags): New function.
* arch-utils.h (default_get_pc_address_flags): New declaration.
* gdbarch.sh: Add get_pc_address_flags.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* stack.c (print_pc): New function.
(print_frame_info) (print_frame): Call print_pc.

gdb/doc/ChangeLog:

* gdb.texinfo (AArch64 Pointer Authentication)
(GDB/MI Breakpoint Information) (Frame Information): Document
addr_field.

5 years ago[ld] [arm] Add support for noinit section
Christophe Lyon [Fri, 16 Aug 2019 08:26:45 +0000 (08:26 +0000)]
[ld] [arm] Add support for noinit section

2019-08-16  Christophe Lyon  <christophe.lyon@linaro.org>

* emulparams/armelf.sh (OTHER_SECTIONS): Add support for noinit
section.

Change-Id: Ib293f28cc5f21e9e9a13abf4d4e37f0a0eec41c0

5 years agoPR24909, Uninitialized use on stack in readelf
Alan Modra [Fri, 16 Aug 2019 05:47:23 +0000 (15:17 +0930)]
PR24909, Uninitialized use on stack in readelf

PR 24909
PR 23499
* readelf.c (get_symbol_version_string): Set sym_info earlier.

5 years agoPowerPC gcc bootstrap fail with bss-plt
Alan Modra [Fri, 16 Aug 2019 03:50:28 +0000 (13:20 +0930)]
PowerPC gcc bootstrap fail with bss-plt

git commit 3e04d7655b introduced a bug by sizing output sections
earlier in ppc_before_allocation.  That meant PLT (and GOT) sizes were
not included when calculating total executable section sizes.

* emultempl/ppc32elf.em (ppc_before_allocation): Force running
prelim_size_sections before deciding whether branch trampolines
might be needed.

5 years agoAligned vs. unaligned ppc32 relocs
Alan Modra [Wed, 14 Aug 2019 07:01:05 +0000 (16:31 +0930)]
Aligned vs. unaligned ppc32 relocs

Given R_PPC_ADDR32 or R_PPC_UADDR32 relocs, this patch generates
R_PPC_ADDR32 or R_PPC_UADDR32 dynamic relocs from either type
depending on whether r_offset is 4-byte aligned, and similarly for
R_PPC_ADDR16/R_PPC_UADDR16.

* elf32-ppc.c (ppc_elf_relocate_section): Optimize unaligned relocs.

5 years agoFix paste-o in examine-backward.exp.
Sandra Loosemore [Fri, 16 Aug 2019 01:15:16 +0000 (18:15 -0700)]
Fix paste-o in examine-backward.exp.

This patch fixes a paste-o that was introduced in commit
c8ad9b9a31aa3e6039567fc1f152dd454c946d5f.  Previously the regexp for
the "examine 3 bytes backward from ${address_zero}" test correctly
matched 3 "${byte}" patterns, but in that commit the 6-byte regexp
from the previous test was mistakenly repeated here instead.

2019-08-15  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/examine-backward.exp: Correct regexp for
"examine 3 bytes backward from ${address_zero}".

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Aug 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb] Make maint info sections print relocated addresses
Tom de Vries [Thu, 15 Aug 2019 22:25:14 +0000 (00:25 +0200)]
[gdb] Make maint info sections print relocated addresses

When running gdb.base/compare-sections.exp with -fPIE/-pie, we get:
...
print /u *(unsigned char *) 0x00000238^M
Cannot access memory at address 0x238^M
(gdb) FAIL: gdb.base/compare-sections.exp: read-only: get value of read-only section
...

The problem is that that "maint info sections" prints an unrelocated address:
...
 [0]     0x00000238->0x00000254 at 0x00000238: .interp ALLOC LOAD READONLY \
                                                       DATA HAS_CONTENTS
...
while the test expects a relocated address.

Given that the documentation states that the command displays "the section
information displayed by info files", and that info files shows relocated
addresses:
...
        0x0000555555554238 - 0x0000555555554254 is .interp
...
fix this by showing relocated addresses for maint info sections as
well.

Build and tested on x86_64-linux.

gdb/ChangeLog:

2019-08-16  Tom de Vries  <tdevries@suse.de>

* maint.c (maintenance_info_sections): Also handle !ALLOBJ case using
print_objfile_section_info.

5 years agoTUI resize unification
Tom Tromey [Tue, 9 Jul 2019 23:29:13 +0000 (17:29 -0600)]
TUI resize unification

The TUI currently has two different ways to resize a window: the
resize method, and the methods make_invisible_and_set_new_height and
make_visible_with_new_height.

There's no deep reason to have two different ways to resize a window,
so this patch unifies them, leaving just the "resize" method.

This also changes the locator to be handled more like an ordinary
window and less like an adjunct of the associated source window.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

* tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before
calling update_cmdwin_start_line.
* tui/tui-winsource.h (struct tui_source_window_base)
<do_make_visible_with_new_height, set_new_height>: Don't declare.
<rerender>: Declare.
* tui/tui-winsource.c (tui_source_window_base::update_tab_width):
Call rerender.
(tui_source_window_base::set_new_height): Remove.
(tui_source_window_base::rerender): Rename from
do_make_visible_with_new_height.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use
resize method.
(tui_win_info::make_invisible_and_set_new_height)
(tui_win_info::make_visible_with_new_height): Remove.
* tui/tui-stack.h (struct tui_locator_window) <rerender>:
Declare.
* tui/tui-stack.c (tui_locator_window::rerender): New method.
* tui/tui-regs.h (struct tui_data_window) <set_new_height,
do_make_visible_with_new_height>: Don't declare.
<rerender>: Declare.
* tui/tui-regs.c (tui_data_window::rerender): Rename from
set_new_height.
(tui_data_window::do_make_visible_with_new_height): Remove.
* tui/tui-layout.c (show_source_disasm_command, show_data): Don't
call tui_show_locator_content.
(tui_gen_win_info::resize): Call rerender.
(show_source_or_disasm_and_command): Don't call
tui_show_locator_content.
* tui/tui-data.h (struct tui_gen_win_info) <rerender>: New
method.
(struct tui_win_info) <rerender>: Declare.
<set_new_height, make_invisible_and_set_new_height,
make_visible_with_new_height>: Don't declare.
* tui/tui-data.c (tui_win_list::rerender): New method.
* tui/tui-command.h (struct tui_cmd_window)
<do_make_visible_with_new_height>: Don't declare.
* tui/tui-command.c
(tui_cmd_window::do_make_visible_with_new_height): Remove.

gdb/testsuite/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

* gdb.tui/empty.exp: Enable resizing tests.

5 years agoFix bug with character enumeration literal
Tom Tromey [Thu, 1 Aug 2019 17:41:32 +0000 (11:41 -0600)]
Fix bug with character enumeration literal

gnat encodes character enumeration literals using a few different
schemes.  The gnat compiler documented the "QU" and "QW" encodings,
but failed to document that a simpler encoding was used for certain
characters.

This patch updates gdb to handle this simple Q encoding.  Note that
wide character literals are still not handled.

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

* ada-exp.y (convert_char_literal): Handle "Q%c" encoding.
* ada-lang.c (ada_enum_name): Likewise.

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

* gdb.ada/char_enum.exp: Add regression tests.
* gdb.ada/char_enum/foo.adb (Char_Enum_Type): Use '_'
and '0'.
(Char, Gchar): Update.
* gdb.ada/char_enum/pck.ads (Global_Enum_Type): Use '+'.

5 years agoRename internal Python functions to start with an underscore
Christian Biesinger [Thu, 15 Aug 2019 16:29:04 +0000 (11:29 -0500)]
Rename internal Python functions to start with an underscore

I could not tell if GdbSetPythonDirectory is internal or not because
I could not find any references to it, so I left it as-is.

Tested by running the testsuite on gdb.python/*.exp; everything still
passes.

2019-08-15  Christian Biesinger  <cbiesinger@google.com>

* python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a
leading underscore.
(GdbOutputErrorFile): Likewise.
(global scope): Adjust constructor calls to GdbOutput{,Error}File
accordingly.
(execute_unwinders): Rename to have a leading underscore.
(auto_load_packages): Likewise.
(global scope): Adjust call to auto_load_packages accordingly.
(GdbSetPythonDirectory): Likewise.
* python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders
instead of execute_unwinders.

gdb/testsuite/ChangeLog:

2019-08-15  Christian Biesinger  <cbiesinger@google.com>

* gdb.python/python.exp: Expect a leading underscore on
GdbOutput{,Error}File.

5 years agoRISC-V: Fix lui relaxation issue with code at address 0.
Jim Wilson [Thu, 15 Aug 2019 19:01:13 +0000 (12:01 -0700)]
RISC-V: Fix lui relaxation issue with code at address 0.

This fixes a problem originally reported at
    https://github.com/riscv/riscv-binutils-gdb/issues/173

If you have code linked at address zero, you can have a lui instruction
loading a value 0x800 which gets relaxed to a c.lui which is valid (c.lui 0x1
followed by addi -0x800).  Relaxation can reduce the value below 0x800 at which
point the c.lui 0x0 is no longer valid.  We can fix this by converting the
c.lui to a c.li which can load 0.

bfd/
* elfnn-riscv.c (perform_relocation) <R_RISCV_RVC_LUI>: If
RISCV_CONST_HIGH_PART (value) is zero, then convert c.lui instruction
to c.li instruction, and use ENCODE_RVC_IMM to set value.

ld/
* testsuite/ld-riscv-elf/c-lui-2.d: New.
* testsuite/ld-riscv-elf/c-lui-2.ld: New.
* testsuite/ld-riscv-elf/c-lui-2.s: New.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the c-lui-2 test.

5 years agoTUI window resize should not need invisibility
Tom Tromey [Tue, 9 Jul 2019 21:35:17 +0000 (15:35 -0600)]
TUI window resize should not need invisibility

When resizing a window, the TUI currently first makes it invisible,
then changes the size, and then restores its visibility.

I think this is done because curses doesn't truly support resizing a
window -- there is a "wresize" extension, but the man page says it
isn't available in all versions of curses.

First, this is probably not a major problem any more.  I imagine most
of those old systems are gone now.

Second, I think it's a better API to have this detail hidden inside of
the resize method.

This patch changes the code to follow this idea, and changes the
ordinary resize method to use wresize when it is available.  The
special case for the command window is also moved to methods on the
command window.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (show_layout, show_source_disasm_command)
(show_data): Don't change window visibility.
(tui_gen_win_info::resize): Remove special case for command
window.  Use wresize, when available.
(show_source_or_disasm_and_command): Don't change window
visibility.
* tui/tui-command.h (struct tui_cmd_window) <resize>: Declare.
<make_visible>: New method.
* tui/tui-command.c (tui_cmd_window::resize): New method.

5 years agoChange TUI source window iteration
Tom Tromey [Sun, 7 Jul 2019 03:19:45 +0000 (21:19 -0600)]
Change TUI source window iteration

Currently the TUI does separate bookkeeping to track which source
windows exist.  It seems better to me to just refer to the list of
windows for this, so this patch removes the special handling and
instead adds a new iterator.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_iterator): New.
(struct tui_source_windows): New.
* tui/tui-winsource.c (tui_display_main): Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
(new_height_ok, parse_scrolling_args): Update.
* tui/tui-layout.c (show_layout, show_data): Update.
* tui/tui-data.h (tui_source_windows, tui_clear_source_windows)
(tui_add_to_source_windows): Don't declare.
* tui/tui-data.c (source_windows, tui_source_windows)
(tui_clear_source_windows, tui_add_to_source_windows): Remove.

5 years agoRename the "reset" method to "resize"
Tom Tromey [Sat, 6 Jul 2019 23:32:45 +0000 (17:32 -0600)]
Rename the "reset" method to "resize"

tui_gen_win_info::reset really just resizes the window.  This patch
renames it to reflect this.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base) <resize>:
Rename from reset.
* tui/tui-winsource.c (tui_source_window_base::resize): Rename.
* tui/tui-layout.c (show_source_disasm_command, show_data):
Update.
(tui_gen_win_info::resize): Rename.
(show_source_or_disasm_and_command): Update.
* tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from
reset.