binutils-gdb.git
9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd gmonster-{1,2} perf testcases.
Doug Evans [Fri, 24 Jul 2015 22:46:31 +0000 (15:46 -0700)]
Add gmonster-{1,2} perf testcases.

These testcases are mocks of real programs.
GDB doesn't care what the programs do, they just have to look
and/or behave like the real program.
These testcases exercise gdb when debugging really large programs.
E.g., gmonster-1 has 10,000 CUs, and gmonster-2 has 1000 shared libs
(which is actually a little small, 5000 would be more accurate).

gdb/testsuite/ChangeLog:

* gdb.perf/lib/perftest/utils.py: New file.
* gdb.perf/gm-hello.cc: New file.
* gdb.perf/gm-pervasive-typedef.cc: New file.
* gdb.perf/gm-pervasive-typedef.h: New file.
* gdb.perf/gm-std.cc: New file.
* gdb.perf/gm-std.h: New file.
* gdb.perf/gm-use-cerr.cc: New file.
* gdb.perf/gm-utils.h: New file.
* gdb.perf/gmonster-null-lookup.py: New file.
* gdb.perf/gmonster-pervasive-typedef.py: New file.
* gdb.perf/gmonster-print-cerr.py: New file.
* gdb.perf/gmonster-ptype-string.py: New file.
* gdb.perf/gmonster-runto-main.py: New file.
* gdb.perf/gmonster-select-file.py: New file.
* gdb.perf/gmonster1-null-lookup.exp: New file.
* gdb.perf/gmonster1-pervasive-typedef.exp: New file.
* gdb.perf/gmonster1-print-cerr.exp: New file.
* gdb.perf/gmonster1-ptype-string.exp: New file.
* gdb.perf/gmonster1-runto-main.exp: New file.
* gdb.perf/gmonster1-select-file.exp: New file.
* gdb.perf/gmonster1.cc: New file.
* gdb.perf/gmonster1.exp: New file.
* gdb.perf/gmonster2-null-lookup.exp: New file.
* gdb.perf/gmonster2-pervasive-typedef.exp: New file.
* gdb.perf/gmonster2-print-cerr.exp: New file.
* gdb.perf/gmonster2-ptype-string.exp: New file.
* gdb.perf/gmonster2-runto-main.exp: New file.
* gdb.perf/gmonster2-select-file.exp: New file.
* gdb.perf/gmonster2.cc: New file.
* gdb.perf/gmonster2.exp: New file.

9 years agoAdd perf testcase generator.
Doug Evans [Fri, 24 Jul 2015 22:43:15 +0000 (15:43 -0700)]
Add perf testcase generator.

gdb/testsuite/ChangeLog:

* gdb.perf/README: New file.
* lib/perftest.exp (tcl_string_list_to_python_list): New function.
* lib/gen-perf-test.exp: New file.

9 years agoPerfTest::assemble functions return results.
Doug Evans [Fri, 24 Jul 2015 22:38:21 +0000 (15:38 -0700)]
PerfTest::assemble functions return results.

gdb/testsuite/ChangeLog:

* lib/perftest.exp (PerfTest::compile): Unconditionally call body.
(PerfTest::startup): New function.
(PerfTest::run): Return result of calling body.
(PerfTest::assemble): Rewrite.
* gdb.perf/backtrace.exp (PerfTest::assemble): Update function result.
* gdb.perf/disassemble.exp (PerfTest::assemble): Ditto.
* gdb.perf/single-step.exp (PerfTest::assemble): Ditto.
* gdb.perf/skip-prologue.exp (PerfTest::assemble): Ditto.
* gdb.perf/solib.exp (PerfTest::assemble): Ditto.

9 years agolib/gdb.exp (clean_restart): Make executable optional.
Doug Evans [Fri, 24 Jul 2015 22:35:12 +0000 (15:35 -0700)]
lib/gdb.exp (clean_restart): Make executable optional.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (clean_restart): Make executable optional.

9 years agoClean up testsuite compiler_info support.
Doug Evans [Fri, 24 Jul 2015 22:32:45 +0000 (15:32 -0700)]
Clean up testsuite compiler_info support.

gdb/testsuite/ChangeLog:

* gdb.base/watchpoint.exp (test_complex_watchpoint): Remove
compiler_info references.
* gdb.cp/temargs.exp: Ditto.
* lib/gdb.exp: Unset compiler_info instead of setting to "unknown".
(get_compiler_info): Early exit if already computed.  Set compiler_info
to "unknown" if there was a problem.
(test_compiler_info): Add function comment.  Call get_compiler_info.

9 years agoAdd parallel build support for perf tests.
Doug Evans [Fri, 24 Jul 2015 22:28:46 +0000 (15:28 -0700)]
Add parallel build support for perf tests.

gdb/testsuite/ChangeLog:

* Makefile.in (check/%.exp): Pass directory for GDB_PARALLEL.
(workers/%.worker, build-perf): New rule.
(GDB_PERFTEST_MODE): New variable.
(check-perf): Use it.
(clean): Clean up gdb.perf parallel build subdirs.
* lib/build-piece.exp: New file.
* lib/cache.exp (gdb_do_cache): Include $GDB_PARALLEL in path name.
* lib/gdb.exp (standard_output_file): Include $GDB_PARALLEL in path
name.
(standard_temp_file): Ditto.
(GDB_PARALLEL handling): Make outputs,temp,cache directories as subdirs
of $GDB_PARALLEL.

9 years agoWorkaround debian change to default value of --as-needed.
Doug Evans [Fri, 24 Jul 2015 22:24:37 +0000 (15:24 -0700)]
Workaround debian change to default value of --as-needed.

gdb/testsuite/ChangeLog:

* lib/future.exp (gdb_default_target_compile): New option
"early_flags".
* lib/gdb.exp (gdb_compile): Undo debian's change in default of
--as-needed.

9 years agoPrint data from individual perf runs.
Doug Evans [Fri, 24 Jul 2015 22:11:07 +0000 (15:11 -0700)]
Print data from individual perf runs.

gdb/testsuite/ChangeLog:

* gdb.perf/lib/perftest/measure.py (MeasurementCpuTime::stop): Print
result.
(MeasurementWallTime::stop): Ditto.
(MeasurementVmSizeTime::stop): Ditto.

9 years agoCall gdb_exit before gdb_skip_xml_test on gdb.base/catch-syscall.exp
Sergio Durigan Junior [Fri, 24 Jul 2015 20:46:49 +0000 (16:46 -0400)]
Call gdb_exit before gdb_skip_xml_test on gdb.base/catch-syscall.exp

The gdb_skip_xml_test procedure explicitly says that it cannot be
invoked when GDB is running.  However, the testcase for "catch
syscall" is wrongly doing that, which is causing a failure on
native-extended-gdbserver tests:

  new FAIL: gdb.base/catch-syscall.exp: set tdesc filename /home/gdb-buildbot/fedora-x86-64-3/fedora-x86-64-native-extended-gdbserver-m32/build/gdb/testsuite/outputs/gdb.base/catch-syscall/trivial.xml (got interactive prompt)

This obvious commit fixes this, by calling gdb_exit before gdb_skip_xml_test.

Checked in as obvious.

gdb/testsuite/ChangeLog
2015-07-24  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.base/catch-syscall.exp: Call gdb_exit before
gdb_skip_xml_test.

9 years agoFix s390 GNU/Linux build after enum __ptrace_request changes
Pedro Alves [Fri, 24 Jul 2015 19:29:53 +0000 (20:29 +0100)]
Fix s390 GNU/Linux build after enum __ptrace_request changes

The buildbot noticed that the enum __ptrace_request series broke the
s390 GNU/Linux build:

../../binutils-gdb/gdb/s390-linux-nat.c: In function 'fetch_regs':
../../binutils-gdb/gdb/s390-linux-nat.c:226:54: error: macro "ptrace" requires 4 arguments, but only 3 given
   if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
                                                      ^
../../binutils-gdb/gdb/s390-linux-nat.c: In function 'store_regs':
../../binutils-gdb/gdb/s390-linux-nat.c:243:54: error: macro "ptrace" requires 4 arguments, but only 3 given
   if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
                                                      ^

Fix this the same way it's handled everywhere else -- just pass 0 as
forth argument, which also handles non-varargs ptrace prototypes in
non-glibc libcs, e.g., Bionic (if it ever gets a s390 port...).

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

* s390-linux-nat.c (fetch_regs, store_regs, fetch_fpregs)
(s390_stopped_by_watchpoint, s390_prepare_to_resume): Pass 0 as
forth argument to ptrace PTRACE_PEEKUSR_AREA/PTRACE_POKEUSR_AREA.

9 years agogdb.python/py-events.exp and normal_stop observers ordering
Pedro Alves [Fri, 24 Jul 2015 18:34:17 +0000 (19:34 +0100)]
gdb.python/py-events.exp and normal_stop observers ordering

I have patches that:

 1 - make the CLI print stop info from a normal_stop observer, like MI
     does.

 2 - happen to change the order in which the Python and CLI/TUI
     normal_stop observers are installed.

With those in place, py-events.exp regresses like shown below [1],
because the Python stop events are output before CLI prints stop info,
instead of after, and the test doesn't expect that.

With the same Python hooks, the order in which MI and Python events is
emited today is already undefined, because MI also uses the
normal_stop observer for output.  I see no reason that we should in
general define the order observers, interpreters and scripting
languages get their turn at being notified of these events.  So this
patch makes the test cope with Python->CLI output order too.

Tested on x86_64 Fedora 20.

gdb/testsuite/
2015-07-24  Pedro Alves  <palves@redhat.com>

* gdb.python/py-events.exp: Accept output between the stop event
and the prompt.
* gdb.python/py-evsignal.exp: Likewise.
* gdb.python/py-evthreads.exp: Likewise.

[1] - The regressions in question look like:

Before said patches:
  (gdb) continue
  Continuing.
  event type: continue

  Breakpoint 2, first () at /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-events.c:30
  30   for (i = 0; i < 2; i++)
  event type: stop
  event type: stop
  stop reason: breakpoint
  first breakpoint number: 2
  breakpoint number: 2
  breakpoint number: 3
  all threads stopped
  (gdb) PASS: gdb.python/py-events.exp: continue

After said patches:
  (gdb) continue
  Continuing.
  event type: continue
  event type: stop
  event type: stop
  stop reason: breakpoint
  first breakpoint number: 2
  breakpoint number: 2
  breakpoint number: 3
  all threads stopped

  Breakpoint 2, first () at /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-events.c:30
  30   for (i = 0; i < 2; i++)
  (gdb) FAIL: gdb.python/py-events.exp: continue

9 years agoPR gdb/18717: internal error if non-leader thread exits process
Pedro Alves [Fri, 24 Jul 2015 18:18:44 +0000 (18:18 +0000)]
PR gdb/18717: internal error if non-leader thread exits process

If a non-leader thread exits the process while all other threads are
ptrace-stopped, native gdb fails an assertion.  The test added by this
commit catches it:

 /home/pedro/gdb/mygit/build/../src/gdb/linux-nat.c:3198: internal-error: linux_nat_filter_event: Assertion `lp->resumed' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)
 FAIL: gdb.threads/non-leader-exit-process.exp: program exits normally (GDB internal error)

The fix is just to remove the assertion.

With that out of the way, neither GDB not GDBserver handle this
perfectly though, so I'm adding a KFAIL:

 (gdb) continue
 Continuing.
 [Thread 0x7ffff7fc0700 (LWP 15350) exited]
 No unwaited-for children left.
 Couldn't get registers: No such process.
 (gdb) KFAIL: gdb.threads/non-ldr-exit.exp: program exits normally (PRMS: gdb/18717)

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

PR gdb/18717
* linux-nat.c (linux_nat_filter_event): Don't assert that the lwp
is resumed, and extend the debug log.

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

PR gdb/18717
* gdb.threads/non-ldr-exit.c: New file.
* gdb.threads/non-ldr-exit.exp: New file.

9 years agoFix failed exec error message
Pedro Alves [Fri, 24 Jul 2015 16:27:58 +0000 (17:27 +0100)]
Fix failed exec error message

Ref: https://sourceware.org/ml/gdb-patches/2015-07/msg00629.html

This fixes the bogus command line in the error message shown when the
SHELL environment variable points somewhere that's not something that
resembles a shell:

  $ SHELL=/nonexisting gdb /home/pedro/a.out
  (gdb) r
  Starting program: /home/pedro/a.out
 - Cannot exec /home/pedro/a.out -c exec /home/pedro/a.out .
 + Cannot exec /nonexisting -c exec /home/pedro/a.out .
  Error: No such file or directory
  During startup program exited with code 127.
  (gdb)

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

* fork-child.c (fork_inferior): Print argv[0] instead of exec_file.

9 years agoAdd 'U' suffix to silence GCC 6 warning
H.J. Lu [Fri, 24 Jul 2015 16:10:18 +0000 (09:10 -0700)]
Add 'U' suffix to silence GCC 6 warning

GCC 6 warns:

error: result of ‘63 << 26’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Werror=shift-overflow=]

on 0x3f << 26.  This patch adds 'U' suffix to make integer constant
unsigned.

* alpha.c (OP_Jxx): Add 'U' suffix to make it unsigned.
(OP_BSR): Likewise.
(Jxx_FUNC_JMP): Likewise.
(Jxx_FUNC_JSR): Likewise.
(Jxx_FUNC_RET): Likewise.
(Jxx_FUNC_JSR_COROUTINE): Likewise.
(alpha_find_call): Replace 0x3f with 0x3fU.

9 years agoUse 0xffffffffffffffffLL to silence GCC 6 warning
H.J. Lu [Fri, 24 Jul 2015 16:05:33 +0000 (09:05 -0700)]
Use 0xffffffffffffffffLL to silence GCC 6 warning

GCC 6 warns:

error: result of ‘4294967295ll << 32’ requires 65 bits to represent, but ‘long long int’ only has 64 bits [-Werror=shift-overflow=]

on ((((bfd_signed_vma) 0xffffffff) << 32) | 0xffffffff).  This patch
replaces it with bfd_signed_vma) 0xffffffffffffffffLL.

* stabs.c (parse_stab_range_type): Use 0xffffffffffffffffLL.

9 years agoFix the evaluation of RL78 complex relocs, by making immediate values be computed...
Nick Clifton [Fri, 24 Jul 2015 15:44:27 +0000 (16:44 +0100)]
Fix the evaluation of RL78 complex relocs, by making immediate values be computed relative to a new absolute symbol.

gas * config/tc-rl78.c (rl78_abs_sym): New local variable.
(md_begin): Initialise the new symbol.
(OPIMM): Define the value to be relative to the new symbol and not
the absolute section symbol.

ld * emulparams/elf32rl78.sh (OTHER_SECTIONS): Provide a value for
the _-rl78_abs__ symbol.

tests * gas/all/struct.d: Allow for extra symbols in the output.
* gas/macros/test1.d: Likewise.
* gas/elf/elf.exp: Add an rl78 machine.
* gas/elf/sections2e-rl78: New file.

tests * binutils-all/localize-hidden-1.d: Allow for extra symbols in the
output.
        * binutils-all/strip-11.d: Skip for the RL78.

9 years agoLinux: sys/ptrace.h -> nat/gdb_ptrace.h everywhere
Pedro Alves [Fri, 24 Jul 2015 13:57:20 +0000 (14:57 +0100)]
Linux: sys/ptrace.h -> nat/gdb_ptrace.h everywhere

So that we pick the enum __ptrace_request fix everywhere.

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

* aarch64-linux-nat.c: Include nat/gdb_ptrace.h instead of
sys/ptrace.h.
* alpha-linux-nat.c: Likewise.
* amd64-linux-nat.c: Likewise.
* arm-linux-nat.c: Likewise.
* hppa-linux-nat.c: Likewise.
* i386-linux-nat.c: Likewise.
* ia64-linux-nat.c: Likewise.
* linux-fork.c: Likewise.
* linux-nat.c: Likewise.
* m32r-linux-nat.c: Likewise.
* m68klinux-nat.c: Likewise.
* mips-linux-nat.c: Likewise.
* nat/linux-btrace.c: Likewise.
* nat/linux-ptrace.c: Likewise.
* nat/linux-ptrace.h
* nat/mips-linux-watch.c: Likewise.
* nat/x86-linux-dregs.c: Likewise.
* ppc-linux-nat.c: Likewise.
* s390-linux-nat.c: Likewise.
* spu-linux-nat.c: Likewise.
* tilegx-linux-nat.c: Likewise.
* x86-linux-nat.c: Likewise.
* xtensa-linux-nat.c: Likewise.

gdb/gdbserver/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.c: Likewise.om>

* linux-aarch64-low.c: Include nat/gdb_ptrace.h instead of
sys/ptrace.h.
* linux-arm-low.c: Likewise.
* linux-cris-low.c: Likewise.
* linux-crisv32-low.c: Likewise.
* linux-low.c: Likewise.
* linux-m68k-low.c: Likewise.
* linux-mips-low.c: Likewise.
* linux-nios2-low.c: Likewise.
* linux-s390-low.c: Likewise.
* linux-sparc-low.c: Likewise.
* linux-tic6x-low.c: Likewise.
* linux-tile-low.c: Likewise.
* linux-x86-low.c: Likewise.

9 years agoC++: handle glibc's ptrace(enum __ptrace_request, ...)
Pedro Alves [Fri, 24 Jul 2015 13:57:20 +0000 (14:57 +0100)]
C++: handle glibc's ptrace(enum __ptrace_request, ...)

Building in C++ mode issues ~40 warnings like this:

 ../../src/gdb/linux-nat.c: In function ‘int linux_handle_extended_wait(lwp_info*, int, int)’:
 ../../src/gdb/linux-nat.c:2016:51: warning: invalid conversion from ‘int’ to ‘__ptrace_request’ [-fpermissive]
ptrace (PTRACE_GETEVENTMSG, pid, 0, &new_pid);

The issue is that in glibc, ptrace's first parameter is an enum.
That's not a problem if we pick the PTRACE_XXX requests from
sys/ptrace.h, as those will be values of the corresponding enum.
However, we have fallback definitions for PTRACE_XXX symbols when the
system headers miss them (such as PTRACE_GETEVENTMSG above), and those
are plain integer constants.  E.g., nat/linux-ptrace.h:

 #define PTRACE_GETEVENTMSG 0x4201

One idea would be to fix this by defining those fallbacks like:

 -#define PTRACE_GETEVENTMSG 0x4201
 +#define PTRACE_GETEVENTMSG ((enum __ptrace_request) 0x4201)

However, while glibc's ptrace uses enum __ptrace_request for first
parameter:

  extern long int ptrace (enum __ptrace_request __request, ...) __THROW;

other libc's, like e.g., Android's bionic do not -- in that case, the
first parameter is int:

  long ptrace(int request, pid_t pid, void * addr, void * data);

So the fix I came up is to make configure/ptrace.m4 also detect the
type of the ptrace's first parameter and defin PTRACE_TYPE_ARG1, as
already does the for parameters 3-4, and then simply wrap ptrace with
a macro that casts the first argument to the detected type.  (I'm
leaving adding a nicer wrapper for when we drop building in C).

While this adds the wrapper, GNU/Linux files won't use it until the
next patch, which makes all native GNU/Linux files include
gdb_ptrace.h.

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

* ptrace.m4 (ptrace tests): Test in C++ mode.  Try with 'enum
__ptrace_request as first parameter type instead of int.
(PTRACE_TYPE_ARG1): Define.
* nat/gdb_ptrace.h [!PTRACE_TYPE_ARG5] (ptrace): Define as wrapper
that casts first argument to PTRACE_TYPE_ARG1.
* config.in: Regenerate.
* configure: Regenerate.

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

* config.in: Regenerate.
* configure: Regenerate.

9 years agoMove gdb_ptrace.h to nat/
Pedro Alves [Fri, 24 Jul 2015 13:57:19 +0000 (14:57 +0100)]
Move gdb_ptrace.h to nat/

Now that gdbserver's configure defines PTRACE_TYPE_ARGx etc., we'll be
able to make gdbserver use gdb_ptrace.h too.  Move it to the native
target files directory.

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

* gdb_ptrace.h: Move ...
* nat/gdb_ptrace.h: ... here.
* inf-ptrace.c: Adjust.

9 years agomake gdbserver use the same ptrace autoconf checks as gdb
Pedro Alves [Fri, 24 Jul 2015 13:57:19 +0000 (14:57 +0100)]
make gdbserver use the same ptrace autoconf checks as gdb

This factors the ptrace checks out of gdb's configure.ac to a new
ptrace.m4 file, and then makes gdbserver's configure.ac source it too.

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

* acinclude.m4: Include ptrace.m4.
* configure.ac: Call GDB_AC_PTRACE and move ptrace checks ...
* ptrace.m4: ... to this new file.

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

* acinclude.m4: Include ../ptrace.m4.
* configure.ac: Call GDB_AC_PTRACE.
* config.in, configure: Regenerate.

9 years agoRemove proc->priv->new_inferior
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Remove proc->priv->new_inferior

As the result of the previous patch, new_inferior is no longer used.
This patch is to remove it.

gdb/gdbserver:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_create_inferior): Remove setting to
proc->priv->new_inferior.
(linux_attach): Likewise.
(linux_low_filter_event): Likewise.
* linux-low.h (struct process_info_private) <new_inferior>: Remove.

9 years agoInitialise target descrption after skipping extra traps for --wrapper
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Initialise target descrption after skipping extra traps for --wrapper

Nowadays, when --wrapper is used, GDBserver skips extra traps/stops
in the wrapper program, and stops at the first instruction of the
program to be debugged.  However, GDBserver created target description
in the first stop of inferior, and the executable of the inferior
is the wrapper program rather than the program to be debugged.  In
this way, the target description can be wrong if the architectures
of wrapper program and program to be debugged are different.  This
is shown by some fails in gdb.server/wrapper.exp on buildbot.

We are testing i686-linux GDB (Fedora-i686) on an x86_64-linux box
(fedora-x86-64-4) in buildbot, such configuration causes fails in
gdb.server/wrapper.exp like this:

spawn /home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/gdb/testsuite/../../gdb/gdbserver/gdbserver --once --wrapper env TEST=1 -- :2346 /home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/gdb/testsuite/outputs/gdb.server/wrapper/wrapper
Process /home/gdb-buildbot-2/fedora-x86-64-4/fedora-i686/build/gdb/testsuite/outputs/gdb.server/wrapper/wrapper created; pid = 8795
Can't debug 64-bit process with 32-bit GDBserver
Exiting
target remote localhost:2346
localhost:2346: Connection timed out.
(gdb) FAIL: gdb.server/wrapper.exp: setting breakpoint at marker

See https://sourceware.org/ml/gdb-testers/2015-q3/msg01541.html

In this case, program to be debugged ("wrapper") is 32-bit but wrapper
program ("/usr/bin/env") is 64-bit, so GDBserver gets the 64-bit
target description instead of 32-bit.

The root cause of this problem is that GDBserver creates target
description too early, and the rationale of fix could be creating
target description once the GDBserver skips extra traps and inferior
stops at the first instruction of the program we want to debug.  IOW,
when GDBserver skips extra traps, the inferior's tdesc is NULL, and
mywait and its callees shouldn't use inferior's tdesc, so in this
patch, we skip code that requires register access, see changes in
linux_resume_one_lwp_throw and need_step_over_p.

In linux_low_filter_event, if target description isn't initialised and
GDBserver attached the process, we create target description immediately,
because GDBserver don't have to skip extra traps for attach, IOW, it
makes no sense to use --attach and --wrapper together.  Otherwise, the
process is launched by GDBserver, we keep the status pending, and return.

After GDBserver skipped extra traps in start_inferior, we call a
target_ops hook arch_setup to initialise target description there.

gdb/gdbserver:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_arch_setup): New function.
(linux_low_filter_event): If proc->tdesc is NULL and
proc->attached is true, call the_low_target.arch_setup.
Otherwise, keep status pending, and return.
(linux_resume_one_lwp_throw): Don't call get_pc if
thread->while_stepping isn't NULL.  Don't call
get_thread_regcache if proc->tdesc is NULL.
(need_step_over_p): Return 0 if proc->tdesc is NULL.
(linux_target_ops): Install arch_setup.
* server.c (start_inferior): Call the_target->arch_setup.
* target.h (struct target_ops) <arch_setup>: New field.
(target_arch_setup): New marco.
* lynx-low.c (lynx_target_ops): Update.
* nto-low.c (nto_target_ops): Update.
* spu-low.c (spu_target_ops): Update.
* win32-low.c (win32_target_ops): Update.

9 years agoSet proc->priv->new_inferior out of linux_add_process
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Set proc->priv->new_inferior out of linux_add_process

Nowadays, we set proc->priv->new_inferior to 1 inside linux_add_process,
and new_inferior is used as a flag to initialise target description later.
linux_add_process is used for the three cases, fork/vfork event
(handle_extended_wait), run the program (linux_create_inferior), and
attach to the process (linux_attach).  In the first case, the child's
target description is copied from parent's, so we don't need to initialise
target description again later, which means we don't need to set
proc->priv->new_inferior to 1 in this case.  For the rest of two cases,
we need this flag.

This patch move the code setting proc->priv->new_inferior to 1 inside
linux_add_process to linux_create_inferior and linux_attach.  No
functionality is changed.

gdb/gdbserver:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_add_process): Don't set
proc->priv->new_inferior.
(linux_create_inferior): Set proc->priv->new_inferior to 1.
(linux_attach): Likewise.

9 years agoRefactor start_inferior
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Refactor start_inferior

This patch is to refactor function start_inferior that signal_pid
is return in one place.

gdb/gdbserver:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* server.c (start_inferior): Code refactor.

9 years agoTest --wrapper when restarting process.
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Test --wrapper when restarting process.

My patch series will affect the code starting inferior in GDBserver
(callees of start_inferior), so we need tests to cover how
start_inferior is used in different cases.

In server.c:process_serial_event, start_inferior is used when
GBDserver receives 'R' packet, and this patch is to add a test
for this path, and see how --wrapper option works when the process
is restarted.

gdb/testsuite:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* gdb.server/ext-wrapper.exp: Test --wrapper option when
restarting process.

9 years agoSet general_thread after restart
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Set general_thread after restart

When I run gdb.server/ext-restart.exp, I get the following GDB internal
error,

run^M
The program being debugged has been started already.^M
Start it from the beginning? (y or n) y^M
Sending packet: $vKill;53c5#3d...Packet received: OK^M
Packet vKill (kill) is supported^M
Sending packet: $vFile:close:6#b6...Packet received: F0^M
Sending packet: $vFile:close:3#b3...Packet received: F0^M
Starting program: /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.server/ext-restart ^M
Sending packet: $QDisableRandomization:1#cf...Packet received: OK^M
Sending packet: $R0#82...Sending packet: $qC#b4...Packet received: QCp53c5.53c5^M  <-- [1]
Sending packet: $qAttached:53c5#c9...Packet received: E01^M
warning: Remote failure reply: E01^M
....
0x00002aaaaaaac2d0 in ?? () from target:/lib64/ld-linux-x86-64.so.2^M
/home/yao/SourceCode/gnu/gdb/git/gdb/thread.c:88: internal-error: inferior_thread: Assertion `tp' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.server/ext-restart.exp: run to main (GDB internal error)
Resyncing due to internal error.

the test is to restart the program, to make sure GDBserver handles
packet 'R' correctly.  From the GDBserver output, we can see,

 Remote debugging from host 127.0.0.1^M
 Process /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.server/ext-restart created; pid = 21445^M
 GDBserver restarting^M
 Process /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.server/ext-restart created; pid = 21446^M
 Killing process(es): 21446

we first start process 21445(0x53c5), kill it and restart a new process
21446.  However, in the gdb output above [1], we can see that the reply
of qC is still the old process id rather than the new one.  Looks
general_thread isn't up to date after GDBserver receives R packet.
This patch is to update general_thread after call start_inferior.

gdb/gdbserver:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* server.c (process_serial_event): Set general_thread.

gdb/testsuite:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* gdb.server/ext-restart.exp: New file.

9 years agoTest --wrapper in extended-remote
Yao Qi [Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)]
Test --wrapper in extended-remote

We didn't test --wrapper option in extended-remote before, this patch
is to add a test case for it.  In order to pass option --wrapper to
gdbserver in extended-remote, I add arg in gdbserver_start_extended,
and its default value is "", so that other places use
gdbserver_start_extended don't have to be updated.

gdb/testsuite:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* lib/gdbserver-support.exp (gdbserver_start_extended): Add
argument options.
* gdb.server/ext-wrapper.exp: New file.

9 years agoReplace -g with -ggdb3 in ld compress tests
H.J. Lu [Fri, 24 Jul 2015 11:14:04 +0000 (04:14 -0700)]
Replace -g with -ggdb3 in ld compress tests

Use -ggdb3 to generate .debug_macro sections, which are bigger and are
always compressed.

* ld-elf/compress.exp (build_tests): Replace -g with -ggdb3.
* ld-elf/zlibbegin.rS: Also expect "GC".
* ld-elf/zlibnormal.rS: Likewise.

9 years agoRemove leading/trailing white spaces in ChangeLog
H.J. Lu [Fri, 24 Jul 2015 11:08:12 +0000 (04:08 -0700)]
Remove leading/trailing white spaces in ChangeLog

9 years agoCorrect reloc section name
Alan Modra [Fri, 24 Jul 2015 05:14:26 +0000 (14:44 +0930)]
Correct reloc section name

* elf.c (_bfd_elf_assign_file_positions_for_non_load): Use .rela
prefix for reloc section corresponding to rela section associated
with renamed debug section.

9 years agobfd_get_section_by_name_if hash chain traversal
Alan Modra [Fri, 24 Jul 2015 05:06:38 +0000 (14:36 +0930)]
bfd_get_section_by_name_if hash chain traversal

This function stops too soon, as I found when the hash chain happened
to contain two .debug_macro sections and a .bss section:
.debug_macro -> .bss -> .debug_macro

* section.c (bfd_get_section_by_name_if): Iterate over entire hash
chain.

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

9 years ago2015-07-23 Ian Coolidge <icoolidge@google.com>
Han Shen [Thu, 23 Jul 2015 22:52:22 +0000 (15:52 -0700)]
2015-07-23  Ian Coolidge  <icoolidge@google.com>

Plumb --pic-veneer option for gold.

gold/ChangeLog:
* arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub generation.
* options.h (General_options): Add --pic-veneer option.

9 years agoFix DT_MIPS_RLD_MAP_REL tag for n64 target and 32-bit host.
Joseph Myers [Thu, 23 Jul 2015 21:52:04 +0000 (21:52 +0000)]
Fix DT_MIPS_RLD_MAP_REL tag for n64 target and 32-bit host.

For the case of MIPS n64 target and 32-bit host, the computation of
the DT_MIPS_RLD_MAP_REL tag involves sdyn->output_section->vma +
sdyn->output_offset (64-bit) being added to b (32-bit host pointer),
so losing the high part and resulting in an incorrect
DT_MIPS_RLD_MAP_REL tag, and all dynamically linked glibc tests
failing for n64.  This patch fixes this (spot-tested with glibc tests;
however, I don't have a self-contained testcase for this bug).

* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections)
<DT_MIPS_RLD_MAP_REL>: Add target address to host address
difference, not to host pointer.

9 years agoFix crash when reading dummy CUs.
Doug Evans [Thu, 23 Jul 2015 16:21:48 +0000 (09:21 -0700)]
Fix crash when reading dummy CUs.

Dummy CUs are used by the incremental linker to pre-allocate space
in the output file. They have a DWARF header but no contents.

gdb/ChangeLog:

* dwarf2read.c (dwarf2_per_cu_data): Add comment.
(load_cu): Handle dummy CUs.
(dw2_do_instantiate_symtab, process_queuef): Ditto.
(dwarf2_fetch_die_loc_sect_off, dwarf2_fetch_constant_bytes): Ditto.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/dw2-dummy-cu.S: New file.
* gdb.dwarf2/dw2-dummy-cu.exp: New file.

9 years agopy-linetable.c: Fix doc of LineTable.source_lines' return type
Ciro Santilli [Thu, 23 Jul 2015 13:36:25 +0000 (06:36 -0700)]
py-linetable.c: Fix doc of LineTable.source_lines' return type

The ltpy_get_all_source_lines function, use to implement
the gdb.LineTable.source_lines method, returns a list:

    source_list = PyDict_Keys (source_dict);
    return source_list;

This patch fixes the function's documentation as well as its docstring
to say that it returns a list rather than a FrozenSet.

gdb/ChangeLog:

        * py-linetable.c (ltpy_get_all_source_lines): Adjust function
        documentation to say that it returns a list rather than
        a FrozenSet.
        (linetable_object_methods): Update the docstring of the
        "source_line" entry.

Tested on x86_64-linux.

9 years agogdb/gdbtypes: fix handling of typedef layers between array types
Pierre-Marie de Rodat [Wed, 22 Jul 2015 10:25:14 +0000 (12:25 +0200)]
gdb/gdbtypes: fix handling of typedef layers between array types

When a dynamic array type contains a typedef-wrapped array, an assertion
failure occurs during type resolution.  This is what happens in the
following Ada case:

    type Rec_Type is record
       I : Integer;
       B : Boolean;
    end record;

    type Vec_Type is array (1 .. 4) of Rec_Type;

    type Array_Type is array (Positive range <>) of Vec_Type;

If users try to print or even pass to an inferior call a variable A of
type Array_Type, GDB will raise an error:

    (gdb) print a
    ../../src/gdb/gdbtypes.c:1807: internal-error:
    resolve_dynamic_array: Assertion `TYPE_CODE (type) ==
    TYPE_CODE_ARRAY' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)

What happens is that during dynamic array type resolution, we first peel
TYPE_CODE_TYPEDEF layers wrapping the array element type and check if
its type is itself TYPE_CODE_ARRAY.  If it is, we pass the
typedef-wrapped type to a recursive call to resolve_dynamic_array
whereas this function expects only TYPE_CODE_ARRAY types.

This patch makes it pass the peeled type to the recursive call so that
type resolution can continue smoothly.

gdb/ChangeLog:

* gdbtypes.c (resolve_dynamic_array): Pass the peeled element
type to the recursive call instead of the original (maybe
TYPE_CODE_TYPEDEF) type.

gdb/testsuite/ChangeLog:

* gdb.ada/var_arr_typedef.exp: New testcase.
* gdb.ada/var_arr_typedef/pack.adb: New file.
* gdb.ada/var_arr_typedef/pack.ads: New file.
* gdb.ada/var_arr_typedef/var_arr_typedef.adb: New file.

9 years agoReturn zero in aarch64_linux_can_use_hw_breakpoint if target doesn't support HW watch...
Yao Qi [Thu, 23 Jul 2015 10:22:34 +0000 (11:22 +0100)]
Return zero in aarch64_linux_can_use_hw_breakpoint if target doesn't support HW watchpoint/breakpoint

Nowadays aarch64_linux_can_use_hw_breakpoint always return one, but it
can be smarter, say, if GDB knows target doesn't support HW watchpoint
or breakpoint because HW watchpoint/breakpoint is disabled in linux
kernel, for example, it can safely return zero.

gdb:

2015-07-23  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): If
TYPE is watchpoint, return zero if aarch64_num_wp_regs is zero.
If TYPE is breakpoint, return zero if arch64_num_bp_regs is zero.

9 years agoFix ubsan signed integer overflow
Alan Modra [Thu, 23 Jul 2015 03:11:38 +0000 (12:41 +0930)]
Fix ubsan signed integer overflow

IMO a fairly useless warning in this case, but technically correct.

PR 18708
* i386-dis.c (get64): Avoid signed integer overflow.

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

9 years agoFix memory operand size for vcvtt?ps2u?qq instructions
H.J. Lu [Wed, 22 Jul 2015 20:24:20 +0000 (13:24 -0700)]
Fix memory operand size for vcvtt?ps2u?qq instructions

When disassembling AVX512 vcvtt?ps2u?q instructions with data
broadcasting enabled, memory operand size should be DWORD.

gas/testsuite/

PR binutils/18631
* gas/i386avx512dq-intel.d: Replace "QWORD" with "DWORD" in
vcvtt?ps2u?qq instructions disassembly regexes.
Add disassembly regex for new test.
* gas/i386/avx512dq.d: Likewise.
* gas/i386/avx512dq_vl-intel.d: Likewise.
* gas/i386/avx512dq_vl.d: Likewise.
* gas/i386/x86-64-avx512dq-intel.d: Likewise.
* gas/i386/x86-64-avx512dq.d: Likewise.
* gas/i386/x86-64-avx512dq_vl-intel.d: Likewise.
* gas/i386/x86-64-avx512dq_vl.d: Likewise.
* gas/i386/avx512dq.s: Add new test for Intel syntax with memory
operand and broadcasting enabled.
* gas/i386/avx512dq_vl.s: Likewise.
* gas/i386/x86-64-avx512dq.s: Likewise.
* gas/i386/x86-64-avx512dq_vl.s: Likewise.

opcodes/

PR binutils/18631
* i386-dis-evex.h (EVEX_W_0F78_P_2): Replace "EXxmmq" with
"EXEvexHalfBcstXmmq" for the second operand.
(EVEX_W_0F79_P_2): Likewise.
(EVEX_W_0F7A_P_2): Likewise.
(EVEX_W_0F7B_P_2): Likewise.

9 years agoreadelf display of 0x800...000 addend
Alan Modra [Wed, 22 Jul 2015 00:56:29 +0000 (10:26 +0930)]
readelf display of 0x800...000 addend

* readelf.c (dump_relocations): Show MIN_INT addends as negative.

9 years agogas line buffer handling
Alan Modra [Wed, 22 Jul 2015 12:28:50 +0000 (21:58 +0930)]
gas line buffer handling

This fixes a segfault when macro definitions end on the last line of a
file, and that line isn't properly terminated with a newline.  gas
used to throw away the last line in cases like this, whereas in other
cases gas added the missing newline.  So I've also made gas
consistently provide a missing newline.

PR gas/18687
* input-scrub.c (input_scrub_next_buffer): Rearrange and simplify
loop.  Don't drop lines at end of file lacking a newline, add a
newline instead.  Ensure partial_size is zero whenever
partial_where is NULL.  Adjust buffer size for extra char.
(input_scrub_push, input_scrub_begin): Adjust buffer size here too.

9 years agoDon't compare symbol addresses directly
H.J. Lu [Wed, 22 Jul 2015 10:36:42 +0000 (03:36 -0700)]
Don't compare symbol addresses directly

GCC 5 will fold symbol address comparison, assuming each symbol has a
different address, which leads to abort.  We should use separate
functions to compare symbol address.

PR gold/18663
* testsuite/Makefile.am (script_test_1_SOURCES): Set to
script_test_1a.cc script_test_1b.cc.
(script_test_11_r.o): Replace script_test_11.o with
script_test_11a.o script_test_11b.o.
(script_test_11.o): Removed.
(script_test_11a.o): New.
(script_test_11b.o): Likewise.
* testsuite/Makefile.in: Regenerated.
* testsuite/script_test_1.h: New file.
* testsuite/script_test_1b.cc: Likewise.
* testsuite/script_test_11.h: Likewise.
* testsuite/script_test_11b.c: Likewise.
* testsuite/script_test_1.cc: Renamed to ...
* testsuite/script_test_1a.cc: This.
Include "script_test_1.h".
(main): Call check_int and check_ptr.
* testsuite/script_test_11.c: Renamed to ...
* testsuite/script_test_11a.c: This.
Include "script_test_11.h".
(main): Call ptr_equal.

9 years agoMark global with hidden attribute
H.J. Lu [Wed, 22 Jul 2015 10:35:47 +0000 (03:35 -0700)]
Mark global with hidden attribute

GCC 5 will generate a relocation for protected symbol:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248

when compiling for a shared library.  It is undefined to access protected
symbol in IFUNC selector function inside a shared library.

PR gold/18628
* testsuite/ifuncdep2.c (global): Change protected to hidden.
* testsuite/ifuncmod1.c (global): Likewise.
* testsuite/ifuncmod5.c (global): Likewise.

9 years agoFix ppc64 ELFv1 assertion failure
Alan Modra [Wed, 22 Jul 2015 09:41:22 +0000 (19:11 +0930)]
Fix ppc64 ELFv1 assertion failure

Bogus assembly can hit an assertion in opd_entry_value when the symbol
referenced by a function descriptor is undefined.  Worse, the code
after the assert copies unitialised memory to return the code section.
This uninitialised pointer can later be dereferencd, possibly causing
a linker segmentation fault.

* elf64-ppc.c (opd_entry_value): Remove assertion.  Instead,
return -1 if symbol referenced is not defined.  Tidy.

9 years agoGOLD aarch64 warning fix
Alan Modra [Tue, 21 Jul 2015 02:40:27 +0000 (12:10 +0930)]
GOLD aarch64 warning fix

aarch64.cc:2026:50: error: integer overflow in expression [-Werror=overflow]
       Insntype adr_insn = adrp_insn & ((1 << 31) - 1);

* aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.

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

9 years agoFix problem where __start_ and __stop_ section symbols do not honor version script.
Cary Coutant [Tue, 21 Jul 2015 23:10:05 +0000 (16:10 -0700)]
Fix problem where __start_ and __stop_ section symbols do not honor version script.

When creating the special __start_ and __stop_ section symbols, gold
does not check the version script to see if they should be local
instead of global.

2015-07-21  Cary Coutant  <ccoutant@gmail.com>

gold/
PR gold/18548
* symtab.cc (Symbol_table::do_define_in_output_data): Check for
forced local symbol even when oldsym != NULL.
(Symbol_table::do_define_in_output_segment): Likewise.
(Symbol_table::do_define_as_constant): Likewise.

9 years agoFix typo in PR number.
Cary Coutant [Tue, 21 Jul 2015 19:50:45 +0000 (12:50 -0700)]
Fix typo in PR number.

    Fix internal error when linking an archive library with no preceding objects.

    gold/
PR gold/18698
* archive.cc (Library_base::should_include_member): Don't use entry
point for relocatable links, or if target is not yet valid.
* parameters.cc (Parameters::entry): Check target_valid().

9 years agoFix internal error when linking an archive library with no preceding objects.
Cary Coutant [Tue, 21 Jul 2015 19:42:07 +0000 (12:42 -0700)]
Fix internal error when linking an archive library with no preceding objects.

gold/
PR gold/18696
* archive.cc (Library_base::should_include_member): Don't use entry
point for relocatable links, or if target is not yet valid.
* parameters.cc (Parameters::entry): Check target_valid().

9 years agoMove aarch64_linux_get_debug_reg_capacity to nat/aarch64-linux-hw-point.c
Yao Qi [Tue, 21 Jul 2015 15:33:41 +0000 (16:33 +0100)]
Move aarch64_linux_get_debug_reg_capacity to nat/aarch64-linux-hw-point.c

There are also some duplication on getting HW watchpoint/breakpoint
registers info between GDB and GDBserver.  This patch moves them
to nat/aarch64-linux-hw-point.c.

Note that ENABLE_NLS is not defined in GDBserver, so it should be OK
to use _( markup.

gdb:

2015-07-21  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity):
Move it to nat/aarch64-linux-hw-point.c.
(aarch64_linux_child_post_startup_inferior): Update.
* nat/aarch64-linux-hw-point.c (aarch64_linux_get_debug_reg_capacity):
New function.
* nat/aarch64-linux-hw-point.h (aarch64_linux_get_debug_reg_capacity):
Declare it.

gdb/gdbserver:

2015-07-21  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_arch_setup): Remove code and call
aarch64_linux_get_debug_reg_capacity.

9 years agobtrace: fix case label in btrace_data_append
Markus Metzger [Wed, 15 Jul 2015 06:43:09 +0000 (08:43 +0200)]
btrace: fix case label in btrace_data_append

gdb/
* common/btrace-common.c (btrace_data_append): Change case label.

9 years ago[ARM] Support correctly spelled ARMv6KZ architecture names
Matthew Wahab [Tue, 21 Jul 2015 08:43:35 +0000 (09:43 +0100)]
[ARM] Support correctly spelled ARMv6KZ architecture names

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

gas/
    * NEWS: Mention corrected spelling of armv6kz.
    * config/tc-arm.c (arm_cpus): Replace ARM_ARCH_V6ZK with
    ARM_ARCH_V6KZ.
    (arm_archs): Likewise. Also add "armv6kz" and "armv6kzt2".
    * doc/c-arm.texi: Replace "armv6zk" with "armv6kz".

gas/testsuite

    * gas/arm/attr-march-armv6kz.d: New.
    * gas/arm/attr-march-armv6kzt2.d: New.

include/opcode

    * arm.h (ARM_AEXT_V6ZK): Rename to ARM_AEXT_V6KZ.
    (ARM_AEXT_V6ZKT2): Rename to ARM_AEXT_V6KZT2.
    (ARM_ARCH_V6ZK): Rename to ARM_ARCH_V6KZ.
    (ARM_ARCH_V6ZKT2): Rename to ARM_ARCH_V6KZT2.

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

9 years agogdb.ada/info_exc.exp: Adjust expected output in "info exception" test.
Joel Brobecker [Mon, 20 Jul 2015 22:09:44 +0000 (15:09 -0700)]
gdb.ada/info_exc.exp: Adjust expected output in "info exception" test.

Since multi_line was moved to gdb.exp in a slightly stricter form,
The gdb.ada/info_exc.exp:info exceptions test has been failing.
This is because it now expects a new-line sequence at the end of
each argument given to multi_line, including ".*". But the intent
when writing the test was to signify "could-be-nothing-at-all".
As a result, the test fails on x86_64-linux with a runtime built as
recommended, because of that
extra new-line sequence.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc.exp: Adjust "info exceptions" expected output.

9 years agoOptimize erratum 843419 fix.
Han Shen [Mon, 20 Jul 2015 20:04:06 +0000 (13:04 -0700)]
Optimize erratum 843419 fix.

gold/ChangeLog:
* aarch64.cc (AArch64_insn_utilities::is_adr): New method.
(AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
(AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
(E843419_stub): New sub-class of Erratum_stub.
(AArch64_relobj::try_fix_erratum_843419_optimized): New method.
(AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
(AArch64_relobj::create_erratum_stub): Add 1 argument.
(Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.

9 years agoUpdate testsuite/pr18689.sh for older GCC
H.J. Lu [Mon, 20 Jul 2015 19:18:06 +0000 (12:18 -0700)]
Update testsuite/pr18689.sh for older GCC

Older GCC, like 4.2, generates .debug_macinfo section instead of
.debug_macro section.  This patch updates testsuite/pr18689.sh to
support it.

9 years agoProperly set arm-specific elf flags wrt hardfp.
Han Shen [Thu, 16 Jul 2015 22:59:16 +0000 (15:59 -0700)]
Properly set arm-specific elf flags wrt hardfp.

gold/ChangeLog:
* arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.

9 years agoClear SHF_COMPRESSED flag bit from input to output
H.J. Lu [Mon, 20 Jul 2015 17:14:26 +0000 (10:14 -0700)]
Clear SHF_COMPRESSED flag bit from input to output

For relocatable link, we should clear the SHF_COMPRESSED flag bit from
input group section.

PR gold/18689
* layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
from input group section for relocatable link.
* testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
(check_DATA): Add pr18689.stdout.
(MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
(pr18689.stdout): New rule.
(pr18689a.o): Likewise.
(pr18689b.o): Likewise.
(pr18689.o): Likewise.
* testsuite/pr18689.c: New file.
* testsuite/pr18689.sh: Likewise.
* testsuite/Makefile.in: Regenerated.

9 years agoMakefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.
Doug Evans [Mon, 20 Jul 2015 16:21:51 +0000 (09:21 -0700)]
Makefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.

gdb/doc/ChangeLog:

* Makefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.

9 years agoRemove warning about references from shared objects to hidden symbols.
Yiran Wang [Mon, 20 Jul 2015 15:47:57 +0000 (08:47 -0700)]
Remove warning about references from shared objects to hidden symbols.

gold/
PR gold/15574
* resolve.cc (Symbol_table): Remove warning about references
from shared objects to hidden symbols.
* testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
* testsuite/Makefile.in: Regenerate.
* testsuite/hidden_test.sh: Check dynamic symbol table; update
expected error messages.

9 years agoFix ARI warnings to nat/aarch64-linux-hw-point.{c,h}
Yao Qi [Mon, 20 Jul 2015 15:29:16 +0000 (16:29 +0100)]
Fix ARI warnings to nat/aarch64-linux-hw-point.{c,h}

This patch is to fix two ARI warnings for nat/aarch64-linux-hw-point.{c,h}.

gdb:

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

* nat/aarch64-linux-hw-point.c (aarch64_handle_unaligned_watchpoint):
Re-indent the code.
* nat/aarch64-linux-hw-point.h: Use ULONGEST rather than
"unsigned long long".

9 years agoMake binutils abort message GDB friendly
H.J. Lu [Fri, 17 Jul 2015 15:29:26 +0000 (08:29 -0700)]
Make binutils abort message GDB friendly

We used to generate abort messages like:

internal error, aborting at .../bfd/elf64-x86-64.c line 1554 in elf_x86_64_check_relocs

We can't cut and paste "file line ???" to GDB.  This patch changes those
abort messages to

internal error, aborting at .../bfd/elf64-x86-64.c:1554 in elf_x86_64_check_relocs

so that we can cut and paste "file:???" to GDB.

bfd/

* bfd.c (_bfd_abort): Replace " line " with ":" in output
message.

gas/

* messages.c (as_assert): Replace " line " with ":" in output
message.
(as_abort): Likewise.

ld/

* ldmisc.c (ld_abort): Replace " line " with ":" in output
message.

9 years agoRegen two files
Alan Modra [Mon, 20 Jul 2015 05:01:23 +0000 (14:31 +0930)]
Regen two files

bfd/
* po/SRC-POTFILES.in: Regenerate.
binutils/
* doc/Makefile.in: Regenerate.

9 years agoALIGN change affects cris scripts
Alan Modra [Mon, 20 Jul 2015 04:59:37 +0000 (14:29 +0930)]
ALIGN change affects cris scripts

More fallout from a2c59f28.  This one could have been fixed by simply
using ". = ALIGN (ABSOLUTE (.), 2);" but it's nicer to align the
section.

* emulparams/criself.sh (INIT_ADDR, FINI_ADDR): Define.
(INIT_START, FINI_START): Don't ALIGN.
* scriptempl/elf.sc (.init, .fini): Apply INIT_ADDR/FINI_ADDR.

9 years agoALIGN change affects standard scripts
Alan Modra [Mon, 20 Jul 2015 04:59:21 +0000 (14:29 +0930)]
ALIGN change affects standard scripts

a2c59f28 changed the way the unary ALIGN behaved inside output sections,
resulting in cris-elf testsuite regressions.  This patch pads out .bss
in the same manner as it was prior to the ALIGN change.

* scripttempl/elf.sc (.ldata, .bss): Align absolute value of dot.
* ldexp.c (is_align_conditional): Handle binary ALIGN.
(exp_fold_tree_1): Move code setting SEC_KEEP for assignments to
dot inside output sections.  Handle absolute expressions.

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

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

9 years agodwarf2read: Allow SEC_ALLOC sections to be located at address 0.
Kevin Buettner [Sat, 11 Jul 2015 00:41:55 +0000 (17:41 -0700)]
dwarf2read: Allow SEC_ALLOC sections to be located at address 0.

GDB already allows statically initialized variables, located in
SEC_LOAD sections, to be placed at address 0.  This change allows
uninitialized variables (which are in SEC_ALLOC sections) to be placed
address 0 as well.

gdb/ChangeLog:

* dwarf2read.c (dwarf2_locate_sections): Allow has_section_at_zero
to be set for SEC_ALLOC sections too.

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

9 years agoMove common aarch64 HW breakpoint/watchpoint code to nat/
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
Move common aarch64 HW breakpoint/watchpoint code to nat/

When I look at test fails related to watchpoint on aarch64-linux,
I find there are some code duplicates between GDB and GDBserver.
This patch is to move some of them to a nat/aarch64-linux-hw-point.{h,c}.

The only change I do is about the dr_changed_t typedef, which was
ULONGEST in GDB and 'unsigned long long' in GDBserver.  Each bit
of dr_changed_t represents a status of each HW breakpoint or
watchpoint register, and the max number of HW breakpoint or watchpoint
registers is 16, so the width of 'unsigned long long' is sufficient.

gdb:

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

* Makefile.in (HFILES_NO_SRCDIR): Add
nat/aarch64-linux-hw-point.h.
(aarch64-linux-hw-point.o): New rule.
* nat/aarch64-linux-hw-point.h: New file.
* nat/aarch64-linux-hw-point.c: New file.
* aarch64-linux-nat.c: Include nat/aarch64-linux-hw-point.h.
(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
(AARCH64_HWP_ALIGNMENT): Likewise.
(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
(struct aarch64_debug_reg_state): Likewise.
(struct arch_lwp_info): Likewise.
(aarch64_linux_set_debug_regs): Likewise.
(aarch64_notify_debug_reg_change): Remove static.
(aarch64_align_watchpoint): Likewise.
(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
(aarch64_watchpoint_length): Likewise.
(aarch64_point_encode_ctrl_reg): Likewise
(aarch64_point_is_aligned): Likewise.
(aarch64_dr_state_insert_one_point): Likewise.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
* config/aarch64/linux.mh (NAT_FILE): Add
aarch64-linux-hw-point.o.

gdb/gdbserver:

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

* Makefile.in (aarch64-linux-hw-point.o): New rule.
* configure.srv (srv_tgtobj): Append aarch64-linux-hw-point.o.
* linux-aarch64-low.c: Include nat/aarch64-linux-hw-point.h.
(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
(AARCH64_HWP_ALIGNMENT): Likewise.
(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
(struct aarch64_debug_reg_state): Likewise.
(struct arch_lwp_info): Likewise.
(aarch64_align_watchpoint): Likewise.
(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
(aarch64_watchpoint_length): Likewise.
(aarch64_point_encode_ctrl_reg): Likewise
(aarch64_point_is_aligned): Likewise.
(aarch64_align_watchpoint): Likewise.
(aarch64_linux_set_debug_regs):
(aarch64_dr_state_insert_one_point): Likewise.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.

9 years agoPass aarch64_debug_reg_state to functions
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
Pass aarch64_debug_reg_state to functions

Some functions on handling HW watchpoint in GDB and GDBserver looks the
same except the code getting debug register state from current inferior.
In GDB, we get debug register state like this:

  state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));

while in GDBserver, we get debug register state like this:

  state = aarch64_get_debug_reg_state ();

This patch is to move two lines above out of some functions, and pass
aarch64_debug_reg_state to these functions, in this way, these functions
are the same, and can be moved to a common place.

gdb:

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

* aarch64-linux-nat.c (aarch64_handle_breakpoint): Add argument
state and don't call aarch64_get_debug_reg_state.  All callers
update.
(aarch64_linux_insert_hw_breakpoint): Call
aarch64_get_debug_reg_state earlier.
(aarch64_linux_remove_hw_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Add argument state and
don't call aarch64_get_debug_reg_state.  All callers update.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Add argument state.
(aarch64_linux_insert_watchpoint): Call aarch64_get_debug_reg_state
earlier.
(aarch64_linux_remove_watchpoint): Likewise.

gdb/gdbserver:

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

* linux-aarch64-low.c (aarch64_handle_breakpoint): Add argument state
and don't aarch64_get_debug_reg_state.  All callers update.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
(aarch64_insert_point): Call aarch64_get_debug_reg_state earlier.
(aarch64_remove_point): Likewise.

9 years agoUse debug_printf to print debug message
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
Use debug_printf to print debug message

Some functions in aarch64-linux-nat.c and linux-aarch64-low.c looks
the same except for the code printing debug message.  In GDB, we use
fprintf_unfiltered (gdb_stdlog, ...) while in GDBserver, we use
fprintf (stderr, ...).  This patch is to change them to use debug_printf
so that these functions are the same, and I can move them to a common
place in the following patch.

gdb:

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

* aarch64-linux-nat.c (aarch64_show_debug_reg_state): Use
debug_printf.
(aarch64_handle_unaligned_watchpoint): Likewise.

gdb/gdbserver:

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

* linux-aarch64-low.c (aarch64_show_debug_reg_state): Use
debug_printf.
(aarch64_handle_unaligned_watchpoint): Likewise.

9 years agoint -> enum target_hw_bp_type in aarch64-linux-nat.c
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
int -> enum target_hw_bp_type in aarch64-linux-nat.c

This patch is to use 'enum target_hw_bp_type' instead of int for
breakpoint type, in order to make some functions in GDB and
GDBserver looks similar.

gdb:

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

* aarch64-linux-nat.c (aarch64_dr_state_insert_one_point): Change
argument type's type to 'enum target_hw_bp_type'.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_linux_insert_hw_breakpoint): Likewise.
(aarch64_linux_remove_hw_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.

9 years agoCall ptid_get_pid instead of get_thread_id in aarch64_linux_get_debug_reg_capacity
Yao Qi [Fri, 17 Jul 2015 13:06:34 +0000 (14:06 +0100)]
Call ptid_get_pid instead of get_thread_id in aarch64_linux_get_debug_reg_capacity

aarch64_linux_get_debug_reg_capacity is called by
aarch64_linux_child_post_startup_inferior, and argument ptid is created in
inf-ptrace.c:inf_ptrace_create_inferior,

  /* On some targets, there must be some explicit actions taken after
     the inferior has been started up.  */
  target_post_startup_inferior (pid_to_ptid (pid));

so in aarch64_linux_get_debug_reg_capacity, we can get pid by ptid_get_pid,
and don't need to use get_thread_id.

gdb:

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

* aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity): Call
ptid_get_pid instead of get_thread_id.

9 years ago[AArch64] Sort TLS reloc types alphabetically
Jiong Wang [Fri, 17 Jul 2015 12:03:26 +0000 (13:03 +0100)]
[AArch64] Sort TLS reloc types alphabetically

9 years agoFix using uninitialised values
Yao Qi [Fri, 17 Jul 2015 11:14:59 +0000 (12:14 +0100)]
Fix using uninitialised values

We did a code refacotr here
https://sourceware.org/ml/gdb-patches/2013-11/msg00063.html

> (get_current_thread): New function, factored out from ...
> (add_current_inferior_and_thread): ... this.  Adjust.
>
>@@ -3332,18 +3371,8 @@ add_current_inferior_and_thread (char *wait_status)
>
>   inferior_ptid = null_ptid;
>
>-  /* Now, if we have thread information, update inferior_ptid.  First
>-     if we have a stop reply handy, maybe it's a T stop reply with a
>-     "thread" register we can extract the current thread from.  If
>-     not, ask the remote which is the current thread, with qC.  The
>-     former method avoids a roundtrip.  Note we don't use
>-     remote_parse_stop_reply as that makes use of the target
>-     architecture, which we haven't yet fully determined at this
>-     point.  */
>-  if (wait_status != NULL)
>-    ptid = stop_reply_extract_thread (wait_status);
>-  if (ptid_equal (ptid, null_ptid))
>-    ptid = remote_current_thread (inferior_ptid);
>+  /* Now, if we have thread information, update inferior_ptid.  */
>+  ptid = get_current_thread (wait_status);

but after the refactor, local variable ptid is used without
initialisation.  However, before this change, ptid is initialised to
null_ptid.  This error can be found by valgrind too...

==3298==    at 0x6B99BA: ptid_equal (ptid.c:80)
==3298==    by 0x4C67FF: get_current_thread (remote.c:3484)
==3298==    by 0x4C6951: add_current_inferior_and_thread (remote.c:3511)
==3298==    by 0x4C762C: extended_remote_create_inferior (remote.c:8506)
==3298==    by 0x5A5312: run_command_1 (infcmd.c:606)
==3298==    by 0x68B4FB: execute_command (top.c:463)
==3298==    by 0x5C7214: command_handler (event-top.c:494)
==3298==    by 0x5C78A3: command_line_handler (event-top.c:692)
==3298==    by 0x6DEB57: rl_callback_read_char (callback.c:220)
==3298==    by 0x5C7278: rl_callback_read_char_wrapper (event-top.c:171)
==3298==    by 0x5C72C2: stdin_event_handler (event-top.c:432)
==3298==    by 0x5C6194: gdb_wait_for_event (event-loop.c:834)

This patch initialises local variable ptid to null in get_current_thread.
We don't need to initialise ptid in add_current_inferior_and_thread,
so this patch also removes the ptid initialisation.

gdb:

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

* remote.c (get_current_thread): Initialise ptid to null_ptid.
(add_current_inferior_and_thread): Don't initialise ptid.

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

9 years agostabs.texinfo: @include gdb-cfg.texi.
Doug Evans [Thu, 16 Jul 2015 16:48:03 +0000 (09:48 -0700)]
stabs.texinfo: @include gdb-cfg.texi.

gdb/doc/ChangeLog:

* stabs.texinfo: @include gdb-cfg.texi.

9 years agoFix gdb.arch/i386-biarch-core.exp FAIL on i386.
Jan Kratochvil [Thu, 16 Jul 2015 16:01:22 +0000 (18:01 +0200)]
Fix gdb.arch/i386-biarch-core.exp FAIL on i386.

This new test fails on i686 buildbot slaves,

(gdb) core-file /home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core
"/home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core"
is not a core dump: File format not recognized
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file

There are two problems:

(1) The testcase did not really test if elf64-i386 is supported by GDB (BFD).
That was OK for a Fedora testcase but I forgot about it when submitting it
upstream.

I haven't really verified if the GNU target is elf64-little but it seems so,
no other one seems suitable from:
elf32-x86-64
elf64-big
elf64-k1om
elf64-l1om
elf64-little
elf64-x86-64
pei-x86-64

(2) The output of the "core-file" command itself can be arbitrary as the
elf64-i386 file with x86_64 registers is really broken; but that does not
matter much, important is the following test whether core file memory is
readable.
./configure --enable-64-bit-bfd
(gdb) core-file /home/jkratoch/redhat/gdb-test-build32-plus64/gdb/testsuite/gdb.arch/i386-biarch-core.core^M
warning: Couldn't find general-purpose registers in core file.^M
Failed to read a valid object file image from memory.^M
warning: Couldn't find general-purpose registers in core file.^M
#0  <unavailable> in ?? ()^M
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file
x/i 0x400078^M
   0x400078:    hlt    ^M
(gdb) PASS: gdb.arch/i386-biarch-core.exp: .text is readable

I do not know much dejagnu but I expect 'istarget' tests against the site.exp
'target_triplet' content which is set to the primary GDB target
(--target=...).

GDB is normally never configured for primary target elf64-i386, I think BFD
does not know such explicit target, it gets recognized as elf64-little.

In fact many testfiles of the GDB testsuite are wrong as they require
'istarget' (therefore primary GDB target) even for just loading arch specific
files which would be sufficient with secondary target (--enable-targets=...)
support.

This my new patch removes this 'istarget' check as it is IMO unrelated to what
we need to test.  Although you are right we do 'x/i' and test for 'hlt' so
I think we should test also for available 'set architecture i386'.
We could also test by 'x/bx' instead of 'x/i' to avoid such additional
test/requirement.

This testcase comes from a different bug from 2009:
https://bugzilla.redhat.com/show_bug.cgi?id=457187
http://pkgs.fedoraproject.org/cgit/gdb.git/commit/?id=94cd124608bf0dd359cb48a710800d72c21b30c3

That bug has been fixed in the meantime but the same testcase was reproducing
this new different bug - internal error regression - so I submitted it.

We can remove the "x/bx $address" test but it was useful for the previous bug
from 2009 as that time the internal error regression did not happen, just the
core file was not recognized (which would not be detected by the proposed
ignoring of the "core-file" command output) and so the core file was not
available.  That can be tested by the "x/bx $address" test.

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

* gdb.arch/i386-biarch-core.exp: Replace istarget
by "complete set gnutarget". Remove expectation for the "core-file"
command.

9 years agoUpdates the ARM disassembler's output of floating point constants to include the...
Alessandro Marzocchi [Thu, 16 Jul 2015 15:38:48 +0000 (16:38 +0100)]
Updates the ARM disassembler's output of floating point constants to include the actual floating point value.

opcodes * arm-dis.c (print_insn_coprocessor): Added support for quarter
float bitfield format.
(coprocessor_opcodes): Changed VFP vmov reg,immediate to use new
quarter float bitfield format.

tests * gas/arm/vfpv3-const-conv.d: Update expected result due to change
of comment for vmov reg,immediate with VFP coprocessor.

9 years agoCorrect readelf dynamic section buffer overlow test
Alan Modra [Thu, 16 Jul 2015 14:43:22 +0000 (00:13 +0930)]
Correct readelf dynamic section buffer overlow test

PR binutils/18672
* readelf.c (get_32bit_dynamic_section): Correct buffer limit test.
(get_64bit_dynamic_section): Likewise.

9 years ago[AArch64][3/3] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21
Jiong Wang [Thu, 16 Jul 2015 14:46:21 +0000 (15:46 +0100)]
[AArch64][3/3] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21

9 years ago[AArch64][2/3] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21
Jiong Wang [Thu, 16 Jul 2015 14:43:21 +0000 (15:43 +0100)]
[AArch64][2/3] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21

9 years ago[AArch64][1/3] Add R_AARCH64_P32_TLSLD_ADR_PREL21 in elf header
Jiong Wang [Thu, 16 Jul 2015 14:38:32 +0000 (15:38 +0100)]
[AArch64][1/3] Add R_AARCH64_P32_TLSLD_ADR_PREL21 in elf header

9 years ago[ARM] Add crypto-neon-fp-armv8.1 as an fpu option
Matthew Wahab [Thu, 16 Jul 2015 14:11:30 +0000 (15:11 +0100)]
[ARM] Add crypto-neon-fp-armv8.1 as an fpu option

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

gas/
  * config/tc-arm.c (arm_fpus): Add crypto-neon-fp-armv8.1.
  * doc/c-arm.texi (-mfpu=): Likewise.  Correct the entry for
  neon-fp-armv8.1.

9 years ago[ARM] Make human parsing of "processor does not support instruction in mode" error...
James Greenhalgh [Thu, 16 Jul 2015 13:43:00 +0000 (14:43 +0100)]
[ARM] Make human parsing of "processor does not support instruction in mode" error messages easier

2015-07-16  James Greenhalgh  <james.greenhalgh@arm.com>

      gas/
* config/tc-arm.c (md_assemble): Rephrase the "selected processor does
not support ARM mode" error messages.

      gas/testsuite/
* gas/arm/arch7em-bad.l: Update expected errors.
* gas/arm/arch7m-bad.l: Likewise.
* gas/arm/arm-idiv-bad.l: Likewise.
* gas/arm/arm7-bad.l: Likewise.
* gas/arm/armv1-bad.l: Likewise.
* gas/arm/thumb-w-bad.l: Likewise.

9 years ago[AArch64] Mark single precision pseudo registers unavailable if invalid
Pierre Langlois [Thu, 16 Jul 2015 09:16:14 +0000 (10:16 +0100)]
[AArch64] Mark single precision pseudo registers unavailable if invalid

I noticed two failure in gdb.trace/mi-trace-frame-collected.exp:

FAIL: gdb.trace/mi-trace-frame-collected.exp: live:
  -trace-frame-collected (register)
FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile:
  -trace-frame-collected (register)

In these cases, we are not collecting registers so the MI command
-trace-frame-collected should only give us the value of the PC.
However, it also gives us all of the single precision pseudo registers,
initialized with 0x0.

We can reproduce this error by simply issuing the
'maint print cooked-register' when no inferior is connected:

~~~
...
(gdb) maint print cooked-register
 Name         Nr  Rel Offset    Size  Type            Cooked value
 x0            0    0      0       8 long            <unavailable>
 x1            1    1      8       8 long            <unavailable>
 ...
 d30         130   62   1540       8 *1              <unavailable>
 d31         131   63   1548       8 *1              <unavailable>
 s0          132   64   1556       4 *1              0x00000000
 s1          133   65   1560       4 *1              0x00000000
 s2          134   66   1564       4 *1              0x00000000
 ...
 s28         160   92   1668       4 *1              0x00000000
 s29         161   93   1672       4 *1              0x00000000
 s30         162   94   1676       4 *1              0x00000000
 s31         163   95   1680       4 *1              0x00000000
 h0          164   96   1684       2 *1              <unavailable>
 h1          165   97   1686       2 *1              <unavailable>
 h2          166   98   1688       2 *1              <unavailable>
 ...
~~~

It turns out GDB does not check if S registers are valid before returning
a value for them.  It should return <unavailable> in this case.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_pseudo_read_value): Mark S register as
unavailable if invalid.

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

9 years agoRevert the previous 7 commits of: Validate binary before use
Jan Kratochvil [Wed, 15 Jul 2015 18:27:32 +0000 (20:27 +0200)]
Revert the previous 7 commits of: Validate binary before use

ddc98fbf2fd9e244a215a4d09e559180dc573a14 Create empty nat/linux-maps.[ch] and common/target-utils.[ch]
6e5b4429db0d66e2d0b27e1bcfe4709f3dae73ed Move gdb_regex* to common/
f7af1fcd759fa126612018a5916cf808df7bb8bc Prepare linux_find_memory_regions_full & co. for move
9904185cfde13d6c6849f1f042c8e3b74974cf08 Move linux_find_memory_regions_full & co.
700ca40f6fc1addd7238f4ab57f76c095ad3c99f gdbserver build-id attribute generator
ca5268b6be265580b91ef75c1a1a9815f581ae42 Validate symbol file using build-id
0a94970d663a053c523f23ac0d71deb25a77f709 Tests for validate symbol file using build-id

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

Revert the previous 6 commits:
Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
Move gdb_regex* to common/
Prepare linux_find_memory_regions_full & co. for move
Move linux_find_memory_regions_full & co.
gdbserver build-id attribute generator
Validate symbol file using build-id

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

Revert the previous 3 commits:
Move gdb_regex* to common/
Move linux_find_memory_regions_full & co.
gdbserver build-id attribute generator

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

Revert the previous 2 commits:
gdbserver build-id attribute generator
Validate symbol file using build-id

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

Revert the previous commit:
Tests for validate symbol file using build-id.

9 years agoTests for validate symbol file using build-id
Jan Kratochvil [Sun, 12 Jul 2015 18:59:03 +0000 (20:59 +0200)]
Tests for validate symbol file using build-id

New testcase.

gdb/testsuite/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com

Tests for validate symbol file using build-id.
* gdb.base/solib-mismatch-lib.c: New file.
* gdb.base/solib-mismatch-libmod.c: New file.
* gdb.base/solib-mismatch.c: New file.
* gdb.base/solib-mismatch.exp: New file.

9 years agoValidate symbol file using build-id
Jan Kratochvil [Wed, 15 Jul 2015 15:37:28 +0000 (17:37 +0200)]
Validate symbol file using build-id

Consumer part of the "build-id" attribute.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Validate symbol file using build-id.
* NEWS (Changes since GDB 7.10): Add 'set validate-build-id'
and 'show validate-build-id'.  Add build-id attribute.
* solib-darwin.c (_initialize_darwin_solib): Assign validate value.
* solib-dsbt.c (_initialize_dsbt_solib): Ditto.
* solib-frv.c (_initialize_frv_solib): Ditto.
* solib-spu.c (set_spu_solib_ops): Ditto.
* solib-svr4.c: Include rsp-low.h.
(NOTE_GNU_BUILD_ID_NAME): New define.
(svr4_validate): New function.
(svr4_copy_library_list): Duplicate field build_id.
(library_list_start_library): Parse 'build-id' attribute.
(svr4_library_attributes): Add 'build-id' attribute.
(_initialize_svr4_solib): Assign validate value.
* solib-target.c (solib.h): Include.
(_initialize_solib_target): Assign validate value.
* solib.c (validate_build_id, show_validate_build_id): New.
(solib_map_sections): Use ops->validate.
(clear_so): Free build_id.
(default_solib_validate): New function.
(_initialize_solib): Add "validate-build-id".
* solib.h (default_solib_validate): New declaration.
* solist.h (struct so_list): New fields 'build_idsz' and 'build_id'.
(target_so_ops): New field 'validate'.

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

* gdb.texinfo (Files): Add 'set validate-build-id'
and 'show validate-build-id'.

9 years agogdbserver build-id attribute generator
Jan Kratochvil [Wed, 15 Jul 2015 15:37:28 +0000 (17:37 +0200)]
gdbserver build-id attribute generator

Producer part of the new "build-id" XML attribute.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

gdbserver build-id attribute generator.
* features/library-list-svr4.dtd (library-list-svr4): New
'build-id' attribute.

gdb/doc/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

gdbserver build-id attribute generator.
* gdb.texinfo (Library List Format for SVR4 Targets): Add
'build-id' in description, example, new attribute in dtd.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

gdbserver build-id attribute generator.
* linux-low.c (nat/linux-maps.h, search.h, rsp-low.h): Include.
(ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New.
(ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New.
(find_phdr): New.
(get_dynamic): Use find_pdhr to traverse program headers.
(struct mapping_entry, mapping_entry_s, free_mapping_entry_vec)
(compare_mapping_entry_range, struct find_memory_region_callback_data)
(read_build_id, find_memory_region_callback, lrfind_mapping_entry)
(get_hex_build_id): New.
(linux_qxfer_libraries_svr4): Add optional build-id attribute
to reply XML document.

9 years agoMove linux_find_memory_regions_full & co.
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Move linux_find_memory_regions_full & co.

This should be just a move with no changes.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Move linux_find_memory_regions_full & co.
* linux-tdep.c (nat/linux-maps.h): Include.
(gdb_regex.h): Remove the include.
(enum filterflags, struct smaps_vmflags, read_mapping, decode_vmflags)
(mapping_is_anonymous_p, dump_mapping_p): Moved to nat/linux-maps.c.
(linux_find_memory_region_ftype): Moved typedef to nat/linux-maps.h.
(linux_find_memory_regions_full): Moved definition to nat/linux-maps.c.
* nat/linux-maps.c: Include ctype.h, target/target-utils.h, gdb_regex.h
and target/target.h.
(struct smaps_vmflags, read_mapping, decode_vmflags)
(mapping_is_anonymous_p, dump_mapping_p): Move from linux-tdep.c.
(linux_find_memory_regions_full): Move from linux-tdep.c.
* nat/linux-maps.h (read_mapping): New declaration.
(linux_find_memory_region_ftype, enum filterflags): Moved from
linux-tdep.c.
(linux_find_memory_regions_full): New declaration.
* target.c (target/target-utils.h): Include.
(read_alloc_pread_ftype): Moved typedef to target/target-utils.h.
(read_alloc, read_stralloc_func_ftype, read_stralloc): Moved
definitions to target/target-utils.c.
* target.h (target_fileio_read_stralloc): Move it to target/target.h.
* target/target-utils.c (read_alloc, read_stralloc): Move definitions
from target.c.
* target/target-utils.h (read_alloc_pread_ftype): New typedef.
(read_alloc): New declaration.
(read_stralloc_func_ftype): New typedef.
(read_stralloc): New declaration.
* target/target.h (target_fileio_read_stralloc): Move it from target.h.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

* target.c: Include target/target-utils.h and fcntl.h.
(target_fileio_read_stralloc_1_pread, target_fileio_read_stralloc_1)
(target_fileio_read_stralloc): New functions.

9 years agoPrepare linux_find_memory_regions_full & co. for move
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Prepare linux_find_memory_regions_full & co. for move

Prepare code for move into gdb/common/.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Prepare linux_find_memory_regions_full & co. for move.
* linux-tdep.c (linux_find_memory_region_ftype): Comment.
(linux_find_memory_regions_full): Change signature and prepare
for moving to linux-maps.
(linux_find_memory_regions_data): Rename field 'obfd' to 'data'.
(linux_find_memory_regions_thunk): New.
(linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'.
(linux_find_memory_regions_gdb): New.
(linux_find_memory_regions): Rename argument 'obfd' to 'func_data'.
(linux_make_mappings_corefile_notes): Use
linux_find_memory_regions_gdb.
* target.c (read_alloc_pread_ftype): New typedef.
(target_fileio_read_alloc_1_pread): New function.
(read_alloc): Refactor from target_fileio_read_alloc_1.
(read_stralloc_func_ftype): New typedef.
(target_fileio_read_alloc_1): New implementation. Use read_alloc.
(read_stralloc): Refactored from target_fileio_read_stralloc.
(target_fileio_read_stralloc): New implementation, use read_stralloc.

9 years agoMove gdb_regex* to common/
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Move gdb_regex* to common/

Later patches need regex support also in gdbserver.

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

* Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to
common/gdb_regex.h.
(COMMON_OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex,
--without-included-regex and USE_INCLUDED_REGEX.
* common/gdb_regex.c: New file from utils.c functions.
* common/gdb_regex.h: Move it here from gdb_regex.h, update include
file wrapping define name.
* configure: Rebuilt.
* configure.ac (gdb_use_included_regex, --without-included-regex)
(USE_INCLUDED_REGEX): Move them to common/common.m4.
* gdb_regex.h: Move it to common/gdb_regex.h.
* utils.c: Remove include gdb_regex.h.
(do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error)
(compile_rx_or_error): Move them to common/gdb_regex.c.

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

* Makefile.in (OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* config.in: Rebuilt.
* configure: Rebuilt.

9 years agoCreate empty nat/linux-maps.[ch] and common/target-utils.[ch]
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Create empty nat/linux-maps.[ch] and common/target-utils.[ch]

Prepare new files for later move.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
* Makefile.in (HFILES_NO_SRCDIR); Add nat/linux-maps.h,
common/target-utils.h.
(COMMON_OBS): Add target-utils.o.
(linux-maps.o, target-utils.o): New.
* target/target-utils.c: New file.
* target/target-utils.h: New file.
* config/i386/linux.mh (NATDEPFILES): Add linux-maps.o.
* config/i386/linux64.mh (NATDEPFILES): Ditto.
* nat/linux-maps.c: New file.
* nat/linux-maps.h: New file.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
* Makefile.in (OBS): Add target-utils.o.
(linux-maps.o, target-utils.o): New.
* configure.srv (srv_linux_obj): Add linux-maps.o.

9 years agoUnbreak nios2-*-linux* GDB testing.
Sandra Loosemore [Wed, 15 Jul 2015 15:30:14 +0000 (08:30 -0700)]
Unbreak nios2-*-linux* GDB testing.

2015-07-15  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/sigaltstack.exp (finish_test): Add kfail for
nios2-*-linux*.
* gdb.base/sigbpt.exp (stepi_out): Likewise.
* gdb.base/siginfo.exp: Likewise.
* gdb.base/sigstep.exp (advance, advancei): Likewise.