external/binutils.git
11 years ago * gdb.python/py-arch.exp: Tweak test name for bad memory access test.
Doug Evans [Thu, 7 Nov 2013 06:39:27 +0000 (22:39 -0800)]
* gdb.python/py-arch.exp: Tweak test name for bad memory access test.

11 years agodaily update
Alan Modra [Wed, 6 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agoS390: Fix TDB regset recognition
Andreas Arnez [Tue, 5 Nov 2013 17:43:50 +0000 (18:43 +0100)]
S390: Fix TDB regset recognition

When checking for the presence of the TDB regset, the current code
interprets ENODATA from PTRACE_GETREGSET as an indication that the TDB
regset *could* occur on this system, but the inferior stopped outside
a transaction.  However, the Linux kernel actually reports ENODATA
even on systems without the transactional execution facility.  Thus
the logic is now changed to check the TE field in the HWCAP as well.

This version also checks the existence of the TDB regset -- just to be
on the safe side when running on TE-enabled hardware with a kernel
that does not offer the TDB regset for some reason.

gdb/
* s390-linux-nat.c (s390_read_description): Consider the TE field
in the HWCAP for determining 'have_regset_tdb'.

gdbserver/
* linux-s390-low.c (HWCAP_S390_TE): New define.
(s390_arch_setup): Consider the TE field in the HWCAP for
determining 'have_regset_tdb'.

11 years agoFix assert failure with --emit-relocs and .eh_frame sections.
Cary Coutant [Wed, 6 Nov 2013 18:34:26 +0000 (10:34 -0800)]
Fix assert failure with --emit-relocs and .eh_frame sections.

gold/
PR gold/15758
* object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
before reloc sections.

11 years agogdb/dwarf2read.c: Sanity check DW_AT_sibling values.
Will Newton [Fri, 1 Nov 2013 21:14:50 +0000 (14:14 -0700)]
gdb/dwarf2read.c: Sanity check DW_AT_sibling values.

When reading objects with corrupt debug information it is possible that
the sibling chain can form a loop, which leads to an infinite loop and
memory exhaustion.

Avoid this situation by disregarding and DW_AT_sibling values that point
to a lower address than the current entry.

gdb/ChangeLog:

2013-11-06  Will Newton  <will.newton@linaro.org>

PR gdb/12866
* dwarf2read.c (skip_one_die): Sanity check DW_AT_sibling
values.  (read_partial_die): Likewise.

11 years agoRevert "2013-11-06 Muhammad Bilal <mbilal@codesourcery.com>"
Muhammad Bilal [Wed, 6 Nov 2013 14:43:45 +0000 (19:43 +0500)]
Revert "2013-11-06  Muhammad Bilal  <mbilal@codesourcery.com>"

This reverts commit dd99d3d15a7d8f41e139dea7871c4fe44cd4b616.

11 years ago2013-11-06 Muhammad Bilal <mbilal@codesourcery.com>
Muhammad Bilal [Wed, 6 Nov 2013 13:53:50 +0000 (18:53 +0500)]
2013-11-06  Muhammad Bilal  <mbilal@codesourcery.com>

PR cli/15224
* top.c (init_main): 'set history save on' by default.

11 years ago[DOC] shell startup files, clarifications and fixes.
Pedro Alves [Wed, 6 Nov 2013 12:26:55 +0000 (12:26 +0000)]
[DOC] shell startup files, clarifications and fixes.

When Bash is started non-interactively, it runs the script pointed by
the BASH_ENV environment variable, not .bashrc.  While at it, mention
Z shell in the warning too, and mention non-interactive mode
explicitly.

gdb/doc/
2013-11-06  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Starting) <set/show startup-with-shell>: Mention
non-interactive mode.
(Environment) <shell startup files warning>: Mention
non-interactive mode.  Mention .zshenv for Z shell, and talk about
BASH_ENV instead of .bashrc for BASH.

11 years ago2013-11-06 Muhammad Bilal <mbilal@codesourcery.com>
Muhammad Bilal [Wed, 6 Nov 2013 06:42:52 +0000 (11:42 +0500)]
2013-11-06  Muhammad Bilal  <mbilal@codesourcery.com>

       PR cli/16122
       * top.c (command_line_input): Unify interactivity tests to use
       input_from_terminal_p.
       * event-top.c (command_line_handler): Likewise.

11 years agoTest on solib load and unload
Yao Qi [Wed, 25 Sep 2013 03:46:10 +0000 (11:46 +0800)]
Test on solib load and unload

This patch is to add a test case to on the performance of GDB handling
load and unload of shared library.

In V4:

 - Handle malloc and dlopen failure,
 - Document test parameters.

In V3, there are some changes,

 - Adapt to perf test framework changes.
 - Measure load and unload separately.

In V2, there are some changes,

 - A new proc gdb_produce_source to produce source files.  I tried to
   move all source file generation code out of solib.exp, but
   compilation step still needs to know the generated file names.  I
   have to hard-code the file names in compilation step, which is not
   good to me, so I give up on this moving.
 - SOLIB_NUMBER -> SOLIB_COUNT
 - New variable SOLIB_DLCLOSE_REVERSED_ORDER to control the order of
   iterating a list of shared libs to dlclose them.
 - New variable GDB_PERFORMANCE to enable these perf test cases.
 - Remove dlsym call in solib.c.
 - Update solib.py for the updated framework.

gdb/testsuite/

* lib/gdb.exp (gdb_produce_source): New procedure.
* gdb.perf/solib.c: New.
* gdb.perf/solib.exp: New.
* gdb.perf/solib.py: New.

11 years agoMention perf test in testsuite/README
Yao Qi [Wed, 16 Oct 2013 06:50:16 +0000 (14:50 +0800)]
Mention perf test in testsuite/README

gdb/testsuite:

2013-11-06  Yao Qi  <yao@codesourcery.com>

* README: Mention performance tests.

11 years agoPerf test framework
Yao Qi [Tue, 24 Sep 2013 09:56:26 +0000 (17:56 +0800)]
Perf test framework

This patch adds a basic framework to do performance testing for GDB.
perftest.py is about the test case, testresult.py is about test
results, and how are they saved.  reporter.py is about how results
are reported (in what format).  measure.py is about measuring the
execution of tests by a collection of measurements.

In V5:
 - Simplify perftest.exp.

In V4:

 - Rename MeasurementCPUTime to MeasurementCpuTime,
 - Add 'pass' in empty method,
 - Simplify string comparison in perftest.exp.
 - Rename GDB_PERFORMANCE to GDB_PERFTEST_MODE and rename
   GDB_PERFORMANCE_TIMEOUT to GDB_PERFTEST_TIMEOUT.

In V3, there are some changes,

 - Add wall time measurement, cpu time measurement and vmsize
   measurement.
 - Rename SingleStatisticTestCase to TestCaseWithBasicMeasurements,
   which measures cpu time, wall time, and memory (vmsize).
 - GDB_PERFORMANCE=run|compile|both to control the mode of perf
   testing.
 - New GDB_PERFORMANCE_TIMEOUT to specify the timeout.
 - Split proc prepare to proc compile and startup.
 - Disable GC while doing measurements.

In V2, there are several changes to address Doug and Sanimir's
comments.

 - Add copyright header and docstring in perftest/__init__.py
 - Remove config.py.
 - Fix docstring format.
 - Rename classes "SingleVariable" to "SingleStatistic".
 - Don't extend gdb.Function in class TestCase.  Add a new method run
   to run the test case so that we can pass parameters to test.
 - Allow to customize whether to warm up and to append test log.
 - Move time measurement into test harness.  Add a new class
   Measurement for a specific measurement and a new class Measure to
   measure them for a given test case.
 - A new class ResultFactory to create instances of TestResult.
 - New file lib/perftest.exp, which is to do some preparations and
   cleanups to simplify each *.exp file.
 - Skip compilation step if GDB_PERFORMANCE_SKIP_COMPILE is set.

gdb/testsuite/

2013-11-06  Yao Qi  <yao@codesourcery.com>

* lib/perftest.exp: New.
* gdb.perf/lib/perftest/__init__.py: New.
* gdb.perf/lib/perftest/measure.py: New.
* gdb.perf/lib/perftest/perftest.py: New.
* gdb.perf/lib/perftest/reporter.py: New.
* gdb.perf/lib/perftest/testresult.py: New.

11 years agoNew make target 'check-perf' and new dir gdb.perf
Yao Qi [Wed, 25 Sep 2013 04:41:45 +0000 (12:41 +0800)]
New make target 'check-perf' and new dir gdb.perf

We add a new dir gdb.perf in testsuite for all performance tests.
However, current 'make check' logic will either run dejagnu in
directory testsuite or iterate all gdb.* directories which has *.exp
files.  Both of them will run tests in gdb.perf.  We want to achieve:

 1) typical 'make check' should not run performance tests.  In each perf
    test case, GDB_PERFTEST_MODE is checked.  If it doesn't exist, return.
 2) run perf tests easily.  We add a new makefile target 'check-perf'.

gdb:

2013-11-06  Yao Qi  <yao@codesourcery.com>

* Makefile.in (check-perf): New target.

gdb/testsuite:

2013-11-06  Yao Qi  <yao@codesourcery.com>

* Makefile.in (check-perf): New target.
* configure.ac (AC_OUTPUT): Output Makefile in gdb.perf.
* configure: Re-generated.
* gdb.perf/Makefile.in: New.

11 years ago* elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs
DJ Delorie [Wed, 6 Nov 2013 03:13:04 +0000 (22:13 -0500)]
* elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs
are loaded before trying to use them.

11 years agodaily update
Alan Modra [Tue, 5 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agogas/
Yufeng Zhang [Tue, 5 Nov 2013 20:54:22 +0000 (20:54 +0000)]
gas/

* config/tc-aarch64.c (parse_sys_reg): Update to use aarch64_sys_reg;
call aarch64_sys_reg_deprecated_p and warn about the deprecated
system registers.

gas/testsuite/

* gas/aarch64/deprecated.d: New file.
* gas/aarch64/deprecated.l: New file.
* gas/aarch64/deprecated.s: New file.
* gas/aarch64/sysreg-1.s: Add tests.
* gas/aarch64/sysreg-1.d: Add tests.

include/opcode/

* aarch64.h (aarch64_sys_reg): New typedef.
(aarch64_sys_regs): Change to define with the new type.
(aarch64_sys_reg_deprecated_p): Declare.

opcodes/

* aarch64-opc.c (F_DEPRECATED): New macro.
(aarch64_sys_regs): Update; flag "spsr_svc" and "spsr_hyp" with
F_DEPRECATED.
(aarch64_print_operand): Call aarch64_sys_reg_deprecated_p on
AARCH64_OPND_SYSREG.

11 years agogas/
Yufeng Zhang [Tue, 5 Nov 2013 20:50:18 +0000 (20:50 +0000)]
gas/

* config/tc-aarch64.c (parse_operands): Handle AARCH64_OPND_COND1.

gas/testsuite/

* gas/aarch64/alias.s: Add tests.
* gas/aarch64/alias.d: Update.
* gas/aarch64/no-aliases.d: Update.
* gas/aarch64/diagnostic.s: Add tests.
* gas/aarch64/diagnostic.l: Update.
* gas/aarch64/illegal.s: Add tests.
* gas/aarch64/illegal.l: Update.

include/opcode/

* aarch64.h (enum aarch64_operand_class): Add AARCH64_OPND_CLASS_COND.
(enum aarch64_opnd): Add AARCH64_OPND_COND1.

opcodes/

* aarch64-dis.c (convert_ubfm_to_lsl): Check for cond != '111x'.
(convert_from_csel): Likewise.
* aarch64-opc.c (operand_general_constraint_met_p): Handle
AARCH64_OPND_CLASS_COND and AARCH64_OPND_COND1.
(aarch64_print_operand): Handle AARCH64_OPND_COND1.
* aarch64-tbl.h (aarch64_opcode_table): Use COND1 instead of
COND for cinc, cset, cinv, csetm and cneg.
(AARCH64_OPERANDS): Add entry for AARCH64_OPND_COND1.
* aarch64-asm-2.c: Re-generated.
* aarch64-dis-2.c: Ditto.
* aarch64-opc-2.c: Ditto.

11 years agoopcodes/
Yufeng Zhang [Tue, 5 Nov 2013 20:46:24 +0000 (20:46 +0000)]
opcodes/

* aarch64-opc.c (set_syntax_error): New function.
(operand_general_constraint_met_p): Replace set_other_error
with set_syntax_error.

gas/testsuite/

* gas/aarch64/diagnostic.s: Add tests of ldp/stp.
* gas/aarch64/diagnostic.l: Update.

11 years agoPass ignored unresolved relocations to ld backend
H.J. Lu [Tue, 5 Nov 2013 18:29:44 +0000 (10:29 -0800)]
Pass ignored unresolved relocations to ld backend

bfd/

PR ld/4409
* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add an argument for
error ignored.
* elf-m10200.c (mn10200_elf_relocate_section): Updated.
* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
* elf32-arm.c (elf32_arm_relocate_section): Likewise.
* elf32-avr.c (elf32_avr_relocate_section): Likewise.
* elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
(bfin_relocate_section): Likewise.
* elf32-cr16.c (elf32_cr16_relocate_section): Likewise.
* elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
* elf32-cris.c (cris_elf_relocate_section): Likewise.
* elf32-crx.c (elf32_crx_relocate_section): Likewise.
* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
* elf32-epiphany.c (epiphany_elf_relocate_section): Likewise.
* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
* elf32-frv.c (elf32_frv_relocate_section): Likewise.
* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-i860.c (elf32_i860_relocate_section): Likewise.
* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-metag.c (elf_metag_relocate_section): Likewise.
* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
* elf32-mep.c (mep_elf_relocate_section): Likewise.
* elf32-moxie.c (moxie_elf_relocate_section): Likewise.
* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
* elf32-mt.c (mt_elf_relocate_section): Likewise.
* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-rl78.c (rl78_elf_relocate_section): Likewise.
* elf32-rx.c (rx_elf_relocate_section): Likewise.
* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf32-v850.c (v850_elf_relocate_section): Likewise.
* elf32-vax.c (elf_vax_relocate_section): Likewise.
* elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
* elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.

* elfnn-ia64.c (elfNN_ia64_relocate_section): Skip if error
from RELOC_FOR_GLOBAL_SYMBOL in executable is ignored.

ld/testsuite/

PR ld/4409
* ld-ia64/error1.d: New file.
* ld-ia64/error1.s: Likewise.
* ld-ia64/error2.d: Likewise.
* ld-ia64/error3.d: Likewise.

11 years agoconfig/tc-aarch64.c: Avoid trying to parse a vector mov as immediate.
Will Newton [Fri, 1 Nov 2013 00:21:11 +0000 (17:21 -0700)]
config/tc-aarch64.c: Avoid trying to parse a vector mov as immediate.

Parsing a vector mov instruction currently leads to a phantom undefined
symbol being added to the symbol table. e.g.:

       .text
       mov     x0, v0.D[0]

Produces an undefined symbol called "v0.D".

gas/ChangeLog:

2013-11-05  Will Newton  <will.newton@linaro.org>

PR gas/16103
* config/tc-aarch64.c (parse_operands): Avoid trying to
parse a vector register as an immediate.

gas/testsuite/ChangeLog:

2013-11-05  Will Newton  <will.newton@linaro.org>

* gas/aarch64/advsimd-mov-bad.d: New file.
* gas/aarch64/advsimd-mov-bad.s: Likewise.

11 years agogdb/arm-tdep.c: Use filtered output in arm_print_float_info.
Will Newton [Sat, 2 Nov 2013 00:44:19 +0000 (17:44 -0700)]
gdb/arm-tdep.c: Use filtered output in arm_print_float_info.

gdb/ChangeLog:

2013-11-05  Will Newton  <will.newton@linaro.org>

PR gdb/7670
* arm-tdep.c (print_fpu_flags): Use filtered output routines.
(arm_print_float_info): Likewise.

11 years agoHide ppc64 .TOC. from --export-dynamic
Alan Modra [Tue, 5 Nov 2013 02:08:51 +0000 (12:38 +1030)]
Hide ppc64 .TOC. from --export-dynamic

I can't see any good reason why anyone would want a dynamic .TOC., so
hide it in a way that is respected by _bfd_elf_export_symbol.  This
also fixes an abort in relocate_section on not finding sreloc for .TOC.

* elf64-ppc.c (ppc64_elf_func_desc_adjust): Make .TOC. defined and
hidden.
(ppc64_elf_set_toc): Adjust.

11 years agoUpdate elf64-ppc.c to use elf_link_hash_table shortcuts.
Alan Modra [Tue, 5 Nov 2013 01:22:26 +0000 (11:52 +1030)]
Update elf64-ppc.c to use elf_link_hash_table shortcuts.

These shortcuts to dynamic sections in ppc_link_hash_table predated
their geneneric elf hash table equivalents.

* elf64-ppc.c (struct ppc_link_hash_table): Remove got, plt, relplt,
iplt, reliplt.  Update all references to use elf.sgot, elf.splt,
elf.srelplt, elf.iplt and elf.irelplt.

11 years agodaily update
Alan Modra [Mon, 4 Nov 2013 23:00:03 +0000 (09:30 +1030)]
daily update

11 years agoswitch to fully parallel mode
Tom Tromey [Tue, 27 Aug 2013 17:52:25 +0000 (11:52 -0600)]
switch to fully parallel mode

This switches "make check" to fully parallel mode.

One primary issue facing full parallelization is the overhead of
"runtest".  On my machine, if I "touch gdb.base/empty.exp", making a
new file, and then "time runtest.exp", it takes 0.08 seconds.

Multiply this by the 1008 (in my configuration) tests and you get ~80
seconds.  This is the overhead that would theoretically be present if
all tests were run in parallel.

However, the problem isn't nearly as bad as this, for two reasons.

First, you must divide by the number of jobs, assuming perfect
parallelization -- reasonably true for small -j numbers, based on the
results I see.

Second, the current test suite parallelization approach bundles the
tests, largely by directory, but also splitting up gdb.base into two
halves.

I was curious to see how the current bundling played out in practice,
so I ran "make -j1 check RUNTEST='/bin/time runtest'".  This invokes
the parallel mode (thus the bundling) and then shows the time taken by
each invocation of runtest.

Then, I ran "/bin/time make -j3 check".  (See below about -j2.)

The time for the entire -j3 test run was the same as the time for
"gdb.base1".  What this means is that gdb.base1 is currently the
time-limiting run, preventing further parallelization gains.

So, I reason, whatever overhead we see from full parallelization will
only be seen by "-j1" and "-j2".

I then tried a -j2 test run.  This does take longer than a -j3 build,
meaning that the gdb.base1 job finishes and then proceeds to other
runtest invocations.

Finally I tried a -j2 test run with the appended patch.
This was 9% slower than the -j2 run without the patch.

I think that is a reasonable slowdown for what is probably a rare
case.  I believe this patch will yield faster test results for all -j
values greater than 2.  For -j3 on my machine, the test suite is a few
seconds faster; I didn't try any larger -j values.

For -j1, I went ahead and changed the Makefile so that, if no -j
option is given, then the "check-single" mode is used.  You can still
use "make -j1 check" to get single-job parallel-mode, though of course
there's no good reason to do so.

This change is likely to speed up the plain "make check" scenario a
little as we will now bypass dg-extract-results.sh.

One drawback of this change is that "make -jN check" is now much more
verbose.  I generally only look at the .sum and .log files, but
perhaps this will bother some.

Another interesting question is scalability of the result.  The
slowest test, which limits the scalability, took 80.78 seconds.  The
mean of the remaining tests is 1.08 seconds.  (Note that this is just
a rough estimate, since there are still outliers.)

This means we can run 80.78 / 1.08 =~ 74 tests in the time available.
And, in this data set (slightly older than the above, but materially
the same) there were 948 tests.  So, I think the current test suite
should scale ok up to about -j12.

We could improve this number if need be by breaking up the biggest
tests.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* Makefile.in (TEST_DIRS): Remove.
(TEST_TARGETS, check-parallel): Rewrite.
(check-gdb.%, BASE1_FILES, BASE2_FILES, check-gdb.base%)
(subdir_do, subdirs): Remove.
(do-check-parallel, check/%): New targets.
(clean): Remove outputs, temp, and cache directories.
(saw_dash_j): New variable.
(CHECK_TARGET): Use it.
(check): Depend on all, site.exp.  Rewrite.
(check-single): Remove dependencies.
(slow_tests, all_tests, reordered_tests): New variables.

11 years agofix some fission tests
Tom Tromey [Fri, 18 Oct 2013 20:25:06 +0000 (14:25 -0600)]
fix some fission tests

A couple of Fission tests rely on the current directory layout.  This
assumption is not valid in parallel mode.

This patch fixes the problem by removing the relative directory from
the .S files and instead having the tests set debug-file-directory
before opening the main file.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.dwarf2/fission-base.S: Remove "gdb.dwarf/".
* gdb.dwarf2/fission-base.exp: Set debug-file-directory
before loading binfile.
* gdb.dwarf2/fission-loclists.S: Remove "gdb.dwarf/".
* gdb.dwarf2/fission-loclists.exp: Set debug-file-directory
before loading binfile.

11 years agofix some "exec" tests
Tom Tromey [Fri, 18 Oct 2013 20:00:44 +0000 (14:00 -0600)]
fix some "exec" tests

A few tests run an inferior that execs some other program.  The name
of this exec'd program is compiled in.  These tests assume the current
test suite directory layout, but fail in parallel mode.

This patch fixes these tests by letting the .exp files pass in the
directory names at compile time.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/foll-exec.c (main): Use BASEDIR.
* gdb.base/foll-exec.exp: Define BASEDIR during compilation.
* gdb.base/foll-vfork.c (main): Use BASEDIR.
* gdb.base/foll-vfork.exp: Define BASEDIR during compilation.
* gdb.multi/bkpt-multi-exec.c (main): Use BASEDIR.
* gdb.multi/bkpt-multi-exec.exp: Define BASEDIR during compilation.

11 years agofix argv0-symlink.exp for parallel mode
Tom Tromey [Fri, 18 Oct 2013 19:12:32 +0000 (13:12 -0600)]
fix argv0-symlink.exp for parallel mode

argv0-symlink.exp doesn't work properly if standard_output_file puts
files into a per-test subdirectory.  That's because it assumes that
files appear in $subdir, which is no longer true.

This patch fixes the problem by computing the correct directory at
runtime.

Tested both with and without GDB_PARALLEL on x86-64 Fedora 18.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/argv0-symlink.exp: Compute executable's directory
dynamically.

11 years agomake gdb.asm parallel-safe
Tom Tromey [Fri, 23 Aug 2013 20:16:58 +0000 (14:16 -0600)]
make gdb.asm parallel-safe

This fixes gdb.asm to be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.asm/asm-source.exp: Use standard_output_file.

11 years agofix up gdb.server
Tom Tromey [Fri, 23 Aug 2013 18:27:36 +0000 (12:27 -0600)]
fix up gdb.server

This fixes gdb.server to be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.server/file-transfer.exp: Use standard_output_file.

11 years agointroduce relative_filename and use it
Tom Tromey [Fri, 23 Aug 2013 18:18:57 +0000 (12:18 -0600)]
introduce relative_filename and use it

This introduces a new relative_filename proc to gdb.exp and changes
some tests to use it.  This helps make these tests parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/fullname.exp: Use standard_output_file,
relative_filename.
* gdb.base/hashline1.exp: Use standard_testfile,
standard_output_file, relative_filename, clean_restart.
* gdb.base/hashline2.exp: Use standard_testfile,
standard_output_file.
* gdb.base/hashline3.exp: Use standard_testfile,
standard_output_file, relative_filename.
* lib/gdb.exp (relative_filename): New proc.

11 years agoupdate fileio test
Tom Tromey [Fri, 23 Aug 2013 18:18:39 +0000 (12:18 -0600)]
update fileio test

This updates the fileio test to be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/fileio.c (test_open, test_write, test_read)
(test_lseek, test_close, test_stat, test_fstat)
(test_isatty, test_system, test_rename, test_unlink):
Use OUTDIR define.
* gdb.base/fileio.exp: Define OUTDIR during compilation.
Use standard_output_file.

11 years agoupdate checkpoint test
Tom Tromey [Fri, 23 Aug 2013 18:18:27 +0000 (12:18 -0600)]
update checkpoint test

This fixes the "checkpoint" test to use the standard output directory.
This makes the test be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/checkpoint.c (main): Use PI_TXT and COPY1_TXT
defines.
* gdb.base/checkpoint.exp: Define PI_TXT and COPY1_TXT during
compilation.  Use prepare_for_testing, standard_output_file.

11 years agosimple changes in gdb.base
Tom Tromey [Fri, 23 Aug 2013 18:18:01 +0000 (12:18 -0600)]
simple changes in gdb.base

This makes more changes in gdb.base to make it parallel-safe.  I think
the changes in this particular patch are relatively straightforward,
so I've grouped them all together.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/advance.exp: Use standard_testfile and
prepare_for_testing.
* gdb.base/bigcore.exp: Use standard_output_file.  "cd" to
appropriate directory when local.
* gdb.base/dump.exp: Use standard_output_file.  Update all
"dump" and "restore" filenames.
* gdb.base/interact.exp: Use standard_output_file.
* gdb.base/jit-so.exp: Don't download file when local.
* gdb.base/jit.exp (compile_jit_test): Don't download file
when local.
* gdb.base/list.exp: Use gdb_remote_download.
* gdb.base/maint.exp: Use standard_output_file.
* gdb.base/prelink.exp: Use standard_output_file.
* gdb.base/save-bp.exp: Use standard_output_file.
* gdb.base/sepdebug.exp: Use standard_testfile,
standard_output_file.
(test_different_dir): Don't declare objdir.
* gdb.base/solib-search.exp: Use standard_output_file.
* gdb.base/step-line.exp: Use gdb_remote_download.
* gdb.base/trace-commands.exp: Use standard_output_file.

11 years agofix up gdb.trace
Tom Tromey [Fri, 23 Aug 2013 18:09:22 +0000 (12:09 -0600)]
fix up gdb.trace

This fixes gdb.trace to be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.trace/mi-traceframe-changed.exp: Pass -DTFILE_DIR
to compilation.  Use standard_output_file.
(test_tfind_tfile): Update.
* gdb.trace/tfile.c (write_basic_trace_file)
(write_error_trace_file): Use TFILE_DIR.
* gdb.trace/tfile.exp: Pass -DTFILE_DIR to compilation.  Use
standard_output_file.

11 years agofix up gdb.mi
Tom Tromey [Fri, 23 Aug 2013 16:44:49 +0000 (10:44 -0600)]
fix up gdb.mi

This fixes gdb.mi to be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
Use "dwarf2 always-disassemble" for the "maint set" test.
* gdb.mi/mi-file-transfer.exp (test_file_transfer): Use
standard_output_file.
* gdb.mi/mi-logging.exp: Use standard_output_file.

11 years agofix up gdb.xml
Tom Tromey [Fri, 23 Aug 2013 16:16:53 +0000 (10:16 -0600)]
fix up gdb.xml

This fixes the gdb.xml tests to be parallel-safe.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.xml/tdesc-arch.exp: Use standard_output_file.  Make
downloads conditional on remote host.
(set_arch): Likewise.
* gdb.xml/tdesc-regs.exp: Use gdb_remote_download.
(load_description): Use standard_output_file.

11 years agofix up gdb.gdb
Tom Tromey [Fri, 23 Aug 2013 13:51:39 +0000 (07:51 -0600)]
fix up gdb.gdb

This fixes the gdb.gdb tests to be parallel-safe, by ensuring that the
new "xgdb" file ends up in the standard output directory during the
tests.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.gdb/selftest.exp: Use standard_output_file.
* lib/selftest-support.exp (do_self_tests): Use
standard_output_file.

11 years agofix weird.exp for parallel testing
Tom Tromey [Thu, 22 Aug 2013 18:05:39 +0000 (12:05 -0600)]
fix weird.exp for parallel testing

This fixes up gdb.stabs/weird.exp for parallel testing.  This just
means using gdb_remote_download and standard_output_file, so that the
tests end up in the right place.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.stabs/weird.exp: Use gdb_remote_download and
standard_output_file.

11 years agofix some simple thinkos in the test suite
Tom Tromey [Thu, 22 Aug 2013 18:10:25 +0000 (12:10 -0600)]
fix some simple thinkos in the test suite

This fixes some parallelization thinkos from a while ago.  I'm not
sure how the problems ever slipped through.  In addition to a thinko
fix in twice.exp, this also finishes fixing it up for parallelization.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/gcore-buffer-overflow.exp: Use
standard_output_file, not standard_testfile.
* gdb.base/twice.exp: Use standard_testfile, not
standard_output_file.  Use gdb_remote_download.

11 years agofix up log-file toggling
Tom Tromey [Thu, 22 Aug 2013 19:09:35 +0000 (13:09 -0600)]
fix up log-file toggling

Currently a proc in gdb.exp toggles the expect (and thus dejagnu)
logging.  This is not a super idea, but it is there to avoid putting
some preprocessor output into the log.

In the right circumstances, this can result in the log file being
mysteriously truncated.  I think this happens because it doesn't
necessarily write to the correct log file again.

The fix is to use "log_file -info" to save the previous log file.

2013-11-04  Tom Tromey  <tromey@redhat.com>

* lib/gdb.exp (get_compiler_info): Use log_file -info and
restore from that.

11 years agox86-64/gas: fix an asymmetry in suffix/register checking
Jan Beulich [Mon, 4 Nov 2013 15:05:39 +0000 (16:05 +0100)]
x86-64/gas: fix an asymmetry in suffix/register checking

Without this, constructs like "orw %rax, (%rax)" aren't being rejected
(other than any other wrong suffix/register combination).

gas/
2013-11-04  Jan Beulich <jbeulich@suse.com>

* config/tc-i386.c (check_long_reg): Correct comment indentation.
(check_qword_reg): Correct comment and its indentation.
(check_word_reg): Extend comment and correct its indentation. Also
check for 64-bit register.

gas/testsuite/
2013-11-04  Jan Beulich <jbeulich@suse.com>

* gas/i386/x86-64-suffix-bad.[sl]: New.
* gas/i386/i386.exp: Run new test.

11 years agoImprove performance of large restore commands
Anton Blanchard [Mon, 4 Nov 2013 10:39:20 +0000 (21:39 +1100)]
Improve performance of large restore commands

I noticed a large (100MB) restore took hours to complete. The problem
is memory_xfer_partial repeatedly mallocs and memcpys the entire
100MB buffer for breakpoint shadow handling only to find a small
portion of it is actually written.

The testcase that originally took hours now takes 50 seconds.

gdb/
2013-07-29  Anton Blanchard  <anton@samba.org>

* target.c (memory_xfer_partial): Cap write to 4KB.

11 years agoRemove powerpc.cc copy of use_plt_offset
Alan Modra [Fri, 1 Nov 2013 05:39:56 +0000 (16:09 +1030)]
Remove powerpc.cc copy of use_plt_offset

This adds an extra flag for needs_dynamic_reloc() in order to remove
the copy of this function and use_plt_offset() in powerpc.cc, and
tweaks the powerpc get_reference_flags() to return the flag as
appropriate.  ELFv2 does not want ELFv1 behaviour here.

* symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
(Symbol::needs_dynamic_reloc): Test new flag.
* powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
(Target_powerpc::Scan::get_reference_flags): Add target param.
Return FUNC_DESC_ABI for 64-bit ELFv1.
(Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
call.
(Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
(Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.

11 years agoRemove incorrect ATTRIBUTE_UNUSED from nios2 bfd
Sandra Loosemore [Mon, 4 Nov 2013 02:39:07 +0000 (18:39 -0800)]
Remove incorrect ATTRIBUTE_UNUSED from nios2 bfd

2013-11-03  Sandra Loosemore  <sandra@codesourcery.com>

bfd/
* elf32-niso2.c (nios2_elf32_do_hi16_relocate): Remove incorrect
ATTRIBUTE_UNUSED from parameter.
(nios2_elf_do_lo16_relocate): Likewise.
(nios2_elf32_do_hiadj16_relocate): Likewise.
(nios2_elf32_do_pcrel_lo16_relocate): Likewise.
(nios2_elf32_do_pcrel_hiadj16_relocate): Likewise.
(nios2_elf32_do_pcrel16_relocate): Likewise.
(nios2_elf32_do_call26_relocate): Likewise.
(nios2_elf32_do_gprel_relocate): Likewise.
(nios2_elf32_do_ujmp_relocate): Likewise.
(nios2_elf32_do_cjmp_relocate): Likewise.
(nios2_elf32_do_callr_relocate): Likewise.
(nios2_elf32_gc_mark_hook): Likewise.

11 years agoEdit ELFv2 global entry prologue to non-PIC
Alan Modra [Fri, 1 Nov 2013 08:55:56 +0000 (19:25 +1030)]
Edit ELFv2 global entry prologue to non-PIC

Changing addis r2,r12,..; addi r2,r2,.. to lis r2,..; addi r2,r2..
in non-PIC executables has the benefit of removing a dependency on r12.

bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): Edit global entry
prologue to non-PIC in non-PIC executables.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Adjust for non-PIC global entry.

11 years agoPowerPC64 ELFv2 symbols defined in plt
Alan Modra [Fri, 1 Nov 2013 08:54:20 +0000 (19:24 +1030)]
PowerPC64 ELFv2 symbols defined in plt

In a non-pic executable, ELFv2 like other targets, needs to emit a plt
entry even for non-call references to functions defined in shared
libraries, and define the function on the plt code.

* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Copy
pointer_equality_needed flag.
(ppc64_elf_check_relocs): For ELFv2 arrange to emit plt
entries for references to functions in shared libraries on
non-call relocs.
(readonly_dynrelocs): Split into function of the same name and..
(maybe_set_textrel): ..this new function.  Update call.
(ppc64_elf_adjust_dynamic_symbol): Don't emit dynrelocs for
ELFv2 in most cases if we have a plt entry.  Use new
readonly_relocs.
(allocate_dynrelocs): For ELFv2, don't allocate dynreloc space
for ifunc in static executables.
(size_global_entry_stubs): New function.
(ppc64_elf_size_dynamic_sections): Call size_global_entry_stubs.
Save end of glink branch table.
(ppc64_elf_hash_symbol): New function.
(build_global_entry_stubs): New function.
(ppc64_elf_build_stubs): Call build_global_entry_stubs.  Adjust
glink sizing.
(ppc64_elf_relocate_section): Tidy plt16/32/64 reloc code.
(ppc64_elf_finish_dynamic_symbol): For ELFv2, adjust symbols
defined on plt code.

11 years agoAllow for extra st_other readelf output in ld testsuite
Alan Modra [Thu, 31 Oct 2013 09:03:23 +0000 (19:33 +1030)]
Allow for extra st_other readelf output in ld testsuite

On PowerPC64 ELFv2 readelf emits [<localentry>: 8] describing extra
symbol st_other bits.

* ld-elfvers/vers24.rd: Allow extra readelf output after
symbol visibility.
* ld-ifunc/ifunc.exp: Likewise.

11 years agold crossref test fix
Alan Modra [Thu, 31 Oct 2013 09:00:24 +0000 (19:30 +1030)]
ld crossref test fix

* ld-scripts/crossref.exp: Don't allow changes made to CFLAGS
for this test to bleed into following tests.  Don't set
-mcall-aixdesc for powerpc64le.

11 years agodaily update
Alan Modra [Sun, 3 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agodaily update
Alan Modra [Sat, 2 Nov 2013 23:00:05 +0000 (09:30 +1030)]
daily update

11 years agoChangeLog fix.
Alan Modra [Sat, 2 Nov 2013 06:42:59 +0000 (17:12 +1030)]
ChangeLog fix.

11 years agoFix gprof build
Alan Modra [Sat, 2 Nov 2013 06:38:44 +0000 (17:08 +1030)]
Fix gprof build

* Makefile.am (.m.c): Fix input and output file specification.

11 years agoRemove unnecessary _bfd_new_bfd initialisation
Alan Modra [Sat, 2 Nov 2013 05:15:12 +0000 (15:45 +1030)]
Remove unnecessary _bfd_new_bfd initialisation

nbfd is allocated by bfd_zmalloc.

* opncls.c (_bfd_new_bfd): Don't init vars already zeroed.

11 years agoAssorted x86 testsuite fixes.
Alan Modra [Sat, 2 Nov 2013 05:01:16 +0000 (15:31 +1030)]
Assorted x86 testsuite fixes.

I think HJ has already fixed the binutils and ld tests with his
2013-09-27 readelf change, but this allows them to pass with wider
address output as per Nick's 2013-09-12 readelf change.

binutils/testsuite/
* binutils-all/x86-64/compressed-1a.d: Allow wide display of addresses.
gas/testsuite/
* gas/cfi/cfi-x86_64.d: Match when lacking end of section padding.
ld/testsuite/
* ld-pe/cfi.d: Allow wide display of addresses.

11 years agoTestsuite fix for targets where .int isn't 4 bytes
Alan Modra [Sat, 2 Nov 2013 04:47:39 +0000 (15:17 +1030)]
Testsuite fix for targets where .int isn't 4 bytes

* binutils-all/dw2-1.S: Use .4byte rather than .int.
* binutils-all/dw2-2.S: Likewise.

11 years agoSimplify ppc64 code setting toc_off.
Alan Modra [Wed, 30 Oct 2013 07:00:43 +0000 (17:30 +1030)]
Simplify ppc64 code setting toc_off.

Every function has a nominal toc pointer value, even if it isn't used,
so set toc_off for every code section to the value used in that object
file.  The thinking here was that if a code section didn't use the toc
it could use the previous object file's toc pointer value.  It can,
but doing so is only a gain if functions in that section are called
mostly from previous objects sharing the same toc.  We lose if the
functions in question are called mostly from the current object or
following objects, and it's a good bet they will probably mostly be
called from the current object.

* elf64-ppc.c (ppc64_elf_next_input_section): Always set toc_off
to value for object file.

11 years agogdb.cp/derivation.exp: s/perrro/perror/
Maciej W. Rozycki [Sat, 2 Nov 2013 00:04:36 +0000 (00:04 +0000)]
gdb.cp/derivation.exp: s/perrro/perror/

11 years agodaily update
Alan Modra [Fri, 1 Nov 2013 23:00:02 +0000 (09:30 +1030)]
daily update

11 years agox86_64-*-nacl*: Adjust test cases for PLT nop fix.
Roland McGrath [Fri, 1 Nov 2013 21:54:40 +0000 (14:54 -0700)]
x86_64-*-nacl*: Adjust test cases for PLT nop fix.

ld/testsuite/
* ld-x86-64/plt-nacl.pd: Update expected disassembly for PLT nop fix.
* ld-x86-64/tlsdesc-nacl.pd: Likewise.

11 years ago*-*-nacl* layout: Drop requirement that some section have SEC_HAS_CONTENTS set.
Roland McGrath [Fri, 1 Nov 2013 21:37:46 +0000 (14:37 -0700)]
*-*-nacl* layout: Drop requirement that some section have SEC_HAS_CONTENTS set.

bfd/
* elf-nacl.c (segment_eligible_for_headers): Drop requirement that
some section have SEC_HAS_CONTENTS set.  It's not set for
.note.gnu.build-id, and a segment of only read-only SHT_NOBITS
sections is implausible and not really supportable anyway.

11 years agogdb.dwarf2/dwzbuildid.exp: Avoid reserved variable name
Maciej W. Rozycki [Fri, 1 Nov 2013 20:34:49 +0000 (20:34 +0000)]
gdb.dwarf2/dwzbuildid.exp: Avoid reserved variable name

* gdb.dwarf2/dwzbuildid.exp: Rename `outdir' variable to
`debugdir'.

11 years agobreakpoint.c: fix libc probe scan when no get_longjmp_target exists.
Tiago Stürmer Daitx [Fri, 1 Nov 2013 16:41:37 +0000 (11:41 -0500)]
breakpoint.c: fix libc probe scan when no get_longjmp_target exists.

As discussed on the GDB ML[1], libc probes for longjmp were not being
loaded if a custom <arch>_get_longjmp_target function was not
implemented.

This is trivially fixed by moving the 'if (!gdbarch_get_longjmp_target_p
(gdbarch))' down, just bellow libc probe code and above the per-objfile
cache lookup.

While the condition could also be removed altogether with no
side-effects, it is in fact an optimization to avoid searching for
symbols if the arch doesn't provide support for get_longjmp_target().

This has been tested on PPC and PPC64.

[1] https://sourceware.org/ml/gdb/2013-10/msg00191.html

gdb/
2013-11-01  Tiago Stürmer Daitx  <tdaitx@linux.vnet.ibm.com>

        * breakpoint.c (create_longjmp_master_breakpoint): Allow libc
        probe scan even when the arch provides no get_longjmp_target.

11 years agodaily update
Alan Modra [Thu, 31 Oct 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agoinfrun.c: use GDB_SIGNAL_0 when hidding signals, not GDB_SIGNAL_TRAP.
Pedro Alves [Thu, 31 Oct 2013 21:00:23 +0000 (21:00 +0000)]
infrun.c: use GDB_SIGNAL_0 when hidding signals, not GDB_SIGNAL_TRAP.

IMO, it doesn't make sense to map random syscall, fork, etc. events to
GDB_SIGNAL_TRAP, and possible have the debuggee see that trap.  This
just seems conceptually wrong to me - these aren't real signals a
debuggee would ever see.  In fact, when stopped for those events, on
Linux, the debuggee isn't in a signal-stop -- there's no way to
resume-and-deliver-signal at that point, for example.  E.g., when
stopped at a fork event:

 (gdb) catch fork
 Catchpoint 2 (fork)
 (gdb) c
 Continuing.

 Catchpoint 2 (forked process 4570), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
 131       pid = ARCH_FORK ();
 (gdb) set debug infrun 1
 (gdb) signal SIGTRAP
 Continuing with signal SIGTRAP.
 infrun: clear_proceed_status_thread (process 4566)
 infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0)
 infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4566] at 0x323d4ba7c4
 infrun: wait_for_inferior ()
 infrun: target_wait (-1, status) =
 infrun:   4566 [process 4566],
 infrun:   status->kind = exited, status = 0
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_EXITED
 [Inferior 1 (process 4566) exited normally]
 infrun: stop_stepping
 (gdb)

Note the signal went nowhere.  It was swallowed.

Resuming with a SIGTRAP from a syscall event does queue the signal,
but doesn't deliver it immediately, like "signal SIGTRAP" from a real
signal would.  It's still an artificial SIGTRAP:

 (gdb) catch syscall
 Catchpoint 2 (any syscall)
 (gdb) c
 Continuing.

 Catchpoint 2 (call to syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
 131       pid = ARCH_FORK ();
 (gdb) set debug infrun 1
 (gdb) signal SIGTRAP
 Continuing with signal SIGTRAP.
 infrun: clear_proceed_status_thread (process 4622)
 infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0)
 infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4
 infrun: wait_for_inferior ()
 infrun: target_wait (-1, status) =
 infrun:   4622 [process 4622],
 infrun:   status->kind = exited syscall
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_SYSCALL_RETURN
 infrun: syscall number = '56'
 infrun: BPSTAT_WHAT_STOP_NOISY
 infrun: stop_stepping

 Catchpoint 2 (returned from syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
 131       pid = ARCH_FORK ();
 (gdb) c
 Continuing.
 infrun: clear_proceed_status_thread (process 4622)
 infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0)
 infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4
 infrun: wait_for_inferior ()
 infrun: target_wait (-1, status) =
 infrun:   4622 [process 4622],
 infrun:   status->kind = stopped, signal = SIGTRAP
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_STOPPED
 infrun: stop_pc = 0x323d4ba7c4
 infrun: random signal 5

 Program received signal SIGTRAP, Trace/breakpoint trap.
 infrun: stop_stepping
 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
 131       pid = ARCH_FORK ();
 (gdb)

In all the above, I used 'signal SIGTRAP' to emulate 'handle SIGTRAP
pass'.  As described in "keep_going", 'handle SIGTRAP pass' does have
its place:

      /* Do not deliver GDB_SIGNAL_TRAP (except when the user
 explicitly specifies that such a signal should be delivered
 to the target program).  Typically, that would occur when a
 user is debugging a target monitor on a simulator: the target
 monitor sets a breakpoint; the simulator encounters this
 breakpoint and halts the simulation handing control to GDB;
 GDB, noting that the stop address doesn't map to any known
 breakpoint, returns control back to the simulator; the
 simulator then delivers the hardware equivalent of a
 GDB_SIGNAL_TRAP to the program being debugged.  */

... and I've made use of that myself when implementing/debugging
stubs/monitors.  But in these cases, treating these events as SIGTRAP
possibly injects signals in the debuggee they'd never see otherwise,
because you need to use ptrace to enable these special events, which
aren't real signals.

There's more.  Take this bit of handle_inferior_event, where we
determine whether a real signal (TARGET_WAITKIND_STOPPED) was random
or not:

  if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
    ecs->random_signal
      = !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
   GDB_SIGNAL_TRAP)
   != BPSTAT_SIGNAL_NO)
  || stopped_by_watchpoint
  || ecs->event_thread->control.trap_expected
  || (ecs->event_thread->control.step_range_end
      && (ecs->event_thread->control.step_resume_breakpoint
  == NULL)));
  else
    {
      enum bpstat_signal_value sval;

      sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
     ecs->event_thread->suspend.stop_signal);
      ecs->random_signal = (sval == BPSTAT_SIGNAL_NO);

      if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP;
    }

Note that the

      if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP;

bit is only reacheable for signals != GDB_SIGNAL_TRAP.  AFAICS, sval
can only be BPSTAT_SIGNAL_HIDE if nothing in the bpstat returns
BPSTAT_SIGNAL_PASS.  So that excludes a "catch signal" for the signal
in question in the bpstat.  All other catchpoints that aren't based on
breakpoints behind the scenes call process_event_stop_test directly
(don't pass through here) (well, almost all: TARGET_WAITKIND_LOADED
does have a fall through, but only for STOP_QUIETLY or
STOP_QUIETLY_NO_SIGSTOP, which still return before this code is
reached).  Catchpoints that are implemented as breakpoints behind the
scenes can only appear in the bpstat if the signal was GDB_SIGNAL_TRAP
(bkpt_breakpoint_hit returns false otherwise).  So that leaves a
target reporting a hardware watchpoint hit with a signal other than
GDB_SIGNAL_TRAP.  And even then it looks quite wrong to me to
magically convert the signal into a GDB_SIGNAL_TRAP here too -- if the
user has set SIGTRAP to "handle pass", the program will see a trap
that gdb invented, not one the program would ever see without gdb in
the picture.

Tested on x86_64 Fedora 17.

gdb/
2013-10-31  Pedro Alves  <palves@redhat.com>

* infrun.c (handle_syscall_event): Don't set or clear stop_signal.
(handle_inferior_event) <TARGET_WAITKIND_FORKED,
TARGET_WAITKIND_VFORKED>: Don't set stop_signal to
GDB_SIGNAL_TRAP, or clear it.  Pass GDB_SIGNAL_0 to
bpstat_explains signal, instead of GDB_SIGNAL_TRAP.
<bpstat handling>: If the bpstat chain wants the signal to be
hidden, then set stop_signal to GDB_SIGNAL_0 instead of
GDB_SIGNAL_TRAP.

11 years agoRestore support for dwp v2 DWARF package file format.
Cary Coutant [Thu, 31 Oct 2013 18:43:23 +0000 (11:43 -0700)]
Restore support for dwp v2 DWARF package file format.

gold/
* dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
tu_length parameter.  Adjust all callers.
* dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
* dwp.cc: Include dwarf.h.
(Section_bounds): New struct type.
(Unit_set): New struct type.
(Dwo_file::Dwo_file): Initialize new data member.
(Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
Combine and rename to...
(Dwo_file::read_unit_index): ...this.
(Dwo_file::sized_read_compunit_index)
(Dwo_file::sized_read_typeunit_index): Combine and rename to...
(Dwo_file::sized_read_unit_index): ...this.
(Dwo_file::copy_section): Remove section_name, is_str_offsets
parameters; add section_id parameter.
(Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
(Dwo_file::add_unit_set): ...this.
(Dwo_file::shndx_map_): Remove.
(Dwo_file::sect_offsets_): New data member.
(Dwp_output_file::Dwp_output_file): Initialize new data members.
(Dwp_output_file::add_section): Rename to...
(Dwp_output_file::add_contribution): ...this.
(Dwp_output_file::add_cu_set): Combine parameters into a struct.
(Dwp_output_file::add_tu_set): Likewise.
(Dwp_output_file::Contribution): New type.
(Dwp_output_file::Section::contributions): New data member.
(Dwp_output_file::Cu_or_tu_set): Remove.
(Dwp_output_file::Section::Section): New ctor.
(Dwp_output_file::Dwp_index::Shndx_pool): Remove.
(Dwp_output_file::Dwp_index::Section_table): New type.
(Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
(Dwp_output_file::Dwp_index::enter_set): Change type of "set"
parameter.
(Dwp_output_file::Dwp_index::shndx_pool): Remove.
(Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
(Dwp_output_file::Dwp_index::section_table): New member function.
(Dwp_output_file::Dwp_index::section_table_end): New member function.
(Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
(Dwp_output_file::Dwp_index::section_table_rows): New member function.
(Dwp_output_file::Dwp_index::section_table_cols): New member function.
(Dwp_output_file::Dwp_index::shndx_pool_): Remove.
(Dwp_output_file::Dwp_index::section_table_): New data member.
(Dwp_output_file::Dwp_index::section_mask_): New data member.
(Dwp_output_file::add_output_section): New member function.
(Dwp_output_file::write_new_section): New member function.
(Dwp_output_file::write_contributions): New member function.
(Dwp_output_file::section_id_map_): New data member.
(class Dwo_id_info_reader): Remove.
(class Unit_reader): New class.
(get_dwarf_section_name): New function.
(Dwo_file::read_executable): Adjust initializations of class data.
(Dwo_file::read): Add support for v2 package file format.
(Dwo_file::read_unit_index): Likewise.
(Dwo_file::sized_read_unit_index): Likewise.
(Dwo_file::copy_section): Likewise.
(Dwo_file::add_unit_set): Likewise.
(Dwp_output_file::add_output_section): Likewise.
(Dwp_output_file::add_contribution): Likewise.
(Dwp_output_file::Dwp_index::find_or_add): Use row index to check
for empty slot.
(Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
file format.
(Dwp_output_file::Dwp_index::grow): Use row index to check for empty
slot.
(Dwp_output_file::initialize): Remove unused function.
(Dwp_output_file::finalize): Add support for v2 package file format.
(Dwp_output_file::write_index): Likewise.
* gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
function prototype.

11 years agogold/
Cary Coutant [Thu, 31 Oct 2013 18:19:12 +0000 (11:19 -0700)]
gold/
* configure.ac: Fix check for -fmerge-constants.
* configure.ac: Regenerate.

11 years agoExtra error message from update_watchpoint
Andrew Burgess [Tue, 29 Oct 2013 16:33:42 +0000 (16:33 +0000)]
Extra error message from update_watchpoint

  https://sourceware.org/ml/gdb-patches/2013-10/msg00551.html

gdb/ChangeLog

* breakpoint.c (update_watchpoint): Update error message and add
an additional error message.

gdb/testsuite/ChangeLog

* gdb.base/watchpoint.exp (test_no_hw_watchpoints): Add additional
tests and update expected error message.
(test_watch_register_location): New tests.
(do_tests): Call test_watch_register_location.
* gdb.base/watchpoints.exp: Update expected error message.

11 years agogold: x86_64-nacl: Correct 9-byte nop sequence to match what the assembler generates.
Roland McGrath [Wed, 30 Oct 2013 22:57:58 +0000 (15:57 -0700)]
gold: x86_64-nacl: Correct 9-byte nop sequence to match what the assembler generates.

gold/
* x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
Correct 9-byte nop sequence to match what the assembler generates.

11 years agodaily update
Alan Modra [Wed, 30 Oct 2013 23:00:02 +0000 (09:30 +1030)]
daily update

11 years agoS/390: Add missing gdb_prompt in s390-multiarch.exp
Ulrich Weigand [Wed, 30 Oct 2013 18:03:39 +0000 (19:03 +0100)]
S/390: Add missing gdb_prompt in s390-multiarch.exp

Correct the patterns in the gdb_test_multiple invocation.

testsuite/
2013-10-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>

* gdb.arch/s390-multiarch.exp (test_linux_v2): Add $gdb_prompt to
the patterns in gdb_test_multiple.

11 years agoS/390: Rename source files to *-linux-*
Ulrich Weigand [Wed, 30 Oct 2013 17:57:08 +0000 (18:57 +0100)]
S/390: Rename source files to *-linux-*

As suggested before, rename the S/390-related source files (tdep and nat)
such that "-linux-" occurs in the file name, like with other GNU/Linux
targets.  Since no other operating system is currently supported by GDB
on this architecture, this isn't strictly necessary.  But the old names
sometimes caused GDB contributors to miss these files when performing a
change that affects all GNU/Linux targets.  The latest such incident was
observed here:

    https://sourceware.org/ml/gdb-patches/2013-09/msg00619.html

gdb/
2013-10-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>

* s390-tdep.h: Rename to...
* s390-linux-tdep.h: ...here.
* s390-tdep.c: Rename to...
* s390-linux-tdep.c: ...here.  Adjust #include.
* s390-nat.c: Rename to...
* s390-linux-nat.c: ...here.  Adjust #include.
* config/s390/s390.mh: Rename to...
* config/s390/linux.mh: ...here.  Reflect rename s390-nat.o ->
s390-linux-nat.o.
* configure.host: Reflect host rename "s390" -> "linux".
* configure.tgt: Reflect rename s390-tdep.o -> s390-linux-tdep.o.
* Makefile.in (ALL_TARGET_OBS): Likewise.
(HFILES_NO_SRCDIR): Reflect rename s390-tdep.h ->
s390-linux-tdep.h.
(ALLDEPFILES): Reflect rename of .c files.

11 years agoClean up whitespace in S/390 -tdep and -nat files.
Ulrich Weigand [Wed, 30 Oct 2013 17:51:57 +0000 (18:51 +0100)]
Clean up whitespace in S/390 -tdep and -nat files.

gdb/
2013-10-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>

* s390-nat.c: Whitespace cleanup.
* s390-tdep.c: Likewise.
* s390-tdep.h: Remove empty line at end of file.

11 years agoS/390: Disassemble 31-bit binaries with "zarch" opcode set by default
Andreas Arnez [Wed, 30 Oct 2013 17:04:32 +0000 (18:04 +0100)]
S/390: Disassemble 31-bit binaries with "zarch" opcode set by default

Currently the disassembler for s390 (by default) assumes that a 31-bit
binary was compiled in "ESA" mode -- and then only disassembles a
limited opcode set.  The change upgrades the default to the full "zarch"
opcode set even for 31-bit binaries.

opcodes/
* s390-dis.c (init_disasm): Default to full 'zarch' opcode
availability even for 31-bit programs.

11 years agoPowerPC64 ELFv2 support for gold.
Alan Modra [Tue, 29 Oct 2013 07:15:48 +0000 (17:45 +1030)]
PowerPC64 ELFv2 support for gold.

elfcpp/
* powerpc.h (EF_PPC64_ABI): New enum constant.
(STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Likewise.
(ppc64_decode_local_entry): New function.
(ppc64_encode_local_entry): Likewise.
gold/
* powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
ppc64_local_entry_offset, ppc64_local_entry_offset,
do_read_symbols): New functions.
(Powerpc_relobj::e_flags_, st_other_): New vars.
(Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
(Powerpc_dynobj::abiversion, set_abiversion): New functions.
(Powerpc_relobj::e_flags_): New var.
(Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
and adjust for ELFv2.
(Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
(Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
(Powerpc_dynobj::do_find_special_sections): Likewise.
(Target_powerpc::do_define_standard_symbols): Define ".TOC.".
(Target_powerpc::Branch_info::make_stub): Adjust stub destination
to ELFv2 local entry.
(Target_powerpc::do_relax): No thread safe barriers needed for
ELFv2.
(Output_data_plt_powerpc::initial_plt_entry_size_,
plt_entry_size): Delete.  Replace all uses with
first_plt_entry_offset() and plt_entry_size().
(Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
reserved_size parm.  Update callers.
(Output_data_plt_powerpc::entry_count): Update.
(Output_data_plt_powerpc::first_plt_entry_offset): Make private
and use Target_powerpc::first_plt_entry_offset().
(Output_data_plt_powerpc::get_plt_entry_size): Similarly and
rename to plt_entry_size.
(Output_data_plt_powerpc::add_ifunc_entry,
add_local_ifunc_entry): Adjust reloc for ELFv2.
(glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
(glink_eh_frame_fde_64v2): New.
(Stub_table::plt_call_size): Support ELFv2 sizing.
(Output_data_glink::add_eh_frame): Use the new FDE.
(Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
(Stub_table::do_write): Write ELFv2 stubs and glink.
(Target_powerpc::Relocate::relocate): Replaces nop after call
with ld 2,24(1) and adjust local offset destination for ELFv2.

11 years agoAdd PowerPC64 ELFv2 tests.
Alan Modra [Tue, 29 Oct 2013 06:10:34 +0000 (16:40 +1030)]
Add PowerPC64 ELFv2 tests.

* ld-powerpc/elfv2.s,
* ld-powerpc/elfv2so.d,
* ld-powerpc/elfv2exe.d: New tests.
* ld-powerpc/powerpc.exp: Run them.

11 years agoReplace DT_PPC_TLSOPT with DT_PPC_OPT.
Alan Modra [Tue, 29 Oct 2013 06:04:35 +0000 (16:34 +1030)]
Replace DT_PPC_TLSOPT with DT_PPC_OPT.

This removes the DT_PPC_TLSOPT/DT_PPC64_TLSOPT dynamic tag and replaces
it with DT_PPC_OPT/DT_PPC64_OPT tag to provide the same functionality
and more.  This isn't backwards compatible, but the TLSOPT tag hasn't
been used since the tls optimisation support was never submitted to
glibc.

/include/elf/
* ppc.h (DT_PPC_TLSOPT): Delete.
(DT_PPC_OPT, PPC_OPT_TLS): Define.
* ppc64.h (DT_PPC64_TLSOPT): Delete.
(DT_PPC64_OPT, PPC64_OPT_TLS, PPC64_OPT_MULTI_TOC): Define.
bfd/
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Use new DT_PPC_OPT
tag to specify tls optimisation.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
(ppc64_elf_finish_dynamic_sections): Specify whether multiple
toc pointers are used via DT_PPC64_OPT.
binutils/
* readelf.c (get_ppc_dynamic_type): Replace PPC_TLSOPT with PPC_OPT.
(get_ppc64_dynamic_type): Replace PPC64_TLSOPT with PPC64_OPT.

11 years agoSupport ELFv2 stack frame.
Alan Modra [Tue, 29 Oct 2013 05:47:22 +0000 (16:17 +1030)]
Support ELFv2 stack frame.

The toc pointer save slot changes on ELFv2 from 40(1) to 24(1).

* elf64-ppc.c (STK_LR, STK_TOC, STK_LINKER): Define.
(savegpr0_tail, restgpr0_tail, savefpr0_tail, restfpr0_tail)
build_plt_stub, build_tls_get_addr_stub, ppc_build_one_stub,
ppc64_elf_relocate_section): Use new defines.

11 years agoELFv2 stub, plt and glink changes
Alan Modra [Tue, 29 Oct 2013 05:28:05 +0000 (15:58 +1030)]
ELFv2 stub, plt and glink changes

An ELFv2 PLT entry is simply the address of the target function rather
than three (or two) words to specify entry, toc and static chain.  PLT
call stubs are correspondingly simpler and need no thread safety
barrier.  The glink resolver stub and branch table also is simplified,
a change that could be applied to ELFv1 too, but isn't as yet.

* elf64-ppc.c (PLT_ENTRY_SIZE, PLT_INITIAL_ENTRY_SIZE): Add htab
parameter and adjust for ELFv2.  Update all uses.
(PLT_CALL_STUB_SIZE): Delete.
(ppc64_elf_get_synthetic_symtab): Support new glink layout.
(allocate_dynrelocs): Likewise.
(plt_stub_size, build_plt_stub): Adjust for ELFv2.
(get_r2off): Return 0 for ELFv2 -R.
(ppc_build_one_stub, ppc_size_one_stub): Adjust for ELFv2.
(ppc64_elf_size_stubs): Likewise.
(ppc64_elf_build_stubs): Add new ELFv2 glink.

11 years agoAdd ELFv2 .localentry support.
Alan Modra [Tue, 29 Oct 2013 05:07:43 +0000 (15:37 +1030)]
Add ELFv2 .localentry support.

This defines the ELF symbol st_other field used to encode the number
of instructions between a function "global entry" and its "local entry",
and adds support related to the local entry offset.

include/elf/
* ppc64.h (STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Define.
(ppc64_decode_local_entry, ppc64_encode_local_entry): New functions.
(PPC64_LOCAL_ENTRY_OFFSET, PPC64_SET_LOCAL_ENTRY_OFFSET): Define.
bfd/
* elf64-ppc.c (struct ppc_stub_hash_entry): Add "other".
(stub_hash_newfunc): Init new ppc_stub_hash_entry field, and one
we forgot, "plt_ent".
(ppc64_elf_add_symbol_hook): Check ELFv1 objects don't have
st_other bits only valid in ELFv2.
(ppc64_elf_merge_symbol_attribute): New function.
(ppc_type_of_stub): Add local_off param to test branch range.
(ppc_build_one_stub): Adjust destinations for ELFv2 locals.
(ppc_size_one_stub, toc_adjusting_stub_needed): Similarly.
(ppc64_elf_size_stubs): Pass local_off to ppc_type_of_stub.
Set "other" field.
(ppc64_elf_relocate_section): Adjust destination for ELFv2 local
calls.
gas/
* config/tc-ppc.c (md_pseudo_table): Add .localentry.
(ppc_elf_localentry): New function.
(ppc_force_relocation): Force relocs on all branches to localenty
symbols.
(ppc_fix_adjustable): Don't reduce such symbols to section+offset.
binutils/
* readelf.c (get_ppc64_symbol_other): New function.
(get_symbol_other): Use it for EM_PPC64.

11 years agoAdd .abiversion related support for ELFv2
Alan Modra [Tue, 29 Oct 2013 04:36:09 +0000 (15:06 +1030)]
Add .abiversion related support for ELFv2

Defines bits in ELF e_flags to differentiate ELFv2 objects from ELFv2,
adds .abiversion directive to explicitly choose the ABI, and code to
check and automatically select ABI.

include/elf/
* ppc64.h (EF_PPC64_ABI): Define.
bfd/
* elf64-ppc.c (abiversion, set_abiversion): New functions.
(ppc64_elf_get_synthetic_symtab): Handle ELFv2 objects without .opd.
(struct ppc_link_hash_table): Add opd_abi.
(ppc64_elf_check_relocs): Check no .opd with ELFv2.
(ppc64_elf_merge_private_bfd_data): New function.
(ppc64_elf_print_private_bfd_data): New function.
(ppc64_elf_tls_setup): Set htab->opd_abi.
(ppc64_elf_size_dynamic_sections): Don't emit OPD related dynamic
tags for ELFv2.
(ppc_build_one_stub): Use R_PPC64_IRELATIVE for ELFv2 ifunc.
(ppc64_elf_finish_dynamic_symbol): Likewise
binutils/
* readelf.c (get_machine_flags): Display ABI version for EM_PPC64.
gas/
* config/tc-ppc.c: Include elf/ppc64.h.
(ppc_abiversion): New variable.
(md_pseudo_table): Add .abiversion.
(ppc_elf_abiversion, ppc_elf_end): New functions.
* config/tc-ppc.h (md_end): Define.

11 years agoChange plt stubs to have destination in r12.
Alan Modra [Tue, 29 Oct 2013 02:09:30 +0000 (12:39 +1030)]
Change plt stubs to have destination in r12.

This change is to support the new ELFv2 ABI, which uses the value in
r12 on function entry to calculate the got/toc pointer.

bfd/
* elf64-ppc.c (build_plt_stub): Switch stubs to use r11 as base
reg and r12 as destination.
(ppc_build_one_stub): Likewise.
(ppc64_elf_build_stubs): Likewise for glink.
ld/testsuite/
* ld-powerpc/tls.s: Add proper .opd entry for _start.
* ld-powerpc/tlstoc.s: Likewise.
* ld-powerpc/relbrlt.d: Update for changed stubs.
* ld-powerpc/tls.d: Update for changed stubs and _start .opd entry.
* ld-powerpc/tls.g: Likewise.
* ld-powerpc/tlsexe.d: Likewise.
* ld-powerpc/tlsexe.g: Likewise.
* ld-powerpc/tlsexe.r: Likewise.
* ld-powerpc/tlsexetoc.d: Likewise.
* ld-powerpc/tlsexetoc.g: Likewise.
* ld-powerpc/tlsexetoc.r: Likewise.
* ld-powerpc/tlsso.d: Likewise.
* ld-powerpc/tlsso.g: Likewise.
* ld-powerpc/tlsso.r: Likewise.
* ld-powerpc/tlstoc.d: Likewise.
* ld-powerpc/tlstoc.g: Likewise.
* ld-powerpc/tlstocso.d: Likewise.
* ld-powerpc/tlstocso.g: Likewise.
* ld-powerpc/tlstocso.r: Likewise.

11 years agoReport overflow on PowerPC64 @h and @ha relocations.
Alan Modra [Tue, 29 Oct 2013 06:23:25 +0000 (16:53 +1030)]
Report overflow on PowerPC64 @h and @ha relocations.

This changes the behaviour of @h and @ha on PowerPC64 to report errors
on 32-bit overflow.  The motivation for this change is that on
PowerPC64, most uses of @h and @ha modifiers and their corresponding
relocations are to build up 32-bit offsets.  We'd like to know when
such offsets overflow.  Only rarely do people use @h or @ha with the
high 32-bit modifiers to build a 64-bit constant.  Those uses will now
need to use two new modifiers, @high and @higha, if the constant isn't
known at assembly time.  For now, we won't report overflow at assembly
time..

This also fixes an error when applying some of the HIGHER and HIGHEST
relocations.

include/elf/
* ppc64.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): New.
(IS_PPC64_TLS_RELOC): Match new tls relocs.
bfd/
* reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA,
BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA,
BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New.
* elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs.
Make all _HA and _HI relocs report signed overflow.
(ppc64_elf_reloc_type_lookup): Handle new relocs.
(must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise.
(dec_dynrel_count, ppc64_elf_relocate_section): Likewise.
(ppc64_elf_relocate_section): Don't apply 0x8000 adjust to
R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST,
R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
gas/
* config/tc-ppc.c (SEX16): Don't mask.
(REPORT_OVERFLOW_HI): Define as zero.
(ppc_elf_suffix): Support @high, @higha, @dtprel@high, @dtprel@higha,
@tprel@high, and @tprel@higha modifiers.
(md_assemble): Ignore X_unsigned when applying 16-bit insn fields.
Add (disabled) code to check @h and @ha reloc overflow for powerpc64.
Handle new relocs.
(md_apply_fix): Similarly.
elfcpp/
* powerpc.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): Define.
gold/
* powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
(Target_powerpc::Scan::global, local): Likewise.
(Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
on all ppc64 @h and @ha relocs.

11 years agolinux-tdep.c: Fix "warning: 'siginfo_size' may be used uninitialized..."
Maciej W. Rozycki [Wed, 30 Oct 2013 01:05:18 +0000 (01:05 +0000)]
linux-tdep.c: Fix "warning: 'siginfo_size' may be used uninitialized..."

* linux-tdep.c (linux_corefile_thread_callback): Preinitialize
siginfo_size.

11 years agoBFD: elf64-x86-64-nacl: Correct 9-byte nop sequence used in PLT0 entry.
Roland McGrath [Tue, 29 Oct 2013 23:15:38 +0000 (16:15 -0700)]
BFD: elf64-x86-64-nacl: Correct 9-byte nop sequence used in PLT0 entry.

bfd/
* elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Correct 9-byte nop
sequence to match what the assembler generates.

11 years agodaily update
Alan Modra [Tue, 29 Oct 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agodaily update
Alan Modra [Tue, 29 Oct 2013 09:40:17 +0000 (20:10 +1030)]
daily update

11 years agold/ELF: refine fake STT_FILE symbol emission
Jan Beulich [Tue, 29 Oct 2013 16:52:24 +0000 (17:52 +0100)]
ld/ELF: refine fake STT_FILE symbol emission

There's no real need to emit these always: They're needed only if we
indeed want to emit a localized symbol. Hence defer emission until we
at least did the basic early checks that would lead to no such symbol
getting emitted. This in particular avoids emitting such a symbol in
the majority of (if not all) "ld -r" cases.

I hope my set of cross build tests caught all the test cases needing
adjustment - please forgive if I missed a few.

bfd/
2013-10-29  Jan Beulich <jbeulich@suse.com>

* elflink.c (struct elf_outext_info): Add field file_sym_done.
(bfd_elf_final_link): Initialize new field. Move fake STT_FILE
symbol emission from here ...
(elf_link_output_extsym): ... to here.

gas/testsuite/
2013-10-29  Jan Beulich <jbeulich@suse.com>

* gas/microblaze/relax_size.elf: Drop expectation of no longer
present STT_FILE symbol.
* gas/microblaze/relax_size2.elf: Likewise.

ld/testsuite/
2013-10-29  Jan Beulich <jbeulich@suse.com>

* ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer
present STT_FILE symbol.
* ld-mmix/bpo-18.d: Likewise.
* ld-mmix/bpo-22.d: Likewise.
* ld-mmix/greg-6.d: Likewise.
* ld-mmix/greg-7.d: Likewise.
* ld-mmix/loc4.d: Likewise.
* ld-mmix/local1.d: Likewise.
* ld-mmix/local3.d: Likewise.
* ld-mmix/local5.d: Likewise.
* ld-mmix/local7.d: Likewise.
* ld-mmix/loct-1.d: Likewise.
* ld-sh/sh64/abi32.xd: Likewise.
* ld-sh/sh64/abi64.xd: Likewise.
* ld-sh/sh64/cmpct1.xd: Likewise.
* ld-sh/sh64/crange1.rd: Likewise.
* ld-sh/sh64/crange2.rd: Likewise.
* ld-sh/sh64/crange3-cmpct.rd: Likewise.
* ld-sh/sh64/crange3-media.rd: Likewise.
* ld-sh/sh64/crange3.rd: Likewise.
* ld-sh/sh64/crangerel1.rd: Likewise.
* ld-sh/sh64/crangerel2.rd: Likewise.
* ld-sh/sh64/mix1.xd: Likewise.
* ld-sh/sh64/mix2.xd: Likewise.
* ld-sh/sh64/shdl32.xd: Likewise.
* ld-sh/sh64/shdl64.xd: Likewise.

11 years agoundef reg in gdb_curses.h
Tom Tromey [Wed, 16 Oct 2013 18:25:27 +0000 (12:25 -0600)]
undef reg in gdb_curses.h

I tried to build gdb on the AIX machine in the GCC compile farm
(gcc111), but it failed in a couple of spots because gdb uses "reg" as
a variable name and the AIX <curses.h> defines "reg" to "register".

I saw that we already had a workaround for this lurking in utils.c, so
I just moved that to gdb_curses.h.

This fixed the problem on AIX and still builds on x86-64 Fedora 18.

2013-10-29  Tom Tromey  <tromey@redhat.com>

* utils.c (reg): Move undefinition...
* gdb_curses.h: ... here.  Update comment to mention AIX.

11 years agoChangeLog entries for the remove-symbol-file commits.
Nicolas Blanc [Tue, 29 Oct 2013 16:32:17 +0000 (17:32 +0100)]
ChangeLog entries for the remove-symbol-file commits.

11 years agogdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change...
Pedro Alves [Tue, 29 Oct 2013 13:48:25 +0000 (13:48 +0000)]
gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change-log-default-name.

These references to ChangeLog-mi are stale.
testsuite/gdb.mi/ChangeLog-mi doesn't exist anymore, since:

...
commit 2dd627049d915a78ba15b65ab718d54958d115bf
Author: Andrew Cagney <cagney@redhat.com>
Date:   Sat Jun 23 21:47:09 2001 +0000

    Rename gdb.mi/ChangeLog-mi to gdb.mi/ChangeLog.  Update everything.
...
commit 48efe7049b1c286c702621e2f3e89e4584df2bd2
Author: Andrew Cagney <cagney@redhat.com>
Date:   Mon Jan 12 15:16:44 2004 +0000

    Eliminate the old mi/tui specific ChangeLog files as in ...

    Added Files:
        mi/ChangeLog-1999-2003 testsuite/gdb.mi/ChangeLog-1999-2003
        tui/ChangeLog-1998-2003
    Removed Files:
        mi/ChangeLog testsuite/gdb.mi/ChangeLog tui/ChangeLog

Tested with 'make check RUNTESTFLAGS="--directory=gdb.mi"' on x86_64 Fedora 17.

gdb/testsuite/
2013-10-29  Pedro Alves  <palves@redhat.com>

* gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs
variable setting change-log-default-name to ChangeLog-mi.

11 years agoPrint <unavailable> for unavailable registers in info register output.
Andrew Burgess [Tue, 29 Oct 2013 13:24:11 +0000 (13:24 +0000)]
Print <unavailable> for unavailable registers in info register output.

  https://sourceware.org/ml/gdb-patches/2013-08/msg00171.html

gdb/ChangeLog

* infcmd.c (default_print_one_register_info): Use val_print to
print all values even optimized out or unavailable ones.  Don't
try to print a raw form of optimized out or unavailable values.

gdb/testsuite/ChangeLog

* gdb.trace/unavailable.exp (gdb_unavailable_registers_test):
Expect <unavailable> pattern.

11 years agoTest adding and removing a symbol file at runtime.
Nicolas Blanc [Wed, 17 Jul 2013 09:44:26 +0000 (11:44 +0200)]
Test adding and removing a symbol file at runtime.

This test exercises the commands 'add-symbol-file'
and 'remove-symbol-file'.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

gdb/testsuite
* gdb.base/sym-file-lib.c: New file.
* gdb.base/sym-file-loader.c: New file.
* gdb.base/sym-file-loader.h: New file.
* gdb.base/sym-file-main.c: New file.
* gdb.base/sym-file.exp: New file.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
11 years agoFunction is_elf_target.
Nicolas Blanc [Wed, 17 Jul 2013 09:40:12 +0000 (11:40 +0200)]
Function is_elf_target.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

gdb/testsuite
* lib/gdb.exp (is_elf_target): New function.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
11 years agoCreate target sections for user-added symbol files.
Nicolas Blanc [Wed, 17 Jul 2013 09:33:45 +0000 (11:33 +0200)]
Create target sections for user-added symbol files.

Add the sections of the symbol files that are provided via
'add-symbol-file' to the set of current target sections.
User-added sections are removed upon notification of free_objfile
when their corresponding object file is deleted.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

* exec.h (add_target_sections_of_objfile): New declaration.
* exec.c (add_target_sections_of_objfile): New function.
* symfile.c (add_symbol_file_command): Update current target sections.
(symfile_free_objfile): New function.
(_initialize_symfile): Register observer for free_objfile events.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
11 years agoDocumentation for the remove-symbol-file command.
Nicolas Blanc [Fri, 5 Apr 2013 07:15:56 +0000 (09:15 +0200)]
Documentation for the remove-symbol-file command.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

* NEWS: Add description of the remove-symbol-file command.
gdb/doc
* gdb.texinfo (Commands to Specify Files): Add description
of the remove-symbol-file command.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
11 years agoNew remove-symbol-file command.
Nicolas Blanc [Tue, 12 Mar 2013 10:10:18 +0000 (11:10 +0100)]
New remove-symbol-file command.

New command for removing symbol files added via
the add-symbol-file command.

2013-10-29  Nicolas Blanc  <nicolas.blanc@intel.com>

* breakpoint.c (disable_breakpoints_in_freed_objfile): New function.
* objfiles.c (free_objfile): Notify free_objfile.
(is_addr_in_objfile): New function.
* objfiles.h (is_addr_in_objfile): New declaration.
* printcmd.c (clear_dangling_display_expressions): Act upon free_objfile
events instead of solib_unloaded events.
(_initialize_printcmd): Register observer for free_objfile instead
of solib_unloaded notifications.
* solib.c (remove_user_added_objfile): New function.
* symfile.c (remove_symbol_file_command): New command.
(_initialize_symfile): Add remove-symbol-file.
gdb/doc
* observer.texi: New free_objfile event.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
11 years agoSimplify REGISTRY cleanup usages
Yao Qi [Thu, 24 Oct 2013 12:42:02 +0000 (20:42 +0800)]
Simplify REGISTRY cleanup usages

In registry.c:registry_clear_data, the registered data is iterated and
invoke each 'free' function with the data passed:

  for (registration = data_registry->registrations, i = 0;
       i < fields->num_data;
       registration = registration->next, i++)
    if (fields->data[i] != NULL && registration->data->free != NULL)
      adaptor (registration->data->free, container, fields->data[i]);

we can see that data is passed to function 'free' and data is not NULL.
In each usage, we don't have to get the data again through key and
do NULL pointer checking.  This patch is to simplify them.

gdb:

2013-10-29  Yao Qi  <yao@codesourcery.com>

* auto-load.c (auto_load_pspace_data_cleanup): Get data from
parameter 'arg' instead of from program_space_data.
* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
* solib-darwin.c (darwin_pspace_data_cleanup): Likewise.
* solib-dsbt.c (dsbt_pspace_data_cleanup): Likewise.
* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
* inflow.c (inflow_inferior_data_cleanup): Get data from
parameter 'arg' instead of inferior_data.
* registry.h: Add comments.

11 years agobreakpoint.c:watchpoints_triggered: simplify a tiny bit.
Pedro Alves [Mon, 28 Oct 2013 18:34:37 +0000 (18:34 +0000)]
breakpoint.c:watchpoints_triggered: simplify a tiny bit.

I was reading this, checking the the possible returns, and this
particular path confused a tiny little.  Above we do:

  if (!stopped_by_watchpoint)
    {
...
      return 0;
    }

so any return after that always return true.

Tested on x86_64 Fedora 17.

gdb/
2013-10-28  Pedro Alves  <palves@redhat.com>

* breakpoint.c (watchpoints_triggered)
<!target_stopped_data_address>: Hardcode return 1.

11 years agoFix typo in gdb/testsuite/gdb.arch/thumb2-it.S.
Tom de Vries [Wed, 23 Oct 2013 09:19:46 +0000 (11:19 +0200)]
Fix typo in gdb/testsuite/gdb.arch/thumb2-it.S.

2013-10-28  Tom de Vries  <tom@codesourcery.com>

* gdb.arch/thumb2-it.S (it_8): Fix typo.