binutils-gdb.git
9 years agoPrevent looping in archives
Alan Modra [Wed, 18 Nov 2015 11:42:23 +0000 (22:12 +1030)]
Prevent looping in archives

PR 19256
* archive.c (bfd_generic_openr_next_archived_file): Don't allow
backward file movement via "negative" sizes.
* coff-alpha.c (alpha_ecoff_openr_next_archived_file): Likewise.

9 years agomach-o cleanup: remove useless calls to bfd_seek.
Tristan Gingold [Wed, 18 Nov 2015 09:33:11 +0000 (10:33 +0100)]
mach-o cleanup: remove useless calls to bfd_seek.

Also support new commands.

bfd/
* mach-o.h (struct mach_o_data_struct): Add hdr_offset field.
(bfd_mach_o_fat_archive_p): Renames prototype.
(bfd_mach_o_fat_openr_next_archived_file): Renames.
(bfd_mach_o_header_p): Add argument.
* mach-o.c (bfd_mach_o_read_header): Add hdr_off argument and
use it.
(bfd_mach_o_read_section_32, bfd_mach_o_read_section_64)
(bfd_mach_o_read_section): Remove offset argument.
(bfd_mach_o_read_dylinker): Remove bfd_seek call.
(bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib)
(bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints)
(bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab)
(bfd_mach_o_read_symtab, bfd_mach_o_read_uuid)
(bfd_mach_o_read_linkedit, bfd_mach_o_read_str)
(bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min)
(bfd_mach_o_read_encryption_info): Likewise.
(bfd_mach_o_read_encryption_info_64): New function.
(bfd_mach_o_read_main, bfd_mach_o_read_source_version)
(bfd_mach_o_read_segment): Remove call to bfd_seek.
(bfd_mach_o_read_command): Use hdr_offset in bfd_seek.
Handle BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT,
BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_VERSION_MIN_WATCHOS.
(bfd_mach_o_header_p): Add hdr_off argument.
(bfd_mach_o_gen_object_p, bfd_mach_o_gen_core_p): Adjust calls.
(bfd_mach_o_fat_archive_p): Renames.
(bfd_mach_o_fat_openr_next_archived_file): Renames.
(bfd_mach_o_close_and_cleanup): Remove useless code.
(bfd_mach_o_close_and_cleanup): Define.
* mach-o-x86-64.c (bfd_mach_o_x86_64_object_p)
(bfd_mach_o_x86_64_core_p): Adjust calls.
* mach-o-target.c: Move defines for archive from mach-o.c.
Remove check on TARGET_ARCHIVE.
* mach-o-i386.c (bfd_mach_o_i386_object_p)
(bfd_mach_o_i386_core_p): Adjust calls.

9 years agosim: mn10300/v850: drop unused WITH_CORE define
Mike Frysinger [Tue, 17 Nov 2015 08:24:35 +0000 (00:24 -0800)]
sim: mn10300/v850: drop unused WITH_CORE define

This was dropped from the sim core in 1997, so no point in having these
sim ports continue to define it.

9 years agosim: always enable modulo memory
Mike Frysinger [Tue, 17 Nov 2015 08:19:56 +0000 (00:19 -0800)]
sim: always enable modulo memory

Having this be a config option doesn't make sense: the code size is
pretty much the same (as all the logic is still active), and if it's
disabled, the sim throws an error if you try to use it.  That means
we can't break sims that weren't using it before by enabling it all
the time.

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

9 years ago[sim/ppc] Fix printf_filtered reference
Pedro Alves [Tue, 17 Nov 2015 19:21:21 +0000 (19:21 +0000)]
[sim/ppc] Fix printf_filtered reference

Building a gdb that includes the PPC sim in C++ mode fails to link with:

(...)s.o compile-object-load.o compile-object-run.o compile-loc2c.o compile-c-support.o inflow.o    init.o \
          ../sim/ppc/libsim.a ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a -lz  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -ldl -ldl -lncurses -lm -ldl  -lguile-2.0 -lgc  -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -lexpat -llzma -lbabeltrace -lbabeltrace-ctf  ../libiberty/libiberty.a  build-gnulib/import/libgnu.a
../sim/ppc/libsim.a(sim_calls.o): In function `sim_open':
/home/pedro/gdb/mygit/cxx-convertion/src/sim/ppc/sim_calls.c:73: undefined reference to `printf_filtered'
/home/pedro/gdb/mygit/cxx-convertion/src/sim/ppc/sim_calls.c:73: undefined reference to `printf_filtered'
../sim/ppc/libsim.a(sim_calls.o): In function `sim_close':
/home/pedro/gdb/mygit/cxx-convertion/src/sim/ppc/sim_calls.c:93: undefined reference to `printf_filtered'
/home/pedro/gdb/mygit/cxx-convertion/src/sim/ppc/sim_calls.c:93: undefined reference to `printf_filtered'
../sim/ppc/libsim.a(sim_calls.o): In function `sim_load':
/home/pedro/gdb/mygit/cxx-convertion/src/sim/ppc/sim_calls.c:102: undefined reference to `printf_filtered'
../sim/ppc/libsim.a(sim_calls.o):/home/pedro/gdb/mygit/cxx-convertion/src/sim/ppc/sim_calls.c:102: more undefined references to `printf_filtered' follow
collect2: error: ld returned 1 exit status

The undefined references come from TRACE macro calls, which expand to
calls to printf_filtered.

But note that the sim's 'printf_filtered' is actually a #define to
'sim_io_printf_filtered', in sim_callbacks.h :

 #define printf_filtered sim_io_printf_filtered

AFAICS, this is not meant to call gdb's printf_filtered function.  The
ChangeLog entry that added the printf_filtered macro reads:

 Tue Jul 30 21:12:24 1996  Andrew Cagney  <cagney@kremvax.highland.com.au>

 * sim_callbacks.h (sim_io_printf_filtered): Replace
 printf_filtered with a local simulator specific version.  Add
 #define printf_filtered to simplify updating of existing code.

That is, just another incomplete/partial transition.  Maybe prior to
1996 this was really meant to call gdb's printf_filtered version.

The reference to printf_filtered appears because sim_calls.c, the
compilation unit that fails to link, has this at the top:

 #undef printf_filtered /* blow away the mapping */

presumably so that this further below:

 void
 sim_io_printf_filtered(const char *fmt,
...)
 {
   (...)
   callbacks->printf_filtered(callbacks, "%s", message);
 }

works.  So those TRACE macros instances in sim_calls.c just happen to
work because gdb is linked in, which satisfies the 'printf_filtered'
reference, when GDB is built in C mode.  When built in C++ mode, the
problem is exposed, as GDB's printf_filtered is mangled.

The fix here is to make the TRACE macro call sim_io_printf_filtered
directly.

(Standalone "run" doesn't fail to link simply because the offending
routines are not part of its link.)

sim/ppc/ChangeLog
2015-11-17  Pedro Alves  <palves@redhat.com>

* debug.h (TRACE, ITRACE, DTRACE, DITRACE, PTRACE): Call
sim_io_printf_filtered instead of printf_filtered.

9 years agoFix gdb.threads/multiple-step-overs.exp fails on arm
Yao Qi [Tue, 17 Nov 2015 15:40:29 +0000 (15:40 +0000)]
Fix gdb.threads/multiple-step-overs.exp fails on arm

Hi,
Some tests in gdb.threads/multiple-step-overs.exp fail on arm target
when the displaced stepping on, but they pass when displaced stepping
is off.

 FAIL: gdb.threads/multiple-step-overs.exp: displaced=on: step: step
 FAIL: gdb.threads/multiple-step-overs.exp: displaced=on: next: next
 FAIL: gdb.threads/multiple-step-overs.exp: displaced=on: continue: continue
 FAIL: gdb.threads/multiple-step-overs.exp: displaced=on: signal thr1: continue to sigusr1_handler

when displaced stepping is on,

Sending packet: $vCont;c#a8...infrun: infrun_async(1)^M <--- [1]
infrun: prepare_to_wait^M
infrun: target_wait (-1.0.0, status) =^M
infrun:   -1.0.0 [Thread 0],^M
infrun:   status->kind = ignore^M
infrun: TARGET_WAITKIND_IGNORE^M
infrun: prepare_to_wait^M
Packet received: T05swbreak:;0b:f8faffbe;0d:409ee7b6;0f:d0880000;thread:p635.636;core:0;^M
infrun: target_wait (-1.0.0, status) =^M
infrun:   1589.1590.0 [Thread 1590],^M
infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP^M
infrun: TARGET_WAITKIND_STOPPED^M
infrun: stop_pc = 0x88d0^M
infrun: context switch^M
infrun: Switching context from Thread 1591 to Thread 1590^

GDB resumes the whole process (all threads) rather than the specific
thread for which GDB wants to step over the breakpoint (as shown in [1]).
That is wrong because we resume a single thread and leave others stopped
when doing a normal step over where we temporarily remove the breakpoint,
single-step, reinsert the breakpoint, is that if we let other threads run
in the period while the breakpoint is removed, then these other threads
could miss the breakpoint.  Since with displaced stepping, we don't ever
remove the breakpoint, it should be fine to let other threads run.  However,
there's another reason that we should not let other threads run: that is
the case where some of those threads are also stopped for a breakpoint that
itself needs to be stepped over.  If we just let those threads run, then
they immediately re-trap their breakpoint again.

when displaced stepping is off, GDB behaves correctly, only resumes
the specific thread (as shown in [2]).

Sending packet: $vCont;c:p611.613#b2...infrun: infrun_async(1)^M <-- [2]
infrun: prepare_to_wait^M
infrun: target_wait (-1.0.0, status) =^M
infrun:   -1.0.0 [Thread 0],^M
infrun:   status->kind = ignore^M
infrun: TARGET_WAITKIND_IGNORE^M
infrun: prepare_to_wait^M
Packet received: T05swbreak:;0b:f8faffbe;0d:409e67b6;0f:48880000;thread:p611.613;core:1;^M
infrun: target_wait (-1.0.0, status) =^M
infrun:   1553.1555.0 [Thread 1555],^M
infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP^M
infrun: TARGET_WAITKIND_STOPPED^M
infrun: clear_step_over_info^M
infrun: stop_pc = 0x8848

The current logic in GDB on deciding the set of threads to resume is:

  /* Decide the set of threads to ask the target to resume.  */
  if ((step || thread_has_single_step_breakpoints_set (tp))
      && tp->control.trap_expected)
    {
      /* We're allowing a thread to run past a breakpoint it has
 hit, by single-stepping the thread with the breakpoint
 removed.  In which case, we need to single-step only this
 thread, and keep others stopped, as they can miss this
 breakpoint if allowed to run.  */
      resume_ptid = inferior_ptid;
    }
  else
    resume_ptid = internal_resume_ptid (user_step);

it doesn't handle the case correctly that GDB continue (instead of
single step) the thread for displaced stepping.

I also update the comment below to reflect the code.  I remove the
"with the breakpoint removed" comment, because GDB doesn't remove
breakpoints in displaced stepping, so we don't have to worry that
other threads may miss the breakpoint.

Patch is regression tested on both x86_64-linux and arm-linux.

gdb:

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

* infrun.c (resume): Check control.trap_expected only
when deciding the set of threads to resume.

9 years agoIntroduce null_block_symbol
Pedro Alves [Tue, 17 Nov 2015 13:12:23 +0000 (13:12 +0000)]
Introduce null_block_symbol

... in the spirit of null_ptid, null_frame_id, etc.

Fixes two instances of:

  /root/binutils-gdb/gdb/cp-namespace.c: In function 'block_symbol cp_lookup_nested_symbol(type*, const char*, const block*, domain_enum)':
  /root/binutils-gdb/gdb/cp-namespace.c:1010: warning: jump to case label
  /root/binutils-gdb/gdb/cp-namespace.c:1008: error:   crosses initialization of 'block_symbol <anonymous>'

Compiler info:

  Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd5.8/4.2.1/specs
  Target: amd64-unknown-openbsd5.8
  Configured with: OpenBSD/amd64 system compiler
  Thread model: posix
  gcc version 4.2.1 20070719

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* cp-namespace.c (cp_lookup_bare_symbol)
(cp_search_static_and_baseclasses, cp_lookup_symbol_via_imports)
(cp_lookup_symbol_via_all_imports, cp_lookup_nested_symbol_1)
(cp_lookup_nested_symbol): Use null_block_symbol.
* d-namespace.c (d_lookup_symbol, d_lookup_nested_symbol)
(d_lookup_symbol_imports, d_lookup_symbol_module): Use
null_block_symbol.
* symtab.c (null_block_symbol): New global.
* symtab.h (null_block_symbol): Declare.

9 years ago[C++] Always use setjmp/longjmp for exceptions
Pedro Alves [Tue, 17 Nov 2015 15:17:46 +0000 (15:17 +0000)]
[C++] Always use setjmp/longjmp for exceptions

We currently throw exceptions from signal handlers (e.g., for
Quit/ctrl-c).  But throwing C++ exceptions from signal handlers is
undefined.  (That doesn't restore signal masks, like siglongjmp does,
and, because asynchronous signals can arrive at any instruction, we'd
have to build _everything_ with -fasync-unwind-tables to make it
reliable.)  It happens to work on x86_64 GNU/Linux at least, but it's
likely broken on other ports.

Until we stop throwing from signal handlers, use setjmp/longjmp based
exceptions in C++ mode as well.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.h (GDB_XCPT_SJMP, GDB_XCPT_TRY)
(GDB_XCPT_RAW_TRY, GDB_XCPT): Define.
Replace __cplusplus checks with GDB_XCPT checks throughout.
* common/common-exceptions.c: Replace __cplusplus checks with
GDB_XCPT checks throughout.

9 years agoMinGW and attribute format(printf/gnu_printf)
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
MinGW and attribute format(printf/gnu_printf)

Cross building gdbserver for --host=x86_64-w64-mingw32 with gcc 4.8.4
20141219 (Fedora MinGW 4.8.4-1.fc20), I get:

  src/gdb/gdbserver/tracepoint.c: In function 'cmd_qtdp':
  src/gdb/gdbserver/tracepoint.c:2577:7: error: unknown conversion type character 'l' in format [-Werror=format=]
 trace_debug ("Defined %stracepoint %d at 0x%s, "
 ^
  src/gdb/gdbserver/tracepoint.c:2577:7: error: unknown conversion type character 'l' in format [-Werror=format=]
  src/gdb/gdbserver/tracepoint.c:2577:7: error: too many arguments for format [-Werror=format-extra-args]
  src/gdb/gdbserver/tracepoint.c: In function 'stop_tracing':
  src/gdb/gdbserver/tracepoint.c:3447:7: error: unknown conversion type character 'l' in format [-Werror=format=]
 trace_debug ("Stopping the trace because "
 ^
  src/gdb/gdbserver/tracepoint.c:3447:7: error: too many arguments for format [-Werror=format-extra-args]
  src/gdb/gdbserver/tracepoint.c: In function 'collect_data_at_tracepoint':
  src/gdb/gdbserver/tracepoint.c:4651:3: error: unknown conversion type character 'l' in format [-Werror=format=]
     trace_debug ("Making new traceframe for tracepoint %d at 0x%s, hit %" PRIu64,
     ^
  src/gdb/gdbserver/tracepoint.c:4651:3: error: too many arguments for format [-Werror=format-extra-args]
  src/gdb/gdbserver/tracepoint.c: In function 'collect_data_at_step':
  src/gdb/gdbserver/tracepoint.c:4687:3: error: unknown conversion type character 'l' in format [-Werror=format=]
     trace_debug ("Making new step traceframe for "
     ^

trace_debug is a macro that calls:

  static void trace_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);

The calls that fail checking use PRIu64, etc., like:

      trace_debug ("Defined %stracepoint %d at 0x%s, "
   "enabled %d step %" PRIu64 " pass %" PRIu64,
   tpoint->type == fast_tracepoint ? "fast "
   : tpoint->type == static_tracepoint ? "static " : "",
   tpoint->number, paddress (tpoint->address), tpoint->enabled,
   tpoint->step_count, tpoint->pass_count);

gnulib's stdio/printf module replacements may make %llu, etc. work on
mingw, instead of the MS-specific %I64u, and thus may make PRIu64
expand to %llu.  However, gcc isn't aware of that, because libiberty's
ansidecl.h defines ATTRIBUTE_PRINTF as using attribute format(printf).
But, with that format, gcc checks for MS-style format strings (%I64u).
In order to have gcc expect gnu/standard formats, we need to use
gnu_printf format instead.  Which version to use (printf/gnu_printf)
depends on msvcrt and mingw version, and so gnulib has a
configure-time check, and defines _GL_ATTRIBUTE_FORMAT_PRINTF
accordingly.

Since _GL_ATTRIBUTE_FORMAT_PRINTF is compatible with ATTRIBUTE_PRINTF,
the fix is simply to make use of the former.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* common/common-defs.h (ATTRIBUTE_PRINTF): Redefine in terms of
_GL_ATTRIBUTE_FORMAT_PRINTF after including ansidecl.h.

9 years ago[C++] Define __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS for stdint.h
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++] Define __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS for stdint.h

With some toolchains, building in C++ mode stumbles on many instances
of:

 In file included from ../../src/gdb/../include/splay-tree.h:43:0,
                  from ../../src/gdb/dcache.c:26:
 build-gnulib/import/inttypes.h:61:3: error: #error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
  # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
    ^
 make: *** [dcache.o] Error 1

That's:

 #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 #endif

I see it when cross building for --host=x86_64-w64-mingw32 using
Fedora 20's g++ (gcc version 4.8.4 20141219 (Fedora MinGW
4.8.4-1.fc20)), Simon reports seeing this on several cross compilers
too.

The issue is that on some hosts that predate C++11, when using C++ one
must define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS to make visible
the definitions of INTMAX_C / INTMAX_MAX etc.

This was a C99 requirement that later C++11 -- the first to define
stdint.h -- removed, and then C11 removed it as well.

https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html
says that gnulib's stdint.h fixes this, but because we run gnulib's
configure tests with a C compiler, gnulib determines that mingw's
stdint.h is C99-compliant, and doesn't actually replace it.  Actually,
even though configuring gnulib with a C++ compiler does result in
gnulib replacing stdint.h, the resulting replacement is broken for
mingw, because it defines uintptr_t incorrectly.  I sent a gnulib
patch upstream to fix that, here:

  https://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00004.html

but then even with that, gnulib still stumbles on other
configured-with-C++-compiler problems.

So for now, until gnulib + C++ is fixed upstream and then gdb's copy
is updated, which may take a while, I think it's best to keep
configuring gnulib in C, and define
__STDC_LIMIT_MACROS/__STDC_CONSTANT_MACROS ourselves, just like C99
intended.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* common/common-defs.h (__STDC_CONSTANT_MACROS)
(__STDC_LIMIT_MACROS): Define before including stdint.h.

9 years ago[C++/mingw] Simplify first chance exception handling
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++/mingw] Simplify first chance exception handling

Building in C++ errors out with:

../../src/gdb/windows-nat.c: In function 'int get_windows_debug_event(target_ops*, int, target_waitstatus*)':
../../src/gdb/windows-nat.c:1503:13: warning: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
    last_sig = 1;
             ^
../../src/gdb/windows-nat.c:1533:43: warning: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
  windows_resume (ops, minus_one_ptid, 0, 1);
                                           ^
../../src/gdb/windows-nat.c:1228:1: warning:   initializing argument 4 of 'void windows_resume(target_ops*, ptid_t, int, gdb_signal)' [-fpermissive]
 windows_resume (struct target_ops *ops,
 ^

Looking at the code, I can't figure out why we treat first chance
exceptions any different here.

AFAICS, we set last_sig to 1, and then call windows_resume passing
signal==1, so the DBG_EXCEPTION_NOT_HANDLED code path in win32_resume
is taken:

~~~
  if (sig != GDB_SIGNAL_0)
    {
      if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
{
  OUTMSG (("Cannot continue with signal %d here.\n", sig));
}
      else if (sig == last_sig)
continue_status = DBG_EXCEPTION_NOT_HANDLED;
      else
OUTMSG (("Can only continue with recieved signal %d.\n", last_sig));
    }
~~~

Fix this by removing this special casing.  gdbserver also goes
straight to continuing with DBG_EXCEPTION_NOT_HANDLED, AFAICS.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* windows-nat.c (handle_exception): Return 0 for first chance
exceptions.
(get_windows_debug_event): Adjust.

9 years ago[C++/mingw] gdbserver: gdb/host signal mixup
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++/mingw] gdbserver: gdb/host signal mixup

Building in C++ caught a buglet here:

../../../src/gdb/gdbserver/win32-low.c: In function 'void win32_resume(thread_resume*, size_t)':
../../../src/gdb/gdbserver/win32-low.c:929:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
       sig = resume_info[0].sig;
           ^
../../../src/gdb/gdbserver/win32-low.c:934:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
       sig = 0;
           ^

Signals in the "struct thread_resume" structure are host signals, not
gdb signals.  The current code happens to work because the only
signals that the Windows port supports have the same number as the gdb
equivalent (see handle_exception for the win32 exception -> gdb signal
mapping).

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

* win32-low.c (win32_resume): Use gdb_signal_from_host,
GDB_SIGNAL_0 and gdb_signal_to_string.

9 years ago[C++/mingw] Fix windows-nat.c::xlate
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++/mingw] Fix windows-nat.c::xlate

Fixes:

../../src/gdb/windows-nat.c:287:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
   {-1, -1}};
           ^

The signal number here doesn't really matter.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* windows-nat.c (xslate): Use GDB_SIGNAL_UNKNOWN instead of -1 as
signal number for terminator.

9 years ago[C++/mingw] handle_output_debug_string
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++/mingw] handle_output_debug_string

Fixes:

 ../../../src/gdb/gdbserver/win32-low.c: In function 'int win32_kill(int)':
 ../../../src/gdb/gdbserver/win32-low.c:823:46: error: invalid conversion from 'int' to 'target_waitkind' [-fpermissive]
     struct target_waitstatus our_status = { 0 };
       ^

handle_output_debug_string doesn't use the parameter for anything
(it's an output parameter in the gdb version), so just remove it.

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

* win32-low.c (handle_output_debug_string): Remove parameter.
(win32_kill): Remove our_status local and adjust call to
handle_output_debug_string.
(get_child_debug_event): Adjust call to
handle_output_debug_string.

9 years ago[C++/mingw] ser-tcp.c casts
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++/mingw] ser-tcp.c casts

Fixes a few errors like these:

../../src/gdb/ser-tcp.c: In function 'int net_open(serial*, const char*)':
../../src/gdb/ser-tcp.c:286:73: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
     res = getsockopt (scb->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len);
                                                                         ^

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* ser-tcp.c (net_open) : Cast getsockopt argument to char *
instead of void *.  Update comment.
(net_read_prim): Cast recv argument to char * instead of void *.
(net_write_prim): Cast send argument to char *.  Add comment.

9 years ago[C++/mingw] gdbserver casts
Pedro Alves [Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)]
[C++/mingw] gdbserver casts

A set of obviously-needed C++ casts.

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

* win32-i386-low.c (update_debug_registers_callback)
(win32_get_current_dr): Add cast.
* win32-low.c (thread_rec, delete_thread_info)
(continue_one_thread): Add casts.
(strwinerror): Cast FormatMessage argument to LPTSTR instead of
LPVOID.
(win32_create_inferior, suspend_one_thread): Add casts.

9 years ago[C++/mingw] windows-nat.c casts
Pedro Alves [Tue, 17 Nov 2015 15:17:44 +0000 (15:17 +0000)]
[C++/mingw] windows-nat.c casts

Fixes a set of errors like:

../../src/gdb/windows-nat.c: In function 'void _initialize_loadable()':
../../src/gdb/windows-nat.c:2778:30: error: invalid conversion from 'void*' to 'BOOL (*)(DWORD) {aka int (*)(long unsigned int)}' [-fpermissive]
       DebugActiveProcessStop = (void *)
                              ^

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* windows-nat.c (AdjustTokenPrivileges_ftype)
(DebugActiveProcessStop_ftype, DebugBreakProcess_ftype)
(DebugSetProcessKillOnExit_ftype, EnumProcessModules_ftype)
(GetCurrentConsoleFont_ftype, GetModuleInformation_ftype)
(LookupPrivilegeValueA_ftype, OpenProcessToken_ftype)
(GetConsoleFontSize_ftype): New typedefs.
(AdjustTokenPrivileges, DebugActiveProcessStop)
(DebugBreakProcess, DebugSetProcessKillOnExit, EnumProcessModules)
(GetConsoleFontSize, GetCurrentConsoleFont, GetModuleInformation)
(LookupPrivilegeValueA, OpenProcessToken, GetConsoleFontSize):
Adjust.
(GetModuleFileNameEx_ftype): New typedef.
(GetModuleFileNameEx): Use it.
(_initialize_loadable): Define GPA macro and use it.

9 years ago[C++/mingw] gdb-dlfcn.c casts
Pedro Alves [Tue, 17 Nov 2015 15:17:44 +0000 (15:17 +0000)]
[C++/mingw] gdb-dlfcn.c casts

Fixes:

../../src/gdb/gdb-dlfcn.c: In function 'void* gdb_dlsym(void*, const char*)':
../../src/gdb/gdb-dlfcn.c:105:49: error: invalid conversion from 'void*' to 'HMODULE {aka HINSTANCE__*}' [-fpermissive]
   return (void *) GetProcAddress (handle, symbol);
                                                 ^

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* gdb-dlfcn.c (gdb_dlsym, gdb_dlclose) [__MINGW32__]: Add casts to
HMODULE.

9 years ago[C++/mingw] Misc alloca casts
Pedro Alves [Tue, 17 Nov 2015 15:17:44 +0000 (15:17 +0000)]
[C++/mingw] Misc alloca casts

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* exec.c (exec_file_attach, symfile_bfd_open) [__GO32__ || _WIN32
|| __CYGWIN__]: Add casts.
* utils.c (gdb_filename_fnmatch): Add cast.
* windows-nat.c (windows_create_inferior): Add cast.

9 years ago[C++/mingw] ser-mingw.c casts
Pedro Alves [Tue, 17 Nov 2015 15:17:44 +0000 (15:17 +0000)]
[C++/mingw] ser-mingw.c casts

2015-11-17  Pedro Alves  <palves@redhat.com>

* ser-mingw.c (CancelIo_ftype): New typedef.
(CancelIo): Use CancelIo_ftype.
(ser_windows_close, ser_windows_wait_handle)
(ser_windows_read_prim, stop_select_thread)
(console_select_thread, pipe_select_thread, file_select_thread)
(ser_console_wait_handle, ser_console_done_wait_handle)
(ser_console_close, cleanup_pipe_state, pipe_windows_close)
(pipe_windows_write, pipe_wait_handle, pipe_done_wait_handle)
(net_windows_socket_check_pending, net_windows_select_thread)
(net_windows_wait_handle, net_windows_done_wait_handle)
(net_windows_close): Add casts.
(_initialize_ser_windows): Cast to CancelIo_ftype* instead of
void*.

9 years agoMach-O: add new defines and struct for darwin 14.5
Tristan Gingold [Tue, 17 Nov 2015 13:56:04 +0000 (14:56 +0100)]
Mach-O: add new defines and struct for darwin 14.5

include/mach-o/
* arm64.h: New file.
* unwind.h: Add arm64 encodings.
* loader.h (bfd_mach_o_cpu_subtype): Add arm64 literals.
(BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_LINKER_OPTIONS)
(BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT)
(BFD_MACH_O_LC_VERSION_MIN_WATCHOS): Define.
* external.h (mach_o_encryption_info_64_command_external):
(mach_o_linker_option_command_external)
(mach_o_dyld_cache_header_external)
(mach_o_dyld_cache_mapping_info_external)
(mach_o_dyld_cache_image_info_external): New types.

9 years agoConvert c_string_type to an enum flags type
Simon Marchi [Tue, 17 Nov 2015 13:31:29 +0000 (13:31 +0000)]
Convert c_string_type to an enum flags type

c_string_type contains values meant to be OR'ed together (even though
some bits are mutually exclusive), so it makes sense to make it an
enum flags type.

gdb/ChangeLog:
2015-11-17  Simon Marchi  <simon.marchi@ericsson.com>

* c-exp.y (exp): Adjust, change enum c_string_type to
c_string_type.
(parse_string_or_char): Likewise.
* c-lang.c (charset_for_string_type): Likewise.
(classify_type): Likewise.
(c_printchar): Likewise.
(c_printstr): Likewise.
(evaluate_subexp_c): Likewise.  And change cast to enum
c_string_type_values.
* c-lang.h: Include "common/enum_flags.h".
(enum c_string_type): Rename to...
(enum c_string_type_values): ...this.
(c_string_type): Define new enum flags type.

9 years agoType-safe wrapper for enum flags
Pedro Alves [Tue, 17 Nov 2015 13:31:29 +0000 (13:31 +0000)]
Type-safe wrapper for enum flags

This patch fixes C++ build errors like this:

/home/pedro/gdb/mygit/cxx-convertion/src/gdb/linux-tdep.c:1126:35: error: invalid conversion from ‘int’ to ‘filterflags’ [-fpermissive]
       | COREFILTER_HUGETLB_PRIVATE);
                                   ^

This is a case of enums used as bit flags.  Unlike "regular" enums,
these values are supposed to be or'ed together.  However, in C++, the
type of "(ENUM1 | ENUM2)" is int, and you then can't assign an int to
an enum variable without a cast.  That means that this:

  enum foo_flags flags = 0;

  if (...)
    flags |= FOO_FLAG1;
  if (...)
    flags |= FOO_FLAG2;

... would have to be written as:

  enum foo_flags flags = (enum foo_flags) 0;

  if (...)
    flags = (enum foo_flags) (flags | FOO_FLAG1);
  if (...)
    flags = (enum foo_flags) (flags | FOO_FLAG2);

which is ... ugly.  Alternatively, we'd have to use an int for the
variable's type, which isn't ideal either.

This patch instead adds an "enum flags" class.  "enum flags" are
exactly the enums where the values are bits that are meant to be ORed
together.

This allows writing code like the below, while with raw enums this
would fail to compile without casts to enum type at the assignments to
'f':

  enum some_flag
  {
     flag_val1 = 1 << 1,
     flag_val2 = 1 << 2,
     flag_val3 = 1 << 3,
     flag_val4 = 1 << 4,
  };
  DEF_ENUM_FLAGS_TYPE(enum some_flag, some_flags)

  some_flags f = flag_val1 | flag_val2;
  f |= flag_val3;

It's also possible to assign literal zero to an enum flags variable
(meaning, no flags), dispensing either adding an awkward explicit "no
value" value to the enumeration or the cast to assignments from 0.
For example:

  some_flags f = 0;
  f |= flag_val3 | flag_val4;

Note that literal integers other than zero do fail to compile:

  some_flags f = 1; // error

C is still supported -- DEF_ENUM_FLAGS_TYPE is just a typedef in that
case.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* btrace.h: Include common/enum-flags.h.
(btrace_insn_flags): Define.
(struct btrace_insn) <flags>: Change type.
(btrace_function_flags): Define.
(struct btrace_function) <flags>: Change type.
(btrace_thread_flags): Define.
(struct btrace_thread_info) <flags>: Change type.
* c-exp.y (token_flags): Rename to ...
(token_flag): ... this.
(token_flags): Define.
(struct token) <flags>: Change type.
* common/enum-flags.h: New file.
* compile/compile-c-types.c (convert_qualified): Change type of
'quals' local.
* compile/compile-internal.h: Include "common/enum-flags.h".
(gcc_qualifiers_flags): Define.
* completer.c (enum reg_completer_targets): Rename to ...
(enum reg_completer_target): ... this.
(reg_completer_targets): Define.
(reg_or_group_completer_1): Change type of 'targets' parameter.
* disasm.c (do_mixed_source_and_assembly_deprecated): Change type
of 'psl_flags' local.
(do_mixed_source_and_assembly): Change type of 'psl_flags' local.
* infrun.c: Include "common/enum-flags.h".
(enum step_over_what): Rename to ...
(enum step_over_what_flag): ... this.
(step_over_what): Change type.
(start_step_over): Change type of 'step_what' local.
(thread_still_needs_step_over): Now returns a step_over_what.
Adjust.
(keep_going_pass_signal): Change type of 'step_what' local.
* linux-tdep.c: Include "common/enum-flags.h".
(enum filterflags): Rename to ...
(enum filter_flag): ... this.
(filter_flags): Define.
(dump_mapping_p): Change type of 'filterflags' parameter.
(linux_find_memory_regions_full): Change type of 'filterflags'
local.
(linux_find_memory_regions_full): Pass the address of an unsigned
int to sscanf instead of the address of an enum.
* record-btrace.c (btrace_print_lines): Change type of local
'psl_flags'.
(btrace_call_history): Replace 'flags' parameter
with 'int_flags' parameter.  Adjust.
(record_btrace_call_history, record_btrace_call_history_range)
(record_btrace_call_history_from): Rename 'flags' parameter to
'int_flags'.  Use record_print_flags.
* record.h: Include "common/enum-flags.h".
(record_print_flags): Define.
* source.c: Include "common/enum-flags.h".
(print_source_lines_base, print_source_lines): Change type of
flags parameter.
* symtab.h: Include "common/enum-flags.h".
(enum print_source_lines_flags): Rename to ...
(enum print_source_lines_flag): ... this.
(print_source_lines_flags): Define.
(print_source_lines): Change prototype.

9 years agoguile disassembly hardcode TARGET_XFER_E_IO
Pedro Alves [Tue, 17 Nov 2015 13:31:28 +0000 (13:31 +0000)]
guile disassembly hardcode TARGET_XFER_E_IO

Instead of adding a cast at the memory_error call, as needed for C++,
and have the reader understand the indirection, make it simple and
hardcode the generic memory error at the memory_error call site.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* guile/scm-disasm.c (gdbscm_disasm_read_memory): Return -1 on
error instead of TARGET_XFER_E_IO.
(gdbscm_disasm_memory_error): Always pass TARGET_XFER_E_IO to
memory_error.

9 years agoFix a problematic message with the STM32L4XX fixup on 32-bit hosts.
Christophe Lyon [Tue, 17 Nov 2015 11:35:08 +0000 (11:35 +0000)]
Fix a problematic message with the STM32L4XX fixup on 32-bit hosts.

* elf32-arm.c (elf32_arm_write_section): Force offset output as
long (%ld).

9 years agoFix the disassembly of conditional instructions will illegal condition selections.
Nick Clifton [Mon, 16 Nov 2015 14:26:07 +0000 (14:26 +0000)]
Fix the disassembly of conditional instructions will illegal condition selections.

* rx-dis.c (condition_names): Replace always and never with
invalid, since the always/never conditions can never be legal.

9 years agogdb/testsuite: Fix left shift of negative value.
Dominik Vogt [Tue, 17 Nov 2015 09:56:32 +0000 (10:56 +0100)]
gdb/testsuite: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C cod
which is undefined by the C standard.

gdb/testsuite/ChangeLog:

        * lib/dwarf.exp (_note): Fix left shift of negative value.
        * gdb.trace/trace-condition.exp: Likewise.

9 years agogdb: Fix left shift of negative value.
Dominik Vogt [Tue, 17 Nov 2015 09:56:32 +0000 (10:56 +0100)]
gdb: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C cod
which is undefined by the C standard.

gdb/ChangeLog:

        * hppa-tdep.c (hppa_sign_extend, hppa_low_hppa_sign_extend)
        (prologue_inst_adjust_sp, hppa_frame_cache): Fix left shift of negative
        value.
        * dwarf2read.c (read_subrange_type): Likewise.

9 years agosim: sim-close: use XCONCAT2 helper
Mike Frysinger [Mon, 16 Nov 2015 08:12:23 +0000 (00:12 -0800)]
sim: sim-close: use XCONCAT2 helper

No point in open coding this logic when we've got nifty helpers to do it.

9 years agogas: microblaze: fix shift overflow
Mike Frysinger [Sun, 15 Nov 2015 07:46:03 +0000 (02:46 -0500)]
gas: microblaze: fix shift overflow

This code tries to shift an integer 31 bits which triggers a werror:
gas/config/tc-microblaze.c:742:21: error: integer overflow in expression [-Werror=overflow]
  e->X_add_number |= -(1 << 31);

Cast the 1 to offsetT to match X_add_number to fix things.

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

9 years agoFix stack buffer overflow in aarch64_extract_return_value
Yao Qi [Mon, 16 Nov 2015 15:37:03 +0000 (15:37 +0000)]
Fix stack buffer overflow in aarch64_extract_return_value

Hi,
I build GDB with -fsanitize=address, and run testsuite.  In
gdb.base/callfuncs.exp, I see the following error,

p/c fun1()
=================================================================^M
==9601==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffee858530 at pc 0x6df079 bp 0x7fffee8583a0 sp 0x7fffee858398
WRITE of size 16 at 0x7fffee858530 thread T0
    #0 0x6df078 in regcache_raw_read /home/yao/SourceCode/gnu/gdb/git/gdb/regcache.c:673
    #1 0x6dfe1e in regcache_cooked_read /home/yao/SourceCode/gnu/gdb/git/gdb/regcache.c:751
    #2 0x4696a3 in aarch64_extract_return_value /home/yao/SourceCode/gnu/gdb/git/gdb/aarch64-tdep.c:1708
    #3 0x46ae57 in aarch64_return_value /home/yao/SourceCode/gnu/gdb/git/gdb/aarch64-tdep.c:1918

We are extracting return value from V registers (128 bit), but only
allocate X_REGISTER_SIZE-byte array, which isn't sufficient.  This
patch changes the array to V_REGISTER_SIZE.

gdb:

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

* aarch64-tdep.c (aarch64_extract_return_value):  Change array
buf's length to V_REGISTER_SIZE.

9 years agoPass value * instead of bfd_byte * to pass_* functions in aarch64-tdep.c
Yao Qi [Mon, 16 Nov 2015 14:50:29 +0000 (14:50 +0000)]
Pass value * instead of bfd_byte * to pass_* functions in aarch64-tdep.c

This patch changes the last argument of functions pass_in_x_or_stack,
pass_in_v_or_stack, pass_on_stack, and pass_in_x to type value *.

gdb:

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

* aarch64-tdep.c (pass_in_x_or_stack): Change argument type
from bfd_byte * to value *.  Caller updated.
(pass_in_x): Likewise.
(pass_in_v_or_stack): Likewise.
(pass_on_stack): Likewise.

9 years agoUse value_contents instead of value_contents_writeable
Yao Qi [Mon, 16 Nov 2015 14:47:50 +0000 (14:47 +0000)]
Use value_contents instead of value_contents_writeable

Both aarch64_push_dummy_call and bfin_push_dummy_call only use args[i]
contents but then never write to them, so that we can use
value_contents instead.

gdb:

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

* aarch64-tdep.c (aarch64_push_dummy_call): Call value_contents instead
of value_contents_writeable.
* bfin-tdep.c (bfin_push_dummy_call): Likewise.

9 years agoFix bug in arm_push_dummy_call by -fsanitize=address
Yao Qi [Mon, 16 Nov 2015 14:44:19 +0000 (14:44 +0000)]
Fix bug in arm_push_dummy_call by -fsanitize=address

When I build GDB with -fsanitize=address, and run testsuite,
some gdb.base/*.exp test triggers the ERROR below,

=================================================================
==7646==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000242810 at pc 0x487844 bp 0x7fffe32e84e0 sp 0x7fffe32e84d8
READ of size 4 at 0x603000242810 thread T0
    #0 0x487843 in push_stack_item /home/yao/SourceCode/gnu/gdb/git/gdb/arm-tdep.c:3405
    #1 0x48998a in arm_push_dummy_call /home/yao/SourceCode/gnu/gdb/git/gdb/arm-tdep.c:3960

In that path, GDB passes value on stack, in an INT_REGISTER_SIZE slot,
but the value contents' length can be less than INT_REGISTER_SIZE, so
the contents will be accessed out of the bound.  This patch adds an
array buf[INT_REGISTER_SIZE], and copy val to buf before writing them
to stack.

gdb:

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

* arm-tdep.c (arm_push_dummy_call): New array buf.  Store regval
to buf.  Pass buf instead of val to push_stack_item.

9 years agoFixes an invalid warning about memory region overflow on the ARM.
Nick Clifton [Mon, 16 Nov 2015 14:21:28 +0000 (14:21 +0000)]
Fixes an invalid warning about memory region overflow on the ARM.

PR ld/19106
* emultempl/armelf.em (_set_symbols): New function.  Enables
relaxation for non-relocatable links.
(LDEMUL_SET_SYMBOLS): Define.

9 years agosim: sim-stop/sim-reason/sim-reg: move to common obj list
Mike Frysinger [Mon, 16 Nov 2015 04:06:42 +0000 (20:06 -0800)]
sim: sim-stop/sim-reason/sim-reg: move to common obj list

Now that all arches (for the most part) have moved over, move sim-stop.o,
sim-reason.o, and sim-reg.o to the common object list and out of all the
arch ports.

9 years agosim: cr16: drop global callback state
Mike Frysinger [Sun, 15 Nov 2015 11:41:26 +0000 (03:41 -0800)]
sim: cr16: drop global callback state

Now that we have access to the sim state in all the right places,
use existing sim helpers in place of cr16_callback directly.

9 years agosim: cr16: convert to common sim engine logic
Mike Frysinger [Sun, 15 Nov 2015 11:07:06 +0000 (03:07 -0800)]
sim: cr16: convert to common sim engine logic

Now that we have access to the sim state everywhere, we can convert to
the common engine logic for overall processing.  This frees us up from
tracking exception state ourselves.

9 years agosim: cr16: convert to common sim memory modules
Mike Frysinger [Sun, 15 Nov 2015 23:57:10 +0000 (15:57 -0800)]
sim: cr16: convert to common sim memory modules

The cr16 port has a lot of translation/offset logic baked into it, but
it all looks like copy & paste from the d10v port rather than something
the cr16 port wants.

9 years agosim: cr16: push down sd/cpu vars
Mike Frysinger [Sun, 15 Nov 2015 10:57:42 +0000 (02:57 -0800)]
sim: cr16: push down sd/cpu vars

By itself, this commit doesn't really change anything.  It lays the
groundwork for using the cpu state in follow up commits, both for
engine state and for cpu state.  Splitting things up this way so it
is easier to see how things have changed.

9 years agosim: cr16: delete unused memory helpers
Mike Frysinger [Sun, 15 Nov 2015 20:25:29 +0000 (12:25 -0800)]
sim: cr16: delete unused memory helpers

These aren't used anywhere and are just leftover from the d10v port.
Delete them so follow up commits are easier to follow.

9 years agosim: cr16: switch to common sim-reg
Mike Frysinger [Sun, 15 Nov 2015 20:22:30 +0000 (12:22 -0800)]
sim: cr16: switch to common sim-reg

This is mostly to get us off the weird cr16 specific memory functions,
but it's also a good clean up to move to the common core.

9 years agosim: cr16/d10v: drop redundant call to sim_create_inferior
Mike Frysinger [Sun, 15 Nov 2015 11:47:10 +0000 (03:47 -0800)]
sim: cr16/d10v: drop redundant call to sim_create_inferior

With the conversion to the nrun frontend, this call should no longer be
necessary.  It also actively crashes when trying to use the sd state.

9 years agosim: d10v: drop global callback state
Mike Frysinger [Sun, 15 Nov 2015 11:41:26 +0000 (03:41 -0800)]
sim: d10v: drop global callback state

Now that we have access to the sim state in all the right places,
use existing sim helpers in place of d10v_callback directly.

9 years agosim: d10v: convert to common sim engine logic
Mike Frysinger [Sun, 15 Nov 2015 11:07:06 +0000 (03:07 -0800)]
sim: d10v: convert to common sim engine logic

Now that we have access to the sim state everywhere, we can convert to
the common engine logic for overall processing.  This frees us up from
tracking exception state ourselves.

9 years agosim: d10v: push down sd/cpu vars
Mike Frysinger [Sun, 15 Nov 2015 10:57:42 +0000 (02:57 -0800)]
sim: d10v: push down sd/cpu vars

By itself, this commit doesn't really change anything.  It lays the
groundwork for using the cpu state in follow up commits, both for
engine state and for cpu state.  Splitting things up this way so it
is easier to see how things have changed.

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

9 years agosim: h8300: convert to common sim_{reason,stop}
Mike Frysinger [Sun, 15 Nov 2015 09:04:31 +0000 (01:04 -0800)]
sim: h8300: convert to common sim_{reason,stop}

This ends up being pretty easy as the h8300 port already supports
much of the common engine core.

9 years agosim: mcore: pull cpu state out of global scope
Mike Frysinger [Sun, 15 Nov 2015 08:42:33 +0000 (00:42 -0800)]
sim: mcore: pull cpu state out of global scope

This avoids using global variables to hold the cpu state so we can
better integrate with the sim common code.

There's also a minor fix here where we move the pc register back into
the state that is accessible by the asints array.  When it was pulled
out previously, the reg store/fetch functions broke, but no one really
noticed as the mcore gdb port was dropped a while back.

9 years agosim: mcore: switch to common sim-reg
Mike Frysinger [Sun, 15 Nov 2015 08:17:02 +0000 (00:17 -0800)]
sim: mcore: switch to common sim-reg

This is not entirely useful as mcore doesn't (yet) store its register
state in the cpu state, but it does allow for switching to the common
code for these functions.

9 years agosim: mcore: add a fail testcase
Mike Frysinger [Sun, 15 Nov 2015 08:13:29 +0000 (00:13 -0800)]
sim: mcore: add a fail testcase

9 years agosim: mcore: convert to common reason/resume logic
Mike Frysinger [Sun, 15 Nov 2015 08:09:32 +0000 (00:09 -0800)]
sim: mcore: convert to common reason/resume logic

Switch over to the common event loop logic so we don't have to maintain
the exception/exit logic ourselves.

9 years agosim: clean up redundant objects
Mike Frysinger [Sun, 15 Nov 2015 07:43:11 +0000 (02:43 -0500)]
sim: clean up redundant objects

Some of the target makefiles listed objects that were already pulled in
via SIM_NEW_COMMON_OBJS.  Clean those up.

9 years agosim: sim-close: unify sim_close logic
Mike Frysinger [Mon, 23 Mar 2015 03:10:09 +0000 (23:10 -0400)]
sim: sim-close: unify sim_close logic

Other than the nice advantage of all sims having to declare one fewer
common function, this also fixes leakage in pretty much every sim.
Many were not freeing any resources, and a few were inconsistent as
to the ones they did.  Now we have a single module that takes care of
all the logic for us.

Most of the non-cgen based ones could be deleted outright.  The cgen
ones required adding a callback to the arch-specific cleanup func.
The few that still have close callbacks are to manage their internal
state.

We do not convert erc32, m32c, ppc, rl78, or rx as they do not use
the common sim core.

9 years agosim: m32c: add a basic testsuite
Mike Frysinger [Mon, 9 Nov 2015 06:16:01 +0000 (01:16 -0500)]
sim: m32c: add a basic testsuite

9 years agosim: testsuite: support basic vars in flags
Mike Frysinger [Mon, 9 Nov 2015 06:14:57 +0000 (01:14 -0500)]
sim: testsuite: support basic vars in flags

Sometimes in tests, we need supplemental files like linker scripts or
board helper files.  There's no way to set those flags in the tests
currently and relative paths don't work (breaks out of tree builds).

Update the main option parser to replace some strings on the fly.  Now
tests can do things like:

Long term we'll want to switch the framework to use the dejagnu helpers
like dg-xxx that gcc & gdb utilize.  But that'll require more rework.

9 years agosim: drop extern C linkage from most sim interface headers
Mike Frysinger [Tue, 10 Nov 2015 07:12:52 +0000 (23:12 -0800)]
sim: drop extern C linkage from most sim interface headers

Since these headers merely have enum's, drop the extern C linkage
markings.  Helps to reduce the copy & paste spam.

9 years agoBump version to 2.26.51
Tristan Gingold [Sun, 15 Nov 2015 00:24:39 +0000 (16:24 -0800)]
Bump version to 2.26.51

bfd/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* version.m4: Bump version to 2.26.51
* configure: Regenerate.

binutils/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

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

9 years agoFix problem where bss symbols for copy relocations are marked local.
Cary Coutant [Sat, 14 Nov 2015 19:04:01 +0000 (11:04 -0800)]
Fix problem where bss symbols for copy relocations are marked local.

gold/
PR gold/19244
PR gold/18548
* symtab.cc (Symbol_table::do_define_in_output_data): Check for forced
local symbols only for predefined symbols.

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

9 years agoPR 19051: support of inferior call with gnu vector support on ARM
Yao Qi [Fri, 13 Nov 2015 15:11:58 +0000 (15:11 +0000)]
PR 19051: support of inferior call with gnu vector support on ARM

This patch teaches GDB to support gnu vector in inferior calls.  As a
result, fails in gdb.base/gnu_vector.exp are fixed.  The calling
convention of gnu vector isn't documented in the AAPCS, because it
is the GCC extension.  I checked the gcc/config/arm/arm.c, understand
how GCC pass arguments and return values, and do the same in GDB side.

The patch is tested with both hard float and soft float on arm-linux.

gdb:

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

PR tdep/19051
* arm-tdep.c (arm_type_align): Return the right alignment
value for vector.
(arm_vfp_cprc_sub_candidate): Return true for 64-bit and
128-bit vector types.
(arm_return_in_memory): Handel vector type.

9 years agoRefactor arm_return_in_memory
Yao Qi [Fri, 13 Nov 2015 15:11:58 +0000 (15:11 +0000)]
Refactor arm_return_in_memory

Current arm_return_in_memory isn't friendly to adding new things in it.
Moreover, a lot of stuff are about APCS, which is not used nowadays (AAPCS
is being used).  This patch is to refactor arm_return_in_memory, so that
some code can be shared for both APCS and AAPCS at the beginning of
arm_return_in_memory, and then each ABI (APCS and AAPCS) are processed
separately.

gdb:

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

* arm-tdep.c (arm_return_in_memory): Rewrite it.
(arm_return_value): Call arm_return_in_memory for
TYPE_CODE_COMPLEX.

9 years agoRemove d10v from testsuite
Yao Qi [Fri, 13 Nov 2015 15:06:38 +0000 (15:06 +0000)]
Remove d10v from testsuite

This patch removes the leftover of the d10v stuff in the testsuite
directory. The d10v port was removed in GDB 6.7, but I happen to see
that there are still some leftovers about d10v in testsuite.

gdb/testsuite:

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

* gdb.base/call-sc.exp (test_scalar_returns): Remove the
comments about d10v.
(test_scalar_returns): Likewise.
* gdb.base/d10v.ld: Remove.
* gdb.base/overlays.exp: Remove the target triplet checking for
d10v-*-*.
* gdb.base/structs.exp (test_struct_returns): Remove the
comments about d10v.
(test_struct_calls): Likewise.

9 years agogdb.base/gnu_vector.exp: Don't test output from the inferior
Yao Qi [Fri, 13 Nov 2015 15:03:25 +0000 (15:03 +0000)]
gdb.base/gnu_vector.exp: Don't test output from the inferior

gdb.base/gnu_vector.c printf the vector and gdb.base/gnu_vector.exp
expects the output by gdb_test_multiple.  Nowadays, the test doesn't
expect the output from inferior_spawn_id, which is wrong.  Even we
change the test to expect from inferior_spawn_id for the inferior
output, it is still possible the inferior exit before tcl/expect gets
the inferior output.  We see this fail on both s390x-linux and
ppc-linux on buildbot,

  FAIL: gdb.base/gnu_vector.exp: verify vector return value (the program exited)

https://sourceware.org/ml/gdb-testers/2015-q4/msg04922.html
https://sourceware.org/ml/gdb-testers/2015-q4/msg04952.html

In order to address these two shortcomings above in gnu_vector.exp,
this patch rewrites the test a little bit.  Get rid of checking the
inferior output, and instead checking them by printing them.  In this
way, the test can also be run on the target without inferior io
(gdb,noinferiorio is set in the board file).

gdb/testsuite:

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

* gdb.base/gnu_vector.exp: Check the return value by "p res".
* gdb.base/gnu_vector.c: Don't include stdio.h.
(main): Don't print res and call add_some_intvecs.

9 years agoAdd markers for release 2.26
Tristan Gingold [Fri, 13 Nov 2015 08:30:08 +0000 (09:30 +0100)]
Add markers for release 2.26

binutils/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.26.

gas/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.26.

ld/
2015-11-13  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.26.

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

9 years agoRevert "[LD][AARCH64]Add TLSIE relaxation support under large memory model."
Marcus Shawcroft [Thu, 12 Nov 2015 15:15:28 +0000 (15:15 +0000)]
Revert "[LD][AARCH64]Add TLSIE relaxation support under large memory model."

This reverts commit 3ebe65c0ff9f8f76c9971b1cc078273298f0c693.

Reverted due to PR19188

9 years ago[AArch64] Add support for Cortex-A35
James Greenhalgh [Thu, 12 Nov 2015 12:04:22 +0000 (12:04 +0000)]
[AArch64] Add support for Cortex-A35

This patch adds support to the AArch64 back-end for the Cortex-A35
processor, as recently announced by ARM. The ARM Cortex-A35 provides
full support for the ARMv8-A architecture, including the CRC extension,
with optional Advanced-SIMD and Floating-Point support. We therefore set
feature flags for this CPU to AARCH64_ARCH_V8 and AARCH64_FEATURE_CRC, in
the same fashion as Cortex-A53 and Cortex-A57.

Tested in a cross environment for AArch64 with no issues.

9 years agoFix dates in Changelog for previous commit.
Ramana Radhakrishnan [Thu, 12 Nov 2015 11:13:58 +0000 (11:13 +0000)]
Fix dates in Changelog for previous commit.

582cfe03cb7496371bc6d83af49b6324d0c36887

9 years agoAdd support for Cortex-A35
Ramana Radhakrishnan [Thu, 12 Nov 2015 11:12:53 +0000 (11:12 +0000)]
Add support for Cortex-A35

2015-11-12  James Greenhalgh  <james.greenhalgh@arm.com>

* config/tc-arm.c (arm_cpus): Likewise.
* doc/c-arm.texi (-mcpu=): Likewise.

9 years agoFix PR gas/19217
Ramana Radhakrishnan [Thu, 12 Nov 2015 10:50:22 +0000 (10:50 +0000)]
Fix PR gas/19217

2015-11-11  Matthew Wahab  <matthew.wahab@arm.com>

PR gas/19217
* config/tc-arm.c (move_or_literal_pool): Remove redundant feature
check.  Fix some code formatting.  Drop use of MOVT.  Add some
comments.

2015-11-11  Matthew Wahab  <matthew.wahab@arm.com>

PR gas/19217
        * gas/arm/thumb2_ldr_immediate_armv6t2.d: Update expected output.

9 years agoUse gdb_byte * instead of void * in push_stack_item
Yao Qi [Thu, 12 Nov 2015 09:14:20 +0000 (09:14 +0000)]
Use gdb_byte * instead of void * in push_stack_item

gdb:

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

* arm-tdep.c (push_stack_item): Change contents type to
const gdb_byte *.

9 years agoAdd assembler, disassembler and linker support for power9.
Peter Bergner [Thu, 12 Nov 2015 01:52:52 +0000 (19:52 -0600)]
Add assembler, disassembler and linker support for power9.

include/opcode/
* ppc.h (PPC_OPCODE_POWER9): New define.
(PPC_OPCODE_VSX3): Likewise.

opcodes/
* ppc-dis.c (ppc_opts): Add "power9" and "pwr9" entries.
Add PPC_OPCODE_VSX3 to the vsx entry.
(powerpc_init_dialect): Set default dialect to power9.
        * ppc-opc.c (insert_dcmxs, extract_dcmxs, insert_dxd, extract_dxd,
        insert_dxdn, extract_dxdn, insert_l0, extract_l0, insert_l1,
        extract_l1 insert_xtq6, extract_xtq6): New static functions.
        (insert_esync): Test for illegal L operand value.
(DCMX, DCMXS, DXD, NDXD, L0, L1, RC, FC, UIM6, X_R, RIC, PRS, XSQ6,
XTQ6, LRAND, IMM8, DQX, DQX_MASK, DX, DX_MASK, VXVAPS_MASK, VXVA,XVA,
XX2VA, XVARC, XBF_MASK, XX2UIM4_MASK, XX2BFD_MASK, XX2DCMXS_MASK,
XVA_MASK, XRLA_MASK, XBFRARB_MASK, XLRAND_MASK, POWER9, PPCVEC3,
PPCVSX3): New defines.
(powerpc_opcodes) <ps_cmpu0, ps_cmpo0, ps_cmpu1, ps_cmpo1, fcmpu,
fcmpo, ftdiv, ftsqrt>: Use XBF_MASK.
<mcrxr>: Use XBFRARB_MASK.
<addpcis, bcdcfn., bcdcfsq., bcdcfz., bcdcpsgn., bcdctn., bcdctsq.,
bcdctz., bcds., bcdsetsgn., bcdsr., bcdtrunc., bcdus., bcdutrunc.,
cmpeqb, cmprb, cnttzd, cnttzd., cnttzw, cnttzw., copy, copy_first,
cp_abort, darn, dtstsfi, dtstsfiq, extswsli, extswsli., ldat, ldmx,
lwat, lxsd, lxsibzx, lxsihzx, lxssp, lxv, lxvb16x, lxvh8x, lxvl, lxvll,
lxvwsx, lxvx, maddhd, maddhdu, maddld, mcrxrx, mfvsrld, modsd, modsw,
modud, moduw, msgsync, mtvsrdd, mtvsrws, paste, paste., paste_last,
rmieg, setb, slbieg, slbsync, stdat, stop, stwat, stxsd, stxsibx,
stxsihx, stxssp, stxv, stxvb16x, stxvh8x, stxvl, stxvll, stxvx,
subpcis, urfid, vbpermd, vclzlsbb, vcmpneb, vcmpneb., vcmpneh,
vcmpneh., vcmpnew, vcmpnew., vcmpnezb, vcmpnezb., vcmpnezh, vcmpnezh.,
vcmpnezw, vcmpnezw., vctzb, vctzd, vctzh, vctzlsbb, vctzw, vextractd,
vextractub, vextractuh, vextractuw, vextsb2d, vextsb2w, vextsh2d,
vextsh2w, vextsw2d, vextublx, vextubrx, vextuhlx, vextuhrx, vextuwlx,
vextuwrx, vinsertb, vinsertd, vinserth, vinsertw, vmul10cuq,
vmul10ecuq, vmul10euq, vmul10uq, vnegd, vnegw, vpermr, vprtybd,
vprtybq, vprtybw, vrldmi, vrldnm, vrlwmi, vrlwnm, vslv, vsrv, wait,
xsabsqp, xsaddqp, xsaddqpo, xscmpeqdp, xscmpexpdp, xscmpexpqp,
xscmpgedp, xscmpgtdp, xscmpnedp, xscmpoqp, xscmpuqp, xscpsgnqp,
xscvdphp, xscvdpqp, xscvhpdp, xscvqpdp, xscvqpdpo, xscvqpsdz,
xscvqpswz, xscvqpudz, xscvqpuwz, xscvsdqp, xscvudqp, xsdivqp,
xsdivqpo, xsiexpdp, xsiexpqp, xsmaddqp, xsmaddqpo, xsmaxcdp,
xsmaxjdp, xsmincdp, xsminjdp, xsmsubqp, xsmsubqpo, xsmulqp, xsmulqpo,
xsnabsqp, xsnegqp, xsnmaddqp, xsnmaddqpo, xsnmsubqp, xsnmsubqpo,
xsrqpi, xsrqpix, xsrqpxp, xssqrtqp, xssqrtqpo, xssubqp, xssubqpo,
xststdcdp, xststdcqp, xststdcsp, xsxexpdp, xsxexpqp, xsxsigdp,
xsxsigqp, xvcmpnedp, xvcmpnedp., xvcmpnesp, xvcmpnesp., xvcvhpsp,
xvcvsphp, xviexpdp, xviexpsp, xvtstdcdp, xvtstdcsp, xvxexpdp,
xvxexpsp, xvxsigdp, xvxsigsp, xxbrd, xxbrh, xxbrq, xxbrw, xxextractuw,
xxinsertw, xxperm, xxpermr, xxspltib>: New instructions.
<doze, nap, sleep, rvwinkle, waitasec, lxvx, stxvx>: Disable on POWER9.
<tlbiel, tlbie, sync, slbmfev, slbmfee>: Add additional operands.

include/elf/
* ppc.h (R_PPC_REL16DX_HA): New reloction.
* ppc64.h (R_PPC64_REL16DX_HA): Likewise.

bfd/
* elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_REL16DX_HA.
(ppc_elf_reloc_type_lookup): Handle R_PPC_REL16DX_HA.
(ppc_elf_addr16_ha_reloc): Likewise.
(ppc_elf_check_relocs): Likewise.
(ppc_elf_relocate_section): Likewise.
(is_insn_dq_form): Handle lxv and stxv instructions.
* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_REL16DX_HA.
(ppc64_elf_reloc_type_lookup): Handle R_PPC64_REL16DX_HA.
(ppc64_elf_ha_reloc): Likewise.
(ppc64_elf_check_relocs): Likewise.
(ppc64_elf_relocate_section): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Likewise.
* reloc.c (BFD_RELOC_PPC_REL16DX_HA): New.

elfcpp/
* powerpc.h (R_POWERPC_REL16DX_HA): Define.

gas/
* doc/as.texinfo (Target PowerPC): Document -mpower9 and -mpwr9.
* doc/c-ppc.texi (PowerPC-Opts):  Likewise.
* config/tc-ppc.c (md_show_usage): Likewise.
(md_assemble): Handle BFD_RELOC_PPC_REL16DX_HA.
(md_apply_fix): Likewise.
(ppc_handle_align): Handle power9's group ending nop.

gas/testsuite/
* gas/ppc/altivec3.s: New test.
* gas/ppc/altivec3.d: Likewise.
* gas/ppc/vsx3.s: Likewise.
* gas/ppc/vsx3.d: Likewise.
* gas/ppc/power9.s: Likewise.
* gas/ppc/power9.d: Likewise.
* gas/ppc/ppc.exp: Run them.
* gas/ppc/power8.s <lxvx, lxvd2x, stxvx, stxvd2x>: Add new tests.
* gas/ppc/power8.d: Likewise.
* gas/ppc/vsx.s: <lxvx, stxvx>: Rename invalid mnemonics ...
<lxvd2x, stxvd2x>: ...to this.
* gas/ppc/vsx.d: Likewise.

gold/
* gold/powerpc.cc (Powerpc_relocate_functions::addr16_dq): New function.
(Powerpc_relocate_functions::addr16dx_ha): Likewise.
(Target_powerpc::Scan::local): Handle R_POWERPC_REL16DX_HA.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Likewise.

ld/testsuite/
* ld-powerpc/addpcis.d: New test.
* ld-powerpc/addpcis.s: New test.
* ld-powerpc/powerpc.exp: Run it.

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

9 years agogdb/testsuite/gdb.trace: Deduplicate set_point assembly.
Marcin Kościelnicki [Tue, 10 Nov 2015 11:12:00 +0000 (12:12 +0100)]
gdb/testsuite/gdb.trace: Deduplicate set_point assembly.

The assembly code for emitting the proper tracepointable instruction
was duplicated in many places.  Keep it in one place, to reduce work
needed for new targets.

gdb/testsuite/ChangeLog:

* gdb.trace/change-loc.h: include "trace-common.h", remove SYMBOL
macro.
(func5): Removed.
(func4): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/ftrace-lock.c: include "trace-common.h", remove SYMBOL
macro.
(func): Removed.
(thread_function): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/ftrace.c: include "trace-common.h", remove SYMBOL macro.
(func): Remove.
(marker): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/pendshr1.c: include "trace-common.h", remove SYMBOL macro.
(pendfunc1): Remove.
(pendfunc): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/pendshr2.c: include "trace-common.h", remove SYMBOL macro.
(foo): Remove.
(pendfunc2): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/trace-break.c: include "trace-common.h", remove SYMBOL
macro.
(func): Remove.
(marker): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/trace-common.h: New header.
* gdb.trace/trace-condition.c: include "trace-common.h", remove SYMBOL
macro.
(func): Remove.
(marker): Use FAST_TRACEPOINT_LABEL.
* gdb.trace/trace-mt.c: include "trace-common.h", remove SYMBOL macro.
(func): Remove.
(thread_function): Use FAST_TRACEPOINT_LABEL.

9 years agoReplace long int * cast with PTRACE_TYPE_RET *
Simon Marchi [Wed, 11 Nov 2015 20:16:05 +0000 (15:16 -0500)]
Replace long int * cast with PTRACE_TYPE_RET *

These casts uses the typedef target type (long int *) instead of the
typedef name.  This was a little mistake in one of the big C++ cast
patches.

gdb/ChangeLog:

* inf-ptrace.c (inf_ptrace_fetch_register): Change long int *
cast to PTRACE_TYPE_RET *.
(inf_ptrace_store_register): Likewise.

9 years agogdb: Make use of 'add_info' to create info sub-commands.
Andrew Burgess [Mon, 9 Nov 2015 20:27:55 +0000 (20:27 +0000)]
gdb: Make use of 'add_info' to create info sub-commands.

Switch to using 'add_info' function for creating basic info
sub-commands.

gdb/ChangeLog:

* avr-tdep.c (_initialize_avr_tdep): Switch to 'add_info' for creating
info sub-commands.
* gnu-nat.c (add_task_commands): Likewise.
* macrocmd.c (_initialize_macrocmd): Likewise.

9 years agogdb: Use class_info when creating info commands.
Andrew Burgess [Sat, 7 Nov 2015 11:14:20 +0000 (11:14 +0000)]
gdb: Use class_info when creating info commands.

The 'add_info' function is used for creating info commands, these
commands should be created as 'class_info' rather than 'no_class'.

gdb/ChangeLog:

* cli/cli-decode.c (add_info): Switch to class_info.

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

9 years agogdb/testsuite/gdb.trace: Deduplicate pcreg/spreg/fpreg.
Marcin Kościelnicki [Tue, 10 Nov 2015 08:52:29 +0000 (09:52 +0100)]
gdb/testsuite/gdb.trace: Deduplicate pcreg/spreg/fpreg.

These variables were used in many gdb.trace tests.  Keep them in one place,
to reduce work needed for new targets.

gdb/testsuite/ChangeLog:

* gdb.trace/backtrace.exp: Use global fpreg/spreg definition, add $
in front.
* gdb.trace/change-loc.exp: Use global pcreg definition.
* gdb.trace/collection.exp: Use global pcreg/fpreg/spreg definition.
* gdb.trace/entry-values.exp: Use global spreg definition, add $
in front.
* gdb.trace/mi-trace-frame-collected.exp: Use global pcreg definition.
* gdb.trace/pending.exp: Likewise.
* gdb.trace/report.exp: Use global pcreg/fpreg/spreg definition.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Use global pcreg definition, add $
in front.
* gdb.trace/unavailable.exp: Use global pcreg/fpreg/spreg definition.
* gdb.trace/while-dyn.exp: Use global fpreg definition, add $
in front.
* lib/trace-support.exp: Define fpreg, spreg, pcreg variables.

9 years agoAdd Qualcomm qdf24xx support.
Jim Wilson [Tue, 10 Nov 2015 17:19:45 +0000 (09:19 -0800)]
Add Qualcomm qdf24xx support.

gas/
* config/tc-aarch64.c (aarch64_cpus): Add qdf24xx.
* config/tc-arm.c (arm_cpus): Likewise.
* doc/c-arm.texi, doc/c-aarch64.texi: Likewise.

9 years agoUpdate the RX simulator to handle the latest opcode types.
Nick Clifton [Tue, 10 Nov 2015 16:07:17 +0000 (16:07 +0000)]
Update the RX simulator to handle the latest opcode types.

* rx.c (id_names): Add nop4, nop5, nop6 and nop7.
(decode_opcode): Likewise.
(get_op): Handle RX_Operand_Zero_Indirect.
Handle RX_Bad_Size and RX_MAX_SIZE.
(put_op): Likewise.
(N_MAP): Increase to 90.

9 years agoHandle x86 VTINHERIT/VTENTRY relocs when deleting relocations
H.J. Lu [Tue, 10 Nov 2015 12:26:55 +0000 (04:26 -0800)]
Handle x86 VTINHERIT/VTENTRY relocs when deleting relocations

* elf32-i386.c (elf_i386_relocate_section): Handle VTINHERIT
and VTENTRY relocations when deleting relocations.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

9 years agoProperly move kept relocations when deleting relocations
H.J. Lu [Tue, 10 Nov 2015 07:49:02 +0000 (23:49 -0800)]
Properly move kept relocations when deleting relocations

* elf32-i386.c (elf_i386_relocate_section): Properly move
kept relocations when deleting relocations.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

9 years agoFix performance regression on x86 with ld -r
H.J. Lu [Tue, 10 Nov 2015 07:49:02 +0000 (23:49 -0800)]
Fix performance regression on x86 with ld -r

Similar fix to "commit c316a17c40e44e8798b34ff84130904f2e7a53de".

* elf32-i386.c (elf_i386_relocate_section): Use read and write
pointers to reloc array, rather than memmove when deleting a
reloc.  Don't use RELOC_AGAINST_DISCARDED_SECTION.  Adjust
reloc counts at end of loop.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

9 years agosim: cr16/d10v: localize translation funcs
Mike Frysinger [Tue, 10 Nov 2015 07:04:53 +0000 (23:04 -0800)]
sim: cr16/d10v: localize translation funcs

These functions are only used in the interp module, so there's no point
in exporting them and declaring them in the external sim interface.

9 years agoFix performance regression due to ld -r memmove
Alan Modra [Mon, 9 Nov 2015 04:33:29 +0000 (15:03 +1030)]
Fix performance regression due to ld -r memmove

The idea here is that instead of using memmove to shuffle the relocs
array every time one is deleted, to add a "wrel" pointer and copy from
rel[0] to wrel[0] as we go.

* elf64-ppc.c (ppc64_elf_relocate_section): Use read and write
pointers to reloc array, rather than memmove when deleting a
reloc.  Don't use RELOC_AGAINST_DISCARDED_SECTION.  Adjust
reloc counts at end of loop.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.

9 years agosim: m32c: move test code to testsuite
Mike Frysinger [Mon, 9 Nov 2015 05:13:08 +0000 (00:13 -0500)]
sim: m32c: move test code to testsuite

Various target code belongs in the testsuite/ subdir, so move the m32c
code to match all the other targets.

9 years agosim: m32c: drop redundant dependency info
Mike Frysinger [Mon, 9 Nov 2015 05:14:26 +0000 (00:14 -0500)]
sim: m32c: drop redundant dependency info

9 years agosim: h8300: drop unused littleendian variable
Mike Frysinger [Mon, 9 Nov 2015 02:41:53 +0000 (21:41 -0500)]
sim: h8300: drop unused littleendian variable

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

9 years agoRecognize .pdr debug sections.
Vladimir Radosavljevic [Tue, 3 Nov 2015 16:18:09 +0000 (16:18 +0000)]
Recognize .pdr debug sections.

gold/
* layout.h (Layout::is_debug_info_section): Recognize .pdr debug
sections.

9 years agoRemove unnecessary target dependencies on relocation format.
Cary Coutant [Mon, 9 Nov 2015 16:43:46 +0000 (08:43 -0800)]
Remove unnecessary target dependencies on relocation format.

2015-11-09  Cary Coutant  <ccoutant@gmail.com>
    Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>

gold/
* copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
with type, offset, addend.
(Copy_relocs::save): Likewise.
* copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
(Copy_relocs::save): Likewise.
* aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
and r_addend to Copy_relocs::copy_reloc.
* arm.cc (Target_arm::copy_reloc): Likewise.
* i386.cc (Target_i386::copy_reloc): Likewise.
* mips.cc (Target_mips::copy_reloc): Likewise.
* powerpc.cc (Target_powerpc::copy_reloc): Likewise.
* s390.cc (Target_s390::copy_reloc): Likewise.
* sparc.cc (Target_sparc::copy_reloc): Likewise.
* tilegx.cc (Target_tilegx::copy_reloc): Likewise.
* x86_64.cc (Target_x86_64::copy_reloc): Likewise.

9 years ago[Ada] GDB crash during "finish" of function with out parameters
Joel Brobecker [Mon, 9 Nov 2015 17:58:16 +0000 (09:58 -0800)]
[Ada] GDB crash during "finish" of function with out parameters

Consider a function with the following signature...

   function F (R : out Rec_Type) return Enum_Type;

... where Rec_Type is a simple record:

   type Rec_Type is record
      Cur : Integer;
   end record;

Trying to "finish" from that function causes GDB to SEGV:

    (gdb) fin
    Run till exit from #0  bar.f (r=...) at bar.adb:5
    0x00000000004022fe in foo () at foo.adb:5
    5          I : Enum_Type := F (R);
    [1]    18949 segmentation fault (core dumped)  /[..]/gdb

This is related to the fact that funtion F has a parameter (R)
which is an "out" parameter being passed by copy. For those,
GNAT transforms the return value to be a record with multiple
fields: The first one is called "RETVAL" and contains the return
value shown in the source, and the remaining fields have the same
name as the "out" or "in out" parameters which are passed by copy.
So, in the example above, function F returns a struct that has
one field who name is "r".

Because "RETVAL" starts with "R", GDB thinks it's a wrapper field,
because it looks like the encoding used for  variant records:

   --    member_name ::= {choice} | others_choice
   --    choice ::= simple_choice | range_choice
   --    simple_choice ::= S number
   --    range_choice  ::= R number T number   <<<<<-----  here
   --    number ::= {decimal_digit} [m]
   --    others_choice ::= O (upper case letter O)

See ada_is_wrapper_field:

  return (name != NULL
          && (startswith (name, "PARENT")
              || strcmp (name, "REP") == 0
              || startswith (name, "_parent")
              || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));

As a result of this, when trying to print the RETURN value,
we think that RETVAL is a wrapper, and thus recurse into
print_field_values...

      if (ada_is_wrapper_field (type, i))
        {
          comma_needed =
            print_field_values (TYPE_FIELD_TYPE (type, i),
                                valaddr,
                                (offset
                                 + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT),
                                stream, recurse, val, options,
                                comma_needed, type, offset, language);

... which is a problem since print_field_values assumes that
the type it is given ("TYPE_FIELD_TYPE (type, i)" here), is also
a record type. However, that's not the case, since RETVAL is
an enum. That eventually leads GDB to a NULL type when trying to
extract fields out of the enum, which then leads to a SEGV when
trying to dereference it.

Ideally, we'd want to be a little more careful in identifying
wrapper fields, by enhancing ada_is_wrapper_field to be a little
more complete in its analysis of the field name before declaring
it a variant record wrapper. However, it's not super easy to do
so, considering that the choices can be combined together when
complex choices are used. Eg:

   -- [...] the choice 1 .. 4 | 7 | -10 would be represented by
   --    R1T4S7S10m

Given that we are working towards getting rid of GNAT encodings,
which means that the above will eventually disappear, we took
the more pragmatic approach is just treating  RETVAL as a special
case.

gdb/ChangeLog:

        * ada-lang.c (ada_is_wrapper_field): Add special handling
        for fields called "RETVAL".

gdb/testsuite/ChangeLog:

        * gdb.ada/fin_fun_out: New testcase.

9 years agogas: Fix left shift of negative value.
Dominik Vogt [Mon, 9 Nov 2015 16:12:57 +0000 (17:12 +0100)]
gas: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C cod
which is undefined by the C standard.

gas/ChangeLog:

        * read.c (parse_bitfield_cons): Fix left shift of negative value.
        * config/tc-xstormy16.c (md_section_align): Likewise.
        * config/tc-xgate.c (md_section_align): Likewise.
        * config/tc-visium.c (md_section_align): Likewise.
        * config/tc-v850.c (md_section_align): Likewise.
        * config/tc-tic6x.c (md_section_align): Likewise.
        * config/tc-sh.c (SH64PCREL32_M, SH64PCREL48_M, SH64PCREL32_M)
        (MOVI_32_M, MOVI_48_M, MOVI_32_M, md_section_align): Likewise.
        * config/tc-sh64.c (shmedia_md_estimate_size_before_relax): Likewise.
        * config/tc-score.c (s3_section_align): Likewise.
        * config/tc-score7.c (s7_section_align): Likewise.
        * config/tc-s390.c (md_section_align): Likewise.
        * config/tc-rx.c (md_section_align): Likewise.
        * config/tc-rl78.c (md_section_align): Likewise.
        * config/tc-ppc.c (md_section_align): Likewise.
        * config/tc-or1k.c (md_section_align): Likewise.
        * config/tc-nds32.c (md_section_align): Likewise.
        * config/tc-mt.c (md_section_align): Likewise.
        * config/tc-msp430.c (md_section_align): Likewise.
        * config/tc-mn10300.c (md_section_align): Likewise.
        * config/tc-mn10200.c (md_section_align): Likewise.
        * config/tc-mips.c (md_section_align): Likewise.
        * config/tc-microblaze.c (parse_imm): Likewise.
        * config/tc-mep.c (md_section_align): Likewise.
        * config/tc-m68k.c (md_section_align): Likewise.
        * config/tc-m68hc11.c (md_section_align): Likewise.
        * config/tc-m32r.c (md_section_align): Likewise.
        * config/tc-m32c.c (md_section_align): Likewise.
        * config/tc-lm32.c (md_section_align): Likewise.
        * config/tc-iq2000.c (md_section_align): Likewise.
        * config/tc-ip2k.c (md_section_align): Likewise.
        * config/tc-ia64.c (dot_save, dot_vframe): Likewise.
        * config/tc-i960.c (md_number_to_field, md_section_align): Likewise.
        * config/tc-i386.c (md_section_align): Likewise.
        * config/tc-i370.c (md_section_align): Likewise.
        * config/tc-frv.c (md_section_align): Likewise.
        * config/tc-fr30.c (md_section_align): Likewise.
        * config/tc-epiphany.c (md_section_align): Likewise.
        * config/tc-d30v.c (md_section_align): Likewise.
        * config/tc-d10v.c (md_section_align): Likewise.
        * config/tc-cr16.c (l_cons): Likewise.
        * config/tc-bfin.c (md_section_align): Likewise.
        * config/tc-arm.c (md_section_align): Likewise.
        * config/tc-arc.c (md_section_align): Likewise.
        * config/bfin-parse.y (expr_1): Likewise.

gas/testsuite/ChangeLog:

        * gas/all/test-gen.c (random_order_16s, random_order_24s)
        (random_order_32s): Fix left shift of negative value.

9 years agobinutils: Fix left shift of negative value.
Dominik Vogt [Mon, 9 Nov 2015 16:12:56 +0000 (17:12 +0100)]
binutils: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C code
which is undefined by the C standard.

binutils/ChangeLog:

        * dwarf.c (read_leb128): Fix left shift of negative value.

9 years agobfd: Fix left shift of negative value.
Dominik Vogt [Mon, 9 Nov 2015 16:12:56 +0000 (17:12 +0100)]
bfd: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C code
which is undefined by the C standard.

bfd/ChangeLog:

        * elf64-ppc.c (ppc64_elf_size_stubs, ppc64_elf_build_stubs): Fix left
        shift of negative value.
        * libbfd.c (safe_read_leb128): Likewise.
        * dwarf2.c (place_sections): Likewise.
        * bfd-in.h (align_power): Likewise.
        * bfd-in2.h (align_power): Likewise.