binutils-gdb.git
7 years agoFix --enable-new-dtags config support
Alan Modra [Mon, 5 Jun 2017 05:13:54 +0000 (14:43 +0930)]
Fix --enable-new-dtags config support

and testsuite when configured with --enable-new-dtags.

* ldmain.c (main): Correct setting of link_indo.new_dtags.
* testsuite/ld-elf/now-3.d: Pass --disable-new-dtags to ld
* testsuite/ld-elf/now-4.d: Likewise.
* testsuite/ld-elf/rpath-1.d: Likewise.
* testsuite/ld-elf/rpath-2.d: Likewise.

7 years agoIntroduce --enable-new-dtags configure option.
Slava Barinov [Sun, 4 Jun 2017 23:57:38 +0000 (09:27 +0930)]
Introduce --enable-new-dtags configure option.

This option switches on ld.bfd --enable-new-dtags by default.

* configure.ac: Add --enable-new-dtags option.
* ldmain.c: Set link_info.new_dtags to 1 if when --enable-new-dtags is
switched on.
* configure: Regenerate.
* config.in: Regenerate.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Jun 2017 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoDocument the GDB 8.0 release in gdb/ChangeLog
Joel Brobecker [Sun, 4 Jun 2017 16:04:09 +0000 (09:04 -0700)]
Document the GDB 8.0 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 8.0 released.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 4 Jun 2017 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agox86-linux-nat: Remove unused arch_lwp_info structure
Simon Marchi [Sat, 3 Jun 2017 20:06:55 +0000 (22:06 +0200)]
x86-linux-nat: Remove unused arch_lwp_info structure

The structure arch_lwp_info for x86 is not used, remove it.

gdb/ChangeLog:

* x86-linux-nat.c (struct arch_lwp_info): Remove.

7 years agolinux-nat: Remove unused parameter
Simon Marchi [Sat, 3 Jun 2017 19:24:00 +0000 (21:24 +0200)]
linux-nat: Remove unused parameter

The parameter "first" of linux_nat_post_attach_wait is unused, remove
it.

gdb/ChangeLog:

* linux-nat.c (linux_nat_post_attach_wait): Remove FIRST
parameter.
(linux_nat_attach): Adjust call to linux_nat_post_attach_wait.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Jun 2017 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agox86: Remove linker option: -z prefix-nop
H.J. Lu [Fri, 2 Jun 2017 21:49:37 +0000 (14:49 -0700)]
x86: Remove linker option: -z prefix-nop

Since it is incorrect to convert

bnd call *foo@GOTPCREL(%rip)

to

bnd nop
call foo

this patch removes the "-z prefix-nop" option from x86 linker.

* emulparams/call_nop.sh: Remove -z prefix-nop.
* ld.texinfo: Likewise.
* testsuite/ld-i386/call3c.d: Check for linker error.
* testsuite/ld-x86-64/call1c.d: Likewise.

7 years agoUse delete instead of xfree for gdb_timer
Simon Marchi [Fri, 2 Jun 2017 21:24:21 +0000 (23:24 +0200)]
Use delete instead of xfree for gdb_timer

gdb_timer objects are new'ed in create_timer, but xfree'd in
poll_timers.  Use delete instead.

gdb/ChangeLog:

* event-loop.c (poll_timers): Unallocate timer using delete
instead of xfree.

7 years agoC++ify breakpoint class hierarchy (destructors only)
Simon Marchi [Fri, 2 Jun 2017 21:16:21 +0000 (23:16 +0200)]
C++ify breakpoint class hierarchy (destructors only)

Breakpoints are currently in a limbo state between C and C++.  There is
a pseudo class hierarchy implemented using struct fields.  Taking
watchpoint as an example:

  struct watchpoint
  {
    /* The base class.  */
    struct breakpoint base;

    ...
  }

and it is instantianted with "new watchpoint ()".  When destroyed, a
destructor is first invoked through the breakpoint_ops, and then the
memory is freed by calling delete through a pointer to breakpoint.
Address sanitizer complains about this, for example, because we new and
delete the same memory using different types.

This patch takes the logical step of making breakpoint subclasses extend
the breakpoint class for real, and converts their destructors to actual
C++ destructors.

Regtested on the buildbot.

gdb/ChangeLog:

* breakpoint.h (struct breakpoint_ops) <dtor>: Remove.
(struct breakpoint) <~breakpoint>: New.
(struct watchpoint): Inherit from breakpoint.
<~watchpoint>: New.
<base>: Remove.
(struct tracepoint): Inherit from breakpoint.
<base>: Remove.
* breakpoint.c (longjmp_breakpoint_ops): Remove.
(struct longjmp_breakpoint): Inherit from breakpoint.
<~longjmp_breakpoint>: New.
<base>: Remove.
(new_breakpoint_from_type): Remove casts.
(watchpoint_in_thread_scope): Remove reference to base field.
(watchpoint_del_at_next_stop): Likewise.
(update_watchpoint): Likewise.
(watchpoint_check): Likewise.
(bpstat_check_watchpoint): Likewise.
(set_longjmp_breakpoint): Likewise.
(struct fork_catchpoint): Inherit from breakpoint.
<base>: Remove.
(struct solib_catchpoint): Inherit from breakpoint.
<~solib_catchpoint>: New.
<base>: Remove.
(dtor_catch_solib): Change to ...
(solib_catchpoint::~solib_catchpoint): ... this.
(breakpoint_hit_catch_solib): Remove reference to base field.
(add_solib_catchpoint): Likewise.
(create_fork_vfork_event_catchpoint): Likewise.
(struct exec_catchpoint): Inherit from breakpoint.
<~exec_catchpoint>: New.
<base>: Remove.
(dtor_catch_exec): Change to ...
(exec_catchpoint::~exec_catchpoint): ... this.
(dtor_watchpoint): Change to ...
(watchpoint::~watchpoint): ... this.
(watch_command_1): Remove reference to base field.
(catch_exec_command_1): Likewise.
(base_breakpoint_dtor): Change to ...
(breakpoint::~breakpoint): ... this.
(base_breakpoint_ops): Remove dtor field value.
(longjmp_bkpt_dtor): Change to ...
(longjmp_breakpoint::~longjmp_breakpoint): ... this.
(strace_marker_create_breakpoints_sal): Remove reference to base
field.
(delete_breakpoint): Don't manually call breakpoint destructor.
(create_tracepoint_from_upload): Remove reference to base field.
(trace_pass_set_count): Likewise.
(initialize_breakpoint_ops): Don't initialize
momentary_breakpoint_ops, don't set dtors.
* ada-lang.c (struct ada_catchpoint): Inherit from breakpoint.
<~ada_catchpoint>: New.
<base>: Remove.
(create_excep_cond_exprs): Remove reference to base field.
(dtor_exception): Change to ...
(ada_catchpoint::~ada_catchpoint): ... this.
(dtor_catch_exception): Remove.
(dtor_catch_exception_unhandled): Remove.
(dtor_catch_assert): Remove.
(create_ada_exception_catchpoint): Remove reference to base
field.
(initialize_ada_catchpoint_ops): Don't set dtors.
* break-catch-sig.c (struct signal_catchpoint): Inherit from
breakpoint.
<~signal_catchpoint>: New.
<base>: Remove.
(signal_catchpoint_dtor): Change to ...
(signal_catchpoint::~signal_catchpoint): ... this.
(create_signal_catchpoint): Remove reference to base field.
(initialize_signal_catchpoint_ops): Don't set dtor.
* break-catch-syscall.c (struct syscall_catchpoint): Inherit
from breakpoint.
<~syscall_catchpoint>: New.
<base>: Remove.
(dtor_catch_syscall): Change to ...
(syscall_catchpoint::~syscall_catchpoint): ... this.
(create_syscall_event_catchpoint): Remove reference to base
field.
(initialize_syscall_catchpoint_ops): Don't set dtor.
* break-catch-throw.c (struct exception_catchpoint): Inherit
from breakpoint.
<~exception_catchpoint>: New.
<base>: Remove.
(dtor_exception_catchpoint): Change to ...
(exception_catchpoint::~exception_catchpoint): ... this.
(handle_gnu_v3_exceptions): Remove reference to base field.
(initialize_throw_catchpoint_ops): Don't set dtor.
* ctf.c (ctf_get_traceframe_address): Remove reference to base
field.
* remote.c (remote_get_tracepoint_status): Likewise.
* tracefile-tfile.c (tfile_get_traceframe_address): Likewise.
* tracefile.c (tracefile_fetch_registers): Likewise.
* tracepoint.c (actions_command): Likewise.
(validate_actionline): Likewise.
(tfind_1): Likewise.
(get_traceframe_location): Likewise.
(find_matching_tracepoint_location): Likewise.
(parse_tracepoint_status): Likewise.
* mi/mi-cmd-break.c (mi_cmd_break_passcount): Likewise.

7 years agoCreate struct type for longjmp breakpoint
Simon Marchi [Fri, 2 Jun 2017 21:16:20 +0000 (23:16 +0200)]
Create struct type for longjmp breakpoint

The longjmp kind of breakpoint has a destructor, but doesn't have an
associated structure.  The next patch converts breakpoint destructors from
breakpoint_ops::dtor to actual destructors, but to do that it is needed
for longjmp_breakpoint to have a structure that will contain such
destructor.  This patch adds it.

According to initialize_breakpoint_ops, a longjmp breakpoint derives
from "momentary breakpoints", so eventually a momentary_breakpoint
struct/class should probably be created.  It's not necessary for the
destructor though, so a structure type for this abstract kind of
breakpoint can be added when we fully convert breakpoint ops into
methods of the breakpoint type hierarchy.

It is now necessary to instantiate different kinds of breakpoint objects
in set_raw_breakpoint_without_location based on bptype (sometimes a
breakpoint, sometimes a longjmp_breakpoint), so it now uses
new_breakpoint_from_type to do that.  I also changed set_raw_breakpoint
to use it, even though I don't think that it can ever receive a bptype
that actually requires it.  However, I think it's good if all breakpoint
object instantion is done in a single place.

gdb/ChangeLog:

* breakpoint.c (struct longjmp_breakpoint): New struct.
(is_tracepoint_type): Change return type to bool.
(is_longjmp_type): New function.
(new_breakpoint_from_type): Handle longjmp kinds of breakpoints.
(set_raw_breakpoint_without_location): Use
new_breakpoint_from_type.
(set_raw_breakpoint): Likewise.

7 years agoIntroduce and use new_breakpoint_from_type
Simon Marchi [Fri, 2 Jun 2017 21:16:19 +0000 (23:16 +0200)]
Introduce and use new_breakpoint_from_type

This is a small preparatory patch to factor out a snippet that appears
twice.  More kinds of breakpoints will need to be created based on
bptype, so I think it's a good idea to centralize the instantiation of
breakpoint objects.

gdb/ChangeLog:

* breakpoint.c (new_breakpoint_from_type): New function.
(create_breakpoint_sal): Use new_breakpoint_from_type and
unique_ptr.
(create_breakpoint): Likewise.

7 years agoCorrect check for endianness
Michael Eager [Fri, 2 Jun 2017 15:04:59 +0000 (08:04 -0700)]
Correct check for endianness

* interp.c: (target_big_endian): target endianess recognition fix.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Jun 2017 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoCorrect ChangeLog entry date.
John Baldwin [Thu, 1 Jun 2017 16:47:31 +0000 (09:47 -0700)]
Correct ChangeLog entry date.

7 years agoUse the ELF class to determine the word size for FreeBSD core notes.
John Baldwin [Thu, 1 Jun 2017 16:40:46 +0000 (09:40 -0700)]
Use the ELF class to determine the word size for FreeBSD core notes.

FreeBSD ELF cores contain data structures with that have two different
layouts: one for ILP32 platforms and a second for LP64 platforms.
Previously, the code used 'bits_per_word' from 'arch_info', but this
field is not a reliable indicator of the format for FreeBSD MIPS cores
in particular.

I had originally posted this patch back in November because process
cores for FreeBSD MIPS contained an e_flags value of 0 in the header
which resulted in a bfd_arch which always had 'bits_per_word' set to
32.  This permitted reading o32 cores, but not n64 cores.  The feedback
I received then was to try to change n64 cores to use a different
default bfd_arch that had a 64-bit 'bits_per_word' when e_flags was zero.
I submitted a patch to that effect but it was never approved.  Instead,
I changed FreeBSD's kernel and gcore commands to preserve the e_flags
field from an executable when generating process cores.  With a proper
e_flags field in process cores, n64 cores now use a 64-bit bfd_arch and
now work fine.  However, the change to include e_flags in the process
cores had the unintended side effect of breaking handling of o32
process cores.  Specifically, FreeBSD MIPS builds o32 with a default
MIPS architecture of 'mips3', thus FreeBSD process cores with a non-zero
e_flags match the 'mips3' bfd_arch which has 64 'bits_per_word'.

From this, it seems that 'bits_per_word' for FreeBSD MIPS is not likely
to ever be completely correct.  However, FreeBSD core dumps do
reliably set the ELF class to ELFCLASS32 for cores using ILP32 and
ELFCLASS64 for cores using LP64.  As such, I think my original patch of
using the ELF class instead of 'bits_per_word' is probably the simplest
and most reliable approach for detecting the note structure layout.

bfd/ChangeLog:

* elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
determine structure sizes.
(elfcore_grok_freebsd_prstatus): Likewise.

7 years agoPPC64_OPT_LOCALENTRY
Alan Modra [Fri, 26 May 2017 00:32:29 +0000 (10:02 +0930)]
PPC64_OPT_LOCALENTRY

ELFv2 functions with localentry:0 are those with a single entry point,
ie. global entry == local entry, and that have no requirement on r2 or
r12, and guarantee r2 is unchanged on return.  Such an external
function can be called via the PLT without saving r2 or restoring it
on return, avoiding a common load-hit-store for small functions.   The
optimization is attractive.  The TOC pointer load-hit-store is a major
reason why calls to small functions that need no register saves, or
with shrink-wrap, no register saves on a fast path, are slow on
powerpc64le.

To be safe, this optimization needs ld.so support to check that the
run-time matches link-time function implementation.  If a function
in a shared library with st_other localentry non-zero is called
without saving and restoring r2, r2 will be trashed on return, leading
to segfaults.  For that reason the optimization does not happen for
weak functions since a weak definition is a fairly solid hint that the
function will likely be overridden.  I'm also not enabling the
optimization by default unless glibc-2.26 is detected, which should
have the ld.so checks implemented.

bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
(ppc64_elf_merge_symbol_attribute): Merge localentry bits from
dynamic objects.
(is_elfv2_localentry0): New function.
(ppc64_elf_tls_setup): Default params->plt_localentry0.
(plt_stub_size): Adjust size for tls_get_addr_opt stub.
(build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
(ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
optimized localentry:0 stubs.
(ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
(ppc64_elf_relocate_section): Leave nop unchanged for optimized
localentry:0 stubs.
(ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
DT_PPC64_OPT.
* elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
include/
* elf/ppc64.h (PPC64_OPT_LOCALENTRY): Define.
ld/
* emultempl/ppc64elf.em (params): Init plt_localentry0 field.
(enum ppc64_opt): New, replacing OPTION_* defines.  Add
OPTION_PLT_LOCALENTRY, and OPTION_NO_PLT_LOCALENTRY.
(PARSE_AND_LIST_*): Support --plt-localentry and --no-plt-localentry.
* testsuite/ld-powerpc/elfv2so.d: Update.
* testsuite/ld-powerpc/powerpc.exp (TLS opt 5): Use --no-plt-localentry.
* testsuite/ld-powerpc/tlsopt5.d: Update.

7 years agoS/390: idte/ipte fixes
Andreas Krebbel [Thu, 1 Jun 2017 11:46:15 +0000 (13:46 +0200)]
S/390: idte/ipte fixes

Later CPU generations added optional operands to the ipte/idte
instructions.  I've added these with:
https://sourceware.org/ml/binutils/2017-05/msg00316.html ... but
supported the optional operands only with the specific hardware
levels.  However, it is more useful to have the optional operands
already in the first versions.  Of course they need to be zero there.

Regression-tested with on s390 and s390x.  Committed to mainline.

Bye,

-Andreas-

opcodes/ChangeLog:

2017-06-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.txt: Support the optional parameters with the first
versions of ipte/idte.

gas/ChangeLog:

2017-06-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/s390/esa-g5.d: Add ipte tests.
* testsuite/gas/s390/esa-g5.s: Likewise.
* testsuite/gas/s390/zarch-z196.d: Remove ipte tests.
* testsuite/gas/s390/zarch-z196.s: Likewise.
* testsuite/gas/s390/zarch-z990.d: Add idte tests.
* testsuite/gas/s390/zarch-z990.s: Likewise.
* testsuite/gas/s390/zarch-zEC12.d: Remove ipte/idte tests.
* testsuite/gas/s390/zarch-zEC12.s: Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Jun 2017 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoRename "mem" related commmands
Simon Marchi [Wed, 31 May 2017 15:09:07 +0000 (17:09 +0200)]
Rename "mem" related commmands

Rename "mem" related commands, so that their naming is consistent with
the <command-name>_command pattern of naming functions that implement
commands.

gdb/ChangeLog:

* memattr.c (mem_info_command): Rename to ...
(info_mem_command): ... this.
(mem_enable_command): Rename to ...
(enable_mem_command): ... this.
(mem_disable_command): Rename to ...
(disable_mem_command): ... this.
(mem_delete_command): Rename to ...
(delete_mem_command): ... this.
(_initialize_mem): Adjust function names.

7 years agoPowerPC64 ld help quoting
Alan Modra [Wed, 31 May 2017 08:40:01 +0000 (18:10 +0930)]
PowerPC64 ld help quoting

* emultempl/ppc64elf.em (plt-static-chain help): Fix quoting.

7 years agobtrace: support decoder events
Markus Metzger [Mon, 21 Nov 2016 13:27:57 +0000 (14:27 +0100)]
btrace: support decoder events

Newer versions of libipt support instruction flow decoder events instead of
indicating those events with flags in struct pt_insn.  Add support for them in
GDB.

gdb/
* btrace.c (handle_pt_insn_events): New.
(ftrace_add_pt): Call handle_pt_insn_events.  Rename ERRCODE into
STATUS.  Split into this and ...
(handle_pt_insn_event_flags): ... this.

7 years agoconfig, btrace: check for pt_insn_event in libipt
Markus Metzger [Mon, 21 Nov 2016 10:46:15 +0000 (11:46 +0100)]
config, btrace: check for pt_insn_event in libipt

Version 2 of libipt adds an event system to instruction flow decoders and
deprecates indicating events via flags in struct pt_insn.  Add configuration
checks to determine which version we have.

gdb/
* configure.ac: Check for pt_insn_event, struct pt_insn.enabled,
and struct pt_insn.resynced.
* configure: Regenerated.
* config.in: Regenerated.

7 years agoAvoid compilation warning on MinGW in xstrndup
Eli Zaretskii [Wed, 31 May 2017 06:44:08 +0000 (09:44 +0300)]
Avoid compilation warning on MinGW in xstrndup

libiberty/ChangeLog:

2017-05-31  DJ Delorie  <dj@redhat.com>

* configure.ac (strnlen): Add to AC_CHECK_DECLS.
* configure: Likewise.
* config.in: Add HACE_DECL_STRNLEN.

7 years agoMake libiberty/waitpid.c compile without warnings on MinGW
Eli Zaretskii [Wed, 31 May 2017 06:37:48 +0000 (09:37 +0300)]
Make libiberty/waitpid.c compile without warnings on MinGW

libiberty/ChangeLog:

2017-05-31  Eli Zaretskii  <eliz@gnu.org>

* waitpid.c (wait) [__MINGW32__]: Define as a macro
that calls _cwait, so that this function works on MinGW.

7 years agoFix MinGW compilation warnings due to environ.h
Eli Zaretskii [Wed, 31 May 2017 06:35:07 +0000 (09:35 +0300)]
Fix MinGW compilation warnings due to environ.h

include/ChangeLog:

2017-05-31  Eli Zaretskii <eliz@gnu.org>

* environ.h: Add #ifndef guard.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 31 May 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix calculation of R_ARM_RHM_ALU_PREL_11_0 relocation when used with a SUB instruction.
Casey Smith [Tue, 30 May 2017 14:07:56 +0000 (15:07 +0100)]
Fix calculation of R_ARM_RHM_ALU_PREL_11_0 relocation when used with a SUB instruction.

PR ld/21523
* elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.

7 years ago[ARC] Allow CPU to be enforced via disassemble_info options
Anton Kolesov [Thu, 16 Mar 2017 12:21:31 +0000 (15:21 +0300)]
[ARC] Allow CPU to be enforced via disassemble_info options

Currently print_insn_arc relies on BFD mach and ELF private headers to
distinguish between various ARC architectures.  Sometimes those values are not
correct or available, mainly in the case of debugging targets without and ELF
file available.  Changing a BFD mach is not a problem for the debugger, because
this is a generic BFD field, and GDB, for example, already sets it according to
information provided in XML target description or specified via GDB 'set arch'
command.  However, things are more complicated for ELF private headers, since
it requires existing of an actual ELF file.  To workaround this problem this
patch allows CPU model to be specified via disassemble info options.  If CPU is
specified in options, then it will take a higher precedence than whatever might
be specified in ELF file.

This is mostly needed for ARC EM and ARC HS, because they have the same
"architecture" (mach) ARCv2 and differ in their private ELF headers.  Other ARC
architectures can be distinguished between each other purely via "mach" field.

Proposed disassemble option format is "cpu=<CPU>", where CPU can be any valid
ARC CPU name as supported by GAS.  Note that this creates a seeming redundancy
with objdump -m/--architecture option, however -mEM and -mHS still result in
"ARCv2" architecture internally, while -Mcpu={HS,EM} would have an actual
effect on disassembler.

opcodes/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* arc-dis.c (enforced_isa_mask): Declare.
(cpu_types): Likewise.
(parse_cpu_option): New function.
(parse_disassembler_options): Use it.
(print_insn_arc): Use enforced_isa_mask.
(print_arc_disassembler_options): Document new options.

binutils/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* doc/binutils.texi: Document new cpu=... disassembler options for ARC.

7 years ago[ARC] Add arc-cpu.def with processor definitions
Anton Kolesov [Fri, 7 Apr 2017 14:22:39 +0000 (17:22 +0300)]
[ARC] Add arc-cpu.def with processor definitions

This patch extracts ARC CPU definitions from gas/config/tc-arc.c (cpu_types)
into a separate file arc-cpu.def.  This will allow reuse of CPU type definition
in multiple places where it might be needed, for example in disassembler.  This
will help ensure that gas and disassembker use same option values for CPUs.

arc-cpu.def file relies on preprocessor macroses which are defined somewhere
else.  This for example multiple C files to include arc-cpu.def, but define
different macroses, therefore creating different structures.

include/ChangeLog:
yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* elf/arc-cpu.def: New file.

gas/ChangeLog:
yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* config/tc-arc.c (cpu_types): Include arc-cpu.def

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
7 years ago[ARC] Implement compatible function for ARC BFD architectures
Anton Kolesov [Fri, 17 Mar 2017 15:37:42 +0000 (18:37 +0300)]
[ARC] Implement compatible function for ARC BFD architectures

The general rule for bfd_arch_info_type->compatible (A, B) is that if A and B
are compatible, then this function should return architecture that is more
"feature-rich", that is, can run both A and B.  ARCv2, EM and HS all has same
mach number, so bfd_default_compatible assumes they are the same, and returns
an A.  That causes issues with GDB, because GDB assumes that if machines are
compatible, then "compatible ()" always returns same machine regardless of
argument order.  As a result GDB gets confused because, for example,
compatible(ARCv2, EM) returns ARCv2, but compatible(EM, ARCv2) returns EM,
hence GDB is not sure if they are compatible and prints a warning.

bfd/ChangeLog:

yyyy-mm-dd  Anton Kolesov  Anton.Kolesov@synopsys.com

 cpu-arc.c (arc_compatible): New function.

7 years ago[ARC] Remove duplicate ARC600 entry
Anton Kolesov [Fri, 17 Mar 2017 13:43:31 +0000 (16:43 +0300)]
[ARC] Remove duplicate ARC600 entry

ARC600 is already defined as the head of the bfd_arch_arc.

bfd/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.

7 years agoAdd bfd_get_file_size to get archive element size
H.J. Lu [Tue, 30 May 2017 13:34:05 +0000 (06:34 -0700)]
Add bfd_get_file_size to get archive element size

We can't use stat() to get archive element size.  Add bfd_get_file_size
to get size for both normal files and archive elements.

bfd/

PR binutils/21519
* bfdio.c (bfd_get_file_size): New function.
* bfd-in2.h: Regenerated.

binutils/

PR binutils/21519
* objdump.c (dump_relocs_in_section): Replace get_file_size
with bfd_get_file_size to get archive element size.
* testsuite/binutils-all/objdump.exp (test_objdump_f): New
proc.
(test_objdump_h): Likewise.
(test_objdump_t): Likewise.
(test_objdump_r): Likewise.
(test_objdump_s): Likewise.
Add objdump tests on archive.

7 years agobtrace: Store function segments as objects.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Store function segments as objects.

7 years agobtrace: Remove bfun_s vector.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Remove bfun_s vector.

7 years agobtrace: Replace struct btrace_function::segment.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Replace struct btrace_function::segment.

This used to hold a pair of pointers to the previous and next function segment
that belong to this function call.  Replace with a pair of indices into the
vector of function segments.

7 years agobtrace: Remove struct btrace_function::flow.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Remove struct btrace_function::flow.

This used to hold a pair of pointers to the previous and next function segment
in execution flow order.  It is no longer necessary as the previous and next
function segments now are simply the previous and next elements in the vector
of function segments.

7 years agobtrace: Replace struct btrace_function::up.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Replace struct btrace_function::up.

This used to hold a function segment pointer.  Change it to hold an index into
the vector of function segments instead.

7 years agobtrace: Remove struct btrace_thread_info::{begin,end}.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Remove struct btrace_thread_info::{begin,end}.

These are no longer needed and might hold invalid addresses once we change the
vector of function segment pointers into a vector of function segment objects
where a reallocation of the vector changes the address of its elements.

7 years agobtrace: Remove constant arguments.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Remove constant arguments.

7 years agobtrace: Use function segment index in insn iterator.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Use function segment index in insn iterator.

Remove FUNCTION pointer in struct btrace_insn_iterator and use an index into
the list of function segments instead.

7 years agobtrace: Use function segment index in call iterator.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Use function segment index in call iterator.

Remove FUNCTION pointer in struct btrace_call_iterator and use an index into
the list of function segments instead.

7 years agobtrace: Add btinfo to instruction interator.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Add btinfo to instruction interator.

This will serve as the access path to the vector of function segments once
the FUNCTION pointer in struct btrace_insn_iterator is removed.

7 years agobtrace: Transfer ownership of pointers.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Transfer ownership of pointers.

Directly insert new btrace_function pointers into the vector and have the
vector own these pointers.  This allows us to later retrieve these objects by
their number directly after creation whereas at the moment we have to wait
until the vector is fully populated.

This requires to pull btrace_thread_info through different functions but
cleans up the code for freeing the trace.

7 years agobtrace: Use std::vector in struct btrace_thread_information.
Tim Wiederhake [Tue, 30 May 2017 10:47:37 +0000 (12:47 +0200)]
btrace: Use std::vector in struct btrace_thread_information.

7 years agoS/390: Fix indentation
Andreas Krebbel [Tue, 30 May 2017 10:04:10 +0000 (12:04 +0200)]
S/390: Fix indentation

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/tc-s390.c (md_gather_operands): Fix indentation.

7 years agoFix NEWS formatting in GDB 8.0 section
Simon Marchi [Tue, 30 May 2017 09:29:57 +0000 (11:29 +0200)]
Fix NEWS formatting in GDB 8.0 section

Change the GDB 8.0 section of the NEWS file to try to follow this order:

  * Functional changes
  * Added and removed configurations and targets
  * New commands
  * New options
  * MI changes

In particular, there were two "New commands" sections.

gdb/ChangeLog:

* NEWS (Changes in GDB 8.0): Remove extra empty line.  Move
"Removed targets and native configurations" up.  Merge duplicate
"New commands" sub-sections.  Add "New options" sub-sections.

7 years agogdb.base/watch-cond-infcall.exp: Don't run if target doesn't support infcalls
Simon Marchi [Tue, 30 May 2017 09:24:52 +0000 (11:24 +0200)]
gdb.base/watch-cond-infcall.exp: Don't run if target doesn't support infcalls

This test requires calling a function in the inferior, and therefore it
doesn't make sense to run it if the target doesn't support calling
functions from GDB.

gdb/testsuite/ChangeLog:

* gdb.base/watch-cond-infcall.exp: Don't run if target doesn't
support function calls from GDB.

7 years agoS/390: Fix instruction types of csdtr and csxtr
Andreas Krebbel [Mon, 29 May 2017 10:38:42 +0000 (12:38 +0200)]
S/390: Fix instruction types of csdtr and csxtr

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.c: Add new instruction types RRF_0URF and RRF_0UREFE.
* s390-opc.txt: Fix instruction typs of csdtr and csxtr.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/s390/zarch-z9-ec.d: Adjust csdtr and csxtr.
* testsuite/gas/s390/zarch-z9-ec.s: Likewise.

7 years agoS/390: Add missing operand to tb instruction
Andreas Krebbel [Mon, 29 May 2017 10:38:11 +0000 (12:38 +0200)]
S/390: Add missing operand to tb instruction

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/s390/esa-g5.d: Add missing operand to tb
instruction.
* testsuite/gas/s390/esa-g5.s: Likewise.

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.txt: Add missing operand to tb instruction.

7 years agoS/390: Add ipte/idte variants with optional operands
Andreas Krebbel [Mon, 29 May 2017 10:36:57 +0000 (12:36 +0200)]
S/390: Add ipte/idte variants with optional operands

This patch adds missing variants of ipte and idte instructions added with later CPU
generations.

ipte got an optional operand with z196 and another one with zEC12.
idte got an optional operand with zEC12

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.c: Add new idte/ipte variants.
* s390-opc.txt: Likewise.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/s390/zarch-z196.d: Add new idte/ipte variants.
* testsuite/gas/s390/zarch-z196.s: Likewise.
* testsuite/gas/s390/zarch-zEC12.d: Likewise.
* testsuite/gas/s390/zarch-zEC12.s: Likewise.

7 years agoS/390: Improve error checking for optional operands
Andreas Krebbel [Mon, 29 May 2017 10:34:56 +0000 (12:34 +0200)]
S/390: Improve error checking for optional operands

So far we only had an instruction flag which made an arbitrary number
of operands optional.  This limits error checking capabilities for
instructions marked that way.  With this patch the optparm flag only
allows a single optional parameter and another one is added (optparm2)
allowing 2 optional arguments.  Hopefully we won't need more than that
in the future. So far there will be only a single use of optparm2.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/tc-s390.c (md_gather_operands): Support new optparm2
instruction flag.

include/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* opcode/s390.h: Add new instruction flags optparm2.

opcodes/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-dis.c (s390_print_insn_with_opcode): Support new optparm2
instruction flag.
* s390-mkopc.c (main): Recognize the new instruction flag when
parsing instruction list.

7 years agoS/390: Remove optional operand flag.
Andreas Krebbel [Mon, 29 May 2017 10:33:15 +0000 (12:33 +0200)]
S/390: Remove optional operand flag.

The per operand optional flag hasn't been used for quite some time.
Cleanup some remains.

include/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* opcode/s390.h: Remove S390_OPERAND_OPTIONAL.

gas/ChangeLog:

2017-05-30  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/tc-s390.c (md_gather_operands): Remove code dealing with
S390_OPERAND_OPTIONAL.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 May 2017 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 May 2017 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 28 May 2017 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 27 May 2017 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAdd regcache raw_supply_integer and raw_collect_integer.
Alan Hayward [Fri, 26 May 2017 16:04:13 +0000 (17:04 +0100)]
Add regcache raw_supply_integer and raw_collect_integer.

Use these to replace instances of MAX_REGISTER_SIZE.

* defs.h (copy_integer_to_size): New declaration.
* findvar.c (copy_integer_to_size): New function.
(do_cint_test): New selftest function.
(copy_integer_to_size_test): Likewise.
(_initialize_findvar): Likewise.
* mips-fbsd-tdep.c (mips_fbsd_supply_reg): Use raw_supply_integer.
(mips_fbsd_collect_reg): Use raw_collect_integer.
* mips-linux-tdep.c (supply_32bit_reg): Use raw_supply_integer.
(mips64_fill_gregset): Use raw_collect_integer
(mips64_fill_fpregset): Use raw_supply_integer.
* regcache.c (regcache::raw_supply_integer): New function.
(regcache::raw_collect_integer): Likewise.
* regcache.h: (regcache::raw_supply_integer): New declaration.
(regcache::raw_collect_integer): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 May 2017 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 May 2017 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAdd unit test to gdbarch methods register_to_value and value_to_register
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Add unit test to gdbarch methods register_to_value and value_to_register

This patch adds one unit test for gdbarch methods register_to_value and
value_to_register.  The test pass different combinations of {regnu, type}
to gdbarch_register_to_value and gdbarch_value_to_register.  In order
to do the test, add a new function create_new_frame to create a fake
frame.  It can be improved after we converted frame_info to class.

In order to isolate regcache (from target_ops operations on writing
registers, like target_store_registers), the sub-class of regcache in the
test override raw_write.  Also, in order to get the right regcache from
get_thread_arch_aspace_regcache, the sub-class of regcache inserts itself
to current_regcache.

Suppose I incorrectly modified the size of buffer as below,

@@ -1228,7 +1228,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum,
                        int *optimizedp, int *unavailablep)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
-  gdb_byte in[MAX_REGISTER_SIZE];
+  gdb_byte in[1];

   /* Convert to TYPE.  */
   if (!get_frame_register_bytes (frame, regnum, 0,

build GDB with "-fsanitize=address" and run unittest.exp, asan can detect
such error

==2302==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff98193870 at pc 0xbd55ea bp 0x7fff981935a0 sp 0x7fff98193598
WRITE of size 16 at 0x7fff98193870 thread T0
    #0 0xbd55e9 in frame_register_unwind(frame_info*, int, int*, int*, lval_type*, unsigned long*, int*, unsigned char*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1119
    #1 0xbd58c8 in frame_register(frame_info*, int, int*, int*, lval_type*, unsigned long*, int*, unsigned char*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1147
    #2 0xbd6e25 in get_frame_register_bytes(frame_info*, int, unsigned long, int, unsigned char*, int*, int*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1427
    #3 0x70080a in ia64_register_to_value /home/yao/SourceCode/gnu/gdb/git/gdb/ia64-tdep.c:1236
    #4 0xbf570e in gdbarch_register_to_value(gdbarch*, frame_info*, int, type*, unsigned char*, int*, int*) /home/yao/SourceCode/gnu/gdb/git/gdb/gdbarch.c:2619
    #5 0xc05975 in register_to_value_test /home/yao/SourceCode/gnu/gdb/git/gdb/gdbarch-selftests.c:131

Or, even if GDB is not built with asan, GDB just crashes.

*** stack smashing detected ***: ./gdb terminated
Aborted (core dumped)

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (SFILES): Add gdbarch-selftests.c.
(COMMON_OBS): Add gdbarch-selftests.o.
* frame.c [GDB_SELF_TESTS] (create_new_frame): New function.
* frame.h [GDB_SELF_TESTS] (create_new_frame): Declare.
* gdbarch-selftests.c: New file.
* regcache.h (regcache) <~regcache>: Mark it virtual if
GDB_SELF_TEST.
<raw_write>: Likewise.

7 years agoMove current_regcache to regcache::current_regcache
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Move current_regcache to regcache::current_regcache

This patches moves global variable current_regcache to a class regcache
static variable (protected) so that the unit test I add in the following
patch can access it (by means of extending class regcache in unit test).

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* regcache.c (current_regcache): Change it to
regcache::current_regcache.
(regcache_observer_target_changed): Update.
(regcache_thread_ptid_changed): Make it a regcache static
method.
(regcache_thread_ptid_changed): Update.
(class regcache_access): New.
(current_regcache_test): Update.
(_initialize_regcache): Update.
* regcache.h: Include forward_list.
(regcache): Declare regcache_thread_ptid_changed and declare
registers_changed_ptid as friend.

7 years agoGet register contents by register_size instead of TYPE_LENGTH
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Get register contents by register_size instead of TYPE_LENGTH

We should use register_size to get register contents instead of
TYPE_LENGTH.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* i387-tdep.c (i387_register_to_value): Use register_size
instead of TYPE_LENGTH.
* m68k-tdep.c (m68k_register_to_value): Likewise.

7 years agoRestrict i387_convert_register_p
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Restrict i387_convert_register_p

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* i387-tdep.c (i387_convert_register_p): Return false if type
code isn't TYPE_CODE_FLT.

7 years agoRestrict alpha_convert_register_p
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Restrict alpha_convert_register_p

This patch restricts alpha_convert_register_p from
"TYPE_LENGTH (type) != 8" to "TYPE_LENGTH (type) == 4", because,

 - we have check "TYPE_LENGTH (valtype) == 4" in alpha_register_to_value
   and alpha_value_to_register,
 - alpha lds and sts instruction access 4 bytes,
 - comments "It might need to convert the [float] register into the
   corresponding [integer] type (see Alpha)" and integer is 4-byte on
   alpha,

I think it is the right restrict condition to "TYPE_LENGTH (valtype) == 4".

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* alpha-tdep.c (alpha_convert_register_p): Return true if type
length is 4.
(alpha_register_to_value): Remove type length check.
(alpha_value_to_register): Likewise.

7 years agoRestrict ia64_convert_register_p
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Restrict ia64_convert_register_p

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* ia64-tdep.c (ia64_convert_register_p): Check type's code is
TYPE_CODE_FLT.

7 years agoRestrict m68k_convert_register_p
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Restrict m68k_convert_register_p

We need to convert register if the type is float.  Suppose we get a value
from float point register, but its type is integer, we don't have to convert.
This case may not exist in real code, but exist in my unit test case.

warning: Cannot convert floating-point register value to non-floating-point type.
Self test failed: arch m68k: self-test failed at gdb/git/gdb/findvar.c:1072

              ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,
                                              buf.data (), &optim, &unavail);

1072:         SELF_CHECK (ok);

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* m68k-tdep.c (m68k_convert_register_p): Check type's code is
TYPE_CODE_FLT or not.

7 years agoUse XCNEW gdbarch_tdep
Yao Qi [Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)]
Use XCNEW gdbarch_tdep

This patch uses XCNEW gdbarch_tdep instead of XNEW.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* alpha-tdep.c (alpha_gdbarch_init): Use XCNEW instead of XNEW.
* avr-tdep.c (avr_gdbarch_init): Likewise.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* cris-tdep.c (cris_gdbarch_init): Likewise.
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
* lm32-tdep.c (lm32_gdbarch_init): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.

7 years agoClear GDB internal state after each unit test
Yao Qi [Wed, 24 May 2017 21:15:22 +0000 (22:15 +0100)]
Clear GDB internal state after each unit test

GDB has some global variables, like sentinel_frame,
current_thread_arch, and etc, we need to reset them after each unit
tests.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* selftest-arch.c (tests_with_arch): Call registers_changed
and reinit_frame_cache.
* selftest.c (run_self_tests): Likewise.

7 years agoMove print_insn_XXX to an opcodes internal header
Yao Qi [Wed, 24 May 2017 16:23:52 +0000 (17:23 +0100)]
Move print_insn_XXX to an opcodes internal header

With the changes done in previous patches, print_insn_XXX functions
don't have to be external visible out of opcodes, because both gdb
and objdump select disassemblers through a single interface.

This patch moves these print_insn_XXX declarations from
include/dis-asm.h to opcodes/disassemble.h, which is a new header
added by this patch.

include:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* dis-asm.h: Move some function declarations to
opcodes/disassemble.h.

opcodes:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* alpha-dis.c: Include disassemble.h, don't include
dis-asm.h.
* avr-dis.c, bfin-dis.c, cr16-dis.c: Likewise.
* crx-dis.c, d10v-dis.c, d30v-dis.c: Likewise.
* disassemble.c, dlx-dis.c, epiphany-dis.c: Likewise.
* fr30-dis.c, ft32-dis.c, h8300-dis.c, h8500-dis.c: Likewise.
* hppa-dis.c, i370-dis.c, i386-dis.c: Likewise.
* i860-dis.c, i960-dis.c, ip2k-dis.c: Likewise.
* iq2000-dis.c, lm32-dis.c, m10200-dis.c: Likewise.
* m10300-dis.c, m32r-dis.c, m68hc11-dis.c: Likewise.
* m68k-dis.c, m88k-dis.c, mcore-dis.c: Likewise.
* metag-dis.c, microblaze-dis.c, mmix-dis.c: Likewise.
* moxie-dis.c, msp430-dis.c, mt-dis.c:
* nds32-dis.c, nios2-dis.c, ns32k-dis.c: Likewise.
* or1k-dis.c, pdp11-dis.c, pj-dis.c: Likewise.
* ppc-dis.c, pru-dis.c, riscv-dis.c: Likewise.
* rl78-dis.c, s390-dis.c, score-dis.c: Likewise.
* sh-dis.c, sh64-dis.c, tic30-dis.c: Likewise.
* tic4x-dis.c, tic54x-dis.c, tic6x-dis.c: Likewise.
* tic80-dis.c, tilegx-dis.c, tilepro-dis.c: Likewise.
* v850-dis.c, vax-dis.c, visium-dis.c: Likewise.
* w65-dis.c, wasm32-dis.c, xc16x-dis.c: Likewise.
* xgate-dis.c, xstormy16-dis.c, xtensa-dis.c: Likewise.
* z80-dis.c, z8k-dis.c: Likewise.
* disassemble.h: New file.

7 years agoUse disassemble.c:disassembler select rs6000 disassembler
Yao Qi [Wed, 24 May 2017 16:23:52 +0000 (17:23 +0100)]
Use disassemble.c:disassembler select rs6000 disassembler

Nowadays, rs6000 disassembler is selected in different ways in
opcodes and gdb,

opcodes:
    case bfd_arch_rs6000:
      if (mach == bfd_mach_ppc_620)
disassemble = print_insn_big_powerpc;
      else
disassemble = print_insn_rs6000;
      break;

gdb:

  if (arch == bfd_arch_rs6000)
    set_gdbarch_print_insn (gdbarch, print_insn_rs6000);
  else
    set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc);

I am not sure which one is the right one.  However, such selection
should be done in one place instead of two.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* rs6000-tdep.c (gdb_print_insn_powerpc): Remove.
(rs6000_gdbarch_init): Don't call set_gdbarch_print_insn.

7 years agoUse disassemble.c:disassembler select rl78 disassembler
Yao Qi [Wed, 24 May 2017 16:23:52 +0000 (17:23 +0100)]
Use disassemble.c:disassembler select rl78 disassembler

This patch changes rl78 to let disassble.c:disassembler select
disassembler.  rl78_get_disassembler doesn't handle the case
that abfd is NULL, so this patch also fix it.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* rl78-tdep.c (rl78_gdbarch_init): Don't call
set_gdbarch_print_insn.

opcodes:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* rl78-dis.c (rl78_get_disassembler): If parameter abfd
is NULL, set cpu to E_FLAG_RL78_ANY_CPU.

7 years agoUse disassemble.c:disassembler select h8300 disassembler
Yao Qi [Wed, 24 May 2017 16:23:52 +0000 (17:23 +0100)]
Use disassemble.c:disassembler select h8300 disassembler

opcodes/disassble.c:disassembler select h8300 disassembler like this,

      if (mach == bfd_mach_h8300h || mach == bfd_mach_h8300hn)
disassemble = print_insn_h8300h;
      else if (mach == bfd_mach_h8300s
       || mach == bfd_mach_h8300sn
       || mach == bfd_mach_h8300sx
       || mach == bfd_mach_h8300sxn)
disassemble = print_insn_h8300s;
      else
disassemble = print_insn_h8300;

which is the same as what gdb/h8300-tdpe.c does,

  switch (info.bfd_arch_info->mach)
    {
    case bfd_mach_h8300:
    ...
      set_gdbarch_print_insn (gdbarch, print_insn_h8300);
    case bfd_mach_h8300h:
    case bfd_mach_h8300hn:
    ...
      set_gdbarch_print_insn (gdbarch, print_insn_h8300h);
    case bfd_mach_h8300s:
    case bfd_mach_h8300sn:
    ...
      set_gdbarch_print_insn (gdbarch, print_insn_h8300s);

so we can leave disassble.c:disassembler doing the selection.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* h8300-tdep.c (h8300_gdbarch_init): Don't call
set_gdbarch_print_insn.

7 years agoDelegate opcodes to select disassembler in GDB
Yao Qi [Wed, 24 May 2017 16:23:52 +0000 (17:23 +0100)]
Delegate opcodes to select disassembler in GDB

This patch changes GDB to use disassembler selected by opcodes in
default, so that we don't have to duplicate the selection logic again
in GDB side.  For example, gdb/score-tdep.c has

static int
score_print_insn (bfd_vma memaddr, struct disassemble_info *info)
{
  if (info->endian == BFD_ENDIAN_BIG)
    return print_insn_big_score (memaddr, info);
  else
    return print_insn_little_score (memaddr, info);
}

and opcodes/disassemble.c has the same logic,

    case bfd_arch_score:
      if (big)
disassemble = print_insn_big_score;
      else
disassemble = print_insn_little_score;

This patch removes the logic in GDB and calls
opcodes/disassemble.c:disassembler in default to select disassembler.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* alpha-tdep.c (alpha_gdbarch_init): Don't call
set_gdbarch_print_insn.
* arc-tdep.c (arc_gdbarch_init): Likewise.
* arch-utils.c: include dis-asm.h.
(default_print_insn): New function.
* arch-utils.h (default_print_insn): Declare.
* avr-tdep.c (avr_gdbarch_init): Don't call set_gdbarch_print_insn.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* cris-tdep.c (cris_delayed_get_disassembler): Remove.
(cris_gdbarch_init): Don't call set_gdbarch_print_insn.
* frv-tdep.c (frv_gdbarch_init): Likewise.
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
* gdbarch.sh (print_insn): Use default_print_insn.
* gdbarch.c: Regenerated.
* hppa-tdep.c (hppa_gdbarch_init): Likewise.
* iq2000-tdep.c (iq2000_gdbarch_init): Likewise.
* lm32-tdep.c (lm32_gdbarch_init): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* m68hc11-tdep.c (gdb_print_insn_m68hc11): Remove.
(m68hc11_gdbarch_init): Don't call set_gdbarch_print_insn.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_gdbarch_init): Likewise.
* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* nios2-tdep.c (nios2_print_insn): Remove.
(nios2_gdbarch_init): Don't call set_gdbarch_print_insn.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* score-tdep.c (score_print_insn): Remove.
(score_gdbarch_init): Don't call set_gdbarch_print_insn.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* tic6x-tdep.c (tic6x_print_insn): Remove.
(tic6x_gdbarch_init): Don't call set_gdbarch_print_insn.
* tilegx-tdep.c (tilegx_gdbarch_init): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* vax-tdep.c (vax_gdbarch_init): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
* xtensa-tdep.c (xtensa_gdbarch_init): Likewise.

7 years agoRefactor disassembler selection
Yao Qi [Wed, 24 May 2017 16:23:52 +0000 (17:23 +0100)]
Refactor disassembler selection

Nowadays, opcodes/disassemble.c:disassembler selects the proper
disassembler according to ABFD only.  However, it actually
selects disassemblers according to arch, mach, endianess, and
abfd.  This patch adds them to the parameters of disassembler,
so that its caller can still select disassemblers in case that
abfd is NULL (a typical case in GDB).

There isn't any functionality change.

binutils:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* objdump.c (disassemble_data): Caller update.

include:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* dis-asm.h (disassembler): Update declaration.

opcodes:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* disassemble.c (disassembler): Add arguments a, big and mach.
Use them.

sim/common:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* sim-trace.c (trace_disasm): Caller update.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 24 May 2017 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoUse mips_regnum instead of constants for FreeBSD/mips register operations.
John Baldwin [Tue, 18 Apr 2017 17:49:44 +0000 (10:49 -0700)]
Use mips_regnum instead of constants for FreeBSD/mips register operations.

gdb/ChangeLog:

* mips-fbsd-tdep.c (MIPS_PC_REGNUM): Remove.
(MIPS_FP0_REGNUM): Remove.
(MIPS_FSR_REGNUM): Remove.
(mips_fbsd_supply_fpregs): Use mips_regnum.
(mips_fbsd_supply_gregs): Likewise.
(mips_fbsd_collect_fpregs): Likewise.
(mips_fbsd_collect_gregs): Likewise.

7 years agoCleanups to FreeBSD/mips native register operations.
John Baldwin [Tue, 18 Apr 2017 17:49:44 +0000 (10:49 -0700)]
Cleanups to FreeBSD/mips native register operations.

Compare against the "raw" PC register number instead of the cooked
register number when determining if a register was handled by
PT_GETREGS.  Previously the register fetch/store operations only tried
PT_GETREGS to fetch any individual register.  The result was that
fetching or storing an individual register not covered by PT_GETREGS
(such as floating point registers) did not work.

While here, remove an early exit to simplify the code flow from the
PT_GETREGS / PT_SETREGS case, and add a getfpregs_supplies similar to
getregs_supplies to describe the registers supplied by PT_GETFPREGS
and PT_SETFPREGS.

gdb/ChangeLog:

* mips-fbsd-nat.c (getregs_supplies): Fix upper bound comparison.
(getpfpregs_supplies): New function.
(mips_fbsd_fetch_inferior_registers): Remove early exit and use
getfpregs_supplies.
(mips_fbsd_store_inferior_registers): Likewise.

7 years agox86: Update notrackbad tests for non-ELF targets
H.J. Lu [Tue, 23 May 2017 13:49:35 +0000 (06:49 -0700)]
x86: Update notrackbad tests for non-ELF targets

* gas/testsuite/gas/i386/notrackbad.l: Updated for non-ELF
targets.
* gas/testsuite/gas/i386/x86-64-notrackbad.l: Likewise.

7 years agoPR21503, Gold doesn't create linker stub symbols on ppc64
Alan Modra [Mon, 22 May 2017 12:01:34 +0000 (21:31 +0930)]
PR21503, Gold doesn't create linker stub symbols on ppc64

PR 21503
* options.h: Add --emit-stub-syms option.
* powerpc.cc (object_id): New.
(Powerpc_relobj): Add uniq_ and accessor.  Sort variables for
better packing.
(Powerpc_dynobj): Sort variables for better packing.
(Target_powerpc::define_local): New function.
(Target_powerpc::group_sections): Pass stub table size to
Stub_table constructor.
(Target_powerpc::do_relax): Define stub and glink symbols.
(Stub_table): Add uniq_ variable, and id param to constructor.
(Stub_table::Plt_stub_ent): Add indx_ variable.
(Stub_table::Branch_stub_entries): Move typedef earlier.
(Stub_table::branch_stub_size): Replace "to" parameter with a
Branch_stub_entries iterator.
(Stub_table::add_long_branch_entry): Adjust to suit.
(Stub_table::add_plt_call_entry): Set indx_.
(Stub_table::define_stub_syms): New function.

7 years ago[ARC] Reformat error messages.
claziss [Tue, 23 May 2017 10:18:11 +0000 (12:18 +0200)]
[ARC] Reformat error messages.

gas/
2017-05-23  Claudiu Zissulescu <claziss@synopsys.com>

* config/tc-arc.c (md_apply_fix): Use as_bad_where.
(assemble_insn): Use as_bad.

7 years ago[ARC] Fix fall through warnings.
claziss [Tue, 23 May 2017 10:18:10 +0000 (12:18 +0200)]
[ARC] Fix fall through warnings.

bfd/
2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>

* elf32-arc.c (arc_elf_merge_attributes): Add fall through
comments.

7 years ago[ARC] Update MAX_INSN_FLGS.
claziss [Tue, 23 May 2017 10:18:10 +0000 (12:18 +0200)]
[ARC] Update MAX_INSN_FLGS.

It is required to parse instructions like ldb.x.a.di.

include/
2017-05-23  Claudiu Zissulescu <claziss@synopsys.com>

* opcode/arc.h (MAX_INSN_FLGS): Update to 4.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 23 May 2017 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agogdb: Document vMustReplyEmpty remote packet
Andrew Burgess [Mon, 15 May 2017 09:11:57 +0000 (10:11 +0100)]
gdb: Document vMustReplyEmpty remote packet

Add mention of the vMustReplyEmpty to the remote serial protocol
documentation.  It is important that this packet be treated in the same
fashion as any other unknown 'v' packet, and I have tried to reflect
this in the description of the packet, it is not simply the case that we
_must_ return the empty string for this packet.

As the intention is that we should treat this packet as unknown then an
argument could be made that we should not document it, however, for
someone implementing a gdbserver from scratch, seeing an undocumented
packet arrive from gdb is confusing, and will probably cause them to
have to read the code in order to check how this packet should be
handled, which is not ideal.

gdb/doc/ChangeLog:

* gdb.texinfo (Packets): Document vMustReplyEmpty packet.

7 years agox86: Add NOTRACK prefix support
H.J. Lu [Mon, 22 May 2017 18:02:46 +0000 (11:02 -0700)]
x86: Add NOTRACK prefix support

For register indirect branches, NOTRACK prefix (0x3e), which is also
the DS segment register prefix, can be used to ignore the CET indirect
branch track.

gas/

* config/tc-i386.c (REX_PREFIX): Changed to 7.
(NOTRACK_PREFIX): New.
(MAX_PREFIXES): Changed to 8.
(_i386_insn): Add notrack_prefix.
(PREFIX_GROUP): Add PREFIX_DS.
(add_prefix): Return PREFIX_DS for DS_PREFIX_OPCODE.
(md_assemble): Check if NOTRACK prefix is supported.
(parse_insn): Set notrack_prefix and issue an error for
other prefixes after NOTRACK prefix.
* testsuite/gas/i386/i386.exp: Run tests for NOTRACK prefix.
* testsuite/gas/i386/notrack-intel.d: New file.
* testsuite/gas/i386/notrack.d: Likewise.
* testsuite/gas/i386/notrack.s: Likewise.
* testsuite/gas/i386/notrackbad.l: Likewise.
* testsuite/gas/i386/notrackbad.s: Likewise.
* testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
* testsuite/gas/i386/x86-64-notrack.d: Likewise.
* testsuite/gas/i386/x86-64-notrack.s: Likewise.
* testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
* testsuite/gas/i386/x86-64-notrackbad.s: Likewise.

include/

* include/opcode/i386.h (NOTRACK_PREFIX_OPCODE): New.

opcodes/

* i386-dis.c (NOTRACK_Fixup): New.
(NOTRACK): Likewise.
(NOTRACK_PREFIX): Likewise.
(last_active_prefix): Likewise.
(reg_table): Use NOTRACK on indirect call and jmp.
(ckprefix): Set last_active_prefix.
(prefix_name): Return "notrack" for NOTRACK_PREFIX.
* i386-gen.c (opcode_modifiers): Add NoTrackPrefixOk.
* i386-opc.h (NoTrackPrefixOk): New.
(i386_opcode_modifier): Add notrackprefixok.
* i386-opc.tbl: Add NoTrackPrefixOk to indirect call and jmp.
Add notrack.
* i386-tbl.h: Regenerated.

7 years agox86-64: Use dynobj instead of htab->elf.dynobj
H.J. Lu [Mon, 22 May 2017 14:41:16 +0000 (07:41 -0700)]
x86-64: Use dynobj instead of htab->elf.dynobj

* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
dynobj instead of htab->elf.dynobj.

7 years ago[AArch64, ld] Support ILP32 triplet aarch64*-linux-gnu_ilp32
Jiong Wang [Mon, 22 May 2017 08:50:29 +0000 (09:50 +0100)]
[AArch64, ld] Support ILP32 triplet aarch64*-linux-gnu_ilp32

This patch allows AArch64 LD defaulting to ILP32 if it is configured with
aarch64*-linux-gnu_ilp32.

ld/
* configure.tgt: Set "targ_emul" to "aarch64linux32b" for
aarch64_be-*-linux-gnu_ilp32.  Set "targ_emul" to "aarch64linux32" for
aarch64-*-linux-gnu_ilp32.

7 years ago[AArch64, gas] Support ILP32 triplet aarch64*-linux-gnu_ilp32
Jiong Wang [Mon, 22 May 2017 08:50:19 +0000 (09:50 +0100)]
[AArch64, gas] Support ILP32 triplet aarch64*-linux-gnu_ilp32

This patch allows AArch64 GAS defaulting to ILP32 if it is configured with
aarch64*-linux-gnu_ilp32.

"md_after_parse_args" is implemented to update ABI into ILP32 if DEFAULT_ARCH is
"aarch64:32".

gas/
* configure.tgt: Set "arch" to "aarch64" if ${cpu} equals "aarch64".
Recognize the new triplet name aarch64*-linux-gnu_ilp32.
* configure.ac: Output DEFAULT_ARCH macro for AArch64.
* configure: Regenerate.
* config/tc-aarch64.h (aarch64_after_parse_args): New declaration.
(md_after_parse_args): New define.
* config/tc-aarch64.c (aarch64_abi_type): New enumeration
AARCH64_ABI_NONE.
(DEFAULT_ARCH): New define.
(aarch64_abi): Set default value to AARCH64_ABI_NONE.
(aarch64_after_parse_args): New function.

7 years agogdb: Add John Baldwin as FreeBSD Maintainer
Pedro Alves [Mon, 22 May 2017 10:58:19 +0000 (11:58 +0100)]
gdb: Add John Baldwin as FreeBSD Maintainer

gdb/ChangeLog:
2017-05-22  Pedro Alves <palves@redhat.com>

* MAINTAINERS (Host/Native): Add John Baldwin as FreeBSD
maintainer.

7 years agoAdd PPC_MAX_REGISTER_SIZE
Alan Hayward [Mon, 22 May 2017 08:23:22 +0000 (09:23 +0100)]
Add PPC_MAX_REGISTER_SIZE

gdb/
* ppc-linux-nat.c (fetch_register): Use PPC_MAX_REGISTER_SIZE.
(store_register): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Likewise.
(get_decimal_float_return_value): Likewise.
(do_ppc_sysv_return_value): Likewise.
(ppc64_sysv_abi_push_integer): Likewise.
(ppc64_sysv_abi_push_freg): Likewise.
(ppc64_sysv_abi_return_value_base): Likewise.
(ppc64_sysv_abi_return_value): Likewise.
* rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise.
* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise.
* rs6000-nat.c: Likewise.
* rs6000-tdep.c (rs6000_register_to_value): Likewise.
(rs6000_value_to_register): Likewise.
* ppc-tdep.h (PPC_MAX_REGISTER_SIZE): Add.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 22 May 2017 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoPrint Rust unsized array types a bit more nicely
Tom Tromey [Sun, 21 May 2017 23:00:10 +0000 (17:00 -0600)]
Print Rust unsized array types a bit more nicely

It's a bit difficult to create an unsized array type in Rust, but if
you do, right now ptype will show something like "[u8; ]".  It really
should print "[u8]", though, which is what this patch implements.

This is part of PR 21466.

Built and regtested on x86-64 Fedora 25.  I'm checking this in.

ChangeLog
2017-05-21  Tom Tromey  <tom@tromey.com>

PR rust/21466:
* rust-lang.c (rust_print_type) <TYPE_CODE_ARRAY>: Print unsized
arrays as "[T]", not "[T; ]".

testsuite/ChangeLog
2017-05-21  Tom Tromey  <tom@tromey.com>

PR rust/21466:
* gdb.rust/unsized.exp: New file.
* gdb.rust/unsized.rs: New file.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 21 May 2017 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agobinutils: remove sparc64/mips64 workaround in objcopy build notes merge code
Jose E. Marchesi [Sat, 20 May 2017 06:45:29 +0000 (23:45 -0700)]
binutils: remove sparc64/mips64 workaround in objcopy build notes merge code

This patch removes a workaround recently installed in objcopy that
avoided removing duplicated notes in targets for which the number of
internal relocations may be bigger than the number of external
relocations.  With the recent fixes in sparc64 and mips64, this
workaround is no longer necessary.

2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

* objcopy.c (merge_gnu_build_notes): Remove workaround that
prevented deleting relocations in duplicated notes in mips64 and
sparc.

7 years agoUse watchpoint's language when re-parsing expression
Tom Tromey [Sun, 14 May 2017 17:12:14 +0000 (11:12 -0600)]
Use watchpoint's language when re-parsing expression

PR rust/21484 notes that watch -location does not work with Rust:

    (gdb) watch -location a
    syntax error in expression, near `) 0x00007fffffffe0f4'.

update_watchpoint tries to tell gdb that the new expression it creates
has C syntax:

      /* The above expression is in C.  */
      b->language = language_c;

However, update_watchpoint doesn't actually use this language when
re-parsing the expression.

Originally I was going to fix this by saving and restoring the
language in update_watchpoint, but this regressed
gdb.dlang/watch-loc.exp, because the constructed expression actually
has D syntax (specifically the name is not parseable by C).

Next I looked at directly constructing an expression, and not relying
on the parser at all; but it seemed to me that upon a re-set, we'd
want to reparse the type, and there is no existing API to do this
correctly.

So, in the end I made a hook to let each language choose what
expression to use.  I made all the languages other than Rust use the C
expression, because that is the status quo ante.  However, this is
probably not truly correct.  After this patch, at least, it is easy to
correct by someone who knows the language(s) in question.

Regtested by the buildbot.

ChangeLog
2017-05-19  Tom Tromey  <tom@tromey.com>

PR rust/21484:
* rust-lang.c (exp_descriptor_rust): New function.
(rust_language_defn): Use it.
* p-lang.c (pascal_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* language.h (struct language_defn)
<la_watch_location_expression>: New member.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Update.
* go-lang.c (go_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* c-lang.h (c_watch_location_expression): Declare.
* c-lang.c (c_watch_location_expression): New function.
(c_language_defn, cplus_language_defn, asm_language_defn)
(minimal_language_defn): Use it.
* breakpoint.c (watch_command_1): Call
la_watch_location_expression.
* ada-lang.c (ada_language_defn): Update.

testsuite/ChangeLog
2017-05-19  Tom Tromey  <tom@tromey.com>

PR rust/21484:
* gdb.rust/watch.exp: New file.
* gdb.rust/watch.rs: New file.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 20 May 2017 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count'
Maciej W. Rozycki [Fri, 19 May 2017 14:11:31 +0000 (15:11 +0100)]
MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count'

Revert parts of commit fee24f1c5bfe ("objdump improvements for mips
elf64"), <https://sourceware.org/ml/binutils/2003-03/msg00108.html>, and
make the `->reloc_count' member of `struct bfd_section' hold the actual
number of internal relocations stored in its `->relocation' vector.  To
do so adjust `mips_elf64_slurp_one_reloc_table' to set `->reloc_count'
to the actual number of internal relocations retrieved and discard
`mips_elf64_canonicalize_reloc', `mips_elf64_canonicalize_dynamic_reloc'
and their corresponding target macros.  Contrary to the description of
`mips_elf64_slurp_one_reloc_table', adjusted appropriately, this makes
generic relocation processing code happy and satisfies the "merge notes
section" binutils test case.

Add extra binutils test cases to expand the coverage of the generic
"merge notes section" test case, now passing with the n64 ABI, across
the MIPS o32, n32 and n64 ABIs regardless of the default ABI selected in
target configuration, and also to verify correctness of the relocations
produced.  Conversely, do not provide any additional test cases for the
original issue addressed with the commit referred:

- objdump would display only 1/3 of the total number of relocations,
  because it used the external relocation count, but each external
  relocation is brought in as 3 internal relocations.

as n64 ABI relocation processing with `objdump -r' and `objdump -R' is
already widely covered across the GAS and LD test suites.

bfd/
* elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
and function.
(mips_elf64_canonicalize_dynamic_reloc): Likewise.
(mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
actual number of internal relocations retrieved.  Adjust
function description.
(bfd_elf64_canonicalize_reloc): Remove macro.
(bfd_elf64_canonicalize_dynamic_reloc): Likewise.

binutils/
* testsuite/binutils-all/mips/mips-note-2.d: New test.
* testsuite/binutils-all/mips/mips-note-2r.d: New test.
* testsuite/binutils-all/mips/mips-note-2-n32.d: New test.
* testsuite/binutils-all/mips/mips-note-2-n64.d: New test.
* testsuite/binutils-all/mips/mips-note-2r-n32.d: New test.
* testsuite/binutils-all/mips/mips-note-2r-n64.d: New test.
* testsuite/binutils-all/mips/mips.exp: Define `has_newabi'.
Run the new tests.

7 years agobinutils/testsuite: Permit the reuse of dump patterns
Maciej W. Rozycki [Fri, 19 May 2017 14:08:16 +0000 (15:08 +0100)]
binutils/testsuite: Permit the reuse of dump patterns

Complement commit 89210bdc8fd2 ("GAS: Permit the reuse of dump
patterns"), <https://sourceware.org/ml/binutils/2010-07/msg00269.html>,
and commit ef2b5578f693 ("MIPS: Enable NewABI tests for SDE targets"),
<https://sourceware.org/ml/binutils/2012-08/msg00017.html>, and like the
GAS and LD versions make the binutils version of `run_dump_test' also
support the `dump' keyword, for reusing dump patterns between tests.

binutils/
* testsuite/lib/utils-lib.exp (run_dump_test): Handle the `dump'
option.