external/binutils.git
9 years agoFix internal error in do_relocate_sections when using plugins.
Cary Coutant [Sun, 22 Mar 2015 00:47:49 +0000 (17:47 -0700)]
Fix internal error in do_relocate_sections when using plugins.

In a previous patch for PR 14675, to fix a problem with
the .eh_frame section when static linking, I added a step to
finalize the .eh_frame section at the end of the first link
pass. This patch caused PR 18152, where a plugin-claimed
object caused a non-claimed object's layout to be deferred
until replacement files were read. The call to
finalize_eh_frame_section() is happening before the layout of
the deferred objects, leading to the internal error in
do_relocate_sections.

This patch moves the finalization of the .eh_frame section to
after deferred objects have been processed.

gold/
PR gold/14675
PR gold/18152
* gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
deferred objects.

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

9 years agoFix undefined behavior in TUI's TAB expansion
Eli Zaretskii [Sat, 21 Mar 2015 08:48:34 +0000 (10:48 +0200)]
Fix undefined behavior in TUI's TAB expansion

gdb/ChangeLog:

* tui/tui-io.c (tui_expand_tabs): Reinitialize the column counter
before the second loop, to avoid undefined behavior.  Reported by
Anton Blanchard <anton@samba.org>.

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

9 years ago[gdb/DWARF] Introduce linked list for dynamic attributes
Keven Boell [Fri, 20 Mar 2015 21:45:20 +0000 (17:45 -0400)]
[gdb/DWARF] Introduce linked list for dynamic attributes

This patch introduces a linked list for dynamic attributes of a type.
This is a pre-work for the Fortran dynamic array support. The Fortran
dynamic array support will add more dynamic attributes to a type.
As only a few types will have such dynamic attributes set, a linked
list is more efficient in terms of memory consumption than adding
multiple attributes to main_type.

gdb/ChangeLog:

        * gdbtypes.c (resolve_dynamic_type_internal): Adapt
        data_location usage to linked list.
        (resolve_dynamic_type_internal): Adapt data_location to
        linked list.
        (get_dyn_prop, add_dyn_prop, copy_dynamic_prop_list): New function.
        (copy_type_recursive, copy_type): Add copy of linked list.
        * gdbtypes.h (enum dynamic_prop_node_kind): New enum.
        (struct dynamic_prop_list): New struct.
        * dwarf2read.c (set_die_type): Set data_location data.

9 years agoconstify i386-sol2-tdep.c and machoread.c
Pedro Alves [Mon, 9 Mar 2015 11:58:23 +0000 (11:58 +0000)]
constify i386-sol2-tdep.c and machoread.c

/home/pedro/gdb/mygit/src/gdb/i386-sol2-tdep.c: In function ‘const char* i386_sol2_static_transform_name(const char*)’:
/home/pedro/gdb/mygit/src/gdb/i386-sol2-tdep.c:93:29: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
       p = strrchr (name, '.');
                             ^
gdb:

2015-03-20  Pedro Alves  <palves@redhat.com>

* i386-sol2-tdep.c (i386_sol2_static_transform_name): Move "p" to
inner block and make it const.
* machoread.c (get_archive_prefix_len): Make "lparen" const.

9 years agoconstify set_breakpoint_condition
Pedro Alves [Mon, 9 Mar 2015 11:58:21 +0000 (11:58 +0000)]
constify set_breakpoint_condition

gdb:

2015-03-20  Pedro Alves  <palves@redhat.com>

* breakpoint.c (set_breakpoint_condition): Make argument "exp" const.
* breakpoint.h (set_breakpoint_condition): Update declaration.

9 years agoconstify tui/tui-io.c
Pedro Alves [Mon, 9 Mar 2015 11:58:20 +0000 (11:58 +0000)]
constify tui/tui-io.c

gdb:

2015-03-20  Pedro Alves  <palves@redhat.com>

* tui/tui-io.c (tui_expand_tabs): Make "s1" const.

9 years agoconstify xcoffread.c
Pedro Alves [Mon, 9 Mar 2015 11:58:20 +0000 (11:58 +0000)]
constify xcoffread.c

/home/pedro/gdb/mygit/src/gdb/xcoffread.c: In function ‘void scan_xcoff_symtab(objfile*)’:
/home/pedro/gdb/mygit/src/gdb/xcoffread.c:2644:33: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
      p = strchr (namestring, ':');
                                 ^
gdb:

2015-03-20  Pedro Alves  <palves@redhat.com>

* xcoffread.c (scan_xcoff_symtab): Make "p" and "q" const.

9 years agoconstify remote-m32r-sdi.c
Pedro Alves [Mon, 9 Mar 2015 11:58:19 +0000 (11:58 +0000)]
constify remote-m32r-sdi.c

gdb:

2015-03-20  Pedro Alves  <palves@redhat.com>

* remote-m32r-sdi.c (m32r_open): Make "port_str" const.

9 years agoconstify nto-tdep.c
Pedro Alves [Mon, 9 Mar 2015 11:58:14 +0000 (11:58 +0000)]
constify nto-tdep.c

/home/pedro/gdb/mygit/src/gdb/nto-tdep.c: In function ‘int nto_find_and_open_solib(char*, unsigned int, char**)’:
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c:111:14: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
       endian = gdbarch_byte_order (target_gdbarch ())
              ^
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c: In function ‘void nto_init_solib_absolute_prefix()’:
/home/pedro/gdb/mygit/src/gdb/nto-tdep.c:170:14: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
       endian = gdbarch_byte_order (target_gdbarch ())
              ^

gdb

2015-03-20  Pedro Alves  <palves@redhat.com>

* nto-tdep.c (nto_find_and_open_solib): Make "endian" const.
(nto_init_solib_absolute_prefix): Likewise.

9 years agoconstify gdbserver/tracepoint.c
Pedro Alves [Mon, 9 Mar 2015 11:58:09 +0000 (11:58 +0000)]
constify gdbserver/tracepoint.c

gdb/gdbserver/tracepoint.c:3647:7: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
gdb/gdbserver/tracepoint.c:3652:7: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
gdb/gdbserver/tracepoint.c:3657:7: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

gdb/gdbserver

2015-03-20  Pedro Alves  <palves@redhat.com>

* tracepoint.c (cmd_qtstatus): Make "str" const.

9 years agoconstify gdbserver/server.c
Pedro Alves [Mon, 9 Mar 2015 11:58:08 +0000 (11:58 +0000)]
constify gdbserver/server.c

gdb/gdbserver/

2015-03-20  Pedro Alves  <palves@redhat.com>

* server.c (handle_general_set): Make "req_str" const.

9 years agoconstify sparc-sol2-tdep.c and spu-tdep.c
Pedro Alves [Mon, 9 Mar 2015 11:58:17 +0000 (11:58 +0000)]
constify sparc-sol2-tdep.c and spu-tdep.c

/home/pedro/gdb/mygit/src/gdb/sparc-sol2-tdep.c: In function ‘const char* sparc_sol2_static_transform_name(const char*)’:
/home/pedro/gdb/mygit/src/gdb/sparc-sol2-tdep.c:247:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
       char *p = strrchr (name, '.');
                                   ^
gdb:

2015-03-20  Pedro Alves  <palves@redhat.com>

* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Make "p" const.
* spu-tdep.c (spu_gdbarch_init): Make "name" const.

9 years agoRemove gdb.hp
Jan Kratochvil [Fri, 20 Mar 2015 16:15:15 +0000 (17:15 +0100)]
Remove gdb.hp

gdb/ChangeLog
2015-03-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

* config/djgpp/README: Remove gdb.hp.

gdb/testsuite/ChangeLog
2015-03-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

* Makefile.in (ALL_SUBDIRS): Remove gdb.hp.
* README: Remove HP-UX and gdb.hp.
(configuration):
* configure: Regenerate.
* configure.ac (AC_OUTPUT): Remove gdb.hp/Makefile,
gdb.hp/gdb.objdbg/Makefile, gdb.hp/gdb.base-hp/Makefile,
gdb.hp/gdb.aCC/Makefile, gdb.hp/gdb.compat/Makefile,
gdb.hp/gdb.defects/Makefile.
* gdb.hp/Makefile.in: File deleted.
* gdb.hp/gdb.aCC/Makefile.in: File deleted.
* gdb.hp/gdb.aCC/optimize.c: File deleted.
* gdb.hp/gdb.aCC/optimize.exp: File deleted.
* gdb.hp/gdb.aCC/run.c: File deleted.
* gdb.hp/gdb.aCC/watch-cmd.exp: File deleted.
* gdb.hp/gdb.base-hp/Makefile.in: File deleted.
* gdb.hp/gdb.base-hp/callfwmall.c: File deleted.
* gdb.hp/gdb.base-hp/callfwmall.exp: File deleted.
* gdb.hp/gdb.base-hp/dollar.c: File deleted.
* gdb.hp/gdb.base-hp/dollar.exp: File deleted.
* gdb.hp/gdb.base-hp/genso-thresh.c: File deleted.
* gdb.hp/gdb.base-hp/hwwatchbus.c: File deleted.
* gdb.hp/gdb.base-hp/hwwatchbus.exp: File deleted.
* gdb.hp/gdb.base-hp/pxdb.c: File deleted.
* gdb.hp/gdb.base-hp/pxdb.exp: File deleted.
* gdb.hp/gdb.base-hp/reg-pa64.exp: File deleted.
* gdb.hp/gdb.base-hp/reg-pa64.s: File deleted.
* gdb.hp/gdb.base-hp/reg.exp: File deleted.
* gdb.hp/gdb.base-hp/reg.s: File deleted.
* gdb.hp/gdb.base-hp/sized-enum.c: File deleted.
* gdb.hp/gdb.base-hp/sized-enum.exp: File deleted.
* gdb.hp/gdb.base-hp/so-thresh.exp: File deleted.
* gdb.hp/gdb.base-hp/so-thresh.mk: File deleted.
* gdb.hp/gdb.base-hp/so-thresh.sh: File deleted.
* gdb.hp/gdb.compat/Makefile.in: File deleted.
* gdb.hp/gdb.compat/average.c: File deleted.
* gdb.hp/gdb.compat/sum.c: File deleted.
* gdb.hp/gdb.compat/xdb.c: File deleted.
* gdb.hp/gdb.compat/xdb0.c: File deleted.
* gdb.hp/gdb.compat/xdb0.h: File deleted.
* gdb.hp/gdb.compat/xdb1.c: File deleted.
* gdb.hp/gdb.compat/xdb1.exp: File deleted.
* gdb.hp/gdb.compat/xdb2.exp: File deleted.
* gdb.hp/gdb.compat/xdb3.exp: File deleted.
* gdb.hp/gdb.defects/Makefile.in: File deleted.
* gdb.hp/gdb.defects/bs14602.c: File deleted.
* gdb.hp/gdb.defects/bs14602.exp: File deleted.
* gdb.hp/gdb.defects/solib-d.c: File deleted.
* gdb.hp/gdb.defects/solib-d.exp: File deleted.
* gdb.hp/gdb.defects/solib-d1.c: File deleted.
* gdb.hp/gdb.defects/solib-d2.c: File deleted.
* gdb.hp/gdb.objdbg/Makefile.in: File deleted.
* gdb.hp/gdb.objdbg/objdbg01.exp: File deleted.
* gdb.hp/gdb.objdbg/objdbg01/x1.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg01/x2.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg01/x3.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg01/x3.h: File deleted.
* gdb.hp/gdb.objdbg/objdbg02.exp: File deleted.
* gdb.hp/gdb.objdbg/objdbg02/x1.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg02/x2.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg02/x3.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg03.exp: File deleted.
* gdb.hp/gdb.objdbg/objdbg03/x1.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg03/x2.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg03/x3.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg04.exp: File deleted.
* gdb.hp/gdb.objdbg/objdbg04/x.h: File deleted.
* gdb.hp/gdb.objdbg/objdbg04/x1.cc: File deleted.
* gdb.hp/gdb.objdbg/objdbg04/x2.cc: File deleted.
* gdb.hp/gdb.objdbg/tools/symaddr: File deleted.
* gdb.hp/gdb.objdbg/tools/symaddr.pa64: File deleted.
* gdb.hp/gdb.objdbg/tools/test-objdbg.cc: File deleted.
* gdb.hp/tools/odump: File deleted.

9 years agoLimit multi-byte nop instructions to 10 bytes
H.J. Lu [Fri, 20 Mar 2015 11:39:04 +0000 (04:39 -0700)]
Limit multi-byte nop instructions to 10 bytes

There is no performance advantage to use multi-byte nop instructions
greater than 10 bytes.  This patch limits multi-byte nop instructions
to 10 bytes.  Since there is only one way to encode multi-byte nop
instructions now, it also removed redundant nop tests.

gas/

* config/tc-i386.c (i386_align_code): Limit multi-byte nop
instructions to 10 bytes.

gas/testsuite/

* gas/i386/i386.exp: Don't run nops-1-bdver1, nops-1-bdver2,
nops-1-bdver3, nops-1-bdver4, nops-1-znver1, nops-1-btver1
nops-1-btver2, x86-64-nops-1-nocona, x86-64-nops-1-bdver1,
x86-64-nops-1-bdver2, x86-64-nops-1-bdver3, x86-64-nops-1-bdver4,
x86-64-nops-1-znver1, x86-64-nops-1-btver1 nor
x86-64-nops-1-btver2.
* gas/i386/nops-1-core2.d: Updated.
* gas/i386/nops-1-k8.d: Likewise.
* gas/i386/nops-4a-i686.d: Likewise.
* gas/i386/nops-5-i686.d: Likewise.
* gas/i386/nops-5.d: Likewise.
* gas/i386/nops-6.d: Likewise.
* gas/i386/x86-64-nops-1-core2.d: Likewise.
* gas/i386/x86-64-nops-1-g64.d: Likewise.
* gas/i386/x86-64-nops-1-k8.d: Likewise.
* gas/i386/x86-64-nops-1.d: Likewise.
* gas/i386/x86-64-nops-2.d: Likewise.
* gas/i386/x86-64-nops-3.d: Likewise.
* gas/i386/x86-64-nops-4-core2.d: Likewise.
* gas/i386/x86-64-nops-4-k8.d: Likewise.
* gas/i386/x86-64-nops-4.d: Likewise.
* gas/i386/x86-64-nops-5-k8.d: Likewise.
* gas/i386/x86-64-nops-5.d: Likewise.
* gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise.
* gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise.
* gas/i386/ilp32/x86-64-nops-1.d: Likewise.
* gas/i386/ilp32/x86-64-nops-2.d: Likewise.
* gas/i386/ilp32/x86-64-nops-3.d: Likewise.
* gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise.
* gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise.
* gas/i386/ilp32/x86-64-nops-4.d: Likewise.
* gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise.
* gas/i386/ilp32/x86-64-nops-5.d: Likewise.
* gas/i386/nops-1-bdver1.d: Removed.
* gas/i386/nops-1-bdver2.d: Likewise.
* gas/i386/nops-1-bdver3.d: Likewise.
* gas/i386/nops-1-bdver4.d: Likewise.
* gas/i386/nops-1-btver1.d: Likewise.
* gas/i386/nops-1-btver2.d: Likewise.
* gas/i386/nops-1-znver1.d: Likewise.
* gas/i386/x86-64-nops-1-bdver1.d: Likewise.
* gas/i386/x86-64-nops-1-bdver2.d: Likewise.
* gas/i386/x86-64-nops-1-bdver3.d: Likewise.
* gas/i386/x86-64-nops-1-bdver4.d: Likewise.
* gas/i386/x86-64-nops-1-btver1.d: Likewise.
* gas/i386/x86-64-nops-1-btver2.d: Likewise.
* gas/i386/x86-64-nops-1-nocona.d: Likewise.
* gas/i386/x86-64-nops-1-znver1.d: Likewise.
* gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise.

9 years agoFixes implementation of hardware multiply/divide peripheral in RL78 G13 cores.
Nick Clifton [Fri, 20 Mar 2015 10:29:46 +0000 (10:29 +0000)]
Fixes implementation of hardware multiply/divide peripheral in RL78 G13 cores.

* load.c (rl78_load): If the G10, G13 or G14 flag bits are set in
the ELF header use them to select the proper emulation mode.
* mem.c (mem_put_byte): Use mem_put_hi to store a value into the
MDB register.
(mem_get_byte): Use mem_get_hi to extract a value from the MDB
register.

9 years agoDon't call set_gdbarch_cannot_step_breakpoint in aarch64_gdbarch_init
Yao Qi [Fri, 20 Mar 2015 10:15:21 +0000 (10:15 +0000)]
Don't call set_gdbarch_cannot_step_breakpoint in aarch64_gdbarch_init

Hi,
I am looking at the following fails in aarch64-linux,

stepi^M
47        NOP; /* after permanent bp */^M
(gdb) FAIL: gdb.base/bp-permanent.exp: always_inserted=off, sw_watchpoint=0: stepi signal with handler: single-step to handler

the test expects GDB single step into signal handler, but GDB doesn't.
The code in infrun.c:resume

      /* Most targets can step a breakpoint instruction, thus
 executing it normally.  But if this one cannot, just
 continue and we will hit it anyway.  */
      if (gdbarch_cannot_step_breakpoint (gdbarch))
step = 0;

change the intended action from "step" to "continue".  The gdbarch method
cannot_step_breakpoint isn't documented well, and I don't get much clue
after explore the history.  However, from the comments above,
aarch64-linux can step a breakpoint instruction, so don't need to call
set_gdbarch_cannot_step_breakpoint.

gdb:

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

* aarch64-tdep.c (aarch64_gdbarch_init): Don't call
set_gdbarch_cannot_step_breakpoint.

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

9 years agoFix race exposed by gdb.threads/killed.exp
Pedro Alves [Thu, 19 Mar 2015 15:12:33 +0000 (15:12 +0000)]
Fix race exposed by gdb.threads/killed.exp

On GNU/Linux, this test sometimes FAILs like this:

 (gdb) run
 Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/killed
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library "/lib64/libthread_db.so.1".
 ptrace: No such process.
 (gdb)
 Program terminated with signal SIGKILL, Killed.
 The program no longer exists.
 FAIL: gdb.threads/killed.exp: run program to completion (timeout)

Note the suspicious "No such process" line (that's errno==ESRCH).
Adding debug output we see:

  linux_nat_wait: [process -1], [TARGET_WNOHANG]
  LLW: enter
  LNW: waitpid(-1, ...) returned 18465, ERRNO-OK
  LLW: waitpid 18465 received Stopped (signal) (stopped)
  LNW: waitpid(-1, ...) returned 18461, ERRNO-OK
  LLW: waitpid 18461 received Trace/breakpoint trap (stopped)
  LLW: Handling extended status 0x03057f
  LHEW: Got clone event from LWP 18461, new child is LWP 18465
  LNW: waitpid(-1, ...) returned 0, ERRNO-OK
  RSRL: resuming stopped-resumed LWP LWP 18465 at 0x3b36af4b51: step=0
  RSRL: resuming stopped-resumed LWP LWP 18461 at 0x3b36af4b51: step=0
  sigchld
  ptrace: No such process.
  (gdb) linux_nat_wait: [process -1], [TARGET_WNOHANG]
  LLW: enter
  LNW: waitpid(-1, ...) returned 18465, ERRNO-OK
  LLW: waitpid 18465 received Killed (terminated)
  LLW: LWP 18465 exited.
  LNW: waitpid(-1, ...) returned 18461, No child processes
  LLW: waitpid 18461 received Killed (terminated)
  Process 18461 exited
  LNW: waitpid(-1, ...) returned -1, No child processes
  LLW: exit
  sigchld
  infrun: target_wait (-1, status) =
  infrun:   18461 [process 18461],
  infrun:   status->kind = signalled, signal = GDB_SIGNAL_KILL
  infrun: TARGET_WAITKIND_SIGNALLED

  Program terminated with signal SIGKILL, Killed.
  The program no longer exists.
  infrun: stop_waiting
  FAIL: gdb.threads/killed.exp: run program to completion (timeout)

The issue is that here:

  RSRL: resuming stopped-resumed LWP LWP 18465 at 0x3b36af4b51: step=0
  RSRL: resuming stopped-resumed LWP LWP 18461 at 0x3b36af4b51: step=0

The first line shows we had just resumed LWP 18465, which does:

 void *
 child_func (void *dummy)
 {
   kill (pid, SIGKILL);
   exit (1);
 }

So if the kernel manages to schedule that thread fast enough, the
process may be killed before GDB has a chance to resume LWP 18461.

GDBserver has code at the tail end of linux_resume_one_lwp to cope
with this:

~~~
    ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, lwpid_of (thread),
    (PTRACE_TYPE_ARG3) 0,
    /* Coerce to a uintptr_t first to avoid potential gcc warning
       of coercing an 8 byte integer to a 4 byte pointer.  */
    (PTRACE_TYPE_ARG4) (uintptr_t) signal);

    current_thread = saved_thread;
    if (errno)
      {
/* ESRCH from ptrace either means that the thread was already
   running (an error) or that it is gone (a race condition).  If
   it's gone, we will get a notification the next time we wait,
   so we can ignore the error.  We could differentiate these
   two, but it's tricky without waiting; the thread still exists
   as a zombie, so sending it signal 0 would succeed.  So just
   ignore ESRCH.  */
if (errno == ESRCH)
  return;

perror_with_name ("ptrace");
      }
~~~

However, that's not a complete fix, because between starting to handle
the resume request and getting that PTRACE_CONTINUE, we run other
ptrace calls that can also fail with ESRCH, and that end up throwing
an error (with perror_with_name).

In the case above, I indeed sometimes see resume_stopped_resumed_lwps
fail in the registers read:

resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
{
...
      CORE_ADDR pc = regcache_read_pc (regcache);

Or e.g., in 32-bit mode, i386_linux_resume has several calls that can
throw too.

Whether to ignore ptrace errors or not depends on context that is only
available somewhere up the call chain.  So the fix is to let ptrace
errors throw as they do today, and wrap the resume request in a
TRY/CATCH that swallows it iff the lwp that we were trying to resume
is no longer ptrace-stopped.

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

* linux-low.c (linux_resume_one_lwp): Rename to ...
(linux_resume_one_lwp_throw): ... this.  Don't handle ESRCH here,
instead call perror_with_name.
(check_ptrace_stopped_lwp_gone): New function.
(linux_resume_one_lwp): Reimplement as wrapper around
linux_resume_one_lwp_throw that swallows errors if the LWP is
gone.

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

* linux-nat.c (linux_resume_one_lwp): Rename to ...
(linux_resume_one_lwp_throw): ... this.  Don't handle ESRCH here,
instead call perror_with_name.
(check_ptrace_stopped_lwp_gone): New function.
(linux_resume_one_lwp): Reimplement as wrapper around
linux_resume_one_lwp_throw that swallows errors if the LWP is
gone.
(resume_stopped_resumed_lwps): Try register reads in TRY/CATCH and
swallows errors if the LWP is gone.  Use
linux_resume_one_lwp_throw instead of linux_resume_one_lwp.

9 years agoRemove spurious gdb/ChangeLog entry
Pedro Alves [Thu, 19 Mar 2015 17:00:55 +0000 (17:00 +0000)]
Remove spurious gdb/ChangeLog entry

My last change added the same entry to both gdbserver's and gdb's
ChangeLogs by mistake...  Should have gone to gdbserver's only.

9 years agogdbserver/Linux: unbreak non-stop
Pedro Alves [Thu, 19 Mar 2015 16:51:09 +0000 (16:51 +0000)]
gdbserver/Linux: unbreak non-stop

The previous change added an assertion that is catching yet another
bug in count_events_callback/select_event_lwp_callback:

  (gdb)
  PASS: gdb.mi/mi-nonstop.exp: interrupted
  mi_expect_interrupt: expecting: \*stopped,(reason="signal-received",signal-name="0",signal-meaning="Signal 0"|reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt")[^
  ]*

  /home/pedro/gdb/mygit/src/gdb/gdbserver/linux-low.c:2329: A problem internal to GDBserver has been detected.
  select_event_lwp: Assertion `num_events > 0' failed.
  =thread-group-exited,id="i1"

Certainly select_event_lwp_callback should always at least find one
event, as it's only called because an event triggered (though we may
have more than one: the point of the function is randomly picking
one).

An LWP that GDB previously asked to continue/step (thus is resumed)
and gets a vCont;t request ends up with last_resume_kind ==
resume_stop.  These functions in gdbserver used to filter out events
that weren't going to be reported to GDB; I think the last_resume_kind
kind check used to make sense at that point, but it no longer does.

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

* linux-low.c (count_events_callback, select_event_lwp_callback):
No longer check whether the thread has resume_stop as last resume
kind.

9 years agoAdd support for G13 and G14 flag bits in RL78 ELF binaries.
Nick Clifton [Thu, 19 Mar 2015 15:37:43 +0000 (15:37 +0000)]
Add support for G13 and G14 flag bits in RL78 ELF binaries.

inc * rl78.h (E_FLAG_RL78_G10): Redefine.
(E_FLAG_RL78_CPU_MASK, E_FLAG_RL78_ANY_CPU, E_FLAG_RL78_G13
E_FLAG_RL78_G14): New flags.

bin * readelf.c (get_machine_flags): Decode RL78's G13 and G14 flags.

gas * config/tc-rl78.c (enum options): Add G13 and G14.
(md_longopts): Add -mg13 and -mg14.
(md_parse_option): Handle -mg13 and -mg14.
(md_show_usage): List -mg13 and -mg14.
* doc/c-rl78.texi: Add description of -mg13 and -mg14 options.

bfd * elf32-rl78.c (rl78_cpu_name): New function.  Prints the name of
the RL78 core based upon the flags.
(rl78_elf_merge_private_bfd_data): Handle merging of G13 and G14
flags.
(rl78_elf_print_private_bfd_data): Use rl78_cpu_name.
(elf32_rl78_machine): Always return bfd_mach_rl78.

9 years agogdbserver/Linux: unbreak thread event randomization
Pedro Alves [Sun, 15 Mar 2015 19:35:26 +0000 (19:35 +0000)]
gdbserver/Linux: unbreak thread event randomization

Wanting to make sure the new continue-pending-status.exp test tests
both cases of threads 2 and 3 reporting an event, I added counters to
the test, to make it FAIL if events for both threads aren't seen.
Assuming a well behaved backend, and given a reasonable number of
iterations, it should PASS.

However, running that against GNU/Linux gdbserver, I found that
surprisingly, that FAILed.  GDBserver always reported the breakpoint
hit for the same thread.

Turns out that I broke gdbserver's thread event randomization
recently, with git commit 582511be ([gdbserver] linux-low.c: better
starvation avoidance, handle non-stop mode too).  In that commit I
missed that the thread structure also has a status_pending_p field...
The end result was that count_events_callback always returns 0, and
then if no thread is stepping, select_event_lwp always returns the
event thread.  IOW, no randomization is happening at all.  Quite
curious how all the other changes in that patch were sufficient to fix
non-stop-fair-events.exp anyway even with that broken.

Tested on x86_64 Fedora 20, native and gdbserver.

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

* linux-low.c (count_events_callback, select_event_lwp_callback):
Use the lwp's status_pending_p field, not the thread's.

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

* gdb.threads/continue-pending-status.exp (saw_thread_2)
(saw_thread_3): New globals.
(top level): Increment them when an event for the corresponding
thread is seen.
(no thread starvation): New test.

9 years agonative/Linux: internal error if resume is short-circuited
Pedro Alves [Thu, 19 Mar 2015 12:20:25 +0000 (12:20 +0000)]
native/Linux: internal error if resume is short-circuited

If the linux_nat_resume's short-circuits the resume because the
current thread has a pending status, and, a thread with a higher
number was previously stopped for a breakpoint, GDB internal errors,
like:

 /home/pedro/gdb/mygit/src/gdb/linux-nat.c:2590: internal-error: status_callback: Assertion `lp->status != 0' failed.

Fix this by make status_callback bail out earlier.  GDBserver is
already doing the same.

New test added that exercises this.

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

* linux-nat.c (status_callback): Return early if the LWP has no
status pending.

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

* gdb.threads/continue-pending-status.c: New file.
* gdb.threads/continue-pending-status.exp: New file.

9 years agoselect_event_lwp_callback: update comments
Pedro Alves [Thu, 19 Mar 2015 12:24:06 +0000 (12:24 +0000)]
select_event_lwp_callback: update comments

This function (in both GDB and GDBserver) used to consider only
SIGTRAP/breakpoint events, but that's no longer the case nowadays.

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

* linux-low.c (select_event_lwp_callback): Update comments to
no longer mention SIGTRAP.

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

* linux-nat.c (select_event_lwp_callback): Update comment to no
longer mention SIGTRAP.

9 years agoFix building and testing dwarf debug section compression feature when zlib is not...
Nick Clifton [Thu, 19 Mar 2015 12:14:56 +0000 (12:14 +0000)]
Fix building and testing dwarf debug section compression feature when zlib is not available.

PR gas/18087
gas/test * gas/i386/dw2-compress-1.d: Allow the test to pass regardless of
whether the .debug_info section was compressed on not.

bfd * compress.c (bfd_compress_section_contents): Do not define this
function if it is not used.

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

9 years agoTighten gdb.base/disp-step-syscall.exp
Pedro Alves [Wed, 18 Mar 2015 19:28:08 +0000 (19:28 +0000)]
Tighten gdb.base/disp-step-syscall.exp

This fixes several problems with this test.

E.g,. with --target_board=native-extended-gdbserver on x86_64 Fedora
20, I get:

 Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/disp-step-syscall.exp ...
 FAIL: gdb.base/disp-step-syscall.exp: vfork: get hexadecimal valueof "$pc" (timeout)
 FAIL: gdb.base/disp-step-syscall.exp: vfork: single step over vfork final pc
 FAIL: gdb.base/disp-step-syscall.exp: vfork: delete break vfork insn
 FAIL: gdb.base/disp-step-syscall.exp: vfork: continue to marker (vfork) (the program is no longer running)

And with --target=native-gdbserver, I get:

 Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/disp-step-syscall.exp ...
 KPASS: gdb.base/disp-step-syscall.exp: vfork: single step over vfork (PRMS server/13796)
 FAIL: gdb.base/disp-step-syscall.exp: vfork: get hexadecimal valueof "$pc" (timeout)
 FAIL: gdb.base/disp-step-syscall.exp: vfork: single step over vfork final pc
 FAIL: gdb.base/disp-step-syscall.exp: vfork: delete break vfork insn
 FAIL: gdb.base/disp-step-syscall.exp: vfork: continue to marker (vfork) (the program is no longer running)

First, the lack of fork support on remote targets is supposed to be
kfailed, so the KPASS is obviously bogus.  The extended-remote board
should have KFAILed too.

The problem is that the test is using "is_remote" instead of
gdb_is_target_remote.

And then, I get:

 (gdb) PASS: gdb.base/disp-step-syscall.exp: vfork: set displaced-stepping on
 stepi

 Program terminated with signal SIGSEGV, Segmentation fault.
 The program no longer exists.
 (gdb) PASS: gdb.base/disp-step-syscall.exp: vfork: single step over vfork

Obviously, that should be a FAIL.  The problem is that the test only
expects SIGILL, not SIGSEGV.  It also doesn't bail correctly if an
internal error or some other pattern caught by gdb_test_multiple
matches.  The test doesn't really need to match specific exits/crashes
patterns, if the PASS regex is improved, like in ...

... this and the other "stepi" tests are a bit too lax, passing on
".*".  This tightens those up to expect "x/i" and the "=>" current PC
indicator, like in:

 1: x/i $pc
 => 0x3b36abc9e2 <vfork+34>:     syscall

On x86_64 Fedora 20, I now get a quick KFAIL instead of timeouts with
both the native-extended-gdbserver and native-gdbserver boards:

 PASS: gdb.base/disp-step-syscall.exp: vfork: delete break vfork
 PASS: gdb.base/disp-step-syscall.exp: vfork: continue to syscall insn vfork
 PASS: gdb.base/disp-step-syscall.exp: vfork: set displaced-stepping on
 KFAIL: gdb.base/disp-step-syscall.exp: vfork: single step over vfork (PRMS: server/13796)

and a full pass with native testing.

gdb/testsuite/
2015-03-18  Pedro Alves  <palves@redhat.com>

* gdb.base/disp-step-syscall.exp (disp_step_cross_syscall):
Use gdb_is_target_remote instead of is_remote.  Use
gdb_test_multiple instead of gdb_expect.  Exit early if
gdb_test_multiple hits its internal matches.  Tighten stepi tests
expected output.  Fail on exit with any signal, instead of just
SIGILL.

9 years agoMake bfd_compress_section_contents static
H.J. Lu [Wed, 18 Mar 2015 18:20:06 +0000 (11:20 -0700)]
Make bfd_compress_section_contents static

* compress.c (bfd_compress_section_contents): Make it static.
* bfd/bfd-in2.h: Regenerated.

9 years agoAdd a testcase for PR gas/18087
H.J. Lu [Wed, 18 Mar 2015 16:20:38 +0000 (09:20 -0700)]
Add a testcase for PR gas/18087

PR gas/18087
* gas/i386/dw2-compress-1.d: Revert the last change.
* gas/i386/dw2-compress-3.d: New.
* gas/i386/dw2-compress-3.s: Likewise.
* gas/i386/i386.exp: Run dw2-compress-3 for ELF targets.

9 years agoFixes a problem generating relocs for import libraries created by Microsoft tools...
Nick Clifton [Wed, 18 Mar 2015 16:19:59 +0000 (16:19 +0000)]
Fixes a problem generating relocs for import libraries created by Microsoft tools for the x85_64 architecture.

PR ld/16598
* peicode.h (pe_ILF_build_a_bfd): Add support for creating relocs
suitable for the AMD64.

9 years agoFix debug section compression so that it is only performed if it would make the secti...
Jon Turney [Wed, 18 Mar 2015 15:47:13 +0000 (15:47 +0000)]
Fix debug section compression so that it is only performed if it would make the section smaller.

PR binutils/18087
gas * doc/as.texinfo: Note that when gas compresses debug sections the
compression is only performed if it makes the section smaller.
* write.c (compress_debug): Do not compress a debug section if
doing so would make it larger.

tests * gas/i386/dw2-compress-1.d: Do not expect the .debug_abbrev or
.debug_info sections to be compressed.

binu * doc/binutils.texi: Note that when objcopy compresses debug
sections the compression is only performed if it makes the section
smaller.

bfd * coffgen.c (make_a_section_from_file): Only prepend a z to a
debug section's name if the section was actually compressed.
* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
* compress.c (bfd_init_section_compress_status): Do not compress
the section if doing so would make it bigger.  In such cases leave
the section alone and return COMPRESS_SECTION_NONE.

9 years agoFix amd64 windows unwinding issues within MS dlls.
Tristan Gingold [Thu, 5 Mar 2015 13:36:32 +0000 (14:36 +0100)]
Fix amd64 windows unwinding issues within MS dlls.

Unwind info in system dlls uses almost all possible codes, contrary to unwind
info generated by gcc.  A few issues have been discovered: incorrect handling
of SAVE_NONVOL opcodes and incorrect in prologue range checks.  Furthermore I
added comments not to forget what has been investigated.

gdb/ChangeLog:
* amd64-windows-tdep.c (amd64_windows_find_unwind_info): Move
redirection code to ...
(amd64_windows_frame_decode_insns): ... Here.  Fix in prologue
checks.  Fix SAVE_NONVOL operations.  Add debug code and comments.

9 years agoReimplement "vFile:fstat" without qSupported
Gary Benson [Wed, 18 Mar 2015 11:19:02 +0000 (11:19 +0000)]
Reimplement "vFile:fstat" without qSupported

This commit makes support for the "vFile:fstat" packet be detected
by probing rather than using qSupported, for consistency with the
other vFile: packets.

gdb/ChangeLog:

(remote_protocol_features): Remove the "vFile:fstat" feature.
(remote_hostio_fstat): Probe for "vFile:fstat" support.

gdb/doc/ChangeLog:

* gdb.texinfo (General Query Packets): Remove documentation
for now-removed vFile:fstat qSupported features.

gdb/gdbserver/ChangeLog:

* server.c (handle_query): Do not report vFile:fstat as supported.

9 years agoSupport catch syscall on aarch64 linux
Yao Qi [Wed, 18 Mar 2015 10:47:45 +0000 (10:47 +0000)]
Support catch syscall on aarch64 linux

Hi,
This patch is to support catch syscall on aarch64 linux.  We
implement gdbarch method get_syscall_number for aarch64-linux,
and add aarch64-linux.xml file, which looks straightforward, however
the changes to test case doesn't.

First of all, we enable catch-syscall.exp on aarch64-linux target,
but skip the multi_arch testing on current stage.  I plan to touch
multi arch debugging on aarch64-linux later.

Then, when I run catch-syscall.exp on aarch64-linux, gcc errors that
SYS_pipe isn't defined.  We find that aarch64 kernel only has pipe2
syscall and libc already convert pipe to pipe2.  As a result, I change
catch-syscall.c to use SYS_pipe if it is defined, otherwise use
SYS_pipe2 instead.  The vector all_syscalls in catch-syscall.exp can't
be pre-determined, so I add a new proc setup_all_syscalls to fill it,
according to the availability of SYS_pipe.

Regression tested on {x86_64, aarch64}-linux x {native, gdbserver}.

gdb:

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

PR tdep/18107
* aarch64-linux-tdep.c: Include xml-syscall.h
(aarch64_linux_get_syscall_number): New function.
(aarch64_linux_init_abi): Call
set_gdbarch_get_syscall_number.
* syscalls/aarch64-linux.xml: New file.

gdb/testsuite:

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

PR tdep/18107
* gdb.base/catch-syscall.c [!SYS_pipe] (pipe2_syscall): New
variable.
* gdb.base/catch-syscall.exp: Don't skip it on
aarch64*-*-linux* target.  Remove elements in all_syscalls.
(test_catch_syscall_multi_arch): Skip it on aarch64*-linux*
target.
(setup_all_syscalls): New proc.

9 years agoUse %F instead of %X for einfo
Chen Gang [Wed, 18 Mar 2015 01:12:19 +0000 (11:42 +1030)]
Use %F instead of %X for einfo

When src or dst is NULL, the next fread or fwrite will cause a
segmentation fault, so we need to treat it as fatal.

* ldmain.c (main): Use %F instead of %X for einfo.

9 years agoExclude target-zlib if target-libjava isn't built
H.J. Lu [Wed, 18 Mar 2015 00:05:38 +0000 (17:05 -0700)]
Exclude target-zlib if target-libjava isn't built

* configure.ac (target_configdirs): Exclude target-zlib if
target-libjava isn't built.
* configure: Regenerated.

9 years agoRevert "Disable all target libraries if not building gcc"
H.J. Lu [Wed, 18 Mar 2015 00:01:54 +0000 (17:01 -0700)]
Revert "Disable all target libraries if not building gcc"

This reverts commit 35fece71d50e1883e67fcd28c69245de4335b8b5.

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

9 years agosim/erc32: Removed type mismatch compiler warnings
Jiri Gaisler [Tue, 17 Mar 2015 21:02:39 +0000 (22:02 +0100)]
sim/erc32: Removed type mismatch compiler warnings

9 years agosim/erc32: Added -v command line switch for verbose output
Jiri Gaisler [Tue, 17 Mar 2015 21:02:38 +0000 (22:02 +0100)]
sim/erc32: Added -v command line switch for verbose output

9 years agoAdd znver1 processor
Ganesh Gopalasubramanian [Tue, 17 Mar 2015 16:19:15 +0000 (21:49 +0530)]
Add znver1 processor

9 years agoFix name of ser_base_setstopbits's second argument.
Yurij Grechishhev [Tue, 17 Mar 2015 14:11:20 +0000 (10:11 -0400)]
Fix name of ser_base_setstopbits's second argument.

Small copy/paste error, most likely...

gdb/ChangeLog:

* ser-base.h (ser_base_setstopbits): Change second argument name
from "rate" to "num".

9 years agoSync config-ml.in with GCC trunk
H.J. Lu [Tue, 17 Mar 2015 12:15:34 +0000 (05:15 -0700)]
Sync config-ml.in with GCC trunk

Sync with GCC
2014-06-13  Thomas Schwinge  <thomas@codesourcery.com>

* config-ml.in: Robustify ac_configure_args parsing.

9 years agoRemove forward declaration of struct stat
Gary Benson [Tue, 17 Mar 2015 11:26:09 +0000 (11:26 +0000)]
Remove forward declaration of struct stat

Forward declarations of struct stat break the Windows build.
This commit removes a forward declaration of struct stat and
includes sys/stat.h directly instead.

gdb/ChangeLog:

PR gdb/18131
* common/common-remote-fileio.h (sys/stat.h): New include.
(stuct stat): Remove forward declaration.

9 years agoFix elf64-ppc.c electric fence warning
Alan Modra [Mon, 16 Mar 2015 23:46:51 +0000 (10:16 +1030)]
Fix elf64-ppc.c electric fence warning

* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Return count of 0
on nothing to do, before malloc of returned symbol array.

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

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.