deliverable/binutils-gdb.git
6 years agox86: simplify control register check
Jan Beulich [Fri, 1 Jun 2018 06:39:08 +0000 (08:39 +0200)] 
x86: simplify control register check

... as is already done elsewhere: There's no need for the use of
operand_type_equal() here - the bit identifying control registers isn't
used for any other purposes.

6 years agox86: tighten condition for emitting LOCK on control register accesses
Jan Beulich [Fri, 1 Jun 2018 06:38:36 +0000 (08:38 +0200)] 
x86: tighten condition for emitting LOCK on control register accesses

The control register is never expressed by REX.B; this bit only affects
the involved GPR. Also only one of the operands can have its "control"
flag set, so only check the correct operand.

6 years agox86/Intel: accept "oword ptr" for INVPCID
Jan Beulich [Fri, 1 Jun 2018 06:37:24 +0000 (08:37 +0200)] 
x86/Intel: accept "oword ptr" for INVPCID

The insn is no different in this reagrd from INVEPT and INVVPID.

6 years agoMake _bfd_error_handler available outside libbfd
Alan Modra [Fri, 1 Jun 2018 01:30:46 +0000 (11:00 +0930)] 
Make _bfd_error_handler available outside libbfd

Needed when building libopcodes.so.

bfd/
* bfd.c (_bfd_error_handler): Arrange for this function to be
declared in bfd-in2.h.
* libbfd-in.h (_bfd_error_handler): Don't declare.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
opcodes/
* sysdep.h (_bfd_error_handler): Don't declare.
* msp430-decode.opc: Include bfd.h.  Don't include ansidecl.h here.
* rl78-decode.opc: Likewise.
* msp430-decode.c: Regenerate.
* rl78-decode.c: Regenerate.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 1 Jun 2018 00:01:00 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoFix "set" handling of Python parameters
Tom Tromey [Thu, 26 Apr 2018 22:51:40 +0000 (16:51 -0600)] 
Fix "set" handling of Python parameters

It's long bothered me that setting a Python parameter from the CLI
will print the "set" help text by default.  I think usually "set"
commands should be silent.  And, while you can modify this behavior a
bit by providing a "get_set_string" method, if this method returns an
empty string, a blank line will be printed.

This patch removes the "help" behavior and changes the get_set_string
behavior to avoid printing a blank line.  The code has a comment about
preserving API behavior, but I don't think this is truly important;
and in any case the workaround -- implementing get_set_string -- is
trivial.

Regression tested on x86-64 Fedora 26.

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

* NEWS: Mention new "set" behavior.
* python/py-param.c (get_set_value): Don't print an empty string.
Don't call get_doc_string.

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

* python.texi (Parameters In Python): Update get_set_string
documentation.

6 years agoAdd basic Python API for convenience variables
Tom Tromey [Sun, 22 Apr 2018 21:13:09 +0000 (15:13 -0600)] 
Add basic Python API for convenience variables

This adds a basic Python API for accessing convenience variables.
With this, convenience variables can be read and set from Python.
Although gdb supports convenience variables whose value changes at
each call, this is not exposed to Python; it could be, but I think
it's just as good to write a convenience function in this situation.

This is PR python/23080.

Tested on x86-64 Fedora 26.

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

PR python/23080:
* NEWS: Update for new functions.
* python/py-value.c (gdbpy_set_convenience_variable)
(gdbpy_convenience_variable): New functions.
* python/python-internal.h (gdbpy_convenience_variable)
(gdbpy_set_convenience_variable): Declare.
* python/python.c (python_GdbMethods): Add convenience_variable,
set_convenience_variable.

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

PR python/23080:
* python.texi (Basic Python): Document gdb.convenience_variable,
gdb.set_convenience_variable.

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

PR python/23080:
* gdb.python/python.exp: Add convenience variable tests.

6 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.

6 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.

6 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.

6 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.

6 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

6 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

6 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

6 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.

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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

6 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.

6 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

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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".

6 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

6 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.

6 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.

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 years agoRemove symfile_complaints
Tom Tromey [Thu, 17 May 2018 04:54:44 +0000 (22:54 -0600)] 
Remove symfile_complaints

The complaint system seems to allow for multiple different complaint
topics.  However, in practice only symfile_complaints has ever been
defined.  Seeing that complaints.c dates to 1992, and that no new
complaints have been added in the intervening years, I think it is
reasonable to admit that complaints are specifically related to
debuginfo reading.

This patch removes symfile_complaints and updates all the callers.
Some of these spots should perhaps be calls to warning instead, but I
did not make that change.

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

* complaints.c (symfile_complaints): Remove.
(complaint_internal): Remove "complaints" parameter.
(clear_complaints, vcomplaint): Remove "c" parameter.
(get_complaints): Remove.
* dwarf2read.c (dwarf2_statement_list_fits_in_line_number_section_complaint)
(dwarf2_debug_line_missing_file_complaint)
(dwarf2_debug_line_missing_end_sequence_complaint)
(dwarf2_complex_location_expr_complaint)
(dwarf2_const_value_length_mismatch_complaint)
(dwarf2_section_buffer_overflow_complaint)
(dwarf2_macro_malformed_definition_complaint)
(dwarf2_invalid_attrib_class_complaint)
(create_addrmap_from_index, dw2_symtab_iter_next)
(dw2_expand_marked_cus)
(dw2_debug_names_iterator::find_vec_in_debug_names)
(dw2_debug_names_iterator::next, dw2_debug_names_iterator::next)
(create_debug_type_hash_table, init_cutu_and_read_dies)
(partial_die_parent_scope, add_partial_enumeration)
(skip_one_die, fixup_go_packaging, quirk_rust_enum, process_die)
(dwarf2_compute_name, dwarf2_physname, read_namespace_alias)
(read_import_statement, read_file_scope, create_dwo_cu_reader)
(create_cus_hash_table, create_dwp_hash_table)
(inherit_abstract_dies, read_func_scope, read_call_site_scope)
(dwarf2_rnglists_process, dwarf2_ranges_process)
(dwarf2_add_type_defn, dwarf2_attach_fields_to_type)
(dwarf2_add_member_fn, get_alignment, maybe_set_alignment)
(handle_struct_member_die, process_structure_scope)
(read_array_type, read_common_block, read_module_type)
(read_tag_pointer_type, read_typedef, read_base_type)
(read_subrange_type, load_partial_dies, partial_die_info::read)
(partial_die_info::read, partial_die_info::read)
(partial_die_info::read, read_checked_initial_length_and_offset)
(dwarf2_string_attr, read_formatted_entries)
(dwarf_decode_line_header)
(lnp_state_machine::check_line_address, dwarf_decode_lines_1)
(new_symbol, dwarf2_const_value_attr, lookup_die_type)
(read_type_die_1, determine_prefix, dwarf2_get_ref_die_offset)
(dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes)
(get_signatured_type, get_DW_AT_signature_type)
(decode_locdesc, file_file_name, consume_improper_spaces)
(skip_form_bytes, skip_unknown_opcode, dwarf_parse_macro_header)
(dwarf_decode_macro_bytes, dwarf_decode_macros)
(dwarf2_symbol_mark_computed, set_die_type)
(read_attribute_value): Update.
* stap-probe.c (handle_stap_probe, get_stap_base_address):
Update.
* dbxread.c (unknown_symtype_complaint)
(lbrac_mismatch_complaint, repeated_header_complaint)
(set_namestring, function_outside_compilation_unit_complaint)
(read_dbx_symtab, process_one_symbol): Update.
* gdbtypes.c (stub_noname_complaint): Update.
* windows-nat.c (handle_unload_dll): Update.
* coffread.c (coff_symtab_read, enter_linenos, decode_type)
(decode_base_type): Update.
* xcoffread.c (bf_notfound_complaint, ef_complaint)
(eb_complaint, record_include_begin, record_include_end)
(enter_line_range, xcoff_next_symbol_text, read_xcoff_symtab)
(process_xcoff_symbol, read_symbol)
(function_outside_compilation_unit_complaint)
(scan_xcoff_symtab): Update.
* machoread.c (macho_symtab_read, macho_add_oso_symfile): Update.
* buildsym.c (finish_block_internal, make_blockvector)
(end_symtab_get_static_block, augment_type_symtab): Update.
* dtrace-probe.c (dtrace_process_dof)
(dtrace_static_probe_ops::get_probes): Update.
* complaints.h (struct complaint): Don't declare.
(symfile_complaints): Remove.
(complaint_internal): Remove "complaints" parameter.
(complaint): Likewise.
(clear_complaints): Likewise.
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program)
(dwarf2_frame_cache, decode_frame_entry): Update.
* dwarf2loc.c (dwarf_reg_to_regnum): Update.
* objc-lang.c (lookup_objc_class, lookup_child_selector)
(info_selectors_command): Update.
* macrotab.c (macro_include, check_for_redefinition)
(macro_undef): Update.
* objfiles.c (filter_overlapping_sections): Update.
* stabsread.c (invalid_cpp_abbrev_complaint)
(reg_value_complaint, stabs_general_complaint, dbx_lookup_type)
(define_symbol, error_type, read_type, rs6000_builtin_type)
(stabs_method_name_from_physname, read_member_functions)
(read_cpp_abbrev, read_baseclasses, read_tilde_fields)
(attach_fields_to_type, complain_about_struct_wipeout)
(read_range_type, read_args, common_block_start)
(common_block_end, cleanup_undefined_types_1, scan_file_globals):
Update.
* mdebugread.c (index_complaint, unknown_ext_complaint)
(basic_type_complaint, bad_tag_guess_complaint)
(bad_rfd_entry_complaint, unexpected_type_code_complaint)
(reg_value_complaint, parse_symbol, parse_type, upgrade_type)
(parse_procedure, parse_lines)
(function_outside_compilation_unit_complaint)
(parse_partial_symbols, psymtab_to_symtab_1, cross_ref)
(bad_tag_guess_complaint, reg_value_complaint): Update.
* cp-support.c (demangled_name_complaint): Update.
* macroscope.c (sal_macro_scope): Update.
* dwarf-index-write.c (class debug_names): Update.

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

* gdb.gdb/complaints.exp (test_initial_complaints): Don't mention
symfile_complaints.
(test_short_complaints): Likewise.
(test_empty_complaints): Likewise.
(test_initial_complaints): Update.

6 years agoRemove "noisy" parameter from clear_complaints
Tom Tromey [Thu, 17 May 2018 04:27:50 +0000 (22:27 -0600)] 
Remove "noisy" parameter from clear_complaints

After the previous patch, the "noisy" parameter to clear_complaints is
no longer used, so this patch removes it.

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

* complaints.c (clear_complaints): Remove "noisy" parameter.
* complaints.h (clear_complaints): Update.
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.

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

* gdb.gdb/complaints.exp (test_empty_complaints): Update.

6 years agoRemove elements from complaint_series
Tom Tromey [Thu, 17 May 2018 04:23:09 +0000 (22:23 -0600)] 
Remove elements from complaint_series

I couldn't find a way to get complaints to use a couple of cases, and
the difference between the actual printed output for these cases was
minimal anyway.  So, this patch removes a couple of constants from
complaint_series, plus the associated code.

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

* complaints.c (enum complaint_series): Remove FIRST_MESSAGE,
SUBSEQUENT_MESSAGE.
(vcomplaint, clear_complaints): Update.
(symfile_explanations): Remove some messages.

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

* gdb.gdb/complaints.exp (test_serial_complaints): Remove.
(test_short_complaints): Update.

6 years agoRemove internal_complaint
Tom Tromey [Wed, 16 May 2018 21:09:32 +0000 (15:09 -0600)] 
Remove internal_complaint

I happened to notice that gdb has both complaint_internal and
internal_complaint.  The latter is unused, so this patch removes it.

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

* complaints.c (internal_complaint): Remove.
* complaints.h (internal_complaint): Remove.

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