]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
5 years agoPtrace support for Aarch64 SVE users/simark/regcache-for-alan
Alan Hayward [Fri, 11 May 2018 10:52:56 +0000 (11:52 +0100)] 
Ptrace support for Aarch64 SVE

Add support for reading and writing registers for Aarch64 SVE.
I've made this functionality common as it will be required for
gdbserver when gdbsever sve support is added.

Given that gdbserver does not yet call this function, I am
happy to remove the regcache commonise functions from the
previous patch. However, this would result in code in nat/
that does not compile for gdbserver. I wanted to avoid that.

We need to support the cases where the kernel only gives us a
fpsimd structure. This occurs when there is no active SVE state
in the kernel (for example, after starting a new process).

As per the covering email description, I've included large chunks
of linux kernel headers within an ifdef. Formatting of these macros
remains identical to the Kernel versions (ie not adapted to GNU style).

Added checks to make sure the vector length has not changed whilst
the process is running.

2018-05-11  Alan Hayward  <alan.hayward@arm.com>

gdb/
* aarch64-linux-nat.c (fetch_sveregs_from_thread): New function.
(store_sveregs_to_thread): Likewise.
(aarch64_linux_fetch_inferior_registers): Check for SVE.
(aarch64_linux_store_inferior_registers): Likewise.
* nat/aarch64-sve-linux-ptrace.c (aarch64_sve_get_sveregs): New
function.
(aarch64_sve_regs_copy_to_regcache): Likewise.
(aarch64_sve_regs_copy_from_regcache): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_sveregs): New
declaration.
(aarch64_sve_regs_copy_to_regcache): Likewise.
(aarch64_sve_regs_copy_from_regcache): Likewise.
(sve_context): Structure from Linux headers.
(SVE_SIG_ZREGS_SIZE): Define from Linux headers.
(SVE_SIG_ZREG_SIZE): Likewise.
(SVE_SIG_PREG_SIZE): Likewise.
(SVE_SIG_FFR_SIZE): Likewise.
(SVE_SIG_REGS_OFFSET): Likewise.
(SVE_SIG_ZREGS_OFFSET): Likewise.
(SVE_SIG_ZREG_OFFSET): Likewise.
(SVE_SIG_ZREGS_SIZE): Likewise.
(SVE_SIG_PREGS_OFFSET): Likewise.
(SVE_SIG_PREG_OFFSET): Likewise.
(SVE_SIG_PREGS_SIZE): Likewise.
(SVE_SIG_FFR_OFFSET): Likewise.
(SVE_SIG_REGS_SIZE): Likewise.
(SVE_SIG_CONTEXT_SIZE): Likewise.
(SVE_PT_REGS_MASK): Likewise.
(SVE_PT_REGS_FPSIMD): Likewise.
(SVE_PT_REGS_SVE): Likewise.
(SVE_PT_VL_INHERIT): Likewise.
(SVE_PT_VL_ONEXEC): Likewise.
(SVE_PT_REGS_OFFSET): Likewise.
(SVE_PT_FPSIMD_OFFSET): Likewise.
(SVE_PT_FPSIMD_SIZE): Likewise.
(SVE_PT_SVE_ZREG_SIZE): Likewise.
(SVE_PT_SVE_PREG_SIZE): Likewise.
(SVE_PT_SVE_FFR_SIZE): Likewise.
(SVE_PT_SVE_FPSR_SIZE): Likewise.
(SVE_PT_SVE_FPCR_SIZE): Likewise.
(__SVE_SIG_TO_PT): Likewise.
(SVE_PT_SVE_OFFSET): Likewise.
(SVE_PT_SVE_ZREGS_OFFSET): Likewise.
(SVE_PT_SVE_ZREG_OFFSET): Likewise.
(SVE_PT_SVE_ZREGS_SIZE): Likewise.
(SVE_PT_SVE_PREGS_OFFSET): Likewise.
(SVE_PT_SVE_PREG_OFFSET): Likewise.
(SVE_PT_SVE_PREGS_SIZE): Likewise.
(SVE_PT_SVE_FFR_OFFSET): Likewise.
(SVE_PT_SVE_FPSR_OFFSET): Likewise.
(SVE_PT_SVE_FPCR_OFFSET): Likewise.
(SVE_PT_SVE_SIZE): Likewise.
(SVE_PT_SIZE): Likewise.
(HAS_SVE_STATE): New define.

gdbserver
* Makefile.in: Add aarch64-sve-linux-ptrace.c.

5 years agoAdd methods to gdbserver regcache and raw_compare
Alan Hayward [Fri, 11 May 2018 10:52:55 +0000 (11:52 +0100)] 
Add methods to gdbserver regcache and raw_compare

Add additional functions to gdbserver regcache to make it more like gdb
regcache. This will allow the next patch to add a common function which
uses regcache.
The alternatives for the next patch would be to either duplicate the
common code in both gdb and gdbserver, or alternatively pass function
pointers for read register, write register, get status to the common code.

In addition, add a register compare function. This will be used in the
next patch. Alternatively instead of adding a new function, I could read
into a buffer and then compare.

2018-05-11  Alan Hayward  <alan.hayward@arm.com>

gdb/
* regcache.c (regcache::raw_compare): New function.
* regcache.h (regcache::raw_compare): New declaration.

gdbserver/
* regcache.c (register_data): New function.
(supply_register): Call member function.
(regcache::raw_supply): Replacement for supply_register.
(collect_register): Call member function.
(regcache::raw_collect): Replacement for collect_register.
(regcache::get_register_status): New function.
(regcache::raw_compare): Likewise.
* regcache.h: (regcache::raw_supply): New declaration.
* (regcache::raw_collect): Likewise.
* (regcache::raw_compare): Likewise.
* (regcache::get_register_status): Likewise.

5 years agoAarch64 SVE pseudo register support
Alan Hayward [Fri, 11 May 2018 10:52:54 +0000 (11:52 +0100)] 
Aarch64 SVE pseudo register support

Add the functionality for reading/writing psuedo registers.

On SVE the V registers are pseudo registers. This is supported
by adding AARCH64_SVE_V0_REGNUM.

2018-05-11  Alan Hayward  <alan.hayward@arm.com>

* aarch64-tdep.c (AARCH64_SVE_V0_REGNUM): Add define.
(aarch64_vnv_type): Add function.
(aarch64_pseudo_register_name): Add V regs for SVE.
(aarch64_pseudo_register_type): Likewise.
(aarch64_pseudo_register_reggroup_p): Likewise.
(aarch64_pseudo_read_value_2): Use V0 offset for SVE
(aarch64_pseudo_read_value): Add V regs for SVE.
(aarch64_pseudo_write_2): Use V0 offset for SVE
(aarch64_pseudo_write): Add V regs for SVE.
* aarch64-tdep.h (struct gdbarch_tdep): Add vnv_type.

5 years agoAdd aarch64 psuedo help functions
Alan Hayward [Fri, 11 May 2018 10:52:53 +0000 (11:52 +0100)] 
Add aarch64 psuedo help functions

Reduce code copy/paste by adding two helper functions for
aarch64_pseudo_read_value and aarch64_pseudo_write
The patch does not change any functionality.

2018-05-11  Alan Hayward  <alan.hayward@arm.com>

* aarch64-tdep.c (aarch64_pseudo_read_value_2): New helper func.
(aarch64_pseudo_write_2): Likewise.
(aarch64_pseudo_read_value): Use helper.
(aarch64_pseudo_write): Likewise.

5 years agoEnable SVE for GDB
Alan Hayward [Fri, 11 May 2018 10:52:52 +0000 (11:52 +0100)] 
Enable SVE for GDB

This patch enables SVE support for GDB by reading the VQ when
creating a target description.

It also ensures that SVE is taken into account when creating
the tdep structure, and stores the current VQ value directly
in tdep.

With this patch, gdb on an aarch64 system with SVE will now detect
SVE. The SVE registers will be displayed (but the contents will be
invalid). The following patches fill out the contents.

2018-05-101 Alan Hayward  <alan.hayward@arm.com>

* aarch64-linux-nat.c (aarch64_linux_read_description): Support SVE.
* aarch64-tdep.c (aarch64_get_tdesc_vq): New function.
(aarch64_gdbarch_init): Check for SVE.
* aarch64-tdep.h (gdbarch_tdep::has_sve): New function.

5 years agoAdd SVE register defines
Alan Hayward [Fri, 11 May 2018 10:52:51 +0000 (11:52 +0100)] 
Add SVE register defines

Add all the SVE register defines used by the later patches.

In order to prevent gaps in the register numbering, the Z registers
reuse the V register numbers (which become pseudos on SVE).

2018-05-11  Alan Hayward  <alan.hayward@arm.com>

* aarch64-tdep.c (aarch64_sve_register_names): New const
var.
* arch/aarch64.h (enum aarch64_regnum): Add SVE entries.
(AARCH64_SVE_Z_REGS_NUM): New define.
(AARCH64_SVE_P_REGS_NUM): Likewise.
(AARCH64_SVE_NUM_REGS): Likewise.

5 years agoMake target_store_registers take reg_buffer
Simon Marchi [Thu, 31 May 2018 02:58:37 +0000 (22:58 -0400)] 
Make target_store_registers take reg_buffer

5 years agoUse reg_buffer in target_fetch_registers interface
Simon Marchi [Thu, 31 May 2018 00:56:30 +0000 (20:56 -0400)] 
Use reg_buffer in target_fetch_registers interface

5 years agoMove supply and collect things to reg_buffer
Simon Marchi [Mon, 28 May 2018 15:27:27 +0000 (11:27 -0400)] 
Move supply and collect things to reg_buffer

5 years agoUse unique_ptr in reg-buffer
Simon Marchi [Mon, 28 May 2018 15:04:27 +0000 (11:04 -0400)] 
Use unique_ptr in reg-buffer

5 years agoChange type of reg_buffer::m_register_status to register_status
Simon Marchi [Mon, 28 May 2018 14:26:02 +0000 (10:26 -0400)] 
Change type of reg_buffer::m_register_status to register_status

The type of reg_buffer::m_register_status is an array of signed char,
probably to ensure that each element takes up only one byte.  Instead,
we can force the underlying type of register_status to be signed char
and use the enum type.

gdb/ChangeLog:

* common/common-regcache.h (enum register_status): Add
underlying type "signed char".
* regcache.h (reg_buffer) <m_register_status>: Change type to
register_status *.
* regcache.c (reg_buffer::reg_buffer): Alocate arrays of
register_status instead of signed char.
(reg_buffer::save): Use REG_UNKNOWN instead of 0.
(reg_buffer::get_register_status): Remove cast.
(readable_regcache::raw_read): Remove cast.
(readable_regcache::cooked_read): Remove cast.

5 years agoFix Alpha native GDB build
Uros Bizjak [Thu, 31 May 2018 15:18:02 +0000 (11:18 -0400)] 
Fix Alpha native GDB build

[Commit log by Simon Marchi]

I get this error:

  CXX    linux-nat.o
/home/simark/src/binutils-gdb/gdb/linux-nat.c: In function 'void save_stop_reason(lwp_info*)':
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2718:9: error: duplicated 'if' condition [-Werror=duplicated-cond]
    else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
         ^~
In file included from /home/simark/src/binutils-gdb/gdb/linux-nat.c:31:0:
/home/simark/src/binutils-gdb/gdb/nat/linux-ptrace.h:173:41: note: previously used here
 # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
                                    ~~~~~^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2709:13: note: in expansion of macro 'GDB_ARCH_IS_TRAP_BRKPT'
    else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
             ^~~~~~~~~~~~~~~~~~~~~~

For Alpha, we currently define GDB_ARCH_IS_TRAP_BRKPT and
GDB_ARCH_IS_TRAP_HWBKPT both to ((X) == TRAP_BRKPT), which causes the
two if branches to be duplicated.

Alpha doesn't have hardware breakpoints, so the Linux kernel for Alpha
never sets si_code to TRAP_HWBKPT.  We can just remove the special
definitions of these macros for __alpha__ and rely on the default ones.
Since the kernel will never report TRAP_HWBKPT, we will just never enter
the "hardware breakpoint" branch on Alpha (which is fine since it
doesn't have them).

gdb/ChangeLog:

* nat/linux-ptrace.h [__alpha__]
(GDB_ARCH_IS_TRAP_BRKPT, GDB_ARCH_IS_TRAP_HWBKPT): Remove
definitions.

5 years agoarch-utils: Make the last endianness actually chosen sticky
Maciej W. Rozycki [Thu, 31 May 2018 14:15:35 +0000 (15:15 +0100)] 
arch-utils: Make the last endianness actually chosen sticky

Use the last endianness explicitly selected, either by choosing a binary
file or with the `set endian' command, for future automatic selection.

As observed with the `gdb.base/step-over-no-symbols.exp' test case when
discarding the binary file even while connected to a live target the
endianness automatically selected is reset to the GDB target's default,
even if it does not match the endianness of the target being talked to.

For example with a little-endian MIPS target and the default endianness
being big we get this:

(gdb) file .../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols
Reading symbols from .../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols...done.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break main
Breakpoint 1 at 0x400840: file .../gdb/testsuite/gdb.base/start.c, line 34.
[...]
(gdb) continue
Continuing.

Breakpoint 1, main () at .../gdb/testsuite/gdb.base/start.c:34
34   foo();
(gdb) delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
No executable file now.
Discard symbol table from `.../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols'? (y or n) y
No symbol file now.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: purging symbols
p /x $pc
$1 = 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get before PC
break *$pc
Breakpoint 2 at 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: break *$pc
set displaced-stepping off
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: set displaced-stepping off
stepi
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x40084000

Command aborted.
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
$2 = 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host ...
monitor exit
(gdb) Killing process(es): ...
testcase .../gdb/testsuite/gdb.base/step-over-no-symbols.exp completed in 2 seconds

which shows that with the removal of the executable debugged the
endianness of $pc still at `main' gets swapped and the value in that
register is now incorrectly interpreted as 0x40084000 rather than
0x400840 as shown earlier on with the `break' command.  Consequently the
debug session no longer works as expected, until the endianness is
overridden with an explicit `set endian little' command.

This will happen while working with any target hardware whose endianness
does not match the default GDB target's endianness guessed and recorded
for a later use in `initialize_current_architecture'.

Given that within a single run of GDB it is more likely that consecutive
target connections will use the same endianness than that the endianness
will be swapped between connections, it makes sense to preserve the last
endianness explicitly selected as the automatic default.  It will make a
session like above, where an executable is removed, work correctly and
will retain the endianness for a further reconnection to the target.

And the new automatic default will still be overridden by subsequently
choosing a binary to debug, or with an explicit `set endian' command.

With the change in place the test case above completes successfully:

(gdb) continue
Continuing.

Breakpoint 1, main () at .../gdb/testsuite/gdb.base/start.c:34
34   foo();
(gdb) delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
No executable file now.
Discard symbol table from `.../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols'? (y or n) y
No symbol file now.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: purging symbols
p /x $pc
warning: GDB can't find the start of the function at 0x400840.

    GDB is unable to find the start of the function at 0x400840
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
    This problem is most likely caused by an invalid program counter or
stack pointer.
    However, if you think GDB should simply search farther back
from 0x400840 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
$1 = 0x400840
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get before PC
break *$pc
Breakpoint 2 at 0x400840
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: break *$pc
set displaced-stepping off
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: set displaced-stepping off
stepi
warning: GDB can't find the start of the function at 0x4007f8.
0x004007f8 in ?? ()
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
$2 = 0x4007f8
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
PASS: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host ...
monitor exit
(gdb) Killing process(es): ...
testcase .../gdb/testsuite/gdb.base/step-over-no-symbols.exp completed in 2 seconds

gdb/
* arch-utils.c (gdbarch_info_fill): Set `default_byte_order' to
the endianness selected.
* NEWS: Document `set endian auto' mode operation update.

gdb/doc/
* gdb.texinfo (Choosing Target Byte Order): Document endianness
selection details with the `set endian auto' mode.

gdb/testsuite
* gdb.base/endian.exp: New test.
* gdb.base/endian.c: New test source.

5 years agoFunction for reading the Aarch64 SVE vector length
Alan Hayward [Thu, 31 May 2018 13:36:48 +0000 (14:36 +0100)] 
Function for reading the Aarch64 SVE vector length

Returns 0 for systems without SVE support.

Note the defines taken from Linux kernel headers
in aarch64-sve-linux-ptrace.h.

gdb/
* Makefile.in: Add new header.
* gdb/arch/aarch64.h (sve_vg_from_vl): New macro.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
* configure.nat: Add new c file.
* nat/aarch64-sve-linux-ptrace.c: New file.
* nat/aarch64-sve-linux-ptrace.h: New file.

gdbserver/
* configure.srv: Add new c/h file.

5 years agoAdd Aarch64 SVE target description
Alan Hayward [Thu, 31 May 2018 12:33:04 +0000 (13:33 +0100)] 
Add Aarch64 SVE target description

No code uses the new descriptions yet.

gdb/
* aarch64-linux-nat.c (aarch64_linux_read_description):
Add parmeter zero.
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
Likewise.
* aarch64-tdep.c (tdesc_aarch64_list): Add.
(aarch64_read_description): Use VQ to index tdesc_aarch64_list.
(aarch64_gdbarch_init): Add parmeter zero.
* aarch64-tdep.h (aarch64_read_description): Add VQ parmeter.
* arch/aarch64.c (aarch64_create_target_description): Check VQ.
* arch/aarch64.h (aarch64_create_target_description): Add VQ.
parmeter.
* doc/gdb.texinfo: Describe SVE feature
* features/aarch64-sve.c: New file.

gdbserver/
* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add
null VQ.

5 years agoinclude: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
edlinger [Mon, 28 May 2018 18:21:23 +0000 (18:21 +0000)] 
include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>

include:
        * splay-tree.h (splay_tree_compare_strings,
        splay_tree_delete_pointers): Declare new utility functions.

libiberty:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.c (splay_tree_compare_strings,
        splay_tree_delete_pointers): New utility functions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260850 138bc75d-0d04-0410-961f-82ee72b054a4

5 years agoImprove boostrap-ubsan config (PR bootstrap/64914).
marxin [Thu, 10 May 2018 10:15:42 +0000 (10:15 +0000)] 
Improve boostrap-ubsan config (PR bootstrap/64914).

2018-05-10  Martin Liska  <mliska@suse.cz>

PR bootstrap/64914
* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260112 138bc75d-0d04-0410-961f-82ee72b054a4

5 years ago* argv.c (expandargv): Fix memory leak for expanded arguments.
law [Mon, 30 Apr 2018 18:00:49 +0000 (18:00 +0000)] 
* argv.c (expandargv): Fix memory leak for expanded arguments.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775 138bc75d-0d04-0410-961f-82ee72b054a4

5 years agoUnset gdbarch significant_addr_bit by default
Omair Javaid [Sat, 26 May 2018 00:58:51 +0000 (05:58 +0500)] 
Unset gdbarch significant_addr_bit by default

This patch fixes a bug introduced by fix to AArch64 pointer tagging.

In our fix for tagged pointer support our agreed approach was to sign
extend user-space address after clearing tag bits. This is not same
for all architectures and this patch allows sign extension for
addresses on targets which specifically set significant_addr_bit.

More information about patch that caused the issues and discussion
around tagged pointer support can be found in links below:

https://sourceware.org/ml/gdb-patches/2018-05/msg00000.html
https://sourceware.org/ml/gdb-patches/2017-12/msg00159.html

gdb/ChangeLog:

2018-05-31  Omair Javaid  <omair.javaid@linaro.org>

PR gdb/23210
* gdbarch.sh (significant_addr_bit): Default to zero when
not set by target architecture.
* gdbarch.c: Re-generated.
* utils.c (address_significant): Update.

5 years agoRun a few more binutils tests non-native
Alan Modra [Tue, 29 May 2018 01:23:18 +0000 (10:53 +0930)] 
Run a few more binutils tests non-native

Setting CC_FOR_TARGET from the environment CC was just plain wrong,
and no doubt the reason these tests were only run natively.

* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Don't
set CC_FOR_TARGET.  Run test non-native.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.
(test_follow_debuglink): Run test non-native.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 31 May 2018 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years ago(ARI) remove trailing newline in call to error in stack.c::func_command
Joel Brobecker [Wed, 30 May 2018 23:43:02 +0000 (16:43 -0700)] 
(ARI) remove trailing newline in call to error in stack.c::func_command

gdb/ChangeLog:

        * stack.c (func_command): Remove trailing newline in call to error.

5 years agoRemove regcache_raw_collect
Simon Marchi [Wed, 30 May 2018 18:54:46 +0000 (14:54 -0400)] 
Remove regcache_raw_collect

Remove regcache_raw_collect, update callers to use
regcache::raw_collect.

gdb/ChangeLog:

* regcache.h (regcache_raw_collect): Remove, update callers to
use regcache::raw_collect.
* regcache.c (regcache_raw_collect): Remove.

5 years agoRemove regcache_raw_supply
Simon Marchi [Wed, 30 May 2018 18:54:45 +0000 (14:54 -0400)] 
Remove regcache_raw_supply

Remove regcache_raw_supply, update callers to use
detached_regcache::raw_supply.

gdb/ChangeLog:

* regcache.h (regcache_raw_supply): Remove, update callers to
use detached_regcache::raw_supply.
* regcache.c (regcache_raw_supply): Remove.

5 years agoRemove regcache_cooked_write_part
Simon Marchi [Wed, 30 May 2018 18:54:44 +0000 (14:54 -0400)] 
Remove regcache_cooked_write_part

Remove regcache_cooked_write_part, update callers to use
regcache::cooked_write_part.

gdb/ChangeLog:

* regcache.h (regcache_cooked_write_part): Remove, update
callers to use regcache::cooked_write_part.
* regcache.c (regcache_cooked_write_part): Remove.

5 years agoRemove regcache_cooked_read_part
Simon Marchi [Wed, 30 May 2018 18:54:43 +0000 (14:54 -0400)] 
Remove regcache_cooked_read_part

Remove regcache_cooked_read_part, update callers to use
readable_regcache::cooked_read_part.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read_part): Remove, update callers
to use readable_regcache::cooked_read_part.
* regcache.c (regcache_cooked_read_part): Remove.

5 years agoRemove regcache_cooked_read_value
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)] 
Remove regcache_cooked_read_value

Remove regcache_cooked_read_value, update callers to use
readable_regcache::cooked_read_value.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read_value): Remove, update
callers to use readable_regcache::cooked_read_value.
* regcache.c (regcache_cooked_read_value): Remove.

5 years agoRemove regcache_cooked_write
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)] 
Remove regcache_cooked_write

Remove regcache_cooked_write, update callers to use
regcache::cooked_write.

gdb/ChangeLog:

* regcache.h (regcache_cooked_write): Remove, update callers to
use regcache::cooked_write.
* regcache.c (regcache_cooked_write): Remove.

5 years agoRemove regcache_invalidate
Simon Marchi [Wed, 30 May 2018 18:54:41 +0000 (14:54 -0400)] 
Remove regcache_invalidate

Remove regcache_invalidate, update callers to use
detached_regcache::invalidate instead.

gdb/ChangeLog:

* regcache.h (regcache_invalidate): Remove, update callers to
use detached_regcache::invalidate instead.
* regcache.c (regcache_invalidate): Remove.

5 years agoRemove regcache_raw_write_part
Simon Marchi [Wed, 30 May 2018 18:54:40 +0000 (14:54 -0400)] 
Remove regcache_raw_write_part

Remove regcache_raw_write_part, update callers to use
regcache::raw_write_part instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_write_part): Remove, update callers
to use regcache::raw_write_part instead.
* regcache.c (regcache_raw_write_part): Remove.

5 years agoRemove regcache_raw_read_part
Simon Marchi [Wed, 30 May 2018 18:54:39 +0000 (14:54 -0400)] 
Remove regcache_raw_read_part

Remove regcache_raw_read_part, update callers to use
readable_regcache::raw_read_part instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_read_part): Remove, update callers to
use readable_regcache::raw_read_part instead.
* regcache.c (regcache_raw_read_part): Remove.

5 years agoRemove regcache_cooked_read
Simon Marchi [Wed, 30 May 2018 18:54:38 +0000 (14:54 -0400)] 
Remove regcache_cooked_read

Remove regcache_cooked_read, update callers to use
readable_regcache::cooked_read instead.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read): Remove, update callers to
use readable_regcache::cooked_read instead.
* regcache.c (regcache_cooked_read): Remove.

5 years agoRemove regcache_raw_write
Simon Marchi [Wed, 30 May 2018 18:54:37 +0000 (14:54 -0400)] 
Remove regcache_raw_write

Remove regcache_raw_write, update all callers to use regcache::raw_write
instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_write): Remove, update callers to use
regcache::raw_write instead.
* regcache.c (regcache_raw_write): Remove.

5 years agoRemove regcache_raw_read
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)] 
Remove regcache_raw_read

Remove regcache_raw_read, update all callers to use
readable_regcache::raw_read instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_read): Remove, update callers to use
readable_regcache::raw_read instead.
* regcache.c (regcache_raw_read): Remove.

5 years agoRemove regcache_raw_update
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)] 
Remove regcache_raw_update

Remove regcache_raw_update, update callers to use
readable_regcache::raw_update instead.

gdb/ChangeLog:

* regcache.h (regcache_raw_update): Remove, update callers to
use readable_regcache::raw_update instead.
* regcache.c (regcache_raw_update): Remove.

5 years agoRemove regcache_register_status
Simon Marchi [Wed, 30 May 2018 18:54:35 +0000 (14:54 -0400)] 
Remove regcache_register_status

Remove regcache_register_status, change callers to use
reg_buffer::get_register_status directly.

gdb/ChangeLog:

* regcache.h (regcache_register_status): Remove, update callers
to use reg_buffer::get_register_status directly instead.
* regcache.c (regcache_register_status): Remove.

5 years agoRemove regcache_get_ptid
Simon Marchi [Wed, 30 May 2018 18:54:34 +0000 (14:54 -0400)] 
Remove regcache_get_ptid

Remove regcache_get_ptid, change all callers to call the regcache method
directly.

gdb/ChangeLog:

* regcache.h (regcache_get_ptid): Remove, update all callers to
call regcache::ptid instead.
* regcache.c (regcache_get_ptid): Remove.

5 years agoAdd option to ar's 't' command to display the offset of elements within the archive.
Ant Bikeneev [Wed, 30 May 2018 16:06:26 +0000 (17:06 +0100)] 
Add option to ar's 't' command to display the offset of elements within the archive.

PR 23107
* ar.c (display_offsets): New variable.
(usage): Add description of 'O' operator.
(decode_option): Handle 'O' operator.
(print_descr): Pass display_offsets to print_arelt_descr.
* arsup.c: Update call to printy_arelt_descr.
* objdump.c: Likewise.
* bucomm.c (print_arelt_descr): If offsets parameter is true then
display offset of archive element within the archive.
* bucomm.h: Update prototype for print_arelt_descr.
* doc/binutils.texi: Update description of ar command.
* NEWS: Mention the new feature.
* testsuite/binutils-all/ar.exp: Add text of new feature.

5 years agoAdd or1k target to --enable-targets=all
Simon Marchi [Wed, 30 May 2018 16:04:35 +0000 (12:04 -0400)] 
Add or1k target to --enable-targets=all

The or1k-tdep.o object is missing from the ALL_TARGET_OBS, which means
it's not currently included in an --enable-targets=all build.

gdb/ChangeLog:

* Makefile.in (ALL_TARGET_OBS): Add or1k-tdep.o.

5 years ago2018-05-30 Amaan Cheval <amaan.cheval@gmail.com>
Amaan Cheval [Fri, 18 May 2018 20:20:40 +0000 (01:50 +0530)] 
2018-05-30  Amaan Cheval <amaan.cheval@gmail.com>

* config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
This is needed to generate UEFI application image files from ELFs.

5 years agoMark END_CATCH as ATTRIBUTE_NORETURN (-Wmaybe-uninitialized warnings)
Pedro Alves [Wed, 30 May 2018 13:18:47 +0000 (14:18 +0100)] 
Mark END_CATCH as ATTRIBUTE_NORETURN (-Wmaybe-uninitialized warnings)

This commit fixes a set of -Wmaybe-uninitialized warnings in GDB and
GDBserver, seen with GCC 7.3.1 on F27 at -O2.  Specifically, all of
these:

 src/gdb/breakpoint.c:5040:4: warning: â€˜e’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/cli/cli-cmds.c:277:71: warning: â€˜tracker’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/cli/cli-cmds.c:302:22: warning: â€˜word’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/gdbserver/server.c:1895:7: warning: â€˜result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 src/gdb/gdbserver/server.c:1966:7: warning: â€˜result’ may be used uninitialized in this function [-Wmaybe-uninitialized]

For example, looking at one of the gdbserver ones in more detail:

 ../../../src/gdb/gdbserver/server.c: In function â€˜int handle_qxfer_btrace_conf(const char*, gdb_byte*, const gdb_byte*, ULONGEST, LONGEST)’:
 ../../../src/gdb/gdbserver/server.c:1966:7: warning: â€˜result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (result != 0)
^~

In this case (like the others), the 'result' variable is assigned in
both TRY and CATCH blocks:

      TRY
        {
          result = target_read_btrace_conf (thread->btrace, &cache);
          if (result != 0)
            memcpy (own_buf, cache.buffer, cache.used_size);
        }
      CATCH (exception, RETURN_MASK_ERROR)
        {
          sprintf (own_buf, "E.%s", exception.message);
          result = -1;
        }
      END_CATCH

      if (result != 0)
        return -3;

so it would seem like the warning is bogus.

However, END_CATCH is really a catch block in disguise, and that path
indeed does not initialize the variable:

#define END_CATCH \
    catch (...) \
      { \
exception_rethrow (); \
      } \
  }

exception_rethrow does not return normally (it rethrows the current
exception after running cleanups), but the compiler can not see that.
If it could return normally, then indeed 'result' could be used
uninitialized if the TRY block threw some non-gdb exception, which
would be caught by END_CATCH.

The fix it to let the compiler know that the exception_rethrow does
not return normally, using ATTRIBUTE_NORETURN.

gdb/ChangeLog:
2018-05-30  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.h (exception_rethrow): Use
ATTRIBUTE_NORETURN.

5 years agoAdd znver2 support.
Amit Pawar [Wed, 30 May 2018 06:57:35 +0000 (12:27 +0530)] 
Add znver2 support.

gas/
* config/tc-i386.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* doc/c-i386.texi : Document znver2.
* gas/testsuite/gas/i386/arch-13.s: Updated for znver2.
* gas/testsuite/gas/i386/arch-13.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver1.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver2.d: New file.
* gas/testsuite/gas/i386/x86-64-arch-3.s: Updated for znver2.
* gas/testsuite/gas/i386/x86-64-arch-3.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver1.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver2.d: New file.
* gas/testsuite/gas/i386/i386.exp: Updated for new test.

opcode/
* i386-gen.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* i386-init.h : Regenerated.

5 years agoRemove "struct" keyword in range-based for loops
Simon Marchi [Wed, 30 May 2018 00:13:04 +0000 (20:13 -0400)] 
Remove "struct" keyword in range-based for loops

I get this kind of errors with GCC 6.3.0:

/home/simark/src/binutils-gdb/gdb/breakpoint.c: In function 'void print_solib_event(int)':
/home/simark/src/binutils-gdb/gdb/breakpoint.c:4618:12: error: types may not be defined in a for-range-declaration [-Werror]
       for (struct so_list *iter : current_program_space->added_solibs)
            ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

* breakpoint.c (print_solib_event, check_status_catch_solib):
Remove struct keyword in range-based for loops.
* dbxread.c (find_corresponding_bincl_psymtab): Likewise.
* dwarf2read.c (compute_delayed_physnames, rust_union_quirks);
Likewise.
* linespec.c (find_superclass_methods, search_minsyms_for_name):
Likewise.
* symfile.c (addr_info_make_relative): Likewise.
* thread.c (value_in_thread_stack_temporaries): Likewise.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 May 2018 00:01:00 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoRemoving lookup_minimal_symbol_and_objfile
Weimin Pan [Tue, 29 May 2018 22:01:34 +0000 (22:01 +0000)] 
Removing lookup_minimal_symbol_and_objfile

Function lookup_minimal_symbol_and_objfile iterates on all objfiles and
calls lookup_minimal_symbol for each of them, effectively searching in all
objfiles.  lookup_bound_minimal_symbol calls lookup_minimal_symbol with NULL,
which also effectively searches all objfiles.  AFAIK, they do exactly the same
thing, so we can get rid of one (and lookup_minimal_symbol_and_objfile happens
to be the most inefficient because it ends up n^2 on the number of objfiles).

Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.

5 years agoFix fall-through comment in windows-nat.c
Tom Tromey [Tue, 29 May 2018 03:26:50 +0000 (21:26 -0600)] 
Fix fall-through comment in windows-nat.c

Now that the mingw builder in the buildbot is working again, it
pointed out a build failure due to a missing fall-through comment in
windows-nat.c.  This patch fixes the problem.

Tested by first triggering the failure with a local mingw build, then
by rebuilding successfully with the patch.

I'm checking this in as obvious.

gdb/ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* windows-nat.c (handle_exception): Update fall-through comment.

5 years agoChange program_space::added_solibs to a std::vector
Tom Tromey [Tue, 29 May 2018 06:38:23 +0000 (00:38 -0600)] 
Change program_space::added_solibs to a std::vector

This changes program_space::added_solibs to a std::vector, removing a
VEC.

Tested by the buildbot.

gdb/ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* progspace.h (so_list_ptr): Remove typedef.  Don't declare VEC.
(struct program_space) <added_solibs>: Now a std::vector.
* breakpoint.c (print_solib_event): Update.
(check_status_catch_solib): Update.
* progspace.c (clear_program_space_solib_cache): Update.
* solib.c (update_solib_list): Update.

5 years agoRemove a VEC from type.c
Tom Tromey [Tue, 29 May 2018 06:29:23 +0000 (00:29 -0600)] 
Remove a VEC from type.c

This removes a VEC from type.c, by using std::vector.

While doing this I also took the opportunity to change
types_deeply_equal to return bool.  This caught some weird code in
typy_richcompare, now fixed.

And, since I was changing types_deeply_equal, it seemed like a good
idea to also change types_equal, so this patch includes that as well.

Tested by the buildbot.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* python/py-type.c (typy_richcompare): Update.
* guile/scm-type.c (tyscm_equal_p_type_smob): Update.
* gdbtypes.h (types_deeply_equal): Return bool.
(types_equal): Likewise.
* gdbtypes.c (type_equality_entry_d): Remove typedef.  Don't
declare VEC.
(check_types_equal): Change worklist to std::vector.  Return
bool.
(struct type_equality_entry): Add constructor.
(compare_maybe_null_strings): Return bool.
(check_types_worklist): Return bool.  Change worklist to
std::vector.
(types_deeply_equal): Use std::vector.
(types_equal): Return bool.
(compare_maybe_null_strings): Simplify.

5 years agoRemove tp_t typedef
Tom Tromey [Tue, 29 May 2018 06:16:01 +0000 (00:16 -0600)] 
Remove tp_t typedef

The tp_t typedef is no longer used and can be removed.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* record-btrace.c (tp_t): Remove typedef.  Don't declare VEC.

5 years agoRemove const_char_ptr typedef
Tom Tromey [Tue, 29 May 2018 06:14:58 +0000 (00:14 -0600)] 
Remove const_char_ptr typedef

The const_char_ptr is no longer used, so it can be removed.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

* objc-lang.h: Don't include cp-support.h.
* common/gdb_vecs.h (const_char_ptr): Remove typedef.  Don't
declare VEC.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 May 2018 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agox86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout
H.J. Lu [Mon, 28 May 2018 17:46:16 +0000 (10:46 -0700)] 
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout

ENDBR64 is added to the special TLSDESC entry, which is similar to the
PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel
CET.  The NaCl PLT is different from the normal PLT.  This patch adds
plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both
normal and NaCl TLSDESC entries.  This fixed

FAIL: TLS descriptor -fpic -shared transitions

for x86_64-nacl.

* elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end for TLSDESC entry.
(elf_i386_lazy_ibt_plt): Likewise.
(elf_i386_nacl_plt): Likewise.
* elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ...
(elf_x86_64_tlsdesc_plt_entry): This.
(elf_x86_64_lazy_plt): Add plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end for TLSDESC entry.
(elf_x86_64_lazy_bnd_plt): Likewise.
(elf_x86_64_lazy_ibt_plt): Likewise.
(elf_x32_lazy_ibt_plt): Likewise.
(elf_x86_64_nacl_plt): Likewise.
(elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to update TLSDESC entry.
* elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments.
Add plt_tlsdesc_entry, plt_tlsdesc_entry_size,
plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset,
plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end.
(elf_x86_non_lazy_plt_layout): Update comments.
(elf_x86_plt_layout): Likewise.

5 years agold: Unify STT_GNU_IFUNC handling
H.J. Lu [Mon, 28 May 2018 15:15:06 +0000 (08:15 -0700)] 
ld: Unify STT_GNU_IFUNC handling

Take STT_GNU_IFUNC handling scattered across targets and gather it in
the generic ELF linker.

bfd/

PR ld/23238
* elf-s390-common.c (elf_s390_add_symbol_hook): Removed.
* elf32-arc.c (elf_arc_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-s390.c (elf_backend_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf64-s390.c (elf_backend_add_symbol_hook): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
* elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC
handling.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* elflink.c (elf_link_add_object_symbols): Set
elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols.

ld/

PR ld/23238
* testsuite/ld-ifunc/ifunc-26.d: New file.
* testsuite/ld-ifunc/ifunc-26.s: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Run *.d tests without a
working compiler.

5 years agold: Skip some x86 IFUNC tests for NaCl targets
H.J. Lu [Mon, 28 May 2018 15:05:09 +0000 (08:05 -0700)] 
ld: Skip some x86 IFUNC tests for NaCl targets

Since NaCl linker may not support "-m elf_i386" nor "-m elf_x86_64", skip
x86 IFUNC tests for NaCl targets where "-m elf_i386" or "-m elf_x86_64"
are passed to linker.

* testsuite/ld-ifunc/ifunc-10-i386.d: Skip NaCl targets.
* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.

5 years agoPR23235, make check uses system installed ld
Alan Modra [Mon, 28 May 2018 07:00:23 +0000 (16:30 +0930)] 
PR23235, make check uses system installed ld

This patch doesn't stop the build-id and debuglink tests using the
installed ld, it just prevents a compiler failure from resulting in a
test fail.  We could move the tests to the ld testsuite but it doesn't
seem all that important.

PR 23235
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Return
unsupported rather than fail on compile errors.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.  Save and restore CFLAGS_FOR_TARGET.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 May 2018 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoRemove last reference to REMOTE_OBS
Tom Tromey [Sun, 27 May 2018 19:05:03 +0000 (13:05 -0600)] 
Remove last reference to REMOTE_OBS

REMOTE_OBS was removed from Makefile.in in
18ca73470a0d7eb96a807c97559cbb9fddb4b461, but one reference remains.
This patch removes the lingerer.

ChangeLog
2018-05-27  Tom Tromey  <tom@tromey.com>

* Makefile.in (DEPFILES): Don't reference REMOTE_OBS.

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 May 2018 00:01:17 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agold: Add _bfd_elf_link_hide_sym_by_version
H.J. Lu [Sat, 26 May 2018 11:27:09 +0000 (04:27 -0700)] 
ld: Add _bfd_elf_link_hide_sym_by_version

bfd_hide_sym_by_version can't be used to check if a versioned symbol is
hidden.  This patch adds _bfd_elf_link_hide_sym_by_version to support
both versioned and unversioned symbols by extracting versioned symbol
check from _bfd_elf_link_assign_sym_version.

bfd/

PR ld/23194
* elf-bfd.h (_bfd_elf_link_hide_sym_by_version): New.
* elflink.c (_bfd_elf_link_hide_versioned_symbol): New function.
Extracted from _bfd_elf_link_assign_sym_version.
(_bfd_elf_link_hide_sym_by_version): New function.
(_bfd_elf_link_assign_sym_version): Use
_bfd_elf_link_hide_versioned_symbol.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Call
_bfd_elf_link_hide_sym_by_version instead of
bfd_hide_sym_by_version.  Don't check unversioned symbol.

ld/

PR ld/23194
* testsuite/ld-i386/pr23194.d: Expect only R_386_GLOB_DAT
against foobar.
* testsuite/ld-i386/pr23194.map: Add foobar.
* testsuite/ld-x86-64/pr23194.map: Likewise.
* testsuite/ld-i386/pr23194.s: Add a common foobar symbol.
* testsuite/ld-x86-64/pr23194.s: Likewise.
* testsuite/ld-x86-64/pr23194.d: Expect only R_X86_64_GLOB_DAT
against foobar.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 May 2018 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoClear entire "location" in value constructor
Tom Tromey [Tue, 10 Apr 2018 14:24:43 +0000 (08:24 -0600)] 
Clear entire "location" in value constructor

My recent change to allocate values with "new" may have introduced a
small bug.  In particular, the previous code allocated with XCNEW, but
the new code only clears a part of the "location" field in the
constructor.  I didn't try very hard to actually trigger a bug here,
the problem remains theoretical.

This patch just arranges to initialize the entire location.

Regression tested by the buildbot.

2018-05-25  Tom Tromey  <tom@tromey.com>

* value.c (value::location): Initialize.

5 years agoRemove cleanups from dbxread.c
Tom Tromey [Fri, 25 May 2018 04:09:24 +0000 (22:09 -0600)] 
Remove cleanups from dbxread.c

This removes the remaining cleanups from dbxread.c, via std::vector,
scoped_restore, and unique_xmalloc_ptr.

Tested by the buildbot.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* dbxread.c (init_bincl_list): Remove.
(bincl_list): Now a std::vector.
(bincls_allocated, next_bincl): Remove.
(free_bincl_list, do_free_bincl_list_cleanup)
(make_cleanup_free_bincl_list): Remove.
(dbx_read_symtab, elfstab_build_psymtabs): Use scoped_restore,
unique_xmalloc_ptr.
(find_corresponding_bincl_psymtab, read_dbx_symtab): Update.
(struct header_file_location): Add constructor.
(add_bincl_to_list): Remove.

5 years agoAdd "name" method to class interp
Tom Tromey [Fri, 25 May 2018 18:39:51 +0000 (12:39 -0600)] 
Add "name" method to class interp

In a review Pedro pointed out that interp::name is intended to be
read-only, and so an accessor would be a better fit.  This patch
renames the field and adds a "name" method that is used instead.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_enable): Update.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (class interp) <name>: New method.
<m_name>: Rename from name.
(~scoped_restore_interp): Update.
* interps.c (interp::interp): Update.
(interp_add, interp_set, interp_lookup_existing)
(current_interp_named_p): Update.

5 years agoRemove interp_name
Tom Tromey [Mon, 30 Apr 2018 05:12:07 +0000 (23:12 -0600)] 
Remove interp_name

This removes the interp_name function.  It is only used a few spots --
one of which was only calling it on "this".  It's simpler to remove
it; and should class interp become opaque in the future, it will be
just as easy to update the two remaining spots to use an accessor.

ChangeLog
2018-05-25  Tom Tromey <tom@tromey.com>

* interps.c (interp_name): Remove.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (interp_name): Remove.
(~scoped_restore_interp): Update.
* tui/tui.c (tui_enable): Update.

5 years agoRemove interp_ui_out
Tom Tromey [Mon, 30 Apr 2018 05:12:06 +0000 (23:12 -0600)] 
Remove interp_ui_out

The function interp_ui_out simply calls the interp_ui_out method.
However, if it is passed a NULL interpreter, it first finds the
current interpreter.  I believe, though, that NULL is never passed
here, and I think it's simpler to just remove this function and
require callers to be more explicit.

ChangeLog
2018-05-25  Tom Tromey <tom@tromey.com>

* utils.c (fputs_maybe_filtered): Update.
* linespec.c (decode_line_full): Update.
* mi/mi-interp.c (mi_on_normal_stop_1, mi_tsv_modified)
(mi_print_breakpoint_for_event, mi_solib_loaded)
(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
(mi_user_selected_context_changed): Update.
* mi/mi-main.c (mi_execute_command): Update.
* cli/cli-script.c (execute_control_command): Update.
* python/python.c (execute_gdb_command): Update.
* solib.c (info_sharedlibrary_command): Update.
* interps.c (interp_ui_out): Remove.
* interps.h (interp_ui_out): Remove.

5 years agoChange the as_*_interp functions to use dynamic_cast
Tom Tromey [Mon, 30 Apr 2018 05:12:05 +0000 (23:12 -0600)] 
Change the as_*_interp functions to use dynamic_cast

This changes the various as_*_interp functions to be implemented using
dynamic_cast.  I believe this is a small improvement, because it is
more typesafe -- the C++ runtime does the type-checking for us.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* tui/tui-interp.c (as_tui_interp): Use dynamic_cast.
* mi/mi-interp.c (as_mi_interp): Use dynamic_cast.
* cli/cli-interp.c (as_cli_interp): Use dynamic_cast.

5 years agoUse scoped_restore in a couple of interp-related places
Tom Tromey [Mon, 30 Apr 2018 05:12:04 +0000 (23:12 -0600)] 
Use scoped_restore in a couple of interp-related places

While looking through the "interp" code I found a couple of spots that
could use scoped_restore.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* cli/cli-interp.c (safe_execute_command): Use scoped_restore.
* interps.c (interp_exec): Use scoped_restore.

5 years agoUse gdb::byte_vector in remote.c
Tom Tromey [Fri, 25 May 2018 03:52:54 +0000 (21:52 -0600)] 
Use gdb::byte_vector in remote.c

This changes a couple of spots in remote.c to use gdb::byte_vector,
allowing for some cleanup removal.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* remote.c (remote_target::remote_file_get): Use
gdb::byte_vector.
(remote_target::remote_file_put): Likewise.

5 years agoRemove cleanups from coff-pe-read.c
Tom Tromey [Fri, 25 May 2018 04:32:24 +0000 (22:32 -0600)] 
Remove cleanups from coff-pe-read.c

This removes cleanups from coff-pe-read.c, using std::string,
std::vector, and gdb::def_vector.

Tested by the buildbot, though I'm not sure these code paths are
exercised there.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* coff-pe-read.c (struct read_pe_section_data) <section_name>: Now
a std::string.
(get_pe_section_index, add_pe_exported_sym): Update.
(read_pe_exported_syms): Use gdb::def_vector.

5 years agoUse TRY/CATCH in remove_prev_frame
Tom Tromey [Fri, 25 May 2018 00:23:37 +0000 (18:23 -0600)] 
Use TRY/CATCH in remove_prev_frame

This changes remove_prev_frame to use TRY/CATCH instead of a cleanup.
TRY/CATCH seemed appropriate here because the cleanup is only needed
in the case where an exception is thrown.

Tested by the buildbot.

ChangeLog
2018-05-25  Tom Tromey  <tom@tromey.com>

* frame.c (remove_prev_frame): Remove.
(get_prev_frame_if_no_cycle): Use TRY/CATCH.

5 years agoMIPS/Linux: Correct o32 core file FGR interpretation
Maciej W. Rozycki [Fri, 25 May 2018 11:37:45 +0000 (12:37 +0100)] 
MIPS/Linux: Correct o32 core file FGR interpretation

Our interpretation of the layout of floating-point general registers
(FGRs) in o32 MIPS/Linux core files is different from how the kernel
makes them, affecting the CP0 Status.FR=0 aka FP32 mode (we don't
currently support the CP0 Status.FR=1 aka FP64 mode with the o32 ABI).

In the FP32 mode pairs of consecutive even/odd-numbered 32-bit registers
are placed together as 64-bit values in even-indexed 64-bit slots
corresponding to the even index, leaving the odd-indexed 64-bit slots
unused.  These 64-bit values are stored according to the endianness in
effect, which is how the MIPS II SDC1 instruction would store them.

It has always been like that with the Linux kernel for MIPS II and
higher ISA processors, which are the vast majority ever supported, as it
is indeed SDC1 that the kernel uses to store FGRs in a floating-point
context.

With MIPS I processors, which lack the SDC1 instruction, a layout that
we expect used to be used long ago, but it was corrected for consistency
with newer processors back in 2002, with `linux-mips.org' (LMO) commit
42533948caac ("Major pile of FP emulator changes."), the fix corrected
with LMO commit 849fa7a50dff ("R3k FPU ptrace() handling fixes."), and
then broken and fixed over and over again, until last time fixed with
commit 80cbfad79096 ("MIPS: Correct MIPS I FP context layout").

Consequently the values we see in FP32 core files or produce with the
`gcore' command are different from those obtained from the same FP
context of a live process, e.g. with a big-endian configuration these
live values:

(gdb) info registers float
f0:  0x4b5c6d7e flt: 14445950          dbl: 1.7446153562345001e-274
f1:  0x0718293a flt: 1.14473244e-34
f2:  0xc3d4e5f6 flt: -425.79657        dbl: -1.046160437414959e-233
f3:  0x8f90a1b2 flt: -1.42617791e-29
f4:  0x4c5d6e7f flt: 58046972          dbl: 1.1908587841220294e-269
f5:  0x08192a3b flt: 4.60914044e-34
f6:  0xc4d5e6f7 flt: -1711.21765       dbl: -6.2784661835068965e-306
f7:  0x8091a2b3 flt: -1.33745124e-38
f8:  0x45566778 flt: 3430.4668         dbl: 1.6530355595710607e-303
f9:  0x01122334 flt: 2.68412219e-38
f10: 0xcddeeff0 flt: -467533312        dbl: -2.1174864564135575e-262
f11: 0x899aabbc flt: -3.72356497e-33
f12: 0x46576879 flt: 13786.1182        dbl: 1.143296486773654e-298
f13: 0x02132435 flt: 1.08102453e-37
f14: 0xcedfe0f1 flt: -1.87803046e+09   dbl: -1.4399511533369862e-257
f15: 0x8a9bacbd flt: -1.4990934e-32
f16: 0x4758697a flt: 55401.4766        dbl: 7.8856820439568725e-294
f17: 0x03142536 flt: 4.3536007e-37
f18: 0xcfd0e1f2 flt: -7.00893696e+09   dbl: -9.7791926757340559e-253
f19: 0x8b9cadbe flt: -6.03504325e-32
f20: 0x48596a7b flt: 222633.922        dbl: 5.4255001483306113e-289
f21: 0x04152637 flt: 1.75324132e-36
f22: 0xc0d1e2f3 flt: -6.55895376       dbl: -6.6332401002310683e-248
f23: 0x8c9daebf flt: -2.42948516e-31
f24: 0x495a6b7c flt: 894647.75         dbl: 3.7244369058749787e-284
f25: 0x05162738 flt: 7.06016945e-36
f26: 0xc1d2e3f4 flt: -26.3613052       dbl: -4.4941535759306202e-243
f27: 0x8d9eafb0 flt: -9.77979703e-31
f28: 0x4a5b6c7d flt: 3595039.25        dbl: 2.5514593711161396e-279
f29: 0x06172839 flt: 2.84294945e-35
f30: 0xc2d3e4f5 flt: -105.947182       dbl: -3.035646690850097e-238
f31: 0x8e9fa0b1 flt: -3.93512664e-30
fcsr: 0x0
fir: 0xf30000
(gdb)

show up in a core file as these:

(gdb) info registers float
f0:  0x0718293a flt: 1.14473244e-34    dbl: nan
f1:  0x7ff80000 flt: nan
f2:  0x8f90a1b2 flt: -1.42617791e-29   dbl: nan
f3:  0x7ff80000 flt: nan
f4:  0x08192a3b flt: 4.60914044e-34    dbl: nan
f5:  0x7ff80000 flt: nan
f6:  0x8091a2b3 flt: -1.33745124e-38   dbl: nan
f7:  0x7ff80000 flt: nan
f8:  0x01122334 flt: 2.68412219e-38    dbl: nan
f9:  0x7ff80000 flt: nan
f10: 0x899aabbc flt: -3.72356497e-33   dbl: nan
f11: 0x7ff80000 flt: nan
f12: 0x02132435 flt: 1.08102453e-37    dbl: nan
f13: 0x7ff80000 flt: nan
f14: 0x8a9bacbd flt: -1.4990934e-32    dbl: nan
f15: 0x7ff80000 flt: nan
f16: 0x03142536 flt: 4.3536007e-37     dbl: nan
f17: 0x7ff80000 flt: nan
f18: 0x8b9cadbe flt: -6.03504325e-32   dbl: nan
f19: 0x7ff80000 flt: nan
f20: 0x04152637 flt: 1.75324132e-36    dbl: nan
f21: 0x7ff80000 flt: nan
f22: 0x8c9daebf flt: -2.42948516e-31   dbl: nan
f23: 0x7ff80000 flt: nan
f24: 0x05162738 flt: 7.06016945e-36    dbl: nan
f25: 0x7ff80000 flt: nan
f26: 0x8d9eafb0 flt: -9.77979703e-31   dbl: nan
f27: 0x7ff80000 flt: nan
f28: 0x06172839 flt: 2.84294945e-35    dbl: nan
f29: 0x7ff80000 flt: nan
f30: 0x8e9fa0b1 flt: -3.93512664e-30   dbl: nan
f31: 0x7ff80000 flt: nan
(gdb)

Notice how values from odd-numbered registers are shown in corresponding
even-numbered registers and how dummy 0x7ff80000 NaN values, which the
kernel places in unused slots, are reported in odd-numbered registers.

Correct our intepretation then, to match the kernel's.  As it happens
the o32 FGR core file representation matches that used by the `ptrace'
PTRACE_GETFPREGS request, which means our 64-bit handlers can be readily
used, as they already correctly handle the differences between o32 FP32
mode vs n32/n64 representations.

Adjust comments accordingly throughout, in particular remove a reference
to the r3000/tx39 MIPS I processor peculiarity, long irrelevant.

Add a test case to verify correctness.  Avoid GCC bugs and limitations
in the test case where possible; the test case still fails to build with
GCC 8 and the o32 FP64 mode (i.e. with `-mips32r2 -mfp64' options)
giving:

mips-fpregset-core.c: In function 'main':
mips-fpregset-core.c:66:3: error: inconsistent operand constraints in an 'asm'
   asm (
   ^~~

(GCC PR target/85909), but that is not a concern for us as yet, because
as noted above we do not currently support the o32 FP64 mode anyway.

gdb/
* mips-linux-tdep.h (mips_supply_fpregset, mips_fill_fpregset):
Remove prototypes.
* mips-linux-nat.c (supply_fpregset): Always call
`mips64_supply_fpregset' rather than `mips_supply_fpregset'.
(fill_fpregset): Always call `mips64_fill_fpregset' rather than
`mips_fill_fpregset'.
* mips-linux-tdep.c (mips_supply_fpregset)
(mips_supply_fpregset_wrapper, mips_fill_fpregset)
(mips_fill_fpregset_wrapper): Remove functions.
(mips64_supply_fpregset, mips64_fill_fpregset): Update comments.
(mips_linux_fpregset): Remove variable.
(mips_linux_iterate_over_regset_sections): Use
`mips64_linux_fpregset' in place of `mips_linux_fpregset'.
(mips_linux_o32_sigframe_init): Remove comment.

gdb/testsuite/
* gdb.arch/mips-fpregset-core.exp: New test.
* gdb.arch/mips-fpregset-core.c: New test source.

5 years agoremote_target::m_remote_state, pointer -> object
Pedro Alves [Fri, 25 May 2018 10:58:58 +0000 (11:58 +0100)] 
remote_target::m_remote_state, pointer -> object

The only reason remote_target::m_remote_state is a pointer is that
struct remote_state is incomplete when struct remote_target is
defined.

This commit thus moves struct remote_state (and its dependencies)
higher up and makes remote_target::m_remote_state an object instead of
a pointer.

gdb/ChangeLog:
2018-05-25  Pedro Alves  <palves@redhat.com>

* remote.c (struct vCont_action_support, MAXTHREADLISTRESULTS)
(struct readahead_cache, struct packet_reg, struct
remote_arch_state, class remote_state): Move higher up in the
file.
(remote_target::m_remote_state): Now an object instead of a pointer.
(remote_target::get_remote_state): Adjust.

5 years agos12z regen
Alan Modra [Fri, 25 May 2018 06:35:30 +0000 (16:05 +0930)] 
s12z regen

This patch regenerates a number of files that either were edited by
hand or not regenerated when s12z support was added to binutils.

bfd/
* Makefile.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
ld/
* po/BLD-POTFILES.in: Regenerate.
opcodes/
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.

5 years agoFix hidden visibility compiler test
Alan Modra [Fri, 25 May 2018 05:37:15 +0000 (15:07 +0930)] 
Fix hidden visibility compiler test

Warnings from configure tests aren't usually checked.  gcc's
"visibility attribute not supported in this configuration" warning is
enabled by default so we don't need to add any warning flag except
-Werror.

* configure.ac (bfd_cv_hidden): Run test with -Werror in CFLAGS.
* configure: Regenerate.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 May 2018 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agogdb: Split func_command into two parts.
Andrew Burgess [Sat, 5 May 2018 14:55:58 +0000 (15:55 +0100)] 
gdb: Split func_command into two parts.

The func_command function is used to emulate the dbx 'func' command.
However, finding a stack frame based on function name might be a useful
feature, and so the core of func_command is now split out into a
separate function.

gdb/ChangeLog:

* stack.c (select_and_print_frame): Delete.
(struct function_bounds): Move struct within function.
(func_command): Most content moved into new function
find_frame_for_function, use new function, print result, add
function comment.
(find_frame_for_function): New function, now returns a result.

5 years agoPATCH (obvious): Fix a comment, and pass stream to cb_data.
Philippe Waroquiers [Thu, 24 May 2018 21:19:05 +0000 (23:19 +0200)] 
PATCH (obvious): Fix a comment, and pass stream to cb_data.

iterate_over_block_arg_vars is a void function, so does
not return 1 or 0.
print_frame_arg_vars tells it prints on STREAM,
so pass STREAM in the cb_data, not gdb_stdout.

gdb/ChangeLog

2018-05-24  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* stack.c (iterate_over_block_arg_vars): Fix comment.
(print_frame_arg_vars): Pass stream in cb_data, not gdb_stdout.

5 years agoUpdate help text in record.c
Tom Tromey [Mon, 30 Apr 2018 14:37:31 +0000 (08:37 -0600)] 
Update help text in record.c

This updates some help text in record.c to conform to GNU standards.
I also added a "Usage" line to "record save".

2018-04-29  Tom Tromey  <tom@tromey.com>

* record.c (_initialize_record): Update help text.

5 years agoUpdate help text in linux-fork.c
Tom Tromey [Mon, 30 Apr 2018 14:37:30 +0000 (08:37 -0600)] 
Update help text in linux-fork.c

This updates some help text in linux-fork.c to conform to GNU
standards.

2018-04-29  Tom Tromey  <tom@tromey.com>

* linux-fork.c (_initialize_linux_fork): Update help text.

5 years agoUpdate help text in record-btrace.c
Tom Tromey [Mon, 30 Apr 2018 14:37:29 +0000 (08:37 -0600)] 
Update help text in record-btrace.c

This updates the help text in record-btrace.c to conform to GNU
standards.

2018-04-29  Tom Tromey  <tom@tromey.com>

* record-btrace.c (_initialize_record_btrace): Update help text.

5 years agoUpdate help text in tracepoint.c
Tom Tromey [Mon, 30 Apr 2018 14:37:28 +0000 (08:37 -0600)] 
Update help text in tracepoint.c

This changes the help text of a couple of commands in tracepoint.c to
follow the GNU style.

ChangeLog
2018-04-29  Tom Tromey  <tom@tromey.com>

* tracepoint.c (_initialize_tracepoint): Update help text.

testsuite/ChangeLog
2018-04-30  Tom Tromey  <tom@tromey.com>

* gdb.trace/tfind.exp: Update help tests.

5 years agoUpdate help text in disasm.c
Tom Tromey [Mon, 30 Apr 2018 14:37:27 +0000 (08:37 -0600)] 
Update help text in disasm.c

This changes some help text in disasm.c to follow the GNU style.

2018-04-29  Tom Tromey  <tom@tromey.com>

* disasm.c (_initialize_disasm): Update help text.

5 years agoUpdate help text for "jump" command
Tom Tromey [Mon, 30 Apr 2018 14:37:26 +0000 (08:37 -0600)] 
Update help text for "jump" command

This updates the usage text for the "jump" command to conform to the
GNU style.

2018-04-29  Tom Tromey  <tom@tromey.com>

* infcmd.c (_initialize_infcmd): Update help text.

5 years agoUpdate help text in dcache.c
Tom Tromey [Mon, 30 Apr 2018 14:37:25 +0000 (08:37 -0600)] 
Update help text in dcache.c

This updates some text in dcache.c to follow GNU standards.
Here, I found a couple of spots needing an update.

2018-04-29  Tom Tromey  <tom@tromey.com>

* dcache.c (dcache_info_1): Update usage text.
(_initialize_dcache): Update help text.

5 years agoUpdate help strings in TUI
Tom Tromey [Mon, 30 Apr 2018 14:37:24 +0000 (08:37 -0600)] 
Update help strings in TUI

This updates some help strings in the TUI to more closely follow GNU
standards.  In this case I chose to reuse some existing "usage" macros
in the help text.  Also, I found that XDBWIN_HEIGHT_USAGE is unused,
so I removed it.

ChangeLog
2018-04-29  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (_initialize_tui_layout): Update help text.
* tui/tui-win.c (WIN_HEIGHT_USAGE, FOCUS_USAGE): Update
(XDBWIN_HEIGHT_USAGE): Remove.
(_initialize_tui_win): Use macros.  Update help text.

5 years agoUpdate memattr.c help strings
Tom Tromey [Mon, 30 Apr 2018 14:37:23 +0000 (08:37 -0600)] 
Update memattr.c help strings

This changes memattr.c to use the GNU style for help strings.

2018-04-29  Tom Tromey  <tom@tromey.com>

* memattr.c (_initialize_mem): Update help string.

5 years agoUpdate core-related help strings
Tom Tromey [Mon, 30 Apr 2018 14:37:22 +0000 (08:37 -0600)] 
Update core-related help strings

This updates some help strings in corefile.c and gcore.c.

2018-04-27  Tom Tromey  <tom@tromey.com>

* corefile.c (_initialize_core): Update help string.
* gcore.c (_initialize_gcore): Update help string.

5 years agoUpdate help strings in skip.c
Tom Tromey [Mon, 30 Apr 2018 14:37:21 +0000 (08:37 -0600)] 
Update help strings in skip.c

This changes help strings in skip.c to follow the GNU style.

2018-04-27  Tom Tromey  <tom@tromey.com>

* skip.c (_initialize_step_skip): Update help strings.

5 years agoFix help and documentation for inferior commands
Tom Tromey [Mon, 30 Apr 2018 14:37:20 +0000 (08:37 -0600)] 
Fix help and documentation for inferior commands

This changes inferior.c to add Usage lines for all commands, and to
change how "metasyntactic variables" are written to conform to GNU
style.

While doing this I noticed that the manual doesn't document the
argument to "info inferiors", so I've added that as well.

ChangeLog
2018-04-27  Tom Tromey  <tom@tromey.com>

* inferior.c (initialize_inferiors): Update help strings.

doc/ChangeLog
2018-04-27  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Inferiors and Programs): Document argument to "info
inferiors".

5 years agoRISC-V: Fix .align handling when .option norelax.
Jim Wilson [Thu, 24 May 2018 17:35:59 +0000 (10:35 -0700)] 
RISC-V: Fix .align handling when .option norelax.

gas/
PR gas/23219
* config/tc-riscv.c (riscv_frag_align_code): Move frag_more call after
!riscv_opts.relax check.
(riscv_handle_align): Rewrite !riscv_opts.relax support.
* config/tc-riscv (MAX_MEM_FOR_RS_ALIGN_CODE): Update.
* testsuite/gas/riscv/no-relax-align.d: New
* testsuite/gas/riscv/no-relax-align.s: New
* testsuite/gas/riscv/no-relax-align-2.d: New
* testsuite/gas/riscv/no-relax-align-2.s: New

5 years agogdb: Restore selected frame in print_frame_local_vars
Andrew Burgess [Fri, 18 May 2018 16:45:16 +0000 (17:45 +0100)] 
gdb: Restore selected frame in print_frame_local_vars

PR gdb/23203 reports 'bt full' causing the currently selected frame to
change, this issue is fixed in this commit.

Add a new class scoped_restore_selected_frame that saves and restores
the selected frame.  Make use of this in print_frame_local_vars to
restore the selected frame on exit.

gdb/ChangeLog:

PR gdb/23203
* frame.c
(scoped_restore_selected_frame::scoped_restore_selected_frame):
Define.
(scoped_restore_selected_frame::~scoped_restore_selected_frame):
Define.
* frame.h (class scoped_restore_selected_frame): New class.
* stack.c (print_frame_local_vars): Remove catching and rethrowing
of any exception, use scoped_restore_selected_frame to restore the
frame instead.

gdb/testsuite/ChangeLog:

PR gdb/23203
* gdb.base/bt-selected-frame.c: New file.
* gdb.base/bt-selected-frame.exp: New file.
* lib/gdb.exp (get_current_frame_number): New function.

5 years agotestsuite: Extend TLS core file testing with an OS-generated dump
Maciej W. Rozycki [Thu, 24 May 2018 14:31:32 +0000 (15:31 +0100)] 
testsuite: Extend TLS core file testing with an OS-generated dump

Complementing commit 280ca31f4d60 ("Add test for fetching TLS from
core file") extend gdb.threads/tls-core.exp with an OS-generated dump
where supported.

This verifies not only that our core dump interpreter is consistent
with our producer, but that it matches the OS verified as well,
avoiding a possible case where our interpreter would be bug-compatible
with our producer but not the OS and it would go unnoticed in testing.

This results in:

 PASS: gdb.threads/tls-core.exp: native: load core file
 PASS: gdb.threads/tls-core.exp: native: print thread-local storage variable
 PASS: gdb.threads/tls-core.exp: gcore: load core file
 PASS: gdb.threads/tls-core.exp: gcore: print thread-local storage variable

with local testing and:

 UNSUPPORTED: gdb.threads/tls-core.exp: native: load core file
 UNSUPPORTED: gdb.threads/tls-core.exp: native: print thread-local storage variable
 PASS: gdb.threads/tls-core.exp: gcore: load core file
 PASS: gdb.threads/tls-core.exp: gcore: print thread-local storage variable

with remote testing, or for testing on ports that don't supports
cores.

gdb/testsuite/ChangeLog:
2018-05-24  Maciej W. Rozycki  <macro@mips.com>
    Pedro Alves  <palves@redhat.com>

* gdb.threads/tls-core.c: Include <stdlib.h>
(thread_proc): Call `abort'.
* gdb.threads/tls-core.exp: Generate a core with core_find too.
(tls_core_test): New procedure, bits factored out from ...
(top level): ... here.  Test both native cores and gcore cores.

5 years agoFix macOS build, missing override
Pedro Alves [Thu, 24 May 2018 12:07:53 +0000 (13:07 +0100)] 
Fix macOS build, missing override

Fixes:

In file included from ../../src/gdb/darwin-nat.c:63:0:
../../src/gdb/darwin-nat.h:28:8: error: 'virtual void darwin_nat_target::create_inferior(const char*, const string&, char**, int)' can be marked override [-Werror=suggest-override]
   void create_inferior (const char *exec_file,
        ^

gdb/ChangeLog:
2018-05-24  Pedro Alves  <palves@redhat.com>

* darwin-nat.h (darwin_nat_target::create_inferior): Mark with
override.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 May 2018 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoAdd ATTRIBUTE_NONSTRING to ppc64_elf_write_core_note
H.J. Lu [Wed, 23 May 2018 17:15:11 +0000 (10:15 -0700)] 
Add ATTRIBUTE_NONSTRING to ppc64_elf_write_core_note

This patch silences gcc8 -Wstringop-truncation warnings.

* elf64-ppc.c (ppc64_elf_write_core_note): Add ATTRIBUTE_NONSTRING
to data.

5 years agoRemove struct complaints
Tom Tromey [Thu, 17 May 2018 05:25:09 +0000 (23:25 -0600)] 
Remove struct complaints

struct complaints now just holds a single enum value, so remove it and
symfile_complaint_book and replace it with a global variable.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (struct complaints): Remove.
(symfile_complaint_book): Remove.
(series): New global.
(complaint_internal): Update.
(clear_complaints): Update.

5 years agoRemove struct complain
Tom Tromey [Thu, 17 May 2018 05:22:54 +0000 (23:22 -0600)] 
Remove struct complain

At this point, struct complain is just holds a key, a value, and a
"next" pointer to form a linked list.  It's simpler to replace this
with an unordered map.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (counters): New global.
(struct complain): Remove.
(struct complaints) <root>: Remove.
(complaint_sentinel): Remove.
(symfile_complaint_book): Update.
(find_complaint) Remove.
(complaint_internal, clear_complaints): Update.

gdb/testsuite/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* gdb.gdb/complaints.exp (test_initial_complaints): Simplify.

5 years agoRemove file and line from struct complain
Tom Tromey [Thu, 17 May 2018 05:14:03 +0000 (23:14 -0600)] 
Remove file and line from struct complain

The file and line handling in complaints.c wasn't used once
internal_complaint was removed.  This patch removes all the related
code.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (struct complain) <file, line>: Remove.
(find_complaint): Remove file, line parameters.
(complaint_internal): Update.

5 years agoRemove vcomplaint
Tom Tromey [Thu, 17 May 2018 05:10:51 +0000 (23:10 -0600)] 
Remove vcomplaint

vcomplaint now has a single caller, so merge it with that caller.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (vcomplaint): Remove.
(complaint_internal) Merge in contents of vcomplaint.

5 years agoRemove struct explanation
Tom Tromey [Thu, 17 May 2018 05:05:54 +0000 (23:05 -0600)] 
Remove struct explanation

Now that there's only a single reason for a complaint to be emitted,
this removes "struct explanation" and changes vcomplaint to emit the
desired messages directly.

gdb/ChangeLog
2018-05-23  Tom Tromey  <tom@tromey.com>

* complaints.c (struct complaints) <explanation>: Remove.
(symfile_explanations): Remove.
(symfile_complaint_book): Update.
(vcomplaint): Update.
(struct explanation): Remove.