binutils-gdb.git
9 years agowatchpoint-reuse-slot.exp: skip setting HW breakpoints on some address
Yao Qi [Fri, 13 Mar 2015 10:56:01 +0000 (10:56 +0000)]
watchpoint-reuse-slot.exp: skip setting HW breakpoints on some address

We see some fails in watchpoint-reuse-slot.exp on aarch64-linux, because
it sets some HW breakpoint on some address doesn't meet the alignment
requirements by kernel, kernel will reject the
ptrace (PTRACE_SETHBPREGS) call, and some fails are caused, for example:

(gdb) PASS: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: watch x hbreak: : width 1, iter 0: base + 0: delete $bpnum
hbreak *(buf.byte + 0 + 1)^M
Hardware assisted breakpoint 80 at 0x410a61^M
(gdb) PASS: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: watch x hbreak: : width 1, iter 0: base + 1: hbreak *(buf.byte + 0 + 1)
stepi^M
Warning:^M
Cannot insert hardware breakpoint 80.^M
Could not insert hardware breakpoints:^M
You may have requested too many hardware breakpoints/watchpoints.^M
^M
(gdb) FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: watch x hbreak: : width 1, iter 0: base + 1: stepi advanced

hbreak *(buf.byte + 0 + 1)^M
Hardware assisted breakpoint 440 at 0x410a61^M
Warning:^M
Cannot insert hardware breakpoint 440.^M
Could not insert hardware breakpoints:^M
You may have requested too many hardware breakpoints/watchpoints.^M
^M
(gdb) FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: watch x hbreak: : width 1, iter 0: base + 1: hbreak *(buf.byte + 0 + 1)

This patch is to skip some tests by checking proc valid_addr_p.
We can handle other targets in valid_addr_p too.

gdb/testsuite:

2015-03-16  Yao Qi  <yao.qi@linaro.org>

* gdb.base/watchpoint-reuse-slot.exp (valid_addr_p): New proc.
(top level): Skip tests if valid_addr_p returns false for
$cmd1 or $cmd2.

9 years agoUpdate top-level files from GCC trunk
H.J. Lu [Mon, 16 Mar 2015 16:12:37 +0000 (09:12 -0700)]
Update top-level files from GCC trunk

* Makefile.def: Updated from GCC trunk.
* Makefile.tpl: Likewise.
* configure.ac: Likewise.
* Makefile.in: Regenerated.
* configure: Likewise.

9 years agoSync isl.m4 with GCC tree
H.J. Lu [Mon, 16 Mar 2015 15:51:37 +0000 (08:51 -0700)]
Sync isl.m4 with GCC tree

* isl.m4: Sync with GCC tree.

9 years agoSync elf.m4 with GCC tree
H.J. Lu [Mon, 16 Mar 2015 15:49:06 +0000 (08:49 -0700)]
Sync elf.m4 with GCC tree

Sync with GCC
2015-02-18  Thomas Schwinge  <thomas@codesourcery.com>

* elf.m4 (ACX_ELF_TARGET_IFELSE): nvptx-*-none isn't ELF.

9 years agoAppend -g -Os rather than overwriting
H.J. Lu [Mon, 16 Mar 2015 15:44:41 +0000 (08:44 -0700)]
Append -g -Os rather than overwriting

Sync with GCC
2014-11-17  Bob Dunlop  <bob.dunlop@xyzzy.org.uk>

* mt-ospace (CFLAGS_FOR_TARGET): Append -g -Os rather than
overwriting.
(CXXFLAGS_FOR_TARGET): Similarly.

9 years agoDon't reset CXXFLAGS_FOR_TARGET
H.J. Lu [Mon, 16 Mar 2015 15:41:42 +0000 (08:41 -0700)]
Don't reset CXXFLAGS_FOR_TARGET

Sync with GCC
2014-04-25  Marc Glisse  <marc.glisse@inria.fr>

PR target/43538
* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.

9 years agoSync bootstrap-asan.mk/bootstrap-lto.mk with GCC tree
H.J. Lu [Mon, 16 Mar 2015 15:34:23 +0000 (08:34 -0700)]
Sync bootstrap-asan.mk/bootstrap-lto.mk with GCC tree

* bootstrap-asan.mk: Sync with GCC tree.
* bootstrap-lto.mk: Likewise.

9 years agoRemove cloog.m4
H.J. Lu [Mon, 16 Mar 2015 15:31:47 +0000 (08:31 -0700)]
Remove cloog.m4

* cloog.m4: Removed.

9 years agoDisable all target libraries if not building gcc
H.J. Lu [Mon, 16 Mar 2015 15:12:46 +0000 (08:12 -0700)]
Disable all target libraries if not building gcc

Don't build target libraries if not building gcc.

* configure.ac (target_configdirs): Unset if not building gcc.
* configure: Regenerated.

9 years agoFetch all registers before writing the core register notes.
John Baldwin [Sat, 14 Mar 2015 17:47:20 +0000 (13:47 -0400)]
Fetch all registers before writing the core register notes.

Without this, not all registers were present in the core generated by
gcore.  For example, running 'gcore' on a program without examining
the vector registers (SSE or AVX) would store all the vector registers
as zeros because they were not pulled into the regcache.  Running
'info vector' before 'gcore' would store the correct values in the
core since it populated the regcache.  For Linux processes, a similar
operation is achieved by having the thread iterator callback invoke
target_fetch_registers on each thread before its corresponding
register notes are dumped.

gdb/ChangeLog:

* fbsd-tdep.c (fbsd_make_corefile_notes): Fetch all target registers
before writing core register notes.

9 years agostub termcap, add extern "C"
Yuanhui Zhang [Mon, 16 Mar 2015 11:28:24 +0000 (11:28 +0000)]
stub termcap, add extern "C"

Fixes linking an --enable-build-with-cxx build on mingw:

 ../readline/terminal.c:278: undefined reference to `tgetnum'
 ../readline/terminal.c:297: undefined reference to `tgetnum'
 ../readline/libreadline.a(terminal.o): In function `get_term_capabilities':
 ../readline/terminal.c:427: undefined reference to `tgetstr'
 ../readline/libreadline.a(terminal.o): In function `_rl_init_terminal_io':
 [etc.]

gdb/ChangeLog:
2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
    Pedro Alves  <palves@redhat.com>

* gdb_curses.h (tgetnum): Mark with EXTERN_C.
* stub-termcap.c (tgetent, tgetnum, tgetflag, tgetstr, tputs)
(tgoto): Wrap with extern "C".

9 years agostub-termcap.c: prototype tputs's parameter's parameter, for C++ mode
Pedro Alves [Mon, 16 Mar 2015 11:28:23 +0000 (11:28 +0000)]
stub-termcap.c: prototype tputs's parameter's parameter, for C++ mode

 src/gdb/stub-termcap.c: In function 'int tputs(char*, int, int (*)())':
 src/gdb/stub-termcap.c:67:22: error: too many arguments to function
      outfun (*string++);
       ^

gdb/ChangeLog:
2015-03-16  Pedro Alves  <palves@redhat.com>
    Yuanhui Zhang  <asmwarrior@gmail.com>

* stub-termcap.c (tputs): Change prototype.

9 years agowindows-nat.c: conflicting declaration of struct thread_info in C++ mode
Yuanhui Zhang [Mon, 16 Mar 2015 11:31:31 +0000 (11:31 +0000)]
windows-nat.c: conflicting declaration of struct thread_info in C++ mode

Building mingw GDB with --enable-build-with-cxx shows:

 ../../binutils-gdb/gdb/windows-nat.c: At global scope:
 ../../binutils-gdb/gdb/windows-nat.c:192:1: error: conflicting declaration 'typedef struct thread_info_struct thread_info'
  thread_info;
  ^
 In file included from ../../binutils-gdb/gdb/windows-nat.c:52:0:
 ../../binutils-gdb/gdb/gdbthread.h:160:8: error: 'struct thread_info' has a previous declaration as 'struct thread_info'
  struct thread_info
 ^

Simply rename the structure to avoid the conflict.

gdb/ChangeLog:
2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
    Pedro Alves  <palves@redhat.com>

* windows-nat.c (struct thread_info_struct): Rename to ...
(struct windows_thread_info_struct): ... this.
(thread_info): Rename to ...
(windows_thread_info): ... this.
All users updated.

9 years agoRemoves a #if 1 ... #endif accidentally left in the source code.
Nick Clifton [Mon, 16 Mar 2015 11:17:52 +0000 (11:17 +0000)]
Removes a #if 1 ... #endif accidentally left in the source code.

* dwarf2dbg.c (out_header): Remove spurious #if 1.

9 years agoFixes a problem with the RX port trying to perform linker relaxation when -no-keep...
Nick Clifton [Mon, 16 Mar 2015 11:14:07 +0000 (11:14 +0000)]
Fixes a problem with the RX port trying to perform linker relaxation when -no-keep-memory has been enabled.

* elf32-rx.c (elf32_rx_relax_delete_bytes): If the relocs are not
stored in the elf_section_data structure then load them as
necessary.

9 years agosim: mcore/microblaze: strip trailing whitespace
Mike Frysinger [Mon, 16 Mar 2015 06:23:02 +0000 (02:23 -0400)]
sim: mcore/microblaze: strip trailing whitespace

No functional changes here.

9 years agosim: mcore/microblaze: clean up a bit
Mike Frysinger [Mon, 16 Mar 2015 06:26:48 +0000 (02:26 -0400)]
sim: mcore/microblaze: clean up a bit

Fix some various warnings and enable the extra warnings options.

9 years agosim: convert some old prototypes
Mike Frysinger [Mon, 16 Mar 2015 06:13:31 +0000 (02:13 -0400)]
sim: convert some old prototypes

9 years agosim: rename tconfig.in to tconfig.h
Mike Frysinger [Sun, 15 Mar 2015 03:41:25 +0000 (23:41 -0400)]
sim: rename tconfig.in to tconfig.h

Rather than manually include tconfig.h when we think we'll need it (which
is error prone as it can define symbols we expect from config.h), have it
be included directly by config.h.  Since we know we have to include that
header everywhere already, this will make sure tconfig.h isn't missed.

It should also be fine as tconfig.h is supposed to be simple and only set
up a few core defines for the target.

This allows us to stop symlinking it in place all the time and just use
it straight out of the respective source directory.

9 years agosim/erc32: use SIM_AC_OPTION_HOSTENDIAN to probe for host endianess
Jiri Gaisler [Mon, 16 Mar 2015 05:14:09 +0000 (01:14 -0400)]
sim/erc32: use SIM_AC_OPTION_HOSTENDIAN to probe for host endianess

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agosim: dv-sockser: push module init prototype down
Mike Frysinger [Sun, 15 Mar 2015 06:55:08 +0000 (02:55 -0400)]
sim: dv-sockser: push module init prototype down

Pull out the duplicated dv_sockser_install prototype from the tconfig.in
files and put it in the one place it gets used -- sim-module.c.  This is
still arguably incorrect, but it's better than the status quo where the
tconfig.in has to include header files and duplicate the dv-sockser func.
The tconfig header is meant to be simple and contain a target defines.

9 years agosim: bfin: fix signed warning
Mike Frysinger [Sun, 15 Mar 2015 00:54:49 +0000 (20:54 -0400)]
sim: bfin: fix signed warning

Fix the type of the local var to match the function it is passed to.

9 years agosim: delete unused sim-inline.c rule
Mike Frysinger [Sun, 15 Mar 2015 00:52:24 +0000 (20:52 -0400)]
sim: delete unused sim-inline.c rule

This dates back to the start of the repo, but has never really been used.
The sim-inline.c file has been checked in to the source, and attempts to
build it in the build tree leads to a circular dep warning from make.  It
also doesn't produce a file that is usable -- it can't be compiled.  Punt!

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agosim: mcore/moxie: clean up makefiles a bit
Mike Frysinger [Sat, 14 Mar 2015 11:46:54 +0000 (07:46 -0400)]
sim: mcore/moxie: clean up makefiles a bit

Clean out stub targets and rules that get autogenerated.

9 years agosim: msp430: use common warnings options
Mike Frysinger [Sat, 8 Mar 2014 05:56:53 +0000 (00:56 -0500)]
sim: msp430: use common warnings options

This triggers a bunch of new warnings, so fix some of them.

9 years agosim: make nrun the default run program
Mike Frysinger [Thu, 19 Feb 2015 08:46:01 +0000 (03:46 -0500)]
sim: make nrun the default run program

We want people to stop using the run.c frontend, but it's hard to notice
when it's still set as the default.  Lets flip things so nrun.c is the
default, and users of run.c will get an error by default.  We turn that
error into a warning for existing sims so we don't break them -- this is
mostly meant for people starting new ports.

9 years agoS/390: Disable relocation sort against code sections.
Andreas Krebbel [Sat, 14 Mar 2015 10:45:05 +0000 (11:45 +0100)]
S/390: Disable relocation sort against code sections.

When downgrading from GD to IE model we rewrite the call to
__tls_get_offset to a 64 bit load instruction. This relies on the fact
that the additional relocation for the call target has already been
executed when doing the rewrite.

   f1018:       e3 20 d0 00 00 04       lg      %r2,0(%r13)
   f101e:       c0 e5 00 00 00 00       brasl   %r14,f101e <__res_init+0x1e>
                        f101e: R_390_TLS_GDCALL __libc_resp
                        f1020: R_390_PLT32DBL   __tls_get_offset+0x2

0000000f1020  39f6c00000014 R_390_PLT32DBL    0000000000000000 __tls_get_offset + 2
0000000f101e  3afb700000026 R_390_TLS_GDCALL  0000000000000008 __libc_resp + 0

Due to the reloc sorting the order changed an the PLT32DBL reloc is
executed after the rewrite and overwrites part of the load instruction
with garbage.

bfd/
2015-03-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* elf-s390-common.c (elf_s390_elf_sort_relocs_p): Don't sort
relocs against code sections.
* elf32-s390.c: Define elf_backend_sort_relocs_p.
* elf64-s390.c: Likewise.

9 years agosim: drop duplicate header checks
Mike Frysinger [Thu, 19 Feb 2015 08:50:11 +0000 (03:50 -0500)]
sim: drop duplicate header checks

The SIM_AC_COMMON macro already checks for a bunch of headers, so specific
sim ports need not do it themselves.

9 years agoNEWS: Remove HPUX
Jan Kratochvil [Sat, 14 Mar 2015 10:01:17 +0000 (11:01 +0100)]
NEWS: Remove HPUX

gdb/ChangeLog
2015-03-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Pedro Alves  <palves@redhat.com>

* NEWS: New Removed targets and native configurations.

9 years agosim: move sim-io.h to sim-assert.h
Mike Frysinger [Sat, 14 Mar 2015 07:42:08 +0000 (03:42 -0400)]
sim: move sim-io.h to sim-assert.h

Since sim-endian.c doesn't actually use sim_io funcs, it's weird to
include the sim-io.h header here.  It's doing so only for the assert
header.  So lets relocate the include to the right place.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 14 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMIPS: Fix constraint issues with the R6 beqc and bnec instructions
Andrew Bennett [Fri, 13 Mar 2015 22:42:55 +0000 (22:42 +0000)]
MIPS: Fix constraint issues with the R6 beqc and bnec instructions

opcodes/
* mips-opc.c (decode_mips_operand): Fix constraint issues
with u and y operands.

gas/testsuite/
* gas/mips/mips.exp: Added branch constraints testcase.
* gas/mips/r6-branch-constraints.s: New test.
* gas/mips/r6-branch-constraints.l: New test.

9 years agoAdd support for MIPS R6 evp and dvp instructions.
Andrew Bennett [Fri, 13 Mar 2015 22:02:16 +0000 (22:02 +0000)]
Add support for MIPS R6 evp and dvp instructions.

opcodes/
* mips-opc.c (mips_builtin_opcodes): Add evp and dvp instructions.

gas/testsuite/
* gas/mips/r6.s: Add evp and dvp instructions.
* gas/mips/r6.d: Likewise.
* gas/mips/r6-n32.d: Likewise.
* gas/mips/r6-n64.d: Likewise.

9 years agoRemove HPUX
Jan Kratochvil [Fri, 13 Mar 2015 19:24:22 +0000 (20:24 +0100)]
Remove HPUX

IIUC it is a pre-requisite for IPv6 support, some UNICes do not support
getaddrinfo required for IPv6.  But coincidentally such UNICes are no longer
really supported by GDB.  Therefore it was concluded we can remove all such
UNICes and then we can implement IPv6 easily with getaddrinfo.

In mail
        Re: getaddrinfo available on all GDB hosts? [Re: [PATCH v2] Add IPv6 support for remote TCP connections]
        Message-ID: <20140211034157.GG5485@adacore.com>
        https://sourceware.org/ml/gdb-patches/2014-02/msg00333.html
Joel said:

So I chose HP-UX first for this patch.

gdb/ChangeLog
2014-10-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

Remove HPUX.
* Makefile.in (ALL_64_TARGET_OBS): Remove ia64-hpux-tdep.o.
(ALL_TARGET_OBS): Remove hppa-hpux-tdep.o, solib-som.o and solib-pa64.o.
(HFILES_NO_SRCDIR): Remove solib-som.h, inf-ttrace.h, solib-pa64.h and
ia64-hpux-tdep.h, solib-ia64-hpux.h.
(ALLDEPFILES): Remove hppa-hpux-tdep.c, hppa-hpux-nat.c,
ia64-hpux-nat.c, ia64-hpux-tdep.c, somread.c and solib-som.c.
* config/djgpp/fnchange.lst: Remove hppa-hpux-nat.c and
hppa-hpux-tdep.c.
* config/ia64/hpux.mh: Remove file.
* config/pa/hpux.mh: Remove file.
* configure: Rebuilt.
* configure.ac (dlgetmodinfo, somread.o): Remove.
* configure.host (hppa*-*-hpux*, ia64-*-hpux*): Make them obsolete.
(ia64-*-hpux*): Remove its float format exception.
* configure.tgt (hppa*-*-hpux*, ia64-*-hpux*): Make them obsolete.
* hppa-hpux-nat.c: Remove file.
* hppa-hpux-tdep.c: Remove file.
* hppa-tdep.c (struct hppa_unwind_info, struct hppa_objfile_private):
Move them here from hppa-tdep.h
(hppa_objfile_priv_data, hppa_init_objfile_priv_data): Make it static.
(hppa_frame_prev_register_helper): Remove HPPA_FLAGS_REGNUM exception.
* hppa-tdep.h (struct hppa_unwind_info, struct hppa_objfile_private):
Move them to hppa-tdep.c.
(hppa_objfile_priv_data, hppa_init_objfile_priv_data): Remove
declarations.
* ia64-hpux-nat.c: Remove file.
* ia64-hpux-tdep.c: Remove file.
* ia64-hpux-tdep.h: Remove file.
* inf-ttrace.c: Remove file.
* inf-ttrace.h: Remove file.
* solib-ia64-hpux.c: Remove file.
* solib-ia64-hpux.h: Remove file.
* solib-pa64.c: Remove file.
* solib-pa64.h: Remove file.
* solib-som.c: Remove file.
* solib-som.h: Remove file.
* somread.c: Remove file.

9 years agoUse kinfo_getvmmap on FreeBSD to enumerate memory regions.
John Baldwin [Wed, 18 Feb 2015 00:15:45 +0000 (19:15 -0500)]
Use kinfo_getvmmap on FreeBSD to enumerate memory regions.

Use kinfo_getvmmap from libutil on FreeBSD to enumerate memory
regions in a running process instead of /proc/<pid>/map.  FreeBSD systems
do not mount procfs by default, but kinfo_getvmmap uses a sysctl that
is always available.

Skip memory regions for devices as well as regions an application has
requested to not be dumped via the MAP_NOCORE flag to mmap or
MADV_NOCORE advice to madvise.

gdb/ChangeLog:

* configure.ac: AC_CHECK_LIB(util, kinfo_getvmmap).
* configure: Regenerate.
* config.in: Regenerate.
* fbsd-nat.c [!HAVE_KINFO_GETVMMAP] (fbsd_read_mapping): Don't
        define.
(fbsd_find_memory_regions): Use kinfo_getvmmap to
enumerate memory regions if present.

9 years agoStyle fixes.
John Baldwin [Fri, 27 Feb 2015 18:17:43 +0000 (13:17 -0500)]
Style fixes.

- Do not leave operators at end-of-line.
- Fix block indentation in if-else chain.

gdb/ChangeLog:

* amd64fbsd-tdep.c (amd64fbsd_sigtramp_p): Style fixes.
* i386fbsd-tdep.c: Fix style in various gdb_static_assert
expressions.
(i386fbsd_sigtramp_p): Likewise.

9 years ago[AArch64] Don't warn on XZR/SP overlapping when it's in load/store
Jiong Wang [Fri, 13 Mar 2015 12:02:23 +0000 (12:02 +0000)]
[AArch64] Don't warn on XZR/SP overlapping when it's in load/store

2015-03-13  Jiong Wang  <jiong.wang@arm.com>

gas/
   * config/tc-aarch64.c (warn_unpredictable_ldst): Don't warn on reg number 31.

gas/testsuite/
  * gas/aarch64/diagnostic.s: New testcases.
  * gas/aarch64/diagnostic.l: New error match.

9 years ago[AArch64] Don't tail-pads sections to the alignment
Jiong Wang [Fri, 13 Mar 2015 12:00:37 +0000 (12:00 +0000)]
[AArch64] Don't tail-pads sections to the alignment

2015-03-13  Jiong Wang  <jiong.wang@arm.com>

gas/
  * config/tc-aarch64.h (SUB_SEGMENT_ALIGN): Define to be zero.

gas/testsuite/
  * gas/aarch64/tail_padding.s: New testcase.
  * gas/aarch64/tail_padding.d: New expectation file.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd myself as a write-after-approval GDB maintainer
John Baldwin [Fri, 6 Mar 2015 20:18:34 +0000 (15:18 -0500)]
Add myself as a write-after-approval GDB maintainer

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add John Baldwin.

9 years agoAdd i6400 entry to the MIPS CPU table.
Andrew Bennett [Thu, 12 Mar 2015 16:27:46 +0000 (16:27 +0000)]
Add i6400 entry to the MIPS CPU table.

gas/

* config/tc-mips.c (mips_cpu_info_table): Add i6400 entry.
* doc/c-mips.texi: Document i6400 -march option.

9 years agoFixes a problem generating relocs for thumb function calls to local symbols defined...
Nick Clifton [Thu, 12 Mar 2015 15:58:37 +0000 (15:58 +0000)]
Fixes a problem generating relocs for thumb function calls to local symbols defined in other sections.

PR gas/17444
* config/tc-arm.h (MD_APPLY_SYM_VALUE): Pass the current segment
to arm_apply_sym_value.  Update prototype.
* config/tc-arm.c (arm_apply_sym_value): Add segment argument.
Do not apply the value if the symbol is in a different segment to
the current segment.

9 years agoAllow "set sysroot" with no argument to restore sysroot to empty
Gary Benson [Thu, 12 Mar 2015 11:44:16 +0000 (11:44 +0000)]
Allow "set sysroot" with no argument to restore sysroot to empty

This commit creates the "set/show sysroot" commands using
add_setshow_optional_filename_cmd to allow the sysroot to
be restored to empty after being set.

gdb/ChangeLog:

* solib.c (_initialize_solib): Make "set/show sysroot" use
add_setshow_optional_filename_cmd so it can be restored to
empty after being set.

9 years agoFix gold incremental test failures.
Cary Coutant [Thu, 12 Mar 2015 05:07:51 +0000 (22:07 -0700)]
Fix gold incremental test failures.

Newer version of GCC pass -z relro to the linker, but incremental linking
does not support relro. This patch adds a check to complain about the
conflict, and changes the testsuite to pass -z norelro to the incremental
tests.

2015-03-11  Cary Coutant  <ccoutant@google.com>

gold/
* options.cc (General_options::finalize): Don't allow -z relro
with incremental linking.
* testsuite/Makefile.am (incremental_test): Add -z norelro.
(incremental_test_2): Likewise.
(incremental_test_3): Likewise.
(incremental_test_4): Likewise.
(incremental_test_5): Likewise.
(incremental_test_6): Likewise.
(incremental_copy_test): Likewise.
(incremental_common_test_1): Likewise.
(incremental_comdat_test_1): Likewise.
* testsuite/Makefile.in: Regenerate.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoCreate gdb/break-catch-syscall.c
Sergio Durigan Junior [Wed, 11 Mar 2015 18:12:07 +0000 (14:12 -0400)]
Create gdb/break-catch-syscall.c

This commits cleans up the gdb/breakpoint.c file and moves everything
that is related to the 'catch syscall' command to the new file
gdb/break-catch-syscall.c.  This is just code movement, and the only
new part is the adjustment needed on 'catching_syscall_number' to use
the new 'breakpoint_find_if' function insted of relying on the
ALL_BREAKPOINTS macro.

Tested by running the 'gdb.base/catch-syscall.exp' testcase.

gdb/ChangeLog:
2015-03-11  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (SFILES): New source break-catch-syscall.c.
(COMMON_OBS): New object break-catch-syscall.o.
* break-catch-syscall.c: New file.
* breakpoint.c: Remove inclusion of "xml-syscall.h".
(syscall_catchpoint_p): Move declaration to break-catch-syscall.c
(struct syscall_catchpoint): Likewise.
(dtor_catch_syscall): Likewise.
(catch_syscall_inferior_data): Likewise.
(struct catch_syscall_inferior_data): Likewise.
(get_catch_syscall_inferior_data): Likewise.
(catch_syscall_inferior_data_cleanup): Likewise.
(insert_catch_syscall): Likewise.
(remove_catch_syscall): Likewise.
(breakpoint_hit_catch_syscall): Likewise.
(print_it_catch_syscall): Likewise.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_breakpoint_ops): Likewise.
(syscall_catchpoint_p): Likewise.
(create_syscall_event_catchpoint): Likewise.
(catch_syscall_split_args): Likewise.
(catch_syscall_command_1): Likewise.
(is_syscall_catchpoint_enabled): Likewise.
(catch_syscall_enabled): Likewise.
(catching_syscall_number): Likewise.
(catch_syscall_completer): Likewise.
(clear_syscall_counts): Likewise.
(initialize_breakpoint_ops): Move initialization of syscall
catchpoints to break-catch-syscall.c.
(_initialize_breakpoint): Move code related to syscall catchpoints
to break-catch-syscall.c.

9 years agoImplement breakpoint_find_if
Sergio Durigan Junior [Wed, 11 Mar 2015 18:09:51 +0000 (14:09 -0400)]
Implement breakpoint_find_if

This commit implements the 'breakpoint_find_if' function, which allows
code external to gdb/breakpoint.c to iterate through the list of
'struct breakpoint *'.  This is needed in order to create the
'gdb/break-catch-syscall.c' file, because one of its functions
(catching_syscall_number) needs to do this iteration.

My first thought was to share the ALL_BREAKPOINTS* macros on
gdb/breakpoint.h, but they use a global variable local to
gdb/breakpoint.c, and I did not want to share that variable.  So, in
order to keep the minimal separation, I decided to implement this
way of iterating through the existing 'struct breakpoint *'.

This function was based on BFD's bfd_sections_find_if.  If the
user-provided function returns 0, the iteration proceeds.  Otherwise,
the iteration stops and the function returns the 'struct breakpoint *'
that is being processed.  This means that the return value of this
function can be either NULL or a pointer to a 'struct breakpoint'.

gdb/ChangeLog:
2015-03-11  Sergio Durigan Junior  <sergiodj@redhat.com>

* breakpoint.c (breakpoint_find_if): New function.
* breakpoint.h (breakpoint_find_if): New prototype.

9 years agoImplement vFile:fstat: in gdbserver
Gary Benson [Wed, 11 Mar 2015 17:53:57 +0000 (17:53 +0000)]
Implement vFile:fstat: in gdbserver

This commit implements the "vFile:fstat:" packet in gdbserver.

gdb/gdbserver/ChangeLog:

* hostio.c (sys/types.h): New include.
(sys/stat.h): Likewise.
(common-remote-fileio.h): Likewise.
(handle_fstat): New function.
(handle_vFile): Handle vFile:fstat packets.
* server.c (handle_query): Report vFile:fstat as supported.

9 years agoImplement remote_bfd_iovec_stat
Gary Benson [Wed, 11 Mar 2015 17:53:57 +0000 (17:53 +0000)]
Implement remote_bfd_iovec_stat

This commit adds a new packet "vFile:fstat:" to the remote protocol
that can be used by to retrieve information about files that have
been previously opened using vFile:open.  vFile:fstat: support is
added to GDB, and remote_bfd_iovec_stat is implemented using it.  If
vFile:fstat: is not supported by the remote GDB creates a dummy result
by zeroing the supplied stat structure and setting its st_size field
to INT_MAX.  This mimics GDB's previous behaviour, with the exception
that GDB did not previously zero the structure so all other fields
would have been returned unchanged, which is to say very likely
populated with random values from the stack.

gdb/ChangeLog:

* remote-fileio.h (remote_fileio_to_host_stat): New declaration.
* remote-fileio.c (remote_fileio_to_host_uint): New function.
(remote_fileio_to_host_ulong): Likewise.
(remote_fileio_to_host_mode): Likewise.
(remote_fileio_to_host_time): Likewise.
(remote_fileio_to_host_stat): Likewise.
* remote.c (PACKET_vFile_fstat): New enum value.
(remote_protocol_features): Register the "vFile:fstat" feature.
(remote_hostio_fstat): New function.
(remote_bfd_iovec_stat): Use the above.
(_initialize_remote): Register new "set/show remote
hostio-fstat-packet" command.
* symfile.c (separate_debug_file_exists): Update comment.
* NEWS: Announce new vFile:fstat packet.

gdb/doc/ChangeLog:

* gdb.texinfo (Remote Configuration): Document the
"set/show remote hostio-fstat-packet" command.
(General Query Packets): Document the vFile:fstat
qSupported features.
(Host I/O Packets): Document the vFile:fstat packet.

9 years agoMove remote_fileio_to_fio_stat to gdb/common
Gary Benson [Wed, 11 Mar 2015 17:53:57 +0000 (17:53 +0000)]
Move remote_fileio_to_fio_stat to gdb/common

This commit moves remote_fileio_to_fio_stat and its supporting
functions into new files common/common-remote-fileio.[ch].

gdb/ChangeLog:

* common/common-remote-fileio.h: New file.
* common/common-remote-fileio.c: Likewise.
* Makefile.in (SFILES): Add common/common-remote-fileio.c.
(HFILES_NO_SRCDIR): Add common/common-remote-fileio.h.
(COMMON_OBS): Add common-remote-fileio.o.
(common-remote-fileio.o): New rule.
* remote-fileio.h (common-remote-fileio.h): New include.
* remote-fileio.c (gdb/fileio.h): Do not include.
(remote_fileio_to_be): Moved to common-remote-fileio.h.
(remote_fileio_to_fio_uint): Likewise.
(remote_fileio_to_fio_time): Likewise.
(remote_fileio_mode_to_target): Moved to common-remote-fileio.c.
(remote_fileio_to_fio_mode): Likewise.
(remote_fileio_to_fio_ulong): Likewise.
(remote_fileio_to_fio_stat): Likewise.

gdb/gdbserver/ChangeLog:

* configure.ac (AC_CHECK_MEMBERS): Add checks for
struct stat.st_blocks and struct stat.st_blksize.
* configure: Regenerate.
* config.in: Likewise.
* Makefile.in (SFILES): Add common/common-remote-fileio.c.
(OBS): Add common-remote-fileio.o.
(common-remote-fileio.o): New rule.

9 years agoFix typo in value-dynamic-type
Andy Wingo [Wed, 11 Mar 2015 13:32:23 +0000 (14:32 +0100)]
Fix typo in value-dynamic-type

gdb/ChangeLog:

* guile/scm-value.c (gdbscm_value_dynamic_type): Fix typo in which
we were checking the cached type, not the cached dynamic type.

9 years agoFix memory corruption in Guile command interface
Andy Wingo [Wed, 11 Mar 2015 13:25:29 +0000 (14:25 +0100)]
Fix memory corruption in Guile command interface

Re-registering a command will delete previous commands of the same name,
running the destroyer for the command object.  The Guile destroyer
incorrectly tried to xfree the name and other strings, which is invalid
as they are on the GC heap.

gdb/ChangeLog:

* guile/scm-cmd.c (cmdscm_destroyer): Don't xfree the name and
other strings, as these are on the GC'd heap, and will be
collected along with the smob.

9 years agoAdd objfile-progspace to Guile interface
Andy Wingo [Wed, 11 Mar 2015 13:20:06 +0000 (14:20 +0100)]
Add objfile-progspace to Guile interface

This commit adds an objfile-progspace accessor to the (gdb) Guile
module.

gdb/testsuite/ChangeLog:

* gdb.guile/scm-objfile.exp: Add objfile-progspace test.

gdb/doc/ChangeLog:

* guile.texi (Objfiles In Guile): Document objfile-progspace.

gdb/ChangeLog:

* guile/scm-objfile.c (gdbscm_objfile_progspace): New function.
(objfile_functions): Bind gdbscm_objfile_progspace to
objfile-progspace.
* guile/lib/gdb.scm: Add objfile-progspace to exports.

9 years ago[guile] Run finalizers from GDB thread
Andy Wingo [Wed, 11 Mar 2015 12:07:53 +0000 (13:07 +0100)]
[guile] Run finalizers from GDB thread

gdb/ChangeLog:

* guile/guile.c (_initialize_guile): Disable automatic
finalization, if Guile offers us that possibility.
* guile/guile.c (call_initialize_gdb_module):
* guile/scm-safe-call.c (gdbscm_with_catch): Arrange to run
finalizers in appropriate places.
* config.in (HAVE_GUILE_MANUAL_FINALIZATION): New definition.
* configure.ac (AC_TRY_LIBGUILE): Add a check for
scm_set_automatic_finalization_enabled.
* configure: Regenerated.

9 years agoTypo fix
Yao Qi [Wed, 11 Mar 2015 11:50:12 +0000 (11:50 +0000)]
Typo fix

Fix typo "inferiorr".

gdb/testsuite:

2015-03-11  Yao Qi  <yao.qi@linaro.org>

* gdb.base/catch-syscall.exp: Fix typo in comments.

9 years agoSkip catch-syscall.exp on HP-UX target
Yao Qi [Wed, 11 Mar 2015 11:43:07 +0000 (11:43 +0000)]
Skip catch-syscall.exp on HP-UX target

"catch syscall" doesn't work on HP-UX.

gdb/testsuite:

2015-03-11  Yao Qi  <yao.qi@linaro.org>

* gdb.base/catch-syscall.exp: Skip it on HP-UX target.

9 years agoS390: Skip prologue using SAL information, if possible
Andreas Arnez [Wed, 11 Mar 2015 10:11:45 +0000 (11:11 +0100)]
S390: Skip prologue using SAL information, if possible

Instead of analyzing the prologue and possibly coming to a wrong
conclusion, this change tries to skip the prologue with the use of
skip_prologue_using_sal.  Only if that fails, the prologue analyzer is
invoked as before.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_skip_prologue): Skip the prologue using
SAL, if possible.

9 years agoS390: Defer PER info update until resume
Andreas Arnez [Wed, 11 Mar 2015 10:11:44 +0000 (11:11 +0100)]
S390: Defer PER info update until resume

For multi-threaded inferiors on S390 GNU/Linux targets, GDB tried to
update the PER info via ptrace() in a newly attached thread before
assuring that the thread is stopped.  Depending on the timing, this
could lead to a GDB internal error.  The patch defers the PER info
update until just before resuming the thread.

gdb/ChangeLog:

* s390-linux-nat.c (struct arch_lwp_info): New.
(s390_fix_watch_points): Rename to...
(s390_prepare_to_resume): ...this.  Skip the PER info update
unless the watch points have changed.
(s390_refresh_per_info, s390_new_thread): New functions.
(s390_insert_watchpoint): Call s390_refresh_per_info instead of
s390_fix_watch_points.
(s390_remove_watchpoint): Likewise.
(_initialize_s390_nat): Reflect renaming of s390_fix_watch_points.
Register s390_prepare_to_resume.

9 years agoFix powerpc gas abort on invalid instruction fixups
Alan Modra [Wed, 11 Mar 2015 07:23:50 +0000 (17:53 +1030)]
Fix powerpc gas abort on invalid instruction fixups

* config/tc-ppc.c (md_assemble): Don't abort on 8 byte insn fixups.
(md_apply_fix): Report an error on data-only fixups used with insns.

9 years agoFix ppc32 synthetic symbols when __tls_get_addr_opt stub is generated
Alan Modra [Wed, 11 Mar 2015 07:15:37 +0000 (17:45 +1030)]
Fix ppc32 synthetic symbols when __tls_get_addr_opt stub is generated

Also update the 32-bit tls testcases to be secure plt.

bfd/
* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Examine stubs in
reverse order.  Account for larger size of __tls_get_addr_opt stub.
ld/testsuite/
* ld-powerpc/tls32.s: Add GOT pointer setup.
* ld-powerpc/tls32.d: Update.
* ld-powerpc/tls32.g: Update.
* ld-powerpc/tls32.t: Update.
* ld-powerpc/tlsexe.d: Update.
* ld-powerpc/tlsexe32.d: Update.
* ld-powerpc/tlsexe32.g: Update.
* ld-powerpc/tlsexe32.r: Update.
* ld-powerpc/tlsexetoc.d: Update.
* ld-powerpc/tlsso32.d: Update.
* ld-powerpc/tlsso32.g: Update.
* ld-powerpc/tlsso32.r: Update.

9 years agoRun objcopy --update-section test only on ELF targets
Alan Modra [Wed, 11 Mar 2015 07:19:42 +0000 (17:49 +1030)]
Run objcopy --update-section test only on ELF targets

* binutils-all/update-section.exp: Only run on ELF targets.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Mar 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMove nothing to do warning to main
H.J. Lu [Tue, 10 Mar 2015 13:57:14 +0000 (06:57 -0700)]
Move nothing to do warning to main

PR binutils/18101
* readelf.c (parse_args): Move nothing to do warning to ...
(main): Here.

9 years agoFixes "readelf -s --wide" not returning an error status or help message.
Nick Clifton [Tue, 10 Mar 2015 13:44:51 +0000 (13:44 +0000)]
Fixes "readelf -s --wide" not returning an error status or help message.

PR binutils/18101
* readelf.c (parse_args): Enhance check for nothing to do by
accounting for the --wide option.

9 years agoFixes a problem with objcopy leaving temporary files and directories around if it...
Nick Clifton [Tue, 10 Mar 2015 13:38:24 +0000 (13:38 +0000)]
Fixes a problem with objcopy leaving temporary files and directories around if it encounters a problem during a copy.

PR binutils/17636
* objcopy.c (copy_object): Avoid calling fatal as that does not
allow the parent to clean up temporary files.

9 years agoS/390: Add more IBM z13 instructions
Andreas Krebbel [Tue, 10 Mar 2015 11:44:54 +0000 (12:44 +0100)]
S/390: Add more IBM z13 instructions

opcodes/
2015-03-10  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.c: Add new IBM z13 instructions.
* s390-opc.txt: Likewise.

gas/testsuite/
2015-03-10  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* gas/s390/zarch-z13.d: Add more z13 instructions.
* gas/s390/zarch-z13.s: Likewise.

9 years agoS/390: Add check for length field operand
Andreas Krebbel [Tue, 10 Mar 2015 11:41:57 +0000 (12:41 +0100)]
S/390: Add check for length field operand

gas/
2015-03-10  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* gas/config/tc-s390.c (md_gather_operands): Check for valid
length field operands.

9 years agoFixes a bug in the ARM port of GAS when parsing inverted register lists.
Michael Perkins [Tue, 10 Mar 2015 11:47:46 +0000 (11:47 +0000)]
Fixes a bug in the ARM port of GAS when parsing inverted register lists.

* config/tc-arm.c (parse_operands): Fix bug setting writeback
values for '^' on OP_REGLSTs.
(do_push_pop): Add new writeback constraint.

9 years ago[ARM]Fix "align directive causes MAP_DATA symbol to be lost"
Sterling Augustine [Tue, 10 Mar 2015 11:34:50 +0000 (11:34 +0000)]
[ARM]Fix "align directive causes MAP_DATA symbol to be lost"

gas/
2015-03-10  Renlin Li  <renlin.li@arm.com>

* config/tc-arm.c (mapping_state): Remove first MAP_DATA emitting code.
(mapping_state_2): Emit first MAP_DATA symbol here.

gas/testsuite/
2015-03-05  Renlin Li  <renlin.li@arm.com>

* gas/arm/dis-data.d: Adjust the desired output.
* gas/arm/dis-data2.d: Ditto.

9 years ago[AARCH64] Remove Load/Store register (unscaled immediate) alias.
Jiong Wang [Tue, 10 Mar 2015 11:27:56 +0000 (11:27 +0000)]
[AARCH64] Remove Load/Store register (unscaled immediate) alias.

opcodes/ChangeLog:

2015-03-10  Renlin Li  <renlin.li@arm.com>

* aarch64-tbl.h (aarch64_opcode_table): Remove strub, ldurb, ldursb,
         stur, ldur, sturh, ldurh, ldursh, ldursw, prfum F_HAS_ALIAS flag and
         related alias.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.

gas/testsuite/ChangeLog:

2015-03-10  Renlin Li  <renlin.li@arm.com>

* gas/aarch64/ldst-reg-uns-imm.d: Adjust expected output.
* gas/aarch64/ldst-reg-unscaled-imm.d: Likewise.
* gas/aarch64/reloc-insn.d: Likewise.

9 years ago[AArch64] Set the minimum alignment on code segments
Jiong Wang [Tue, 10 Mar 2015 11:20:57 +0000 (11:20 +0000)]
[AArch64] Set the minimum alignment on code segments

gas/
2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>

* config/tc-aarch64.c (mapping_state): Set minimum alignment for
code sections.

gas/testsuite
2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>

* gas/aarch64/codealign.d: Add test for code section alignment.
* gas/aarch64/codealign.s: New file.

9 years ago[ARM] PR ld/16572: Remove EF_ARM_HASENTRY flag
Jiong Wang [Tue, 10 Mar 2015 11:15:13 +0000 (11:15 +0000)]
[ARM] PR ld/16572: Remove EF_ARM_HASENTRY flag

bfd/
2015-03-10  Yuri Gribov  <y.gribov@samsung.arm>

PR ld/16572
* elf32-arm.c (elf32_arm_final_link_relocate): Remove
support for ELF_ARM_HASENTRY.
(elf32_arm_print_private_bfd_data): Likewise.

binutils/
2015-03-10  Yuri Gribov  <y.gribov@samsung.arm>

PR ld/16572
* readelf.c: Remove support for ELF_ARM_HASENTRY.

include/
2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>

PR ld/16572
* elf/arm.h (EF_ARM_HASENTRY): Remove.

9 years agoFixes a bug building the ARM Linux kernel with a toolchain compiled with CPU_DEFAULT...
Nick Clifton [Tue, 10 Mar 2015 10:01:45 +0000 (10:01 +0000)]
Fixes a bug building the ARM Linux kernel with a toolchain compiled with CPU_DEFAULT set.

PR gas/17852
* config/tc-arm.c (md_begin): Ensure that selected_cpu is
initialised when CPU_DEFAULT is defined.

9 years agosim: bfin: fix up linux-fixed-code.h generation more [PR sim/13160]
Mike Frysinger [Tue, 10 Mar 2015 05:41:48 +0000 (01:41 -0400)]
sim: bfin: fix up linux-fixed-code.h generation more [PR sim/13160]

Add a trailing semi-colon to the sed print command as the BSD sed
implementation wants it.  It's a nop otherwise and works fine on
GNU/etc... implementations too.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDelete gdb/testsuite/dg-extract-results.py
Pedro Alves [Mon, 9 Mar 2015 17:47:18 +0000 (17:47 +0000)]
Delete gdb/testsuite/dg-extract-results.py

Unfortunately, the Python version of the dg-extract-results.sh script
doesn't produce stable-enough results for GDB.  The test messages
appear to end up alpha sorted (losing the original sequence) and also
sorting changes between runs for some reason.  That may be tolerable
for GCC, but for GDB, it often renders test results diffing between
different revisions unworkable.

Until that is fixed upstream, delete the script from the GDB tree.

testsuite/ChangeLog:
2015-03-09  Pedro Alves  <palves@redhat.com>

* dg-extract-results.py: Delete.

9 years agoMake dg-extract-results.sh explicitly treat .{sum,log} files as text
Pedro Alves [Mon, 9 Mar 2015 17:47:17 +0000 (17:47 +0000)]
Make dg-extract-results.sh explicitly treat .{sum,log} files as text

This merges Sergio's fix from GCC:
  https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01293.html

gdb/testsuite/ChangeLog:
2015-03-09  Pedro Alves  <palves@redhat.com>

Merge dg-extract-results.sh from GCC upstream (r218843).

2014-12-17  Sergio Durigan Junior  <sergiodj@redhat.com>
* dg-extract-results.sh: Use --text with grep to avoid issues with
binary files.  Fall back to cat -v, if that doesn't work.

9 years agosim: bfin: fix bug reference
Mike Frysinger [Mon, 9 Mar 2015 17:26:51 +0000 (13:26 -0400)]
sim: bfin: fix bug reference

9 years agoFix failure in exception_static_test.
Cary Coutant [Mon, 9 Mar 2015 17:10:29 +0000 (10:10 -0700)]
Fix failure in exception_static_test.

Because the __EH_FRAME_BEGIN__ symbol is provided in an empty .eh_frame
section in crtbeginT.o, if crt1.o has a non-empty .eh_frame section,
we place all optimized .eh_frame sections into the output section ahead
of the __EH_FRAME_BEGIN__ symbol, which breaks EH for statically-linked
binaries.

This patch fixes the problem by delaying the attachment of the optimized
.eh_frame sections to the output section until we see the end marker
section (or to the end of pass 1 if we never see an end marker).

gold/
PR gold/14675
* ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
return enum indicating whether .eh_frame section is empty, optimizable,
unrecognized, or an end marker. Adjust explicit instantiations.
* ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
(Eh_frame::add_ehframe_input_section): Change return type.
* gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
* layout.cc (Layout::layout_eh_frame): Don't add optimized sections
to the .eh_frame output section until we see the end marker.
(Layout::finalize_eh_frame_section): New.
* layout.h: (Layout::finalize_eh_frame_section): New.

9 years agogdbserver/tracepoint: Add 'struct sockaddr_un *' -> 'struct sockaddr *' cast
Pedro Alves [Mon, 9 Mar 2015 11:29:56 +0000 (11:29 +0000)]
gdbserver/tracepoint: Add 'struct sockaddr_un *' -> 'struct sockaddr *' cast

Fixes this in C++ mode:

  gdb/gdbserver/tracepoint.c: In function ‘void* gdb_agent_helper_thread(void*)’:
  gdb/gdbserver/tracepoint.c:7190:47: error: cannot convert ‘sockaddr_un*’ to ‘sockaddr*’ for argument ‘2’ to ‘int accept(int, sockaddr*, socklen_t*)’
  fd = accept (listen_fd, &sockaddr, &tmp);

gdb/gdbserver/ChangeLog:
2015-03-09  Pedro Alves  <palves@redhat.com>

* tracepoint.c (gdb_agent_helper_thread): Cast '&sockaddr' to
'struct sockaddr' pointer in 'accept' call.

9 years agoRevert union gdb_sockaddr_u
Pedro Alves [Mon, 9 Mar 2015 11:27:05 +0000 (11:27 +0000)]
Revert union gdb_sockaddr_u

This reverts 366c75fc.

We don't actually need to access the object through
"struct sockaddr *", so we don't need the union:
   https://sourceware.org/ml/gdb-patches/2015-03/msg00213.html

gdb/ChangeLog:
2015-03-09  Pedro Alves  <palves@redhat.com>

Revert:
2015-03-07  Pedro Alves  <palves@redhat.com>
* common/gdb_socket.h: New file.
* ser-tcp.c: Include gdb_socket.h.  Don't include netinet/in.h nor
sys/socket.h.
(net_open): Use union gdb_sockaddr_u.

gdb/gdbserver/ChangeLog:
2015-03-09  Pedro Alves  <palves@redhat.com>

Revert:
2015-03-07  Pedro Alves  <palves@redhat.com>
* gdbreplay.c: No longer include <netinet/in.h>, <sys/socket.h>,
or <winsock2.h> here.  Instead include "gdb_socket.h".
(remote_open): Use union gdb_sockaddr_u.
* remote-utils.c: No longer include <netinet/in.h>, <sys/socket.h>
or <winsock2.h> here.  Instead include "gdb_socket.h".
(handle_accept_event, remote_prepare): Use union gdb_sockaddr_u.
* tracepoint.c: Include "gdb_socket.h" instead of <sys/socket.h>
or <sys/un.h>.
(init_named_socket, gdb_agent_helper_thread): Use union
gdb_sockaddr_u.

9 years agosim: bfin: fix up linux-fixed-code.h generation [PR sim/10143]
Mike Frysinger [Mon, 9 Mar 2015 03:53:48 +0000 (23:53 -0400)]
sim: bfin: fix up linux-fixed-code.h generation [PR sim/10143]

The use of $< ends up picking the wrong object out of the depend
list.  Specify the input name directly to avoid fragility.

On BSD systems, we need to make sure all options come before the
non-options (i.e. the files).

Reported-by: Chris Johns <chrisj@rtems.org>
URL: https://sourceware.org/bugzilla/show_bug.cgi?id=13160

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agosim: microblaze: fix printf string
Mike Frysinger [Sun, 8 Mar 2015 07:24:03 +0000 (03:24 -0400)]
sim: microblaze: fix printf string

Since sizeof returns a size_t, use %zu to display it.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRemove C-specific warnings from common warning set
Pedro Alves [Sat, 28 Feb 2015 19:11:10 +0000 (19:11 +0000)]
Remove C-specific warnings from common warning set

Whoops, these are C specific, but I somehow missed the warnings before:

  cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
  cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
  cc1plus: warning: command line option ‘-Wmissing-parameter-type’ is valid for C/ObjC but not for C++ [enabled by default]
  cc1plus: warning: command line option ‘-Wold-style-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
  cc1plus: warning: command line option ‘-Wold-style-definition’ is valid for C/ObjC but not for C++ [enabled by default]

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* configure.ac (build_warnings): Move -Wmissing-prototypes
-Wdeclaration-after-statement -Wmissing-parameter-type
-Wold-style-declaration -Wold-style-definition to the C-specific
set.
* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* configure.ac (build_warnings): Move
-Wdeclaration-after-statement to the C-specific set.
* configure: Regenerate.

9 years agoFix struct sockaddr/sockaddr_in/sockaddr_un strict aliasing violations
Pedro Alves [Sat, 7 Mar 2015 17:30:46 +0000 (17:30 +0000)]
Fix struct sockaddr/sockaddr_in/sockaddr_un strict aliasing violations

Building gdbserver in C++ mode shows:

  gdb/gdbserver/tracepoint.c: In function ‘void* gdb_agent_helper_thread(void*)’:
  gdb/gdbserver/tracepoint.c:7190:47: error: cannot convert ‘sockaddr_un*’ to ‘sockaddr*’ for argument ‘2’ to ‘int accept(int, sockaddr*, socklen_t*)’
  fd = accept (listen_fd, &sockaddr, &tmp);

A few places in the tree already have an explicit cast to struct
sockaddr *, but that's a strict aliasing violation.  Instead of
propagating invalid code, fix this by using a union instead.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* common/gdb_socket.h: New file.
* ser-tcp.c: Include gdb_socket.h.  Don't include netinet/in.h nor
sys/socket.h.
(net_open): Use union gdb_sockaddr_u.

gdb/gdbserver/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* gdbreplay.c: No longer include <netinet/in.h>, <sys/socket.h>,
or <winsock2.h> here.  Instead include "gdb_socket.h".
(remote_open): Use union gdb_sockaddr_u.
* remote-utils.c: No longer include <netinet/in.h>, <sys/socket.h>
or <winsock2.h> here.  Instead include "gdb_socket.h".
(handle_accept_event, remote_prepare): Use union gdb_sockaddr_u.
* tracepoint.c: Include "gdb_socket.h" instead of <sys/socket.h>
or <sys/un.h>.
(init_named_socket, gdb_agent_helper_thread): Use union
gdb_sockaddr_u.

9 years agoMake TRY/CATCH use real C++ try/catch in C++ mode
Pedro Alves [Sat, 7 Mar 2015 14:50:03 +0000 (14:50 +0000)]
Make TRY/CATCH use real C++ try/catch in C++ mode

Although the current TRY/CATCH implementation works in C++ mode too,
it relies on setjmp/longjmp, and longjmp bypasses calling the
destructors of objects on the stack, which is obviously bad for C++.

This patch fixes this by makes TRY/CATCH use real try/catch in C++
mode behind the scenes.  The way this is done allows RAII and cleanups
to coexist while we phase out cleanups, instead of requiring a flag
day.

This patch is not strictly necessary until we require a C++ compiler
and start actually using RAII, though I'm all for baby steps, and it
shows my proposed way forward.  Putting it in now, allows for easier
experimentation and exposure of potential problems with real C++
exceptions.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.c [!__cplusplus] (enum catcher_state)
(exceptions_state_mc_action_iter)
(exceptions_state_mc_action_iter_1, exceptions_state_mc_catch):
Don't define.
[__cplusplus] (try_scope_depth): New global.
[__cplusplus] (exception_try_scope_entry)
(exception_try_scope_exit, gdb_exception_sliced_copy)
(exception_rethrow): New functions.
(throw_exception): In C++ mode, throw
gdb_exception_RETURN_MASK_QUIT for RETURN_QUIT and
gdb_exception_RETURN_MASK_ERROR for RETURN_ERROR.
(throw_it): In C++ mode, use try_scope_depth.
* common/common-exceptions.h [!__cplusplus]
(exceptions_state_mc_action_iter)
(exceptions_state_mc_action_iter_1, exceptions_state_mc_catch):
Don't declare.
[__cplusplus] (exception_try_scope_entry)
(exception_try_scope_exit, exception_rethrow): Declare.
[__cplusplus] (struct exception_try_scope): New struct.
[__cplusplus] (TRY, CATCH, END_CATCH): Reimplement on top of real
C++ exceptions.
(struct gdb_exception_RETURN_MASK_ALL)
(struct gdb_exception_RETURN_MASK_ERROR)
(struct gdb_exception_RETURN_MASK_QUIT): New types.

9 years agokill volatile struct gdb_exception
Pedro Alves [Sat, 7 Mar 2015 14:50:03 +0000 (14:50 +0000)]
kill volatile struct gdb_exception

After the previous patch, this is the last remaining use of a volatile
struct gdb_exception.  Kill it, as it's troublesome for C++: we can't
assign volatile <-> non-volatile without copy constructors /
assignment operators that do that, which I'd rather avoid.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* main.c (handle_command_errors): Remove volatile qualifier from
parameter.

9 years agomore making TRY/CATCH callers look more like real C++ try/catch blocks
Pedro Alves [Sat, 7 Mar 2015 14:50:05 +0000 (14:50 +0000)]
more making TRY/CATCH callers look more like real C++ try/catch blocks

All these were caught by actually making TRY/CATCH use try/catch
behind the scenes, which then resulted in the build failing (on x86_64
Fedora 20) because there was code between the try and catch blocks.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* breakpoint.c (save_breakpoints): Adjust to avoid code between
TRY and CATCH.
* gdbtypes.c (safe_parse_type): Remove empty line.
(types_deeply_equal):
* guile/scm-frame.c (gdbscm_frame_name):
* linux-thread-db.c (find_new_threads_once):
* python/py-breakpoint.c (bppy_get_commands):
* record-btrace.c (record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_start_replaying)
(record_btrace_start_replaying): Adjust to avoid code between TRY
and CATCH.

9 years agoSplit TRY_CATCH into TRY + CATCH
Pedro Alves [Sat, 7 Mar 2015 15:14:14 +0000 (15:14 +0000)]
Split TRY_CATCH into TRY + CATCH

This patch splits the TRY_CATCH macro into three, so that we go from
this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  if (ex.reason < 0)
    {
    }
~~~

to this:

~~~
  TRY
    {
    }
  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH
~~~

Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.

This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.

TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:

  TRY
    {
    }

  // some code here.

  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH

Just like it isn't valid to do that with C++'s native try/catch.

By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.

The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved.  After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch].  The result was folded into this patch so that GDB
still builds at each incremental step.

END_CATCH is necessary for two reasons:

First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:

  #define CATCH(EXCEPTION, mask) \
    for (struct gdb_exception EXCEPTION; \
         exceptions_state_mc_catch (&EXCEPTION, MASK); \
 EXCEPTION = exception_none)

would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.

Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow.  That will
be done in END_CATCH.

After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.

IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.

gdb/ChangeLog.
2015-03-07  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.c (struct catcher) <exception>: No
longer a pointer to volatile exception.  Now an exception value.
<mask>: Delete field.
(exceptions_state_mc_init): Remove all parameters.  Adjust.
(exceptions_state_mc): No longer pop the catcher here.
(exceptions_state_mc_catch): New function.
(throw_exception): Adjust.
* common/common-exceptions.h (exceptions_state_mc_init): Remove
all parameters.
(exceptions_state_mc_catch): Declare.
(TRY_CATCH): Rename to ...
(TRY): ... this.  Remove EXCEPTION and MASK parameters.
(CATCH, END_CATCH): New.
All callers adjusted.

gdb/gdbserver/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
instead.

9 years agoquit_force: Replace TRY_CATCH wrapper macros
Tom Tromey [Sat, 7 Mar 2015 14:50:04 +0000 (14:50 +0000)]
quit_force: Replace TRY_CATCH wrapper macros

More preparation for running the TRY_CATCH->TRY/CATCH conversion
script.

gdb/ChangeLog:
2015-03-07  Tom Tromey  <tromey@redhat.com>

* top.c (quit_force): Inline and delete DO_TRY, DO_PRINT_EX.

9 years agoNormalize TRY_CATCH exception handling block
Pedro Alves [Sat, 7 Mar 2015 14:50:04 +0000 (14:50 +0000)]
Normalize TRY_CATCH exception handling block

This normalizes some exception catch blocks that check for ex.reason
to look like this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ALL)
    {
      ...
    }
  if (ex.reason < 0)
    {
      ...
    }
~~~

This is a preparation step for running a script that converts all
TRY_CATCH uses to look like this instead:

~~~
  TRY
    {
      ...
    }
  CATCH (ex, RETURN_MASK_ALL)
    {
      ...
    }
  END_CATCH
~~~

The motivation for that change is being able to reimplent TRY/CATCH in
terms of C++ try/catch.

This commit makes it so that:

 - no condition other than ex.reason < 0 is checked in the if
   predicate

 - there's no "else" block to check whether no exception was caught

 - there's no code between the TRY_CATCH (TRY) block and the
   'if (ex.reason < 0)' block (CATCH).

 - the exception object is no longer referred to outside the if/catch
   block.  Note the local volatile exception objects that are
   currently defined inside functions that use TRY_CATCH will
   disappear.  In cases it's more convenient to still refer to the
   exception outside the catch block, a new non-volatile local is
   added and copy to that object is made within the catch block.

The following patches should make this all clearer.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Normal exception handling code.
* break-catch-throw.c (check_status_exception_catchpoint)
(re_set_exception_catchpoint): Ditto.
* cli/cli-interp.c (safe_execute_command):
* cli/cli-script.c (script_from_file): Ditto.
* compile/compile-c-symbols.c (generate_c_for_for_one_variable):
Ditto.
* compile/compile-object-run.c (compile_object_run): Ditto.
* cp-abi.c (baseclass_offset): Ditto.
* cp-valprint.c (cp_print_value): Ditto.
* exceptions.c (catch_exceptions_with_msg):
* frame-unwind.c (frame_unwind_try_unwinder): Ditto.
* frame.c (get_frame_address_in_block_if_available): Ditto.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Ditto.
* infcmd.c (post_create_inferior): Ditto.
* linespec.c (parse_linespec, find_linespec_symbols):
* p-valprint.c (pascal_object_print_value): Ditto.
* parse.c (parse_expression_for_completion): Ditto.
* python/py-finishbreakpoint.c (bpfinishpy_init): Ditto.
* remote.c (remote_get_noisy_reply): Ditto.
* s390-linux-tdep.c (s390_frame_unwind_cache): Ditto.
* solib-svr4.c (solib_svr4_r_map): Ditto.

9 years agoFix mail address format of a couple recent ChangeLog entries
Pedro Alves [Sat, 7 Mar 2015 14:52:22 +0000 (14:52 +0000)]
Fix mail address format of a couple recent ChangeLog entries

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Mar 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoUse show_debug_regs as a boolean
Yao Qi [Fri, 6 Mar 2015 14:14:27 +0000 (14:14 +0000)]
Use show_debug_regs as a boolean

I happen to see that show_debug_regs is used as an arithmetic type,
but it should be a boolean,

  if (show_debug_regs > 1)

On the other hand, GDB RSP only allows setting it to either 0 or 1,
so it makes no sense to check whether it is greater than 1.  This
patch fixes it.

gdb/gdbserver:

2015-03-06  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_insert_point): Use
show_debug_regs as a boolean.
(aarch64_remove_point): Likewise.

9 years agoFix an undefined 32-bit right shift by replacing it with two 16-bit right shifts.
Nick Clifton [Fri, 6 Mar 2015 09:46:15 +0000 (09:46 +0000)]
Fix an undefined 32-bit right shift by replacing it with two 16-bit right shifts.

PR binutils/17765
* elflink.c (put_value): Like previous delta, but for the 32-bit
case.

9 years agoNew common function "startswith"
Gary Benson [Fri, 6 Mar 2015 09:42:06 +0000 (09:42 +0000)]
New common function "startswith"

This commit introduces a new inline common function "startswith"
which takes two string arguments and returns nonzero if the first
string starts with the second.  It also updates the 295 places
where this logic was written out longhand to use the new function.

gdb/ChangeLog:

* common/common-utils.h (startswith): New inline function.
All places where this logic was used updated to use the above.