binutils-gdb.git
9 years agoUse official ELF machine number for moxie
Anthony Green [Fri, 9 Jan 2015 12:12:37 +0000 (07:12 -0500)]
Use official ELF machine number for moxie

9 years agoTest attaching to a program that constantly spawns short-lived threads
Pedro Alves [Wed, 17 Dec 2014 20:40:05 +0000 (20:40 +0000)]
Test attaching to a program that constantly spawns short-lived threads

Before the previous fixes, on Linux, this would trigger several
different problems, like:

 [New LWP 27106]
 [New LWP 27047]
 warning: unable to open /proc file '/proc/-1/status'
 [New LWP 27813]
 [New LWP 27869]
 warning: Can't attach LWP 11962: No child processes
 Warning: couldn't activate thread debugging using libthread_db: Cannot find new threads: debugger service failed
 warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

gdb/testsuite/
2015-01-09  Pedro Alves  <palves@redhat.com>

* gdb.threads/attach-many-short-lived-threads.c: New file.
* gdb.threads/attach-many-short-lived-threads.exp: New file.

9 years agoLinux: Skip thread_db thread event reporting if PTRACE_EVENT_CLONE is supported
Pedro Alves [Tue, 16 Dec 2014 16:12:25 +0000 (16:12 +0000)]
Linux: Skip thread_db thread event reporting if PTRACE_EVENT_CLONE is supported

[A test I wrote stumbled on a libthread_db issue related to thread
event breakpoints.  See glibc PR17705:
 [nptl_db: stale thread create/death events if debugger detaches]
 https://sourceware.org/bugzilla/show_bug.cgi?id=17705

This patch avoids that whole issue by making GDB stop using thread
event breakpoints in the first place, which is good for other reasons
as well, anyway.]

Before PTRACE_EVENT_CLONE (Linux 2.6), the only way to learn about new
threads in the inferior (to attach to them) or to learn about thread
exit was to coordinate with the inferior's glibc/runtime, using
libthread_db.  That works by putting a breakpoint at a magic address
which is called when a new thread is spawned, or when a thread is
about to exit.  When that breakpoint is hit, all threads are stopped,
and then GDB coordinates with libthread_db to read data structures out
of the inferior to learn about what happened.  Then the breakpoint is
single-stepped, and then all threads are re-resumed.  This isn't very
efficient (stops all threads) and is more fragile (inferior's thread
list in memory may be corrupt; libthread_db bugs, etc.) than ideal.

When the kernel supports PTRACE_EVENT_CLONE (which we already make use
of), there's really no need to use libthread_db's event reporting
mechanism to learn about new LWPs.  And if the kernel supports that,
then we learn about LWP exits through regular WIFEXITED wait statuses,
so no need for the death event breakpoint either.

GDBserver has been likewise skipping the thread_db events for a long
while:
  https://sourceware.org/ml/gdb-patches/2007-10/msg00547.html

There's one user-visible difference: we'll no longer print about
threads being created and exiting while the program is running, like:

 [Thread 0x7ffff7dbb700 (LWP 30670) exited]
 [New Thread 0x7ffff7db3700 (LWP 30671)]
 [Thread 0x7ffff7dd3700 (LWP 30667) exited]
 [New Thread 0x7ffff7dab700 (LWP 30672)]
 [Thread 0x7ffff7db3700 (LWP 30671) exited]
 [Thread 0x7ffff7dcb700 (LWP 30668) exited]

This is exactly the same behavior as when debugging against remote
targets / gdbserver.  I actually think that's a good thing (and as
such have listed this in the local/remote parity wiki page a while
ago), as the printing slows down the inferior.  It's also a
distraction to keep bothering the user about short-lived threads that
she won't be able to interact with anyway.  Instead, the user (and
frontend) will be informed about new threads that currently exist in
the program when the program next stops:

 (gdb) c
 ...
 * ctrl-c *
 [New Thread 0x7ffff7963700 (LWP 7797)]
 [New Thread 0x7ffff796b700 (LWP 7796)]

 Program received signal SIGINT, Interrupt.
 [Switching to Thread 0x7ffff796b700 (LWP 7796)]
 clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:81
 81              testq   %rax,%rax
 (gdb) info threads

A couple of tests had assumptions on GDB thread numbers that no longer
hold.

Tested on x86_64 Fedora 20.

gdb/
2014-01-09  Pedro Alves  <palves@redhat.com>

Skip enabling event reporting if the kernel supports
PTRACE_EVENT_CLONE.
* linux-thread-db.c: Include "nat/linux-ptrace.h".
(thread_db_use_events): New function.
(try_thread_db_load_1): Check thread_db_use_events before enabling
event reporting.
(update_thread_state): New function.
(attach_thread): Use it.  Check thread_db_use_events before
enabling event reporting.
(thread_db_detach): Check thread_db_use_events before disabling
event reporting.
(find_new_threads_callback): Check thread_db_use_events before
enabling event reporting.  Update the thread's state if not using
libthread_db events.

gdb/testsuite/
2014-01-09  Pedro Alves  <palves@redhat.com>

* gdb.threads/fork-thread-pending.exp: Switch to the main thread
instead of to thread 2.
* gdb.threads/signal-command-multiple-signals-pending.c (main):
Add barrier around each pthread_create call instead of around all
calls.
* gdb.threads/signal-command-multiple-signals-pending.exp (test):
Set a break on thread_function and have the child threads hit it
one at at a time.

9 years agolibthread_db: Skip attaching to terminated and joined threads
Pedro Alves [Tue, 16 Dec 2014 16:12:24 +0000 (16:12 +0000)]
libthread_db: Skip attaching to terminated and joined threads

I wrote a test that attaches to a program that constantly spawns
short-lived threads, which exposed several issues.  This is one of
them.

On GNU/Linux, attaching to a multi-threaded program sometimes prints
out warnings like:

 ...
 [New LWP 20700]
 warning: unable to open /proc file '/proc/-1/status'
 [New LWP 20850]
 [New LWP 21019]
 ...

That happens because when a thread exits, and is joined, glibc does:

nptl/pthread_join.c:
pthread_join ()
{
...
  if (__glibc_likely (result == 0))
    {
      /* We mark the thread as terminated and as joined.  */
      pd->tid = -1;
...
     /* Free the TCB.  */
      __free_tcb (pd);
    }

So if we attach or interrupt the program (which does an implicit "info
threads") at just the right (or rather, wrong) time, we can find and
return threads in the libthread_db/pthreads thread list with kernel
thread ID -1.  I've filed glibc PR nptl/17707 for this.  You'll find
more info there.

This patch handles this as a special case in GDB.

This is actually more than just a cosmetic issue.  lin_lwp_attach_lwp
will think that this -1 is an LWP we're not attached to yet, and after
failing to attach will try to check we were already attached to the
process, using a waitpid call, which in this case ends up being
"waitpid (-1, ...", which obviously results in GDB potentially
discarding an event when it shouldn't...

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/gdbserver/
2015-01-09  Pedro Alves  <palves@redhat.com>

* thread-db.c (find_new_threads_callback): Ignore thread if the
kernel thread ID is -1.

gdb/
2015-01-09  Pedro Alves  <palves@redhat.com>

* linux-nat.c (lin_lwp_attach_lwp): Assert that the lwp id we're
about to wait for is > 0.
* linux-thread-db.c (find_new_threads_callback): Ignore thread if
the kernel thread ID is -1.

9 years agoLinux: on attach, attach to lwps listed under /proc/$pid/task/
Pedro Alves [Tue, 16 Dec 2014 16:12:24 +0000 (16:12 +0000)]
Linux: on attach, attach to lwps listed under /proc/$pid/task/

... instead of relying on libthread_db.

I wrote a test that attaches to a program that constantly spawns
short-lived threads, which exposed several issues.  This is one of
them.

On Linux, we need to attach to all threads of a process (thread group)
individually.  We currently rely on libthread_db to list the threads,
but that is problematic, because libthread_db relies on reading data
structures out of the inferior (which may well be corrupted).  If
threads are being created or exiting just while we try to attach, we
may trip on inconsistencies in the inferior's thread list.  To work
around that, when we see a seemingly corrupt list, we currently retry
a few times:

 static void
 thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new)
 {
 ...
   if (until_no_new)
     {
       /* Require 4 successive iterations which do not find any new threads.
  The 4 is a heuristic: there is an inherent race here, and I have
  seen that 2 iterations in a row are not always sufficient to
  "capture" all threads.  */
 ...

That heuristic may well fail, and when it does, we end up with threads
in the program that aren't under GDB's control.  That's obviously bad
and results in quite mistifying failures, like e.g., the process dying
for seeminly no reason when a thread that wasn't attached trips on a
breakpoint.

There's really no reason to rely on libthread_db for this nowadays
when we have /proc mounted.  In that case, which is the usual case, we
can list the LWPs from /proc/PID/task/.  In fact, GDBserver is already
doing this.  The patch factors out that code that knows to walk the
task/ directory out of GDBserver, and makes GDB use it too.

Like GDBserver, the patch makes GDB attach to LWPs and _not_ wait for
them to stop immediately.  Instead, we just tag the LWP as having an
expected stop.  Because we can only set the ptrace options when the
thread stops, we need a new flag in the lwp structure to keep track of
whether we've already set the ptrace options, just like in GDBserver.
Note that nothing issues any ptrace command to the threads between the
PTRACE_ATTACH and the stop, so this is safe (unlike one scenario
described in gdbserver's linux-low.c).

When we attach to a program that has threads exiting while we attach,
it's easy to race with a thread just exiting as we try to attach to
it, like:

  #1 - get current list of threads
  #2 - attach to each listed thread
  #3 - ooops, attach failed, thread is already gone

As this is pretty normal, we shouldn't be issuing a scary warning in
step #3.

When #3 happens, PTRACE_ATTACH usually fails with ESRCH, but sometimes
we'll see EPERM as well.  That happens when the kernel still has the
thread in its task list, but the thread is marked as dead.
Unfortunately, EPERM is ambiguous and we'll get it also on other
scenarios where the thread isn't dead, and in those cases, it's useful
to get a warning.  To distiguish the cases, when we get an EPERM
failure, we open /proc/PID/status, and check the thread's state -- if
the /proc file no longer exists, or the state is "Z (Zombie)" or "X
(Dead)", we ignore the EPERM error silently; otherwise, we'll warn.
Unfortunately, there seems to be a kernel race here.  Sometimes I get
EPERM, and then the /proc state still indicates "R (Running)"...  If
we wait a bit and retry, we do end up seeing X or Z state, or get an
ESRCH.  I thought of making GDB retry the attach a few times, but even
with a 500ms wait and 4 retries, I still see the warning sometimes.  I
haven't been able to identify the kernel path that causes this yet,
but in any case, it looks like a kernel bug to me.  As this just
results failure to suppress a warning that we've been printing since
about forever anyway, I'm just making the test cope with it, and issue
an XFAIL.

gdb/gdbserver/
2015-01-09  Pedro Alves  <palves@redhat.com>

* linux-low.c (linux_attach_fail_reason_string): Move to
nat/linux-ptrace.c, and rename.
(linux_attach_lwp): Update comment.
(attach_proc_task_lwp_callback): New function.
(linux_attach): Adjust to rename and use
linux_proc_attach_tgid_threads.
(linux_attach_fail_reason_string): Delete declaration.

gdb/
2015-01-09  Pedro Alves  <palves@redhat.com>

* linux-nat.c (attach_proc_task_lwp_callback): New function.
(linux_nat_attach): Use linux_proc_attach_tgid_threads.
(wait_lwp, linux_nat_filter_event): If not set yet, set the lwp's
ptrace option flags.
* linux-nat.h (struct lwp_info) <must_set_ptrace_flags>: New
field.
* nat/linux-procfs.c: Include <dirent.h>.
(linux_proc_get_int): New parameter "warn".  Handle it.
(linux_proc_get_tgid): Adjust.
(linux_proc_get_tracerpid): Rename to ...
(linux_proc_get_tracerpid_nowarn): ... this.
(linux_proc_pid_get_state): New function, factored out from
(linux_proc_pid_has_state): ... this.  Add new parameter "warn"
and handle it.
(linux_proc_pid_is_gone): New function.
(linux_proc_pid_is_stopped): Adjust.
(linux_proc_pid_is_zombie_maybe_warn)
(linux_proc_pid_is_zombie_nowarn): New functions.
(linux_proc_pid_is_zombie): Use
linux_proc_pid_is_zombie_maybe_warn.
(linux_proc_attach_tgid_threads): New function.
* nat/linux-procfs.h (linux_proc_get_tgid): Update comment.
(linux_proc_get_tracerpid): Rename to ...
(linux_proc_get_tracerpid_nowarn): ... this, and update comment.
(linux_proc_pid_is_gone): New declaration.
(linux_proc_pid_is_zombie): Update comment.
(linux_proc_pid_is_zombie_nowarn): New declaration.
(linux_proc_attach_lwp_func): New typedef.
(linux_proc_attach_tgid_threads): New declaration.
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason): Adjust to
use nowarn functions.
(linux_ptrace_attach_fail_reason_string): Move here from
gdbserver/linux-low.c and rename.
(ptrace_supports_feature): If the current ptrace options are not
known yet, check them now, instead of asserting.
* nat/linux-ptrace.h (linux_ptrace_attach_fail_reason_string):
Declare.

9 years agolibthread_db: debug output should go to gdb_stdlog
Pedro Alves [Tue, 16 Dec 2014 16:12:23 +0000 (16:12 +0000)]
libthread_db: debug output should go to gdb_stdlog

Some debug output in linux-thread-db.c was being sent to gdb_stdout,
and some to gdb_stderr, while the right place to send debug output to is
gdb_stdlog.

gdb/
2015-01-09  Pedro Alves  <palves@redhat.com>

* linux-thread-db.c (thread_db_find_new_threads_silently)
(try_thread_db_load_1, try_thread_db_load, thread_db_load_search)
(find_new_threads_once): Print debug output on gdb_stdlog.

9 years agoskip "attach" tests when testing against stub-like targets
Pedro Alves [Fri, 9 Jan 2015 11:04:19 +0000 (11:04 +0000)]
skip "attach" tests when testing against stub-like targets

We already skip "attach" tests if the target board is remote, in
dejagnu's sense, as we use TCL's exec to spawn the program on the
build machine.  We should also skip these tests if testing with
"target remote" or other stub-like targets where "attach" doesn't make
sense.

Add a helper procedure that centralizes the checks a test that needs
to spawn a program for testing "attach" and make all test files that
use spawn_wait_for_attach check it.

gdb/testsuite/
2015-01-09  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (can_spawn_for_attach): New procedure.
(spawn_wait_for_attach): Error out if can_spawn_for_attach returns
false.
* gdb.base/attach.exp: Use can_spawn_for_attach instead of
checking whether the target board is remote.
* gdb.multi/multi-attach.exp: Likewise.
* gdb.python/py-sync-interp.exp: Likewise.
* gdb.server/ext-attach.exp: Likewise.
* gdb.python/py-prompt.exp: Use can_spawn_for_attach before the
tests that need to attach, instead of checking whether the target
board is remote at the top of the file.

9 years agogdb/compile/compile.c: Check return value of 'system' to avoid compiler warning
Chen Gang [Fri, 9 Jan 2015 10:09:03 +0000 (10:09 +0000)]
gdb/compile/compile.c: Check return value of 'system' to avoid compiler warning

Add missing ChangeLog entry.

2015-01-09  Chen Gang  <gang.chen.5i5j@gmail.com>
    Pedro Alves  <palves@redhat.com>

* compile/compile.c: Include "gdb_wait.h".
(do_rmdir): Check return value, and free 'zap'.

9 years agogdb/compile/compile.c: Check return value of 'system' to avoid compiler warning
Chen Gang [Fri, 9 Jan 2015 02:40:42 +0000 (10:40 +0800)]
gdb/compile/compile.c: Check return value of 'system' to avoid compiler warning

Under Ubuntu 12, we need to check the return value of system(), or the
compiler warns:

  gcc -g -O2   -I. -I../../binutils-gdb/gdb -I../../binutils-gdb/gdb/common -I../../binutils-gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../binutils-gdb/gdb/../include/opcode -I../../binutils-gdb/gdb/../opcodes/.. -I../../binutils-gdb/gdb/../readline/.. -I../bfd -I../../binutils-gdb/gdb/../bfd -I../../binutils-gdb/gdb/../include -I../libdecnumber -I../../binutils-gdb/gdb/../libdecnumber  -I../../binutils-gdb/gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o compile.o -MT compile.o -MMD -MP -MF .deps/compile.Tpo ../../binutils-gdb/gdb/compile/compile.c
  ../../binutils-gdb/gdb/compile/compile.c: In function ‘do_rmdir’:
  ../../binutils-gdb/gdb/compile/compile.c:175:10: error: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Werror=unused-result]
  cc1: all warnings being treated as errors
  make[2]: *** [compile.o] Error 1
  make[2]: Leaving directory `/upstream/build-binutils-s390/gdb'
  make[1]: *** [all-gdb] Error 2
  make[1]: Leaving directory `/upstream/build-binutils-s390'
  make: *** [all] Error 2

Also, 'zap' is leaking.

2015-01-09  Chen Gang  <gang.chen.5i5j@gmail.com>
    Pedro Alves  <palves@redhat.com>

* compile/compile.c: Include "gdb_wait.h".
(do_rmdir): Check return value, and free 'zap'.

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

9 years agoAdds code to the MSP430 linker to transform a 4-byte BR instruction into
Nick Clifton [Thu, 8 Jan 2015 16:23:16 +0000 (16:23 +0000)]
Adds code to the MSP430 linker to transform a 4-byte BR instruction into
a 2-byte JMP instruction, when this can be done safely.

* elf32-msp430.c (msp430_elf_relax_section): Add relaxation of
16-bit absolute BR instructions to 10-bit pc-relative JMP
instructions.

9 years agoFix memory access violations exposed by running strip on fuzzed binaries.
Nick Clifton [Thu, 8 Jan 2015 15:39:49 +0000 (15:39 +0000)]
Fix memory access violations exposed by running strip on fuzzed binaries.

PR binutils/17512
* coffcode.h (coff_slurp_symbol_table): Return false if we failed
to load the line table.
* elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum
maxpagesize of 1.
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if
the Data Directory Size is too large.

* objcopy.c (copy_object): Free the symbol table if no symbols
could be loaded.
(copy_file): Use bfd_close_all_done to close files that could not
be copied.

9 years agoFix memory access violations triggered by running sysdump on fuzzed binaries.
Nick Clifton [Thu, 8 Jan 2015 13:52:42 +0000 (13:52 +0000)]
Fix memory access violations triggered by running sysdump on fuzzed binaries.

PR binutils/17512
* sysdump.c (getINT): Fail if reading off the end of the buffer.
Replace call to abort with a call to fatal.
(getCHARS): Prevetn reading off the end of the buffer.

9 years agold/x86-64: adjust pr14207 test expectations
Jan Beulich [Thu, 8 Jan 2015 13:10:36 +0000 (14:10 +0100)]
ld/x86-64: adjust pr14207 test expectations

The original test output expectations cause it to fail when configure
determines enable_initfini_array=no (which was observed on a cross
build on an old 32-bit host, pointing out that taking into account host
properties in such a case is bogus anyway).

ld/testsuite/
2015-01-08  Jan Beulich  <jbeulich@suse.com>

* ld-x86-64/pr14207.d: Adjust expecations to cover the
enable_initfini_array=no case.

9 years agoalways read synthetic pointers as signed integers
Yao Qi [Sun, 28 Dec 2014 08:12:53 +0000 (16:12 +0800)]
always read synthetic pointers as signed integers

I see the error message "access outside bounds of object referenced
via synthetic pointer" in the two fails below of mips gdb testing

print d[-2]^M
access outside bounds of object referenced via synthetic pointer^M
(gdb) FAIL: gdb.dwarf2/implptrconst.exp: print d[-2]
(gdb) print/d p[-1]^M
access outside bounds of object referenced via synthetic pointer^M
(gdb) FAIL: gdb.dwarf2/implptrpiece.exp: print/d p[-1]

in the first test, 'd[-2]' is processed by GDB as '* (&d[-2])'.  'd'
is a synthetic pointer, so its value is zero, the address of 'd[-2]'
is -2.  In dwarf2loc.c:indirect_pieced_value,

  /* This is an offset requested by GDB, such as value subscripts.
     However, due to how synthetic pointers are implemented, this is
     always presented to us as a pointer type.  This means we have to
     sign-extend it manually as appropriate.  */
  byte_offset = value_as_address (value);
  if (TYPE_LENGTH (value_type (value)) < sizeof (LONGEST))
    byte_offset = gdb_sign_extend (byte_offset,
   8 * TYPE_LENGTH (value_type (value)));
  byte_offset += piece->v.ptr.offset;

We know that the value is really an offset instead of address, so the
fix is to extract the value as an (signed) offset.

gdb:

2015-01-08  Pedro Alves  <palves@redhat.com>
    Yao Qi  <yao@codesourcery.com>

* dwarf2loc.c (indirect_pieced_value): Don't call
gdb_sign_extend.  Call extract_signed_integer instead.
* utils.c (gdb_sign_extend): Remove.
* utils.h (gdb_sign_extend): Remove declaration.

9 years agoFixes for memory access violations triggered by running nlmconv on
Nick Clifton [Thu, 8 Jan 2015 12:37:46 +0000 (12:37 +0000)]
Fixes for memory access violations triggered by running nlmconv on
fuzzed binaries.

PR binutils/17512
* nlmconv.c (i386_mangle_relocs): Skip relocs without an
associated symbol.
(powerpc_mangle_relocs): Skip unrecognised relocs.  Check address
range before applying a reloc.

9 years ago Set language for C++ special symbols.
Pierre Muller [Thu, 8 Jan 2015 07:53:26 +0000 (08:53 +0100)]
Set language for C++ special symbols.

The special handling of C++ special symbol
generates symbols that have no language.
Those symbols cannot be displayed correctly in the backtrace stack.

See
https://sourceware.org/bugzilla/show_bug.cgi?id=17811
for details and examples in C++ and pascal language.

The patch below fixes this issue, by
setting language of new symbol before
special handling of special C++ symbols.

2015-01-07  Pierre Muller  <muller@sourceware.org>

PR symtab/17811
* stabsread.c (define_symbol): Set language for C++ special symbols.

9 years agoRecognize branch instruction on MIPS in gdb.trace/entry-values.exp
Yao Qi [Tue, 30 Dec 2014 06:40:49 +0000 (14:40 +0800)]
Recognize branch instruction on MIPS in gdb.trace/entry-values.exp

The test entry-values.exp doesn't recognize the call instructions
on MIPS, such as JAL, JALS and etc, so this patch sets call_insn
to match various jump and branch instructions first.

Currently, we assume the next instruction address of call instruction
is the address returned from foo, however it is not correct on MIPS
which has delay slot.  We extend variable call_insn to match one
instruction after jump or branch instruction, so that
$returned_from_foo is correct on MIPS.

All tests in entry-values.exp are PASS.

gdb/testsuite:

2015-01-08  Yao Qi  <yao@codesourcery.com>

* gdb.trace/entry-values.exp: Set call_insn for MIPS target.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 8 Jan 2015 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoTrivially tweak the comment documenting initial_gdb_ttystate
Patrick Palka [Wed, 7 Jan 2015 21:23:39 +0000 (16:23 -0500)]
Trivially tweak the comment documenting initial_gdb_ttystate

gdb/ChangeLog:

* inflow.c (initial_gdb_ttystate): Tweak comment.

9 years agoSync with gcc/libiberty.
Richard Earnshaw [Wed, 7 Jan 2015 17:32:24 +0000 (17:32 +0000)]
Sync with gcc/libiberty.

9 years agoFix memory access violations uncovered by running the dlltool on fuzzed binaries.
Nick Clifton [Wed, 7 Jan 2015 17:33:17 +0000 (17:33 +0000)]
Fix memory access violations uncovered by running the dlltool on fuzzed binaries.

PR binutils/17512
* dlltool.c (scan_obj_file): Break loop if the last archive
displayed matches the current archive.

9 years agoFix memory access violations exposed by running the srconv tool on fuzzed binaries.
Nick Clifton [Wed, 7 Jan 2015 16:41:25 +0000 (16:41 +0000)]
Fix memory access violations exposed by running the srconv tool on fuzzed binaries.

PR binutils/17512
* objdump.c (display_any_bfd): Add a depth limit to nested archive
display in order to avoid infinite loops.
* srconv.c: Replace calls to abort with calls to fatal with an
error message.

9 years agoEmpty line after comment documenting set_initial_gdb_ttystate.
Joel Brobecker [Wed, 7 Jan 2015 14:49:49 +0000 (18:49 +0400)]
Empty line after comment documenting set_initial_gdb_ttystate.

gdb/ChangeLog:

        * inflow.c (set_initial_gdb_ttystate): Add empty line after
        comment documenting function.

9 years ago[testsuite patch] Fix avx512.exp regression
Jan Kratochvil [Wed, 7 Jan 2015 14:42:57 +0000 (15:42 +0100)]
[testsuite patch] Fix avx512.exp regression

+gdb compile failed, ^[[01m^[[Kgdb/testsuite/gdb.arch/i386-avx512.c:20:27:^[[m^[[K ^[[01;31m^[[Kfatal error: ^[[m^[[Knat/x86-cpuid.h: No
such file or directory
+ #include "nat/x86-cpuid.h"
+^[[01;32m^[[K                           ^^[[m^[[K
+compilation terminated.
+UNTESTED: gdb.arch/i386-avx512.exp: i386-avx512.exp

125f8a3ddedd413a2290dae011f0bed9ffc78278 is the first bad commit
commit 125f8a3ddedd413a2290dae011f0bed9ffc78278
Author: Gary Benson <gbenson@redhat.com>
Date:   Thu Jun 19 14:46:38 2014 +0100
    Move shared native target specific code to gdb/nat

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

Fix testcase compilation.
* gdb.arch/i386-avx512.exp (comp_flags): Remove /common.

9 years agoDon't propagate our current terminal state to the inferior
Patrick Palka [Sat, 22 Nov 2014 19:12:49 +0000 (14:12 -0500)]
Don't propagate our current terminal state to the inferior

Currently when we start an inferior we have the inferior inherit our
terminal state.  Under TUI, our terminal is highly modified by ncurses
and readline.  So when starting an inferior under TUI, the inferior will
have a highly modified terminal state which will interfere with standard
I/O. For example,

$ gdb gdb
(gdb) break main
(gdb) run
(gdb) print puts ("a\nb")
a
b
$1 = 4
(gdb) [enter TUI mode]
(gdb) run
(gdb) [exit TUI mode]
(gdb) print puts ("a\nb")
a
 b
  $2 = 4
(gdb) print puts ("a\r\nb\r")
a
b
$3 = 6

As you can see, when we start the inferior under the regular interface,
puts() prints the text properly.  But when we start the inferior under
TUI, puts() does not print the text properly.  This is because when we
start the inferior under TUI it inherits our current terminal state
which has been modified by ncurses to, among other things, require an
explicit \r\n to print a new line. As a result the inferior performs
standard I/O in an unexpected way.

Because of this discrepancy, it doesn't seem like a good idea to have
the inferior inherit our _current_ terminal state for it may have been
modified by readline and/or ncurses.  Instead, we should have the
inferior inherit a pristine snapshot of our terminal state taken before
readline or ncurses have had a chance to alter it.  This enables the
inferior to run in a more accurate way, more closely mimicking the
program's behavior had it run standalone.  And it fixes the above
mentioned issue.

Tested on x86_64-unknown-linux-gnu.

gdb/ChangeLog:

* terminal.h (set_initial_gdb_ttystate): Declare.
* inflow.c (initial_gdb_ttystate): New static variable.
(set_initial_gdb_ttystate): New setter.
(child_terminal_init_with_pgrp): Copy initial_gdb_ttystate
instead of our current terminal state.
* top.c (gdb_init): Call set_initial_gdb_ttystate.

9 years agold/testing: Extend comment on run_dump_test
Andrew Burgess [Tue, 6 Jan 2015 15:58:57 +0000 (15:58 +0000)]
ld/testing: Extend comment on run_dump_test

Mention that readelf can be used as a test program in the comment of
run_dump_test.

ld/testsuite/ChangeLog:

* lib/ld-lib.exp (run_dump_test): Extend comment to mention
readelf.

9 years agoRegenerate sim/common/aclocal.m4 and sim/common/configure...
Joel Brobecker [Wed, 7 Jan 2015 09:42:51 +0000 (13:42 +0400)]
Regenerate sim/common/aclocal.m4 and sim/common/configure...

... using automake 1.11.1, which is the version we're currently
using throughout, instead of 1.11.3. This should be a no-op in
practice, but will help automake/aclocal version-related
differences to cloud real changes being made.

sim/common/ChangeLog:

        * aclocal.m4, configure: Regenerate using automake 1.11.1.

9 years agoarm: fix extension feature disabling
Jan Beulich [Wed, 7 Jan 2015 08:39:27 +0000 (09:39 +0100)]
arm: fix extension feature disabling

Using e.g.

.arch_extension simd
.arch_extension nocrypto

so far results in SIMD support getting disabled, which I can't see being
the purpose of the "no"-prefixed variants of architecture extension
specifications.

Of course it is questionable whether the current, counter intuitive
behavior needs to be retained, and the new behavior perhaps be made work
through e.g. a newly recognized "no-" prefix.

gas/
2015-01-07  Jan Beulich <jbeulich@suse.com>

* gas/config/tc-arm.c (struct arm_option_extension_value_table):
Split field "value" into fields "merge_value" and "clear_value".
(arm_extensions): Adjust initializer accordingly.

9 years ago[python,guile] Add comment beside conditions testing empty arrays.
Joel Brobecker [Wed, 7 Jan 2015 03:34:29 +0000 (07:34 +0400)]
[python,guile] Add comment beside conditions testing empty arrays.

gdb/ChangeLog:

        * guile/scm-type.c (tyscm_array_1): Add comment.
        * python/py-type.c (typy_array_1): Add comment.

9 years agoSkip unknown relocation
H.J. Lu [Wed, 7 Jan 2015 00:46:36 +0000 (16:46 -0800)]
Skip unknown relocation

PR binutils/17512
* elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocation.
* elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Jan 2015 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoHandle stack split for x32
H.J. Lu [Thu, 18 Dec 2014 19:09:28 +0000 (11:09 -0800)]
Handle stack split for x32

X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
This patch handles it.

PR gold/17729
* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
(DEFAULT_TARGET_X32): Set for x32.
* x86_64.cc (cmp_insn_32): New.
(lea_r10_insn_32): Likewise.
(lea_r11_insn_32): Likewise.
(cmp_insn_64): Likewise.
(lea_r10_insn_64): Likewise.
(lea_r11_insn_64): Likewise.
(Target_x86_64<size>::do_calls_non_split): Handle x32.
* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
(check_DATA): Add split_x32 files.
(split_x32_[1234n].o): New targets.
(split_x32_[124]): New targets.
(split_x32_[1234r].stdout): New targets.
* testsuite/split_x32.sh: New file.
* testsuite/split_x32_1.s: Likewise.
* testsuite/split_x32_2.s: Likewise.
* testsuite/split_x32_3.s: Likewise.
* testsuite/split_x32_4.s: Likewise.
* testsuite/split_x32_n.s: Likewise.
* configure: Regenerated.
* testsuite/Makefile.in: Likewise.

9 years agoAnother fix for an objdump crash when parsing a corrupt binary.
Nick Clifton [Tue, 6 Jan 2015 22:02:55 +0000 (22:02 +0000)]
Another fix for an objdump crash when parsing a corrupt binary.

PR binutils/17512
* mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the
string table.

9 years agoHandle Initial-Exec to Local-Exec for x32
H.J. Lu [Tue, 6 Jan 2015 20:58:54 +0000 (12:58 -0800)]
Handle Initial-Exec to Local-Exec for x32

PR gold/17809
* x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
x32.

9 years agoFix memory access violations for objdump triggered by fuzzed binaries.
Nick Clifton [Tue, 6 Jan 2015 17:54:02 +0000 (17:54 +0000)]
Fix memory access violations for objdump triggered by fuzzed binaries.

PR binutils/17512
* reloc.c (bfd_get_reloc_size): Handle a reloc size of -1.
(bfd_perform_relocation): Include the size of the reloc in the
test for an out of range relocation.
(bfd_generic_get_relocated_section_contents): Remove reloc range
test.

9 years agoFixes a buffer overflow when compiling assembler for the MinGW targets.
Alan Modra [Tue, 6 Jan 2015 16:46:40 +0000 (16:46 +0000)]
Fixes a buffer overflow when compiling assembler for the MinGW targets.

PR binutils/17754
* internal.h (internal_auxent): Increase size of x_fname field to
20 to allow for PE format's longer file names.

9 years agoFixes for memory access violations in the coffdump program.
Nick Clifton [Tue, 6 Jan 2015 16:06:45 +0000 (16:06 +0000)]
Fixes for memory access violations in the coffdump program.

PR binutils/17512
* coffdump.c (dump_coff_section): Check for a symbol being
available before printing its name.
(main): Check the return value from coff_grok.
* coffgrok.c: Reformat and tidy.
Add range checks to most functions.
(coff_grok): Return NULL if the input bfd is not in a COFF
format.
* coffgrok.h: Reformat and tidy.
(struct coff_section): Change the nrelocs field to unsigned.
* srconv.c (main): Check the return value from coff_grok.

* coff-i860.c (CALC_ADDEND): Always set an addend value.
* tekhex.c (getvalue): Add an end pointer parameter.  Use it to
avoid reading off the end of the buffer.
(getsym): Likewise.
(first_phase): Likewise.
(pass_over): Pass an end pointer to the invoked function.

9 years agogdb/guile: Do not error when trying to create empty array.
Joel Brobecker [Tue, 6 Jan 2015 14:37:53 +0000 (18:37 +0400)]
gdb/guile: Do not error when trying to create empty array.

This fixes a similar error as in the Python support code where
trying to create an empty array.

In guile/scm-type.c::tyscm_array_1, the funtion raises an exception
if N2 < N1:

   if (n2 < n1)
     {
       gdbscm_out_of_range_error (func_name, SCM_ARG3,

But it should be doing so if N2 == N1 - 1, since that would simply
be an empty array, not an array with a negative length.

gdb/ChangeLog:

        * guile/scm-type.c (tyscm_array_1): Do not raise out-of-range
        error if N2 is equal to N1 - 1.

9 years agogdb/python: exception trying to create empty array
Joel Brobecker [Tue, 6 Jan 2015 14:30:53 +0000 (18:30 +0400)]
gdb/python: exception trying to create empty array

The following python command fails:

    (gdb) python print gdb.lookup_type('char').array(1, 0)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ValueError: Array length must not be negative
    Error while executing Python code.

The above is trying to create an empty array, which is fairly command
in Ada.

gdb/ChangeLog:

        * python/py-type.c (typy_array_1): Do not raise negative-length
        exception if N2 is equal to N1 - 1.

gdb/testsuite/ChangeLog:

        * gdb.python/py-type.exp: Add a couple test about empty
        array creation, and negative-length array creation.

9 years agoReturn NULL on corrupt input
H.J. Lu [Tue, 6 Jan 2015 01:43:34 +0000 (17:43 -0800)]
Return NULL on corrupt input

PR binutils/17512
* elf32-i386.c (elf_i386_get_plt_sym_val): Return NULL on corrupt
input.
* elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Jan 2015 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMore fixes for invalid memory accesses triggered by fuzzed binaries.
Nick Clifton [Mon, 5 Jan 2015 23:13:50 +0000 (23:13 +0000)]
More fixes for invalid memory accesses triggered by fuzzed binaries.

PR binutils/17512
* nm.c (print_symbol): Add 'is_synthetic' parameter.  Use it to
help initialize the info.elfinfo field.
(print_size_symbols): Add 'synth_count' parameter.  Use it to set
the is_synthetic parameter when calling print_symbol.
(print_symbols): Likewise.
(display_rel_file): Pass synth_count to printing function.
(display_archive): Break loop if the last archive displayed
matches the current archive.
* size.c (display_archive): Likewise.

* archive.c (do_slurp_bsd_armap): Make sure that the parsed sized
is at least big enough for the header to be read.
* elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocs.
* mach-o.c (bfd_mach_o_get_synthetic_symtab): Add range checks.
(bfd_mach_o_read_command): Prevetn duplicate error messages about
unrecognized commands.
* syms.c (_bfd_stab_section_find_nearest_line): Add range checks
when indexing into the string table.

9 years agoMore fixes for invalid memory accesses triggered by fuzzed binaries.
Nick Clifton [Mon, 5 Jan 2015 13:54:22 +0000 (13:54 +0000)]
More fixes for invalid memory accesses triggered by fuzzed binaries.

PR binutils/17531
* dwarf.c (alloc_num_debug_info_entries): New variable.
(process_debug_info): Set it.  Use it to avoid displaying
attributes for which there is no info.
(display_debug_abbrev): Check that the debug_info_entry index is
valid before using it.
(display_loc_list_dwo): Likewise.
(process_cu_tu_index): Add range check for an overlarge dw_sect
value.
(free_debug_memory): Reset alloc_num_debug_info_entries.
* readelf.c (slurp_ia64_unwind_table): Warn if the reloc could not
be indentified.
(dynamic_section_mips_val): Warn if the timestamp is invalid.
(print_mips_got_entry): Add a data_end parameter.  Warn if a read
would go beyond the end of the data, and return an error value.
(process_mips_specific): Do not read options from beyond the end
of the section.
Correct code to display optional data at the end of an option.
Warn if there are too many GOT symbols.
Update calls to print_mips_got_entry, and handle error returns.

9 years agoCorrects the description of the --kill-at option of dlltool.
Daniel Klauer [Mon, 5 Jan 2015 09:41:48 +0000 (09:41 +0000)]
Corrects the description of the --kill-at option of dlltool.

PR binutils/17489
* doc/binutils.texi (dlltool): Correct description of --kill-at
option.

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

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 4 Jan 2015 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years ago[GCC bug #63539]: libgo does not use the newly built objcopy when doing a combined...
Andrew Pinski [Sat, 3 Jan 2015 22:54:45 +0000 (14:54 -0800)]
[GCC bug #63539]: libgo does not use the newly built objcopy when doing a combined build

2015-01-03  Andrew Pinski  <apinski@cavium.com>

        * Makefile.def (flags_to_pass): Pass OBJCOPY_FOR_TARGET also.
        * Makefile.tpl (HOST_EXPORTS): Add OBJCOPY_FOR_TARGET.
        (BASE_TARGET_EXPORTS): Add OBJCOPY.
        (OBJCOPY_FOR_TARGET): New variable.
        (EXTRA_TARGET_FLAGS): Add OBJCOPY.
        * Makefile.in: Regenerate.
        * configure.ac: Check for already installed target objcopy.
        Also GCC_TARGET_TOOL on objcopy.
        * configure: Regenerate.

9 years agofix spelling of anon-ns2.cc in earlier entry, and whitespace in same entry
Doug Evans [Sat, 3 Jan 2015 20:35:41 +0000 (12:35 -0800)]
fix spelling of anon-ns2.cc in earlier entry, and whitespace in same entry

9 years agoc-exp.y: misc cleanup, no code changes
Doug Evans [Sat, 3 Jan 2015 20:01:29 +0000 (12:01 -0800)]
c-exp.y: misc cleanup, no code changes

gdb/ChangeLog:

* c-exp.y: Whitespace cleanup.
(classify_inner_name): Remove extra ;.

9 years agogdb.cp/nsalias.exp: Fix output of external/declaration flags.
Doug Evans [Sat, 3 Jan 2015 06:00:57 +0000 (22:00 -0800)]
gdb.cp/nsalias.exp: Fix output of external/declaration flags.

gdb/testsuite/ChangeLog:

* gdb.cp/nsalias.exp: Fix output of external/declaration flags.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Jan 2015 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMIPS: Make the extracted stack offset signed in the prologue scanner
Maciej W. Rozycki [Fri, 2 Jan 2015 23:36:05 +0000 (23:36 +0000)]
MIPS: Make the extracted stack offset signed in the prologue scanner

Make the extracted stack offset signed in the standard MIPS prologue
scanner, to simplify handling and make sure register offsets are correct
in all cases, especially where $fp equals the virtual frame pointer (old
GCC frames) and therefore offsets to save slots are negative.

* mips-tdep.c (mips32_scan_prologue): Make the extracted stack
offset signed.

9 years agogdb.dwarf2/dw4-sig-types.exp: Also pass -fdebug-types-section to gcc.
Doug Evans [Fri, 2 Jan 2015 20:59:44 +0000 (12:59 -0800)]
gdb.dwarf2/dw4-sig-types.exp: Also pass -fdebug-types-section to gcc.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/dw4-sig-types.exp: Also pass -fdebug-types-section to gcc.

9 years agodwarf2read.c (setup_type_unit_groups): Remove outdated comment.
Doug Evans [Fri, 2 Jan 2015 19:49:14 +0000 (11:49 -0800)]
dwarf2read.c (setup_type_unit_groups): Remove outdated comment.

gdb/ChangeLog:

* dwarf2read.c (setup_type_unit_groups): Remove outdated comment.

9 years agosymtab.h (struct symbol): Fix typo in comment.
Doug Evans [Fri, 2 Jan 2015 19:02:31 +0000 (11:02 -0800)]
symtab.h (struct symbol): Fix typo in comment.

gdb/ChangeLog:

* symtab.h (struct symbol): Fix typo in comment.

9 years agoRegenerate Makeile.in file for copyright update
Alan Modra [Fri, 2 Jan 2015 11:53:31 +0000 (22:23 +1030)]
Regenerate Makeile.in file for copyright update

9 years agoconfig.sub, config.guess: Update from upstream, to 2015-01-01 version.
Hans-Peter Nilsson [Fri, 2 Jan 2015 09:40:57 +0000 (10:40 +0100)]
config.sub, config.guess: Update from upstream, to 2015-01-01 version.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Jan 2015 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoCorrect printed year in copyright notices for gold.
Alan Modra [Thu, 1 Jan 2015 22:21:43 +0000 (08:51 +1030)]
Correct printed year in copyright notices for gold.

9 years agoCorrect printed year in copyright notices
Alan Modra [Thu, 1 Jan 2015 14:38:15 +0000 (01:08 +1030)]
Correct printed year in copyright notices

9 years agoChangeLog rotatation and copyright year update
Alan Modra [Thu, 1 Jan 2015 14:15:26 +0000 (00:45 +1030)]
ChangeLog rotatation and copyright year update

9 years agoUpdate year range in copyright notice of all files owned by the GDB project.
Joel Brobecker [Thu, 1 Jan 2015 09:32:14 +0000 (13:32 +0400)]
Update year range in copyright notice of all files owned by the GDB project.

gdb/ChangeLog:

        Update year range in copyright notice of all files.

9 years agoUpdate copyright year printed by gdb, gdbserver and gdbreplay.
Joel Brobecker [Thu, 1 Jan 2015 09:24:41 +0000 (13:24 +0400)]
Update copyright year printed by gdb, gdbserver and gdbreplay.

gdb/ChangeLog:

        * top.c (print_gdb_version): Update copyright year to 2015.

gdbserver/ChangeLog:

        * gdbreplay.c (gdbreplay_version): Update copyright year to 2015.
        * server.c (gdbserver_version): Likewise.

9 years agoYearly gdb/ChangeLog rotation.
Joel Brobecker [Thu, 1 Jan 2015 09:21:14 +0000 (13:21 +0400)]
Yearly gdb/ChangeLog rotation.

This patch renames gdb/'s ChangeLog to ChangeLog-2014 and creates
a new one for 2015. config/djgpp/fnchange.lst is updated accordingly.

gdb/ChangeLog:

  * config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2014.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Jan 2015 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRemove "add-shared-symbol-files", "dll-symbols" and "assf" commands doc.
Joel Brobecker [Tue, 30 Dec 2014 07:36:53 +0000 (11:36 +0400)]
Remove "add-shared-symbol-files", "dll-symbols" and "assf" commands doc.

This patch removes documentation from some commands whose support has
been recently removed.

gdb/ChangeLog:

        * NEWS: Document removal of "dll-symbols", "add-shared-symbol-files"
        and "assf" commands.

gdb/doc/ChangeLog:

        * gdb.texinfo (Files): Remove documentation of the
        "add-shared-symbol-files" and "assf" commands.
        (Cygwin Native): Remove documentation of the "dll-symbols"
        command.

9 years agoAssign file position for .strtab only if needed
H.J. Lu [Wed, 31 Dec 2014 03:09:11 +0000 (19:09 -0800)]
Assign file position for .strtab only if needed

bfd/

PR ld/17773
* elflink.c (bfd_elf_final_link): Assign the file position for
the symbol string table only there are symbols to be emitted.

ld/testsuite/

PR ld/17773
* ld-elf/binutils.exp (binutils_test): Add an optional
readelf_options.  Replace -l with $readelf_options.  Add a
gap test.
* ld/testsuite/ld-elf/gap.s: New file.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 31 Dec 2014 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix executable indicator in file name completion on Windows.
Eli Zaretskii [Tue, 30 Dec 2014 19:14:25 +0000 (21:14 +0200)]
Fix executable indicator in file name completion on Windows.

* complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
Windows, they don't work.  Instead, look at the file-name
extension to determine whether the file is executable.

9 years agoRemove "dll-symbols", "add-shared-symbol-files" and assf" commands.
Joel Brobecker [Tue, 30 Dec 2014 07:30:01 +0000 (11:30 +0400)]
Remove "dll-symbols", "add-shared-symbol-files" and assf" commands.

This patch removes a set of commands that have been deprecated for
a while, and which we agreed to remove after the GDB 7.8 release.

gdb/ChangeLog:

* windows-nat.c (safe_symbol_file_add_stub)
(safe_symbol_file_add_cleanup, safe_symbol_file_add)
(dll_symbol_command): Delete.
(_initialize_windows_nat): Delete local variable "c".
Remove "dll-symbols", "add-shared-symbol-files" and assf"
commands.

Tested by rebuilding GDB on x86-windows.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Dec 2014 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoSanitize input_interrupt output
Sergio Durigan Junior [Mon, 29 Dec 2014 19:22:20 +0000 (14:22 -0500)]
Sanitize input_interrupt output

Hi,

This patch is a follow-up of the following discussions:

  <https://sourceware.org/ml/gdb-patches/2014-12/msg00421.html>
  <https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01293.html>

input_interrupt is currently emiting non-printable characters, which
is confusing the dg-extract-results.sh script.  This is obviously not
a good thing, and, by following Pedro's advices here:

  <https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01320.html>

I adapted the function to print "client connection closed" when it
receives a NUL character, or use the "isprint" function to decide how
to print the received char.  I tested it by running the testcases that
were printing the non-printable chars before:

  gdb.base/gdb-sigterm.exp
  gdb.threads/non-ldr-exc-1.exp
  gdb.threads/non-ldr-exc-2.exp
  gdb.threads/non-ldr-exc-3.exp
  gdb.threads/non-ldr-exc-4.exp
  gdb.threads/thread-execl.exp

and confirming that they print the right message.  I tried a bit to
come up with a testcase for this, but failed, and since I did not want
to spend too much time on it, I'm sending the patch anyway.

Comments are welcome, as usual.

gdb/gdbserver/ChangeLog:
2014-12-29  Sergio Durigan Junior  <sergiodj@redhat.com>

* remote-utils.c: Include ctype.h.
(input_interrupt): Explicitly handle the case when the char
received is the NUL byte.  Improve the printing of non-ASCII
characters.

9 years ago[PATCH] Remove cast in Tag_ABI_VFP_args switch case stmts
Jiong Wang [Mon, 29 Dec 2014 14:56:36 +0000 (14:56 +0000)]
[PATCH] Remove cast in Tag_ABI_VFP_args switch case stmts

  2014-12-29  Thomas Preud'homme  <thomas.preudhomme@arm.com>

  gdb/
    * arm-tdep.c (arm_gdbarch_init): Remove casts in Tag_ABI_VFP_args
    switch case statements.

9 years agoClean up gdb.trace/entry-values.exp
Yao Qi [Mon, 29 Dec 2014 03:56:51 +0000 (11:56 +0800)]
Clean up gdb.trace/entry-values.exp

This patch is to clean up gdb.trace/entry-values.exp as a preparation
of the next patch.  It updates the comments to reflect the code.

One DIE generated in dwarf assembler is

  GNU_call_site {
    {low_pc "$bar_start + $bar_call_foo" addr}
      {abstract_origin :$foo_label}

the DW_AT_low_pc attribute is the return address after the call, so I
rename variable bar_call_foo to returned_from_foo.

gdb/testsuite:

2014-12-29  Yao Qi  <yao@codesourcery.com>

* gdb.trace/entry-values.exp: Update comments.  Rename variable
bar_call_foo to returned_from_foo.

9 years agoAdd moxiebox target support
Anthony Green [Mon, 29 Dec 2014 05:42:55 +0000 (00:42 -0500)]
Add moxiebox target support

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Dec 2014 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMisplaced parenthesis calculates two too few bytes for string
Alan Modra [Sun, 28 Dec 2014 04:58:19 +0000 (15:28 +1030)]
Misplaced parenthesis calculates two too few bytes for string

Factor out strlen to give better code and less likelihood of a repeat
of this problem.

PR 17766
* pei-x86_64.c (pex64_bfd_print_pdata_section): Correct string
length.  Use memcpy rather than strcpy.

9 years agoFix small spelling mistake in gdb/ChangeLog.
Joel Brobecker [Sun, 28 Dec 2014 03:44:49 +0000 (07:44 +0400)]
Fix small spelling mistake in gdb/ChangeLog.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Dec 2014 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoUpdate for moxie ISA changes
Anthony Green [Sat, 27 Dec 2014 23:37:58 +0000 (18:37 -0500)]
Update for moxie ISA changes

9 years agoUpdate sto/ldo implementations with 16 bit offsets
Anthony Green [Sat, 27 Dec 2014 23:19:49 +0000 (18:19 -0500)]
Update sto/ldo implementations with 16 bit offsets

9 years agoLimit moxie sto/ldo offsets to 16 bits
Anthony Green [Sat, 27 Dec 2014 15:57:04 +0000 (10:57 -0500)]
Limit moxie sto/ldo offsets to 16 bits

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Dec 2014 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoUpdate two sh64 ld test's expected output
Alan Modra [Fri, 26 Dec 2014 11:40:52 +0000 (22:10 +1030)]
Update two sh64 ld test's expected output

At some stage someone fixed a bug in ld -r output, preserving
SHF_INFO_LINK from input objects.  These two tests expected the old
wrong output.

* ld-sh/sh64/crangerel1.rd: Update.
* ld-sh/sh64/crangerel2.rd: Update.

9 years agoDelete unnecessary code copying SHF_SH5_ISA32 flag
Alan Modra [Fri, 26 Dec 2014 07:56:38 +0000 (18:26 +1030)]
Delete unnecessary code copying SHF_SH5_ISA32 flag

Since 2006, commit d270463e9, _bfd_elf_copy_private_section_data has
copied over SHF_MASKOS and SHF_MASKPROC flags.  That makes the buggy
code in sh_elf64_copy_private_data_internal redundant.

bfd/
PR 17755
* elf64-sh64.c (sh_elf64_copy_private_data_internal): Delete code
copying SHF_SH5_ISA32.
binutils/testsuite/
* binutils-all/strip-11.d: New test.
* binutils-all/objcopy.exp: Run it.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Dec 2014 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoWhitespace cleanup
Anthony Green [Thu, 25 Dec 2014 13:26:57 +0000 (08:26 -0500)]
Whitespace cleanup

9 years agoWhitespace cleanup
Anthony Green [Thu, 25 Dec 2014 13:26:57 +0000 (08:26 -0500)]
Whitespace cleanup

9 years agoARM: Add support for value 3 of Tag_ABI_VFP_args attribute
Alan Modra [Thu, 25 Dec 2014 11:45:14 +0000 (22:15 +1030)]
ARM: Add support for value 3 of Tag_ABI_VFP_args attribute

Missing from 5c294fee

elfcpp/
* arm.h: Add enums for Tag_ABI_FP_number_model and Tag_ABI_VFP_args.
gold/
* arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
new enums.
(Target_arm::merge_object_attributes, ): Likewise.

9 years agoDon't pass unadorned zeros to varargs functions
Yaakov Selkowitz [Thu, 25 Dec 2014 10:55:38 +0000 (21:25 +1030)]
Don't pass unadorned zeros to varargs functions

PR gas/17753
* config/tc-mep.c (md_begin): Specify types of vararg literals.

9 years agoARM: Add support for value 3 of Tag_ABI_VFP_args attribute
Terry Guo [Thu, 25 Dec 2014 01:50:48 +0000 (09:50 +0800)]
ARM: Add support for value 3 of Tag_ABI_VFP_args attribute

*** bfd/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
Tag_ABI_VFP_args value and replace hardcoded values by enum
values.
(elf32_arm_post_process_headers): Set e_flags in ELF header
as hard float only when Tag_ABI_VFP_args is 1, using new enum
value AEABI_VFP_args_vfp to check that.

*** binutils/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible".

*** gdb/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of
Tag_ABI_VFP_args. Also replace hardcoded values by enum values
in the switch handling the different values of Tag_ABI_VFP_args.

*** gold/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF
header as hard float only when Tag_ABI_VFP_args is 1, using new
enum value AEABI_VFP_args_vfp to check that.
(Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
value and replace hardcoded values by enum values.

*** include/elf/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum
values.

*** ld/testsuite/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args.
* ld-arm/attr-merge-2b.s: Likewise.
* ld-arm/attr-merge-2.attr: Likewise.
* ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and
Tag_ABI_VFP_args.
* ld-arm/attr-merge-4b.s: Likewise.
* ld-arm/attr-merge-4.attr: Likewise.
* ld-arm/attr-merge-6a.s: Likewise.
* ld-arm/attr-merge-6b.s: Likewise.
* ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Dec 2014 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd cast to unsigned long
H.J. Lu [Wed, 24 Dec 2014 22:14:14 +0000 (14:14 -0800)]
Add cast to unsigned long

* pei-x86_64.c (pex64_bfd_print_pdata_section): Add cast to
unsigned long.

9 years agoAVR: Document linker relaxation related options.
Andrew Burgess [Tue, 23 Dec 2014 17:46:45 +0000 (17:46 +0000)]
AVR: Document linker relaxation related options.

Adds documentation describing the -mlink-relax and -mno-link-relax
command line options.

gas/ChangeLog:

* doc/c-avr.texi: Document -mlink-relax and -mno-link-relax.

9 years agoAVR: Assembler now prepares for linker relaxation by default.
Andrew Burgess [Mon, 27 Oct 2014 10:51:17 +0000 (10:51 +0000)]
AVR: Assembler now prepares for linker relaxation by default.

Have the assembler prepare for linker relaxation by default.  This
means that users will be able to make use of linker relaxation without
having to adjust the assembler flags, this can make life easier when
compiling libraries.

Having this on by default in the assembler should make no difference to
the assembler code produced, however, some of the debug information will
be slightly less compressed.

A few tests needed to be updated as a result of this change as they
relied on linker relaxation support being off by default.

I've tightened up the definition of which sections can be relaxed on AVR
as part of this commit, the assembler used to think that all
non-debugging sections could be relaxed, when in reality only code
sections can be relaxed for AVR.  The previous definition was not
dangerous, just over cautious.  The new tighter definition allows an
extra test (gas/testsuite/gas/all/forward.d) to continue to pass.

gas/ChangeLog:

* config/tc-avr.c (struct avr_opt_s): Change link_relax to
no_link_relax, extend comment.
(enum options): Add new OPTION_NO_LINK_RELAX.
(md_longopts): Add entry for -mno-link-relax.
(md_parse_option): Handle OPTION_NO_LINK_RELAX, and update
OPTION_LINK_RELAX.
(md_begin): Initialise linkrelax from no_link_relax.
(md_show_usage): Include -mno-link-relax option.
(relaxable_section): Only allocatable code sections can be
relaxed.
* config/tc-avr.h (TC_LINKRELAX_FIXUP): Define.

gas/testsuite/ChangeLog:

* gas/all/gas.exp: Test will not pass on AVR due to linker
relaxation support.
* gas/avr/noreloc_withoutrelax.d: Add -mno-link-relax option.
* gas/avr/link-relax-elf-flag-clear.d: Likewise.

ld/testsuite/ChangeLog:

* ld/testsuite/ld-avr/relax-elf-flags-02.d: Add -mno-link-relax
option.
* ld/testsuite/ld-avr/relax-elf-flags-03.d: Likewise.
* ld/testsuite/ld-avr/relax-elf-flags-04.d: Likewise.
* ld/testsuite/ld-avr/relax-elf-flags-05.d: Likewise.
* ld/testsuite/ld-avr/relax-elf-flags-06.d: Likewise.

9 years agoThis patch fixes a snafu where the -D and -U short versions of the
Alexander Cherepanov [Wed, 24 Dec 2014 14:50:53 +0000 (14:50 +0000)]
This patch fixes a snafu where the -D and -U short versions of the
--enable-deterministic-archives and --disable-deteministic-archive
options were not being accepted.

PR binutils/17671
* objcopy.c (copy_main, strip_main): Add D and U to the list of
accepted short versions of long options.

9 years agoAdd support for moxie's mul.x and umul.x instructions
Anthony Green [Wed, 24 Dec 2014 13:37:16 +0000 (08:37 -0500)]
Add support for moxie's mul.x and umul.x instructions

9 years agoAdd mul.x and umul.x instructions to moxie port
Anthony Green [Wed, 24 Dec 2014 13:34:23 +0000 (08:34 -0500)]
Add mul.x and umul.x instructions to moxie port

9 years agoDon't create .eh_frame_hdr on shared lib bfd
Alan Modra [Wed, 24 Dec 2014 11:37:42 +0000 (22:07 +1030)]
Don't create .eh_frame_hdr on shared lib bfd

If no object files have .eh_frame, but some shared library does, then
ld creates a .eh_frame_hdr section using the shared library bfd.  This
is silly since shared library .eh_frame sections don't contribute to
the output .eh_frame and thus no .eh_frame_hdr is needed.

Also, the bfd section list and count is cleared for shared libraries,
and a zero section count used as a flag in lang_check to omit a call
to bfd_merge_private_bfd_data for shared libraries.  If we create a
section on a shared lib bfd then ld will wrongly attempt to merge the
shared library private bfd data.

PR 17742
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude
shared libraries in loop looking for .eh_frame sections.
Similarly for build-id loop.