platform/upstream/binutils.git
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.

11 years agoinfrun.c:process_event_stop_test: Reindent.
Pedro Alves [Mon, 28 Oct 2013 16:39:06 +0000 (16:39 +0000)]
infrun.c:process_event_stop_test: Reindent.

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

* infrun.c (process_event_stop_test): Remove unnecessary scoping
level and reindent.

11 years agoinfrun.c:handle_inferior_event: Make process_event_stop_test label a function.
Pedro Alves [Mon, 28 Oct 2013 16:39:06 +0000 (16:39 +0000)]
infrun.c:handle_inferior_event: Make process_event_stop_test label a function.

Now that all ecs->random_signal handing is always done before the
'process_event_stop_test' label, we can easily make that a real
function and actually give it a describing comment that somewhat makes
sense.

Reindenting the new function will be handled in a follow up patch.

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

* infrun.c (process_event_stop_test): New function, factored out
from handle_inferior_event.
(handle_inferior_event): 'process_event_stop_test' is now a
function instead of a goto label -- adjust.

11 years agoinfrun.c:handle_inferior_event: Move process_event_stop_test goto label.
Pedro Alves [Mon, 28 Oct 2013 16:39:06 +0000 (16:39 +0000)]
infrun.c:handle_inferior_event: Move process_event_stop_test goto label.

We only ever call "goto process_event_stop_test;" right after checking
that ecs->random_signal is clear.  The code at the
process_event_stop_test label looks like:

  /* For the program's own signals, act according to
     the signal handling tables.  */

  if (ecs->random_signal)
    {
     ... random signal handling ...
     return;
    }
  else
    {
     ... the stop tests that actually matter for the goto callers.
    }

So this moves the label into the else branch.  It'll make converting
process_event_stop_test into a function a bit clearer.

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

* infrun.c (handle_inferior_event): Move process_event_stop_test
goto label to the else branch of the ecs->random_signal check,
along with FRAME and GDBARCH re-fetching.

11 years agoinfrun.c:handle_inferior_event: Put all ecs->random_signal tests together.
Pedro Alves [Mon, 28 Oct 2013 16:39:05 +0000 (16:39 +0000)]
infrun.c:handle_inferior_event: Put all ecs->random_signal tests together.

I recently added a new ecs->random_signal test after the "switch back to
stepped thread" code, and before the stepping tests.  Looking at
making process_event_stop_test a proper function, I realized it'd be
better to keep ecs->random_signal related code together.  To do that,
I needed to factor out the "switch back to stepped thread" code to a new
function, and call it in both the "random signal" and "not random
signal" paths.

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

* infrun.c (switch_back_to_stepped_thread): New function, factored
out from handle_inferior_event.
(handle_inferior_event): Adjust to call
switch_back_to_stepped_thread.  Call it also at the tail of the
random signal handling, and return, instead of also handling
random signals just before the stepping tests.

11 years agoinfrun.c:handle_inferior_event: Remove some more dead code.
Pedro Alves [Mon, 28 Oct 2013 16:39:05 +0000 (16:39 +0000)]
infrun.c:handle_inferior_event: Remove some more dead code.

'ecs' is always memset before being passed to handle_inferior_event.
The stop func is only filled in later in the flow.  And since "Remove
dead sets/clears of ecs->random signal", nothing ever sets
ecs->random_signal before this part is reached either.

(Also tested with some added assertions in place.)

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

* infrun.c (clear_stop_func): Delete.
(handle_inferior_event): Don't call clear_stop_func and don't
clear 'ecs->random_signal'.

11 years agoRename field 'lang' to 'lang_ops'.
Yao Qi [Sat, 26 Oct 2013 07:27:13 +0000 (15:27 +0800)]
Rename field 'lang' to 'lang_ops'.

On 10/25/2013 11:34 AM, Joel Brobecker wrote:
> Also, as a followup, I think it would be beneficial if we renamed
> field "lang" in the varobj_root into "lang_ops". I think it's more
> descriptive, especially since "lang" is used elsewhere with different
> meanings (and types).

Here is the patch to rename 'lang' to 'lang_ops'.  Committed as obvious.

gdb:

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

* varobj.c (struct varobj_root) <lang>: Rename to 'lang_ops'.
(varobj_create, varobj_get_path_expr): Update.
(varobj_value_has_mutated, varobj_update): Likewise.
(create_child_with_value, new_root_variable): Likewise.
(number_of_children, name_of_variable): Likewise.
(value_of_child, my_value_of_variable): Likewise.
(varobj_value_is_changeable_p): Likewise.

11 years agoNew field la_varobj_ops in struct language_defn
Yao Qi [Thu, 17 Oct 2013 13:15:21 +0000 (21:15 +0800)]
New field la_varobj_ops in struct language_defn

This is a follow-up series to move language stuff out of varobj.c.

This patch adds a new field la_varobj_ops in struct language_defn so
that each language has varobj-related options.  Not every language
supports varobj, and the operations are identical to operations of c
languages.

'struct language_defn' is the ideal place to save all language-related
operations.  After this patch, some cleanups can be done in patch 2/2,
which removes language-related stuff completely from varobj.c.

Regression tested on x86_64-linux.

gdb:

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

* language.h (struct lang_varobj_ops): Declare.
(struct language_defn) <la_varobj_ops>: New field.
* ada-lang.c: Include "varobj.h"
(defn ada_language_defn): Initialize field 'la_varobj_ops' by
ada_varobj_ops.
* c-lang.c: Include "varobj.h"
(c_language_defn): Initialize field 'la_varobj_ops' by
c_varobj_ops.
(cplus_language_defn): Initialize field 'la_varobj_ops' by
cplus_varobj_ops.
(asm_language_defn): Initialize field 'la_varobj_ops' by
default_varobj_ops.
(minimal_language_defn): Likewise.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Likewise.
* go-lang.c (go_language_defn): Likewise.
* m2-lang.c (m2_language_defn): Likewise.
* objc-lang.c (objc_language_defn): Likewise.
* opencl-lang.c (opencl_language_defn): Likewise.
* p-lang.c (pascal_language_defn): Likewise.
* language.c (unknown_language_defn): Likewise.
(auto_language_defn): Likewise.
(local_language_defn): Likewise.
* jv-lang.c (java_language_defn): Initialize field
'la_varobj_ops' by java_varobj_ops.
* varobj.c (varobj_create): Update.
* varobj.h (default_varobj_ops): Define macro.

11 years agotestsuite: Fix gdb.base/bang.exp for remote stubs without exit
Anton Kolesov [Wed, 9 Oct 2013 08:58:14 +0000 (12:58 +0400)]
testsuite: Fix gdb.base/bang.exp for remote stubs without exit

Some remote stubs do not have a proper exit() function implementation.
gdb.base/bang.exp was failing on those targets due to timeout.  With
this patch bang.exp uses already defined library procedures to handle
this situation gracefully without breaking native targets.

Tested with x86_64 (unix, native-gdbserver) and with arc-*-elf32.

gdb/testsuite/ChangeLog:

2013-10-25  Anton Kolesov  <Anton.Kolesov@synopsys.com>  (tiny change)

* gdb.base/bang.exp: Use gdb_continue_to_end to properly support
remote stubs where exit() behaviour is unreliable.

11 years agoPrint nonexisting/optimized out static fields gracefully.
Pedro Alves [Fri, 25 Oct 2013 10:37:13 +0000 (11:37 +0100)]
Print nonexisting/optimized out static fields gracefully.

With:

 struct static_struct { static int aaa; };
 struct static_struct sss;
 int main () { return 0; }

We get:

 (gdb) p sss
 $1 = {static aaa = <optimized out>}
 (gdb) p sss.aaa
 field aaa is nonexistent or has been optimized out

Note that the "field aaa ..." message is an error being thrown.

GDB is graceful everywhere else when printing optimized out values.
IOW it usually prints an <optimized out> value and puts that in the
value history.  I see no reason for here to be different, more so that
when the print the whole "containing" object (well, it's a static
field, so it's not really a container), we already print <optimized
out>.

After the patch:

 (gdb) p sss
 $1 = {static aaa = <optimized out>}
 (gdb) p sss.aaa
 $2 = <optimized out>

The value_entirely_optimized_out checks are there to preserve
behavior.  Without those, if the static field is a struct/union, GDB
would go and print its fields one by one (and print <optimized out>
for each).

Tested on x86_64 Fedora 17.

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

* cp-valprint.c (cp_print_value_fields): No longer handle a NULL
static field value.
(cp_print_static_field): If the value is entirely optimized out,
print <optimized out> here.
* jv-valprint.c (java_print_value_fields): No longer handle a NULL
static field value.
* p-valprint.c (pascal_object_print_static_field): If the value is
entirely optimized out, print <optimized out> here.
* valops.c (do_search_struct_field)
(value_struct_elt_for_reference): No longer handle a NULL static
field value.
* value.c (value_static_field): Return an optimized out value
instead of NULL.

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

* gdb.cp/m-static.exp: Adjust expected output of printing a
nonexistent or optimized out static field.  Also test printing the
the "container" object.

11 years ago PR binutils/15994
Nick Clifton [Fri, 25 Oct 2013 08:33:59 +0000 (09:33 +0100)]
PR binutils/15994
* dwarf2.c (lookup_address_in_line_info_table): Change return type
to be the range of addresses covered by the table.
(comp_unit_find_nearest_line): Likewise.
(find_line): Search all CUs.  Select the one that matches and
covers the smallest address range.

11 years ago PR binutils/15994
Nick Clifton [Fri, 25 Oct 2013 08:32:43 +0000 (09:32 +0100)]
PR binutils/15994
* dwarf2.c (lookup_address_in_line_info_table): Change return type
to be the range of addresses covered by the table.
(comp_unit_find_nearest_line): Likewise.
(find_line): Search all CUs.  Select the one that matches and
covers the smallest address range.

11 years ago * nm.c (display_rel_file): Treat bfd_error_no_symbols as
Nick Clifton [Fri, 25 Oct 2013 08:29:07 +0000 (09:29 +0100)]
* nm.c (display_rel_file): Treat bfd_error_no_symbols as
non-fatal.

11 years ago* nm.c (display_rel_file): Treat bfd_error_no_symbols as
Nick Clifton [Fri, 25 Oct 2013 08:26:56 +0000 (09:26 +0100)]
* nm.c (display_rel_file): Treat bfd_error_no_symbols as
  non-fatal.

11 years ago * binutils-all/objdump.exp (cps_expected): Add MSP430 to list.
Nick Clifton [Fri, 25 Oct 2013 08:24:57 +0000 (09:24 +0100)]
* binutils-all/objdump.exp (cps_expected): Add MSP430 to list.

11 years agoSend qXfer:traceframe-info:read when traceframe is selected.
Yao Qi [Thu, 24 Oct 2013 01:28:33 +0000 (09:28 +0800)]
Send qXfer:traceframe-info:read when traceframe is selected.

When I do 'si', I find many 'qXfer:traceframe-info:read' packets are sent,
which is not necessary.  It slows down the single step.
(gdb) si
Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
Sending packet: $Z0,80483c7,1#b4...Packet received: OK
Sending packet: $Z0,4ce5b6b0,1#6e...Packet received: OK
Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;#5f...Packet received: OK
Sending packet: $vCont;s:p1b15.1b15;c#20...Packet received: T0505:44efffbf;04:44efffbf;08:d1830408;thread:p1b15.1b15;core:3;
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $mbfffef40,40#c0...Packet received: d183040878efffbf2e840408030000000000a040030000000500000070efffbf07000000010000004984040807000000030000000500000000000000b396e84c
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $z0,80483c7,1#d4...Packet received: OK
Sending packet: $z0,4ce5b6b0,1#8e...Packet received: OK
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01

This problem was introduced by this patch
(https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html), in
which get_traceframe_number is not checked before calling
traceframe_available_memory.  This patch moves the check to
remote_traceframe_info, say, if GDB doesn't have traceframe selected, GDB
doesn't need to send qXfer:traceframe-info:read packets.

With this patch applied, there is no qXfer:traceframe-info:read sent
out and single step is speed up a little bit.

Here is the experiment I did:

   Num of single step Original Patched

single-step cpu_time 10000 8.08 7.57
single-step cpu_time 20000 16.23 14.23
single-step cpu_time 30000 24.19 21.59
single-step cpu_time 40000 32.49 28.0
single-step wall_time 10000 14.1974210739 13.2641420364
single-step wall_time 20000 28.5278921127 25.0541369915
single-step wall_time 30000 42.5864038467 38.0038759708
single-step wall_time 40000 57.2107698917 49.2350611687
single-step vmsize 10000 16128 16388
single-step vmsize 20000 16128 16388
single-step vmsize 30000 16260 16520
single-step vmsize 40000 16444 16704

The patch is tested on x86_64-linux.

gdb:

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

* remote.c (remote_traceframe_info): Return early if
traceframe is not selected.

11 years agoChange mode of gas/configure back to 0755
Yao Qi [Fri, 25 Oct 2013 07:04:06 +0000 (15:04 +0800)]
Change mode of gas/configure back to 0755

11 years agoFix changelog.
Yao Qi [Fri, 25 Oct 2013 06:55:52 +0000 (14:55 +0800)]
Fix changelog.

gdb/

Add changelog entry for my previous commit.

11 years agoRemove global traceframe_fun and traceframe_sal
Yao Qi [Thu, 24 Oct 2013 00:46:07 +0000 (08:46 +0800)]
Remove global traceframe_fun and traceframe_sal

I happen to see traceframe_fun and traceframe_sal are static variables,
which are not necessary to me.  They are only used in set_traceframe_context,
and they are not stateful.  This patch is to remove them.

gdb:

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

* tracepoint.c (traceframe_fun): Remove.
(traceframe_sal): Remove.
(set_traceframe_context): Add local variables.

11 years agoMinor coding style fixes in varobj.h
Joel Brobecker [Fri, 25 Oct 2013 03:18:50 +0000 (07:18 +0400)]
Minor coding style fixes in varobj.h

No actual code change, just a minor style fix.

gdb/ChangeLog:

        * varobj.h (struct lang_varobj_ops): Remove spaces between '*'
        and parameter name.

11 years agotestsuite: Persistent gdbserver cleanup
Maciej W. Rozycki [Thu, 24 Oct 2013 22:32:30 +0000 (23:32 +0100)]
testsuite: Persistent gdbserver cleanup

* lib/gdb.exp (gdb_finish): Send a kill request to `gdbserver'
if in the persistent mode.
* gdb.trace/disconnected-tracing.exp: Reconnect before completion.

11 years agoAvoid producing broken non-native core files
Maciej W. Rozycki [Thu, 24 Oct 2013 19:37:49 +0000 (20:37 +0100)]
Avoid producing broken non-native core files

gdb/
* linux-tdep.c (linux_corefile_thread_callback): Propagate any
failure from register information collection.

gdb/testsuite/
* lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not
support core file generation" reply.