deliverable/binutils-gdb.git
9 years agoxtensa: optimize check_section_ebb_pcrels_fit
Max Filippov [Fri, 27 Mar 2015 04:13:55 +0000 (07:13 +0300)] 
xtensa: optimize check_section_ebb_pcrels_fit

The original check_section_ebb_pcrels_fit algorithm checks that text
actions proposed for current EBB are OK for every relocation in a
section. There's no need to check every relocation, because text actions
for EBB can only change size of that EBB, thus only affecting
relocations that in any way cross that EBB. In addition EBBs are
iterated in ascending order of their VMA, making it easier to track
relevant relocations.

Introduce a structure that can track relocations that cross the range of
VMAs of EBB and use it to only check relocations relevant to current EBB
in check_section_ebb_pcrels_fit.
It takes O(N log N) operations to build it and O(N) operations to move
current EBB VMA window through its entire range, where N is the number
of relocations in a section. The resulting complexity of
compute_text_actions is thus reduced from O(N^2) to O(N log N + N * M),
where M is the average number of relocations crossing each EBB.

Original profile:

% time    self  children    called     name
-----------------------------------------
         44.26   71.53    6429/6429        compute_text_actions
  50.2   44.26   71.53    6429         check_section_ebb_pcrels_fit
          1.16   20.12 347506666/347576152     pcrel_reloc_fits
          2.95   16.52 347506666/348104944     get_relocation_opnd
          2.01    9.74 347575100/361252208     r_reloc_init
          0.55    7.53 347575100/363381467     r_reloc_get_section
          5.76    0.02 695013332/695013332     xlate_offset_with_removed_text
          0.68    3.89 347575100/363483827     bfd_octets_per_byte
          0.32    0.00 347506666/349910253     is_alt_relocation
          0.18    0.11    6391/6391        build_xlate_map
          0.00    0.00    6429/19417168     get_xtensa_relax_info
          0.00    0.00    6391/6391        free_xlate_map
-----------------------------------------

Same data, after optimization:

% time    self  children    called     name
-----------------------------------------
          2.56    3.08    6429/6429        compute_text_actions
   8.2    2.56    3.08    6429         check_section_ebb_pcrels_fit
          0.08    0.91 17721075/17790561     pcrel_reloc_fits
          0.17    0.47 17721075/31685977     r_reloc_init
          0.43    0.00 35442150/35442150     xlate_offset_with_removed_text
          0.02    0.37 17721075/33815236     r_reloc_get_section
          0.22    0.11    6391/6391        build_xlate_map
          0.05    0.22 17721075/33917596     bfd_octets_per_byte
          0.03    0.00 17721075/20405299     is_alt_relocation
          0.01    0.00    6429/6429        reloc_range_list_update_range
          0.00    0.00    6429/19417168     get_xtensa_relax_info
          0.00    0.00    6391/6391        free_xlate_map
-----------------------------------------

2015-04-01  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (reloc_range_list, reloc_range_list_entry,
reloc_range): new typedef.
(reloc_range_list_struct, reloc_range_list_entry_struct,
reloc_range_struct): new structures.
(reloc_range_compare, build_reloc_ranges,
reloc_range_list_append, reloc_range_list_remove,
reloc_range_list_update_range, free_reloc_range_list): new
functions.
(compute_text_actions): precompute relocation opcodes before the
loop. Add relevant_relocs variable, initialize it before the
loop, pass it to the check_section_ebb_pcrels_fit.
(check_section_ebb_pcrels_fit): add new parameter:
relevant_relocs. Update address range in the relevant_relocs if
it's non-NULL and iterate only over relevant relocations.

9 years agoRemove BNDPLT and add PARSE_AND_LIST_ARGS_CASE_Z
H.J. Lu [Thu, 9 Apr 2015 14:46:21 +0000 (07:46 -0700)] 
Remove BNDPLT and add PARSE_AND_LIST_ARGS_CASE_Z

* emulparams/elf_x86_64.sh (BNDPLT): Removed.
(PARSE_AND_LIST_OPTIONS): New.
(PARSE_AND_LIST_ARGS_CASE_Z): Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Remove
BNDPLT check.  Handle PARSE_AND_LIST_ARGS_CASE_Z.
(gld${EMULATION_NAME}_list_options): Remove BNDPLT check.

9 years agoRename common-remote-fileio.[ch] as fileio.[ch]
Gary Benson [Thu, 9 Apr 2015 13:22:56 +0000 (14:22 +0100)] 
Rename common-remote-fileio.[ch] as fileio.[ch]

This commit renames common-remote-fileio.[ch] as fileio.[ch]
and renames all functions in these files.

gdb/ChangeLog:

* common/common-remote-fileio.h: Rename to...
* common/fileio.h: ...this.  Update all references.
(remote_fileio_to_fio_error): Rename to...
(host_to_fileio_error): ...this.
(remote_fileio_to_be): Rename to...
(host_to_bigendian): ...this.  Update all callers.
(remote_fileio_to_fio_uint): Rename to...
(host_to_fileio_uint): ...this.  Update all callers.
(remote_fileio_to_fio_time): Rename to...
(host_to_fileio_time): ...this.  Update all callers.
(remote_fileio_to_fio_stat): Rename to...
(host_to_fileio_stat): ...this.
Update all references.
* common/common-remote-fileio.c: Rename to...
* common/fileio.c: ...this.  Update all references.
(remote_fileio_to_fio_error): Rename to...
(host_to_fileio_error): ...this.  Update all callers.
(remote_fileio_mode_to_target): Rename to...
(fileio_mode_pack): ...this.  Update all callers.
(remote_fileio_to_fio_mode): Rename to...
(host_to_fileio_mode): ...this.  Update all callers.
(remote_fileio_to_fio_ulong): Rename to...
(host_to_fileio_ulong): ...this.  Update all callers.
(remote_fileio_to_fio_stat): Rename to...
(host_to_fileio_stat): ...this.  Update all callers.

9 years agoUpdate French translation of ld strings.
Nick Clifton [Thu, 9 Apr 2015 13:56:29 +0000 (14:56 +0100)] 
Update French translation of ld strings.

* po/fr.po: Updated French translation.

9 years agoAdd Guile frame-read-register command
Andy Wingo [Thu, 9 Apr 2015 12:06:41 +0000 (13:06 +0100)] 
Add Guile frame-read-register command

gdb/ChangeLog:

* guile/scm-frame.c (gdbscm_frame_read_register): New function.
(frame_functions): Bind gdbscm_frame_read_register to
frame-read-register.
* guile/lib/gdb.scm (frame-read-register): Export.

gdb/doc/ChangeLog:

* guile.texi (Frames In Guile): Describe frame-read-register.

gdb/testsuite/ChangeLog:

* gdb.guile/scm-frame.exp: Add frame-read-register tests, modelled
after the Python tests.

9 years agoIntroduce new shared function remote_fileio_to_fio_error
Gary Benson [Thu, 9 Apr 2015 09:28:05 +0000 (10:28 +0100)] 
Introduce new shared function remote_fileio_to_fio_error

This commit introduces a new shared function to replace three
identical functions in various places in the codebase.

gdb/ChangeLog:

* common/common-remote-fileio.h (remote_fileio_to_fio_error):
New declaration.
* common/common-remote-fileio.c (remote_fileio_to_fio_error):
New function, factored out the named functions below.
* inf-child.c (gdb/fileio.h): Remove include.
(common-remote-fileio.h): New include.
(inf_child_errno_to_fileio_error): Remove function.  Update
all callers to use remote_fileio_to_fio_error.
* remote-fileio.c (remote_fileio_errno_to_target): Likewise.

gdb/gdbserver/ChangeLog:

* hostio-errno.c (errno_to_fileio_error): Remove function.
Update caller to use remote_fileio_to_fio_error.

9 years agoAdd myself to Write After Approval list.
Andy Wingo [Thu, 9 Apr 2015 09:33:22 +0000 (11:33 +0200)] 
Add myself to Write After Approval list.

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add Andy Wingo.

9 years agoAdd support to the RX toolchain to restrict the use of string instructions.
Nick Clifton [Thu, 9 Apr 2015 11:48:37 +0000 (12:48 +0100)] 
Add support to the RX toolchain to restrict the use of string instructions.

bfd * elf32-rx.c (describe_flags): Report the settings of the string
insn using bits.
(rx_elf_merge_private_bfd_data): Handle merging of the string insn
using bits.

bin * readelf.c (get_machine_flags): Report the setting of the string
insn using bits.

gas * config/tc-rx.c (enum options): Add OPTION_DISALLOW_STRING_INSNS.
(md_longopts): Add -mno-allow-string-insns.
(md_parse_option): Handle -mno-allow-string-insns.
(md_show_usage): Mention -mno-allow-string-insns.
(rx_note_string_insn_use): New function.  Produces an error
message if a string insn is used when it is not allowed.
* config/rx-parse.y (SCMPU): Call rx_note_string_insn_use.
(SMOVU, SMOVB, SMOVF, SUNTIL, SWHILE, RMPA): Likewise.
* config/rx-defs.h (rx_note_string_insn_use): Prototype.
* doc/c-rx.texi: Document -mno-allow-string-insns.

elf * rx.h (E_FLAG_RX_SINSNS_SET): New bit in e_flags field.
(E_FLAG_RX_SINSNS_YES): Likewise.
(E_FLAG_RX_SINSNS_MASK): New define.

9 years agoReplace $zlibdir with $ZLIBDIR in LDFLAGS
H.J. Lu [Thu, 9 Apr 2015 11:43:57 +0000 (04:43 -0700)] 
Replace $zlibdir with $ZLIBDIR in LDFLAGS

* acinclude.m4: (GDB_AC_CHECK_BFD): Set ZLIBDIR with $zlibdir.
Replace $zlibdir with $ZLIBDIR in LDFLAGS.
* configure: Regenerated.

9 years agoImport strtok_r gnulib module
Pedro Alves [Wed, 8 Apr 2015 17:10:21 +0000 (18:10 +0100)] 
Import strtok_r gnulib module

gdb/linux-tdep.c recently gained a strtok_r use.  That broke
--enable-targets=all with some versions of mingw64, which don't have
strtok_r:

  https://sourceware.org/ml/gdb-patches/2015-04/msg00266.html

Fix that by importing the strtok_r gnulib module.

gdb/ChangeLog:
2015-04-09  Pedro Alves  <palves@redhat.com>

* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add strtok_r.
* gnulib/Makefile.in (aclocal_m4_deps): Add import/m4/strtok_r.m4.
* gnulib/configure, gnulib/config.in, gnulib/aclocal.m4: Regenerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/strtok_r.m4: New file.
* gnulib/import/strtok_r.c: New file.

9 years agoupdate-gnulib.sh: work around aclocal warning with Perl >= 5.16
Pedro Alves [Thu, 9 Apr 2015 09:35:29 +0000 (10:35 +0100)] 
update-gnulib.sh: work around aclocal warning with Perl >= 5.16

gdb/ChangeLog:
2015-04-09  Pedro Alves  <palves@redhat.com>

* gnulib/update-gnulib.sh (aclocal version check): Filter out
"called too early to check prototype".

9 years agogdbserver gnu/linux: stepping over breakpoint
Yao Qi [Thu, 9 Apr 2015 09:20:48 +0000 (10:20 +0100)] 
gdbserver gnu/linux: stepping over breakpoint

Hi,
I see the following error on arm linux gdbserver,

continue^M
Continuing.^M
../../../binutils-gdb/gdb/gdbserver/linux-arm-low.c:458: A problem internal to GDBserver has been detected.^M
raw_bkpt_type_to_arm_hwbp_type: unhandled raw type^M
Remote connection closed^M
(gdb) FAIL: gdb.base/cond-eval-mode.exp: hbreak: continue

After we make GDBserver handling Zx/zx packet idempotent,

  [PATCH 3/3] [GDBserver] Make Zx/zx packet handling idempotent.
  https://sourceware.org/ml/gdb-patches/2014-04/msg00480.html

> Now removal/insertion of all kinds of breakpoints/watchpoints, either
> internal, or from GDB, always go through the target methods.

GDBserver handles all kinds of breakpoints/watchpoints through target
methods.  However, some target backends, such as arm, don't support Z0
packet but need software breakpoint to do breakpoint stepping over in
linux-low.c:start_step_over,

  if (can_hardware_single_step ())
    {
      step = 1;
    }
  else
    {
      CORE_ADDR raddr = (*the_low_target.breakpoint_reinsert_addr) ();
      set_reinsert_breakpoint (raddr);
      step = 0;
    }

a software breakpoint is requested to the backend, and the error is
triggered.  This problem should affect targets having
breakpoint_reinsert_addr hooked.

Instead of handling memory breakpoint in these affected linux backend,
this patch handles memory breakpoint in linux_{insert,remove}_point,
that, if memory breakpoint is requested, call
{insert,remove}_memory_breakpoint respectively.  Then, it becomes
unnecessary to handle memory breakpoint for linux x86 backend, so
this patch removes the code there.

This patch is tested with GDBserver on x86_64-linux and arm-linux
(-marm, -mthumb).  Note that there are still some fails in
gdb.base/cond-eval-mode.exp with -mthumb, because GDBserver doesn't
know how to select the correct breakpoint instruction according to
the arm-or-thumb-mode of requested address.  This is a separate
issue, anyway.

gdb/gdbserver:

2015-04-09  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_insert_point): Call
insert_memory_breakpoint if TYPE is raw_bkpt_type_sw.
(linux_remove_point): Call remove_memory_breakpoint if type is
raw_bkpt_type_sw.
* linux-x86-low.c (x86_insert_point): Don't call
insert_memory_breakpoint.
(x86_remove_point): Don't call remove_memory_breakpoint.

9 years agoEnable ELF ld_list_options for --enable-targets=all
H.J. Lu [Thu, 9 Apr 2015 00:05:54 +0000 (17:05 -0700)] 
Enable ELF ld_list_options for --enable-targets=all

When --enable-targets=all is used with non-ELF target, we should enable
ELF ld_list_options.

* configure.ac (elf_list_options): Set to TRUE for
--enable-targets=all.
(elf_shlib_list_options): Likewise.
(elf_plt_unwind_list_options): Likewise.
* configure: Regenerated.

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

9 years agoFix Python completion when using the "complete" command
Sergio Durigan Junior [Wed, 8 Apr 2015 22:27:10 +0000 (18:27 -0400)] 
Fix Python completion when using the "complete" command

This patch is related to PR python/16699, and is an improvement over the
patch posted here:

  <https://sourceware.org/ml/gdb-patches/2014-03/msg00301.html>

Keith noticed that, when using the "complete" command on GDB to complete
a Python command, some strange things could happen.  In order to
understand what can go wrong, I need to explain how the Python
completion mechanism works.

When the user requests a completion of a Python command by using TAB,
GDB will first try to determine the right set of "brkchars" that will be
used when doing the completion.  This is done by actually calling the
"complete" method of the Python class.  Then, when we already know the
"brkchars" that will be used, we call the "complete" method again, for
the same values.

If you read the thread mentioned above, you will see that one of the
design decisions was to make the "cmdpy_completer_helper" (which is the
function the does the actual calling of the "complete" method) cache the
first result of the completion, since this result will be used in the
second call, to do the actual completion.

The problem is that the "complete" command does not process the
brkchars, and the current Python completion mechanism (improved by the
patch mentioned above) relies on GDB trying to determine the brkchars,
and then doing the completion itself.  Therefore, when we use the
"complete" command instead of doing a TAB-completion on GDB, there is a
scenario where we can use the invalid cache of a previous Python command
that was completed before.  For example:

  (gdb) A <TAB>
  (gdb) complete B
  B value1
  B value10
  B value2
  B value3
  B value4
  B value5
  B value6
  B value7
  B value8
  B value9
  (gdb) B <TAB>
  comp1   comp2   comp4   comp6   comp8
  comp10  comp3   comp5   comp7   comp9

Here, we see that "complete B " gave a different result than "B <TAB>".
The reason for that is because "A <TAB>" was called before, and its
completion results were "value*", so when GDB tried to "complete B " it
wrongly answered with the results for A.  The problem here is using a
wrong cache (A's cache) for completing B.

We tried to come up with a solution that would preserve the caching
mechanism, but it wasn't really possible.  So I decided to completely
remove the cache, and doing the method calling twice for every
completion.  This is not optimal, but I do not think it will impact
users noticeably.

It is worth mentioning another small issue that I found.  The code was
doing:

  wordobj = PyUnicode_Decode (word, sizeof (word), host_charset (), NULL);

which is totally wrong, because using "sizeof" here will lead to always
the same result.  So I changed this to use "strlen".  The testcase also
catches this problem.

Keith kindly expanded the existing testcase to cover the problem
described above, and everything is passing.

gdb/ChangeLog:
2015-04-08  Sergio Durigan Junior  <sergiodj@redhat.com>

PR python/16699
* python/py-cmd.c (cmdpy_completer_helper): Adjust function to not
use a caching mechanism.  Adjust comments and code to reflect
that.  Replace 'sizeof' by 'strlen' when fetching 'wordobj'.
(cmdpy_completer_handle_brkchars): Adjust call to
cmdpy_completer_helper.  Call Py_XDECREF for 'resultobj'.
(cmdpy_completer): Likewise.

gdb/testsuite/ChangeLog:
2015-04-08  Keith Seitz  <keiths@redhat.com>

PR python/16699
* gdb.python/py-completion.exp: New tests for completion.
* gdb.python/py-completion.py (CompleteLimit1): New class.
(CompleteLimit2): Likewise.
(CompleteLimit3): Likewise.
(CompleteLimit4): Likewise.
(CompleteLimit5): Likewise.
(CompleteLimit6): Likewise.
(CompleteLimit7): Likewise.

9 years agoAdd test for PR18214 and PR18216 - multiple step-overs with queued signals
Pedro Alves [Wed, 8 Apr 2015 18:59:03 +0000 (19:59 +0100)] 
Add test for PR18214 and PR18216 - multiple step-overs with queued signals

Both PRs are triggered by the same use case.

PR18214 is about software single-step targets.  On those, the 'resume'
code that detects that we're stepping over a breakpoint and delivering
a signal at the same time:

  /* Currently, our software single-step implementation leads to different
     results than hardware single-stepping in one situation: when stepping
     into delivering a signal which has an associated signal handler,
     hardware single-step will stop at the first instruction of the handler,
     while software single-step will simply skip execution of the handler.
...
     Fortunately, we can at least fix this particular issue.  We detect
     here the case where we are about to deliver a signal while software
     single-stepping with breakpoints removed.  In this situation, we
     revert the decisions to remove all breakpoints and insert single-
     step breakpoints, and instead we install a step-resume breakpoint
     at the current address, deliver the signal without stepping, and
     once we arrive back at the step-resume breakpoint, actually step
     over the breakpoint we originally wanted to step over.  */

doesn't handle the case of _another_ thread also needing to step over
a breakpoint.  Because the other thread is just resumed at the PC
where it had stopped and a breakpoint is still inserted there, the
thread immediately re-traps the same breakpoint.  This test exercises
that.  On software single-step targets, it fails like this:

 KFAIL: gdb.threads/multiple-step-overs.exp: displaced=off: signal thr3: continue to sigusr1_handler
 KFAIL: gdb.threads/multiple-step-overs.exp: displaced=off: signal thr2: continue to sigusr1_handler

gdb.log (simplified):

 (gdb) continue
 Continuing.

 Breakpoint 4, child_function_2 (arg=0x0) at src/gdb/testsuite/gdb.threads/multiple-step-overs.c:66
 66            callme (); /* set breakpoint thread 2 here */
 (gdb) thread 3
 (gdb) queue-signal SIGUSR1
 (gdb) thread 1
 [Switching to thread 1 (Thread 0x7ffff7fc1740 (LWP 24824))]
 #0  main () at src/gdb/testsuite/gdb.threads/multiple-step-overs.c:106
 106       wait_threads (); /* set wait-threads breakpoint here */
 (gdb) break sigusr1_handler
 Breakpoint 5 at 0x400837: file src/gdb/testsuite/gdb.threads/multiple-step-overs.c, line 31.
 (gdb) continue
 Continuing.
 [Switching to Thread 0x7ffff7fc0700 (LWP 24828)]

 Breakpoint 4, child_function_2 (arg=0x0) at src/gdb/testsuite/gdb.threads/multiple-step-overs.c:66
 66            callme (); /* set breakpoint thread 2 here */
 (gdb) KFAIL: gdb.threads/multiple-step-overs.exp: displaced=off: signal thr3: continue to sigusr1_handler

For good measure, I made the test try displaced stepping too.  And
then I found it crashes GDB on x86-64 (a hardware step target), but
only when displaced stepping... :

 KFAIL: gdb.threads/multiple-step-overs.exp: displaced=on: signal thr1: continue to sigusr1_handler (PRMS: gdb/18216)
 KFAIL: gdb.threads/multiple-step-overs.exp: displaced=on: signal thr2: continue to sigusr1_handler (PRMS: gdb/18216)
 KFAIL: gdb.threads/multiple-step-overs.exp: displaced=on: signal thr3: continue to sigusr1_handler (PRMS: gdb/18216)

 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x000000000062a83a in process_event_stop_test (ecs=0x7fff847eeee0) at src/gdb/infrun.c:4964
 4964          if (sr_bp->loc->permanent
 Setting up the environment for debugging gdb.
 Breakpoint 1 at 0x79fcfc: file src/gdb/common/errors.c, line 54.
 Breakpoint 2 at 0x50a26c: file src/gdb/cli/cli-cmds.c, line 217.
 (top-gdb) p sr_bp
 $1 = (struct breakpoint *) 0x0
 (top-gdb) bt
 #0  0x000000000062a83a in process_event_stop_test (ecs=0x7fff847eeee0) at src/gdb/infrun.c:4964
 #1  0x000000000062a1af in handle_signal_stop (ecs=0x7fff847eeee0) at src/gdb/infrun.c:4715
 #2  0x0000000000629097 in handle_inferior_event (ecs=0x7fff847eeee0) at src/gdb/infrun.c:4165
 #3  0x0000000000627482 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:3298
 #4  0x000000000064ad7b in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:56
 #5  0x00000000004c375f in handle_target_event (error=0, client_data=0x0) at src/gdb/linux-nat.c:4658
 #6  0x0000000000648c47 in handle_file_event (file_ptr=0x2e0eaa0, ready_mask=1) at src/gdb/event-loop.c:658

The all-stop-non-stop series fixes this, but meanwhile, this augments
the multiple-step-overs.exp test to cover this, KFAILed.

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

PR gdb/18214
PR gdb/18216
* gdb.threads/multiple-step-overs.c (sigusr1_handler): New
function.
(main): Install it as SIGUSR1 handler.
* gdb.threads/multiple-step-overs.exp (setup): Remove 'prefix'
parameter.  Always use "setup" as prefix.  Toggle "set
displaced-stepping" off/on depending on global.  Don't switch to
thread 1 here.
(top level): Add displaced stepping "off/on" test axis.  Update
"setup" calls.  Wrap each subtest with with_test_prefix.  Test
continuing with a queued signal in each thread.

9 years agoAdd chdr_size, Chdr, Chdr_write and Chdr_data
H.J. Lu [Wed, 8 Apr 2015 17:29:23 +0000 (10:29 -0700)] 
Add chdr_size, Chdr, Chdr_write and Chdr_data

* elfcpp.h (Elf_sizes): Add chdr_size.
(Chdr): New.
(Chdr_write): Likewise.
* elfcpp_internal.h (Chdr_data): Likewise.

9 years agoAdd SHF_COMPRESSED and ELFCOMPRESS_XXX to elfcpp.h
H.J. Lu [Wed, 8 Apr 2015 17:27:55 +0000 (10:27 -0700)] 
Add SHF_COMPRESSED and ELFCOMPRESS_XXX to elfcpp.h

* elfcpp.h (SHF): Add SHF_COMPRESSED.
(ELFCOMPRESS_ZLIB): New.
(ELFCOMPRESS_LOOS): Likewise.
(ELFCOMPRESS_HIOS): Likewise.
(ELFCOMPRESS_LOPROC): Likewise.
(ELFCOMPRESS_HIPROC): Likewise.

9 years agoSkip empty EMULATION_NAME
H.J. Lu [Wed, 8 Apr 2015 16:46:50 +0000 (09:46 -0700)] 
Skip empty EMULATION_NAME

* emulparams/elf32bmipn32-defs.sh: Skip empty EMULATION_NAME.

9 years agoWork around a GCC uninitialized warning bug
H.J. Lu [Wed, 8 Apr 2015 16:25:08 +0000 (09:25 -0700)] 
Work around a GCC uninitialized warning bug

* compress.c (bfd_compress_section_contents): Work around a GCC
uninitialized warning bug fixed in GCC 4.7.

9 years ago[spu] Don't call set_gdbarch_cannot_step_breakpoint in spu_gdbarch_init
Yao Qi [Wed, 8 Apr 2015 15:04:07 +0000 (16:04 +0100)] 
[spu] Don't call set_gdbarch_cannot_step_breakpoint in spu_gdbarch_init

Nowadays, in infrun.c:resume, the setting to 'step' variable is like:

  if (use_displaced_stepping (gdbarch)
      && tp->control.trap_expected
      && sig == GDB_SIGNAL_0
      && !current_inferior ()->waiting_for_vfork_done)
    {
    }
  /* Do we need to do it the hard way, w/temp breakpoints?  */
  else if (step)
    step = maybe_software_singlestep (gdbarch, pc); <-- [1]

  ...

  if (execution_direction != EXEC_REVERSE
      && step && breakpoint_inserted_here_p (aspace, pc))
    {
      ...
      if (gdbarch_cannot_step_breakpoint (gdbarch)) <-- [2]
        step = 0;
    }

spu doesn't have displaced stepping and uses software single step,
so 'step' is set to zero in [1], and [2] becomes unreachable as a
result.  So don't have to call set_gdbarch_cannot_step_breakpoint
in spu_gdbarch_init.

gdb:

2015-04-08  Yao Qi  <yao.qi@linaro.org>

* spu-tdep.c (spu_gdbarch_init): Don't call
set_gdbarch_cannot_step_breakpoint.

9 years agoAdd SHF_COMPRESSED support to gas and objcopy
H.J. Lu [Wed, 8 Apr 2015 14:53:54 +0000 (07:53 -0700)] 
Add SHF_COMPRESSED support to gas and objcopy

This patch adds --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}
options to gas and objcopy for ELF files. They control how DWARF debug
sections are compressed.  --compress-debug-sections=none is equivalent to
--nocompress-debug-sections.  --compress-debug-sections=zlib and
--compress-debug-sections=zlib-gnu are equivalent to
--compress-debug-sections.  --compress-debug-sections=zlib-gabi compresses
DWARF debug sections with SHF_COMPRESSED from the ELF ABI.  No linker
changes are required to support SHF_COMPRESSED.

bfd/

* archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI
bit.
* bfd.c (bfd::flags): Increase size to 18 bits.
(BFD_COMPRESS_GABI): New.
(BFD_FLAGS_SAVED): Add BFD_COMPRESS_GABI.
(BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
(bfd_update_compression_header): New fuction.
(bfd_check_compression_header): Likewise.
(bfd_get_compression_header_size): Likewise.
(bfd_is_section_compressed_with_header): Likewise.
* compress.c (MAX_COMPRESSION_HEADER_SIZE): New.
(bfd_compress_section_contents): Return the uncompressed size if
the full section contents is compressed successfully.  Support
converting from/to .zdebug* sections.
(bfd_get_full_section_contents): Call
bfd_get_compression_header_size to get compression header size.
(bfd_is_section_compressed): Renamed to ...
(bfd_is_section_compressed_with_header): This.  Add a pointer
argument to return compression header size.
(bfd_is_section_compressed): Use it.
(bfd_init_section_decompress_status): Call
bfd_get_compression_header_size to get compression header size.
Return FALSE if uncompressed section size is 0.
* elf.c (_bfd_elf_make_section_from_shdr): Support converting
from/to .zdebug* sections.
* bfd-in2.h: Regenerated.

binutils/

* objcopy.c (do_debug_sections): Add compress_zlib,
compress_gnu_zlib and compress_gabi_zlib.
(copy_options): Use optional_argument on compress-debug-sections.
(copy_usage): Update --compress-debug-sections.
(copy_file): Handle compress_zlib, compress_gnu_zlib and
compress_gabi_zlib.
(copy_main): Handle
--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
* doc/binutils.texi: Document
--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.

binutils/testsuite/

* compress.exp: Add tests for
--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
* binutils-all/dw2-3.rS: New file.
* binutils-all/dw2-3.rt: Likewise.
* binutils-all/libdw2-compressedgabi.out: Likewise.

gas/

* as.c (show_usage): Update --compress-debug-sections.
(std_longopts): Use optional_argument on compress-debug-sections.
(parse_args): Handle
--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
* as.h (compressed_debug_section_type): New.
(flag_compress_debug): Change type to compressed_debug_section_type.
--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
* write.c (compress_debug): Set BFD_COMPRESS_GABI for
--compress-debug-sections=zlib-gabi.  Call
bfd_get_compression_header_size to get compression header size.
Don't rename section name for --compress-debug-sections=zlib-gabi.
* config/tc-i386.c (compressed_debug_section_type): Set to
COMPRESS_DEBUG_ZLIB.
* doc/as.texinfo: Document
--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.

gas/testsuite/

* gas/i386/dw2-compressed-1.d: New file.
* gas/i386/dw2-compressed-2.d: Likewise.
* gas/i386/dw2-compressed-3.d: Likewise.
* gas/i386/x86-64-dw2-compressed-2.d: Likewise.
* gas/i386/i386.exp: Run dw2-compressed-2, dw2-compressed-1,
dw2-compressed-3 and x86-64-dw2-compressed-2.

ld/testsuite/

* ld-elf/compress.exp: Add a test for
--compress-debug-sections=zlib-gabi.
(build_tests): Add 2 tests for --compress-debug-sections=zlib-gabi.
(run_tests): Likewise.
Verify linker output with zlib-gabi compressed debug input.
* ld-elf/compressed1a.d: New file.
* ld-elf/compressed1b.d: Likewise.
* ld-elf/compressed1c.d: Likewise.

9 years agoDisplay --interleave[=<number>]
H.J. Lu [Wed, 8 Apr 2015 12:04:13 +0000 (05:04 -0700)] 
Display --interleave[=<number>]

Optional argument of a command line option must start with "=".

* objcopy.c (copy_usage): Replace "--interleave [<number>]" with
--interleave[=<number>].

9 years agoAdd ld_list_options
H.J. Lu [Wed, 8 Apr 2015 11:55:07 +0000 (04:55 -0700)] 
Add ld_list_options

This patch adds ld_list_options for ELF targets to avoid duplicated
outputs from ld --help.

* Makefile.am (ELF_CLFAGS): New.
(AM_CFLAGS): Add $(ELF_CLFAGS).
* configure.ac (elf_list_options): New.  AC_SUBST.
(elf_shlib_list_options): Likewise.
(elf_plt_unwind_list_options): Likewise.
* lexsup.c (elf_shlib_list_options): New.
(elf_static_list_options): Likewise.
(elf_plt_unwind_list_options): Likewise.
(ld_list_options): Likewise.
(help): Call ld_list_options.
* Makefile.in: Regenerated.
* configure: Likewise.
* emulparams/plt_unwind.sh (PLT_UNWIND): New.
(PARSE_AND_LIST_OPTIONS): Removed.
* emultempl/elf32.em (gld_list_options): New.
(gld${EMULATION_NAME}_list_options): Define only if BNDPLT or
PARSE_AND_LIST_OPTIONS is defined.
(ld_${EMULATION_NAME}_emulation): Replace
gld${EMULATION_NAME}_list_options with ${gld_list_options.

9 years agoFix gdb.trace/{actions,infotrace,while-stepping}.exp with extended-remote
Pedro Alves [Wed, 8 Apr 2015 09:39:43 +0000 (10:39 +0100)] 
Fix gdb.trace/{actions,infotrace,while-stepping}.exp with extended-remote

The recent actions.exp change to check gdb_run_cmd succeeded caught
further problems.  The test now fails like this
with --target_board=native-extended-gdbserver:

 FAIL: gdb.trace/actions.exp: Can't run to main

gdb.log shows:

 (gdb) run
 Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.trace/actions
 Running the default executable on the remote target failed; try "set remote exec-file"?
 (gdb) FAIL: gdb.trace/actions.exp: Can't run to main

The problem is that a gdb_load call is missing.

Grepping around for similar problems in other tests, I found that
infotrace.exp and while-stepping.exp should be likewise affected.  And
indeed this is what we get today:

 FAIL: gdb.trace/infotrace.exp: tstart
 FAIL: gdb.trace/infotrace.exp: continue to end (the program is no longer running)
 FAIL: gdb.trace/infotrace.exp: tstop
 FAIL: gdb.trace/infotrace.exp: 2.6: info tracepoints (trace buffer usage)
 FAIL: gdb.trace/while-stepping.exp: tstart
 FAIL: gdb.trace/while-stepping.exp: tstop
 FAIL: gdb.trace/while-stepping.exp: tfile: info tracepoints
 FAIL: gdb.trace/while-stepping.exp: ctf: info tracepoints

while-stepping.exp even has the same race bug actions.exp had.

After this, {actions,infotrace,while-stepping}.exp all pass cleanly
with the native-extended-gdbserver board.

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

* gdb.trace/actions.exp: Use gdb_load before gdb_run_cmd.
* gdb.trace/infotrace.exp: Use gdb_load before gdb_run_cmd.  Use
gdb_breakpoint instead of gdb_test that doesn't expect anything.
Return early if running to main fails.
* gdb.trace/while-stepping.exp: Likewise.

9 years agoAdd AArch32 support for arm gold linker.
Han Shen [Wed, 8 Apr 2015 00:20:11 +0000 (17:20 -0700)] 
Add AArch32 support for arm gold linker.

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

9 years agoInitialize variable on gdb/linux-tdep.c:decode_vmflags
Sergio Durigan Junior [Tue, 7 Apr 2015 19:19:07 +0000 (15:19 -0400)] 
Initialize variable on gdb/linux-tdep.c:decode_vmflags

This obvious commit initializes the 'saveptr' variable on
gdb/linux-tdep.c:decode_vmflags.  This was causing a build failure on
Fedora 21 x86_64, caught by the BuildBot here:

  <https://sourceware.org/ml/gdb-testers/2015-q2/msg00450.html>

9 years agogdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id
Pedro Alves [Tue, 7 Apr 2015 17:19:31 +0000 (18:19 +0100)] 
gdb.base/interrupt.exp: Use send_inferior/$inferior_spawn_id

The gdb.base/interrupt.exp test is important for testing system call
restarting, but because it depends on inferior I/O, it ends up skipped
against gdbserver.  This patch adjusts the test to use send_inferior
and $inferior_spawn_id so it works against GDBserver.

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

* gdb.base/interrupt.exp: Don't skip if $inferior_spawn_id !=
$gdb_spawn_id.  Use send_inferior and $inferior_spawn_id to
interact with inferior program.

9 years agotestsuite: Introduce $inferior_spawn_id
Pedro Alves [Tue, 7 Apr 2015 17:19:30 +0000 (18:19 +0100)] 
testsuite: Introduce $inferior_spawn_id

Some important tests, like gdb.base/interrupt.exp end up skipped
against gdbserver, because they depend on inferior I/O, which
gdbserver doesn't do.

This patch adds a mechanism that makes it possible to make them work.
It adds a new "inferior_spawn_id" global that is the spawn ID used for
I/O interaction with the inferior.  By default, for native targets, or
remote targets that can do I/O through GDB (semi-hosting) this will be
the same as the gdb/host spawn ID.  Otherwise, the board may set this
to some other spawn ID.  When debugging with GDBserver, this will be
set to GDBserver's spawn ID.

Then tests can use send_inferior instead of send_gdb to send input to
the inferior, and use expect's "-i" switch to select which spawn ID to
use for matching input/output.  That is, something like this will now
work:

  send_inferior "echo me\n"
  gdb_test_multiple "continue" "test msg" {
    -i "$inferior_spawn_id" -re "echo me\r\necho\r\n" {
      ...
    }
  }

Or even:

  gdb_test_multiple "continue" "test msg" {
    -i "$inferior_spawn_id" -re "hello world" {
      ...
    }
    -i "$gdb_spawn_id" -re "error.*$gdb_prompt $" {
      ...
    }
  }

Of course, by default, gdb_test_multiple still matches with
$gdb_spawn_id.

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

* lib/gdb.exp (inferior_spawn_id): New global.
(gdb_test_multiple): Handle "-i".  Reset the spawn id to GDB's
spawn id after processing the user code.
(default_gdb_start): Set inferior_spawn_id.
(send_inferior): New procedure.
* lib/gdbserver-support.exp (gdbserver_start): Set
inferior_spawn_id.
(close_gdbserver, gdb_exit): Unset inferior_spawn_id.

9 years agotestsuite: Don't use expect_background to reap gdbserver
Pedro Alves [Tue, 7 Apr 2015 17:19:30 +0000 (18:19 +0100)] 
testsuite: Don't use expect_background to reap gdbserver

I adjusted a test to do 'expect -i $server_spawn_id -re ...', and saw
really strange behavior.  Whether that expect would work, depended on
whether GDB would also send output and the same expect matched it too
(on $gdb_spawn_id).  I was perplexed until I noticed that
gdbserver_spawn spawns gdbserver and then uses expect_background to
reap gdbserver.  That expect_background conflicts/races with any
"expect -i $server_spawn_id" done anywhere else in parallel...

In order to make it possible for tests to read inferior I/O out of
$server_spawn_id, we to get rid of that expect_background.  This patch
makes us instead reap gdbserver's spawn id when GDB exits.  If GDB is
still around, this gives a chance for gdbserver to exit cleanly.  The
current code in gdb_finish uses "kill", but that doesn't work with
extended-remote (gdbserver doesn't exit).  We now use "monitor exit"
instead which works in both remote and extended-remote modes.

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

* lib/gdb.exp (gdb_finish): Delete persistent gdbserver handling.
* lib/gdbserver-support.exp (gdbserver_start): Make
$server_spawn_id global.
(gdbserver_start): Don't wait for gdbserver's spawn id with
expect_background.
(close_gdbserver): New procedure.
(gdb_exit): Rename the default version and reimplement.

9 years agogdb_test_multiple: Fix user code argument processing
Pedro Alves [Tue, 7 Apr 2015 17:19:30 +0000 (18:19 +0100)] 
gdb_test_multiple: Fix user code argument processing

While teaching gdb_test_multiple to forward "-i" to gdb_expect, I
found that with:

      gdb_test_multiple (...) {
        -i $some_variable -re "..." {}
      }

$some_variable was not getting expanded in the gdb_test_multiple
caller's scope.  This is a bug inside gdb_test_multiple.  When
processing an argument in passed in user code, it was appending the
original argument literally, instead of appending the uplist'ed
argument.

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

        * lib/gdb.exp (gdb_test_multiple): When processing an argument,
append the substituted item, not the original item.

9 years agogdb.base/interrupt.exp: Use gdb_test_multiple instead of gdb_expect
Pedro Alves [Tue, 7 Apr 2015 17:19:29 +0000 (18:19 +0100)] 
gdb.base/interrupt.exp: Use gdb_test_multiple instead of gdb_expect

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

* gdb.base/interrupt.exp: Use gdb_test_multiple instead of
gdb_expect.

9 years agogdb.base/interrupt.exp: Fix race
Pedro Alves [Tue, 7 Apr 2015 17:19:29 +0000 (18:19 +0100)] 
gdb.base/interrupt.exp: Fix race

Working on splitting gdb and inferior output handling in this test, I
noticed a race that happens to be masked out today.

The test sends "a\n" to the inferior, and then inferior echoes back
"a\n".

If expect manages to read only the first "a\r\n" into its buffer, then
this matches:

    -re "^a\r\n(|a\r\n)$" {

and leaves the second "a\r\n" in output.

Then the next test that processes inferior I/O sends "data\n", and expects:

    -re "^(\r\n|)data\r\n(|data\r\n)$"

which fails given the anchor and given "a\r\n" is still in the buffer.

This is masked today because the test relies on inferior I/O being
done on GDB's terminal, and there are tested GDB commands in between,
which consume the "a\r\n" that was left in the output.

We don't support SunOS4 anymore, so just remove the workaround.

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

* gdb.base/interrupt.exp: Don't handle the case of the inferior
output appearing once only.

9 years ago[AArch64] use subseg_text_p to check .text
Renlin Li [Tue, 7 Apr 2015 17:10:33 +0000 (18:10 +0100)] 
[AArch64] use subseg_text_p to check .text

2015-04-07  Renlin Li  <renlin.li@arm.com>

gas/
  * config/tc-aarch64.c (mapping_state): Use subseg_text_p.
  (s_aarch64_inst): Likewise.
  (md_assemble): Likewise.

9 years agoFix gdb.trace/actions.exp race
Pedro Alves [Thu, 5 Mar 2015 22:01:06 +0000 (22:01 +0000)] 
Fix gdb.trace/actions.exp race

I saw this on PPC64 once:

  not installed on target
  (gdb) PASS: gdb.trace/actions.exp: 5.10a: verify teval actions set for two tracepoints
  break main
  Breakpoint 4 at 0x10000c6c: file ../../../src/gdb/testsuite/gdb.trace/actions.c, line 139.
  (gdb) PASS: gdb.trace/actions.exp: break main
  run
  Starting program: /home/palves/gdb/build/gdb/testsuite/outputs/gdb.trace/actions/actions
  tstatus

  Breakpoint 4, main (argc=1, argv=0x3fffffffebb8, envp=0x3fffffffebc8) at ../../../src/gdb/testsuite/gdb.trace/actions.c:139
  139       begin ();
  (gdb) tstatus
  Trace can not be run on this target.
  (gdb) actions 1
  Enter actions for tracepoint 1, one per line.
  End with a line saying just "end".
  >collect $regs
  >end
  (gdb) PASS: gdb.trace/actions.exp: set actions for first tracepoint
  tstart
  You can't do that when your target is `native'
  (gdb) FAIL: gdb.trace/actions.exp: tstart
  info tracepoints 1
  Num     Type           Disp Enb Address            What
  1       tracepoint     keep y   0x00000000100007c8 in gdb_c_test at ../../../src/gdb/testsuite/gdb.trace/actions.c:74
  collect $regs
  not installed on target
  ...

followed by a cascade of FAILs.  The "tstatus" was supposed to detect
that this target (native) can't do tracepoints, but, alas, it didn't.

That detection failed because 'gdb_test "break main"' doesn't expect
anything, and then the output was slow enough that 'gdb_test ""
"Breakpoint .*"' matched the output of "break main"...

The fix is to use gdb_breakpoint instead.  Also check the result of
gdb_test while at it.

Tested on x86-64 Fedora 20, native and gdbserver.

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

* gdb.trace/actions.exp: Use gdb_breakpoint instead of gdb_test
that doesn't expect anything.  Return early if running to main
fails.

9 years agoAdd new linker option: --warn-orphan which generates warning messages when orphan...
Nick Clifton [Tue, 7 Apr 2015 15:29:41 +0000 (16:29 +0100)] 
Add new linker option: --warn-orphan  which generates warning messages when orphan sections are detected.

ld * ld.h (struct ld_config_type): Add new field: warn_orphan.
* ldlex.h (enum option_values): Add OPTION_WARN_ORPHAN and
OPTION_NO_WARN_ORPHAN.
* lexsup.c (ld_options): Add --warn-orphan and --no-warn-orphan.
(parse_args): Handle the new options.
* ldemul.c (ldemul_place_orphan): If requested, generate a warning
message when an orphan section is placed in the output file.
* ld.texinfo: Document the new option.
* NEWS: Mention the new feature.

tests * ld-elf/orphan-5.l: New test - checks the linker's output with
--warn-orphan enabled.
* ld-elf/elf.exp: Run the new test.

9 years agoupdate thread list, delete exited threads
Pedro Alves [Tue, 7 Apr 2015 14:47:22 +0000 (15:47 +0100)] 
update thread list, delete exited threads

On GNU/Linux, if the running kernel supports clone events, then
linux-thread-db.c defers thread listing to the target beneath:

static void
thread_db_update_thread_list (struct target_ops *ops)
{
...
  if (target_has_execution && !thread_db_use_events ())
    ops->beneath->to_update_thread_list (ops->beneath);
  else
    thread_db_update_thread_list_td_ta_thr_iter (ops);
...
}

However, when live debugging, the target beneath, linux-nat.c, does
not implement the to_update_thread_list method.  The result is that if
a thread is marked exited (because it can't be deleted right now,
e.g., it was the selected thread), then it won't ever be deleted,
until the process exits or is killed/detached.

A similar thing happens with the remote.c target.  Because its
target_update_thread_list implementation skips exited threads when it
walks the current thread list looking for threads that no longer exits
on the target side, using ALL_NON_EXITED_THREADS_SAFE, stale exited
threads are never deleted.

This is not a big deal -- I can't think of any way this might be user
visible, other than gdb's memory growing a tiny bit whenever a thread
gets stuck in exited state.  Still, might as well clean things up
properly.

All other targets use prune_threads, so are unaffected.

The fix adds a ALL_THREADS_SAFE macro, that like
ALL_NON_EXITED_THREADS_SAFE, walks the thread list and allows deleting
the iterated thread, and uses that in places that are walking the
thread list in order to delete threads.  Actually, after converting
linux-nat.c and remote.c to use this, we find the only other user of
ALL_NON_EXITED_THREADS_SAFE is also walking the list to delete
threads.  So we convert that too, and end up deleting
ALL_NON_EXITED_THREADS_SAFE.

Tested on x86_64 Fedora 20, native and gdbserver.

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

* gdbthread.h (ALL_NON_EXITED_THREADS_SAFE): Rename to ...
(ALL_THREADS_SAFE): ... this, and don't skip exited threads.
(delete_exited_threads): New declaration.
* infrun.c (follow_exec): Use ALL_THREADS_SAFE.
* linux-nat.c (linux_nat_update_thread_list): New function.
(linux_nat_add_target): Install it.
* remote.c (remote_update_thread_list): Use ALL_THREADS_SAFE.
* thread.c (prune_threads): Use ALL_THREADS_SAFE.
(delete_exited_threads): New function.

9 years agoModify get_reloc_section for targets that map .got.plt to .got
Alan Modra [Tue, 7 Apr 2015 12:53:21 +0000 (22:23 +0930)] 
Modify get_reloc_section for targets that map .got.plt to .got

Fixes tic6x testsuite failures due to .rela.plt having a zero sh_info.
I considered passing link_info to get_reloc_section so we could
directly return the .got.plt output section, but we need the fallback
to name lookup anyway for objcopy.

bfd/
* elf.c (_bfd_elf_get_reloc_section): Allow for .got.plt being
mapped to output .got section.
ld/testsuite/
* ld-arm/tls-gdesc-nlazy.g: Adjust for readelf note.
* ld-tic6x/shlib-1.rd: Expect corrected .rela.plt sh_info.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1.rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.

9 years agoCast shift expression
Alan Modra [Tue, 7 Apr 2015 01:09:59 +0000 (10:39 +0930)] 
Cast shift expression

PR ld/18176
* ldlang.c (lang_size_sections): Cast shift expression.

9 years agoPowerPC non-PIC to PIC editing for protected var access
Alan Modra [Tue, 31 Mar 2015 23:29:46 +0000 (09:59 +1030)] 
PowerPC non-PIC to PIC editing for protected var access

This is a linker-only solution to the incompatibility between shared
library protected visibility variables and using .dynbss and copy
relocs for non-PIC access to shared library variables.

bfd/
* elf32-ppc.c (struct ppc_elf_link_hash_entry): Add has_addr16_ha
and has_addr16_lo.  Make has_sda_refs a bitfield.
(ppc_elf_check_relocs): Set new flags.
(ppc_elf_link_hash_table_create): Update default_params.
(ppc_elf_adjust_dynamic_symbol): Clear protected_def in cases
where we won't be making .dynbss entries or editing code.  Set
params->pic_fixup when we'll edit code for protected var access.
(allocate_dynrelocs): Allocate got entry for edited code and
discard dyn_relocs.
(struct ppc_elf_relax_info): Add picfixup_size.
(ppc_elf_relax_section): Rename struct one_fixup to struct
one_branch_fixup.  Rename fixups to branch_fixups.  Size space for
pic fixups.
(ppc_elf_relocate_section): Edit non-PIC accessing protected
visibility variables to PIC.  Don't emit dyn_relocs for code
we've edited.
* elf32-ppc.h (struct ppc_elf_params): Add pic_fixup.
ld/
* emultempl/ppc32elf.em: Handle --no-pic-fixup.
(params): Init new field.
(ppc_before_allocation): Enable relaxation for pic_fixup.

9 years agoDisplaced stepping debug: fetch the right regcache
Pedro Alves [Tue, 7 Apr 2015 10:42:09 +0000 (11:42 +0100)] 
Displaced stepping debug: fetch the right regcache

Although not currently possible in practice when we get here,
'resume_ptid' can also be a wildcard throughout this function.  It's
clearer to fetch the regcache using the thread's ptid.

gdb/ChangeLog:
2015-04-07  Pedro Alves  <pedro@codesourcery.com>

* infrun.c (resume) <displaced stepping debug output>: Get the
leader thread's regcache, not resume_ptid's.

9 years agoProperly set alarm value in gdb.threads/non-stop-fair-events.exp
Yao Qi [Tue, 7 Apr 2015 10:30:07 +0000 (11:30 +0100)] 
Properly set alarm value in gdb.threads/non-stop-fair-events.exp

Nowadays, the alarm value is 60, and alarm is generated on some slow
boards.  This patch is to pass DejaGNU timeout value to the program,
and move the alarm call before going to infinite loop.  If any thread
has activities, the alarm is reset.

gdb/testsuite:

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

* gdb.threads/non-stop-fair-events.c (SECONDS): New macro.
(child_function): Call alarm.
(main): Move call to alarm into the loop.
* gdb.threads/non-stop-fair-events.exp: Build program with
-DTIMEOUT=$timeout.

9 years agoTreat assembler generated local labels as local.
Nick Clifton [Tue, 7 Apr 2015 10:22:32 +0000 (11:22 +0100)] 
Treat assembler generated local labels as local.

* elf.c (_bfd_elf_is_local_label_name): Treat assembler generated
local labels as local.

9 years agosim: move sim-engine.o/sim-hrw.o to the common list
Mike Frysinger [Tue, 7 Apr 2015 03:40:00 +0000 (23:40 -0400)] 
sim: move sim-engine.o/sim-hrw.o to the common list

This makes these two objects available to all sims by default.

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

9 years agoFix the signature of a virtual method to match the one in the parent class.
Rafael Ávila de Espíndola [Mon, 6 Apr 2015 19:49:50 +0000 (15:49 -0400)] 
Fix the signature of a virtual method to match the one in the parent class.

9 years agoAvoid a call to find by using the return value of insert.
Rafael Ávila de Espíndola [Mon, 6 Apr 2015 19:45:37 +0000 (15:45 -0400)] 
Avoid a call to find by using the return value of insert.

9 years agoAvoid a copy constructor call.
Rafael Ávila de Espíndola [Mon, 6 Apr 2015 19:39:42 +0000 (15:39 -0400)] 
Avoid a copy constructor call.

9 years agoRemove is_zlib_supported
H.J. Lu [Mon, 6 Apr 2015 19:19:13 +0000 (12:19 -0700)] 
Remove is_zlib_supported

Since zlib is always supported, there is no need for is_zlib_supported.

binutils/testsuite/

* binutils-all/compress.exp: Remove is_zlib_supported check.
* binutils-all/objdump.exp: Likewise.
* binutils-all/readelf.exp (readelf_compressed_wa_test): Likewise.
* lib/utils-lib.exp (run_dump_test): Likewise.
* lib/binutils-common.exp (is_zlib_supported): Removed.

gas/testsuite/

* lib/gas-defs.exp (run_dump_test): Remove is_zlib_supported check.

ld/testsuite/

* ld-elf/compress.exp: Remove is_zlib_supported check.
Fail if --compress-debug-sections doesn't work.
* lib/ld-lib.exp (run_dump_test): Remove is_zlib_supported check.

9 years agox86: Use individual prefix control for each opcode.
Ilya Tocar [Mon, 6 Apr 2015 16:33:01 +0000 (19:33 +0300)] 
x86: Use individual prefix control for each opcode.

2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
    H.J. Lu  <hongjiu.lu@intel.com>

* i386-dis-evex.h (evex_table): Fill prefix_requirement field.
* i386-dis.c (PREFIX_MANDATORY_REPZ, PREFIX_MANDATORY_REPNZ,
PREFIX_MANDATORY_DATA, PREFIX_MANDATORY_ADDR, PREFIX_MANDATORY_LOCK,
PREFIX_UD_SHIFT, PREFIX_UD_REPZ, REFIX_UD_REPNZ, PREFIX_UD_DATA,
PREFIX_UD_ADDR, PREFIX_UD_LOCK, PREFIX_OPTIONAL, PREFIX_MANDATORY):
Define.
(Bad_Opcode, FLOAT, DIS386, DIS386_PREFIX, THREE_BYTE_TABLE_PREFIX):
Fill prefix_requirement field.
(struct dis386): Add prefix_requirement field.
(dis386): Fill prefix_requirement field.
(dis386_twobyte): Ditto.
(twobyte_has_mandatory_prefix_: Remove.
(reg_table): Fill prefix_requirement field.
(prefix_table): Ditto.
(x86_64_table): Ditto.
(three_byte_table): Ditto.
(xop_table): Ditto.
(vex_table): Ditto.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(mod_table): Ditto.
(bad_opcode): Ditto.
(print_insn): Use prefix_requirement.
(FGRPd9_2, FGRPd9_4, FGRPd9_5, FGRPd9_6, FGRPd9_7, FGRPda_5, FGRPdb_4,
FGRPde_3, FGRPdf_4): Fill prefix_requirement field.
(float_reg): Ditto.

9 years agoUse bfd_putb64/bfd_getb64
H.J. Lu [Mon, 6 Apr 2015 16:01:43 +0000 (09:01 -0700)] 
Use bfd_putb64/bfd_getb64

bfd/

* compress.c (get_uncompressed_size): Removed.
(bfd_compress_section_contents): Use bfd_putb64 to write
uncompressed section size.
(bfd_init_section_decompress_status): Replace
get_uncompressed_size with bfd_getb64.

gas/

* write.c (compress_debug): Use bfd_putb64 to write uncompressed
section size.

9 years agoRemove "/dev/null" from remote_exec
H.J. Lu [Mon, 6 Apr 2015 15:59:15 +0000 (08:59 -0700)] 
Remove "/dev/null" from remote_exec

We should catch all errors/warnings from cmp.

* binutils-all/compress.exp (compression_used): Remove "/dev/null"
from remote_exec.

9 years agoAdd testcase for stub-method reading in stabs.
Doug Evans [Mon, 6 Apr 2015 15:59:58 +0000 (08:59 -0700)] 
Add testcase for stub-method reading in stabs.

This patch is based on the testcase provided here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00181.html

I've verified that it catches the internal error discovered here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00139.html

gdb/testsuite/ChangeLog:

* lib/gdb.exp (clean_restart): Return result of gdb_load.
* gdb.pascal/stub-method.exp: New file.
* gdb.pascal/stub-method.pas: New file.

9 years ago* lib/pascal.exp (gpc_compile): Rename dest arg to destfile.
Doug Evans [Mon, 6 Apr 2015 15:45:06 +0000 (08:45 -0700)] 
* lib/pascal.exp (gpc_compile): Rename dest arg to destfile.

The "dest" parameter to fpc_compile/gpc_compile is the name of
compilation destination file, not a board name.

This patch fixes this by using names consistent with
lib/future.exp:gdb_default_target_compile.

gdb/testsuite/ChangeLog:

* lib/pascal.exp (gpc_compile): Rename dest arg to destfile.
Fix dest parameter to board_info.
(fpc_compile): Ditto.
(gdb_compile_pascal): Rename dest arg to destfile.

9 years agosymtab.c (hash_symbol_entry): Hash STRUCT_DOMAIN symbols as VAR_DOMAIN.
Doug Evans [Mon, 6 Apr 2015 15:31:46 +0000 (08:31 -0700)] 
symtab.c (hash_symbol_entry): Hash STRUCT_DOMAIN symbols as VAR_DOMAIN.

gdb/ChangeLog:

* symtab.c (hash_symbol_entry): Hash STRUCT_DOMAIN symbols as
VAR_DOMAIN.
(symbol_cache_lookup): Clarify use of bsc_ptr, slot_ptr parameters.
Include symbol domain in debugging output.

9 years agoFallback to stub-termcap.c on all hosts
Pedro Alves [Mon, 6 Apr 2015 11:35:18 +0000 (12:35 +0100)] 
Fallback to stub-termcap.c on all hosts

Currently building gdb is impossible without an installed termcap or
curses library.  But, GDB already has a very minimal termcap in the
tree to handle this situation for Windows -- gdb/stub-termcap.c.  This
patch makes that the fallback for all hosts.

Testing this on GNU/Linux (by simply hacking away the termcap/curses
detection in gdb/configure.ac), we trip on:

 ../readline/libreadline.a(terminal.o): In function `_rl_init_terminal_io':
 /home/pedro/gdb/mygit/src/readline/terminal.c:527: undefined reference to `PC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:528: undefined reference to `BC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:529: undefined reference to `UP'
 /home/pedro/gdb/mygit/src/readline/terminal.c:538: undefined reference to `PC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:539: undefined reference to `BC'
 /home/pedro/gdb/mygit/src/readline/terminal.c:540: undefined reference to `UP'

These are globals that are normally defined by termcap (or ncurses'
termcap emulation).

Now, we could just define replacements in stub-termcap.c, but
readline/terminal.c (at least the copy in our tree) has this:

 #if !defined (__linux__) && !defined (NCURSES_VERSION)
 #  if defined (__EMX__) || defined (NEED_EXTERN_PC)
 extern
 #  endif /* __EMX__ || NEED_EXTERN_PC */
 char PC, *BC, *UP;
 #endif /* !__linux__ && !NCURSES_VERSION */

which can result in readline defining the globals too.  That will
usually work out in C, given that "-fcommon" is usually the default
for C compilers, but that won't work for C++, or C with -fno-common
(link fails with "multiple definition" errors)...

Mirroring those #ifdef conditions in the stub termcap screams
"brittle" to me -- I can see them changing in latter readline
versions.

Work around that by simply using __attribute__((weak)).
Windows/PE/COFF's do support weak, but not on gcc 3.4 based toolchains
(4.8.x does work).  Given the file never needed the variables while it
was Windows-only, just continue not defining them there.  All other
supported hosts should support this.

gdb/ChangeLog:
2015-04-06  Pedro Alves  <palves@redhat.com>
    Bernd Edlinger  <bernd.edlinger@hotmail.de>

* configure.ac: Remove the mingw32-specific stub-termcap.o
fallback, and instead fallback to the stub termcap on all hosts.
* configure: Regenerate.
* stub-termcap.c [!__MINGW32__] (PC, BC, UP): Define as weak
symbols.

9 years ago[Gold,x86_64] Convert mov foo@GOTPCREL(%rip), %reg to lea foo(%rip), %reg
Ilya Tocar [Mon, 6 Apr 2015 09:37:34 +0000 (12:37 +0300)] 
[Gold,x86_64] Convert mov foo@GOTPCREL(%rip), %reg to lea foo(%rip), %reg

2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>

PR gold/17641
* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
(Target_x86_64::Scan::local): Don't create GOT entry, when we
can convert mov to lea.
(Target_x86_64::Scan::global): Ditto.
(Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
%reg to lea foo(%rip), %reg if possible.
* testsuite/Makefile.am (x86_64_mov_to_lea): New test.
* testsuite/x86_64_mov_to_lea1.s: New.
* testsuite/x86_64_mov_to_lea2.s: Ditto.
* testsuite/x86_64_mov_to_lea3.s: Ditto.
* testsuite/x86_64_mov_to_lea4.s: Ditto.
* testsuite/x86_64_mov_to_lea.sh: Ditto.
---

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

9 years agoAdd SHF_COMPRESSED support to readelf
H.J. Lu [Sun, 5 Apr 2015 16:20:02 +0000 (09:20 -0700)] 
Add SHF_COMPRESSED support to readelf

This patch updates readelf to dump compression header with

readelf -S -W:

  [ 4] .debug_info PROGBITS  00000000 000038 00007d 00   C 0   0  1

readelf -t -W:

  [ 4] .debug_info
       PROGBITS        00000000 000038 00007d 00   0   0  1
       [00000800]: COMPRESSED
       ZLIB, 0000009d, 1

It also checks the compression header when decompressing the compressed
section.

* readelf.c (get_elf_section_flags): Support SHF_COMPRESSED.
(get_compression_header): New.
(process_section_headers): Dump compression header if needed.
(uncompress_section_contents): Don't free compressed_buffer here.
(load_specific_debug_section): Free the compressed buffer, update
the section buffer and the section size if uncompress is
successful.

9 years agoXfail the compressed debug sections
H.J. Lu [Sun, 5 Apr 2015 15:11:11 +0000 (08:11 -0700)] 
Xfail the compressed debug sections

There is no need to generate compressed debug section if compressed
section size is the same as before compression.  We should xfail the
compressed debug section test if there are no compressed sections

binutils/testsuite/

* binutils-all/compress.exp (compression_used): New.
Xfail test if compression didn't make the section smaller.

gas/

2015-04-05  H.J. Lu  <hongjiu.lu@intel.com>

* write.c (compress_debug): Don't write the zlib header if
compressed section size is the same as before compression.

9 years agosim: moxie: fix running after nrun conversion
Mike Frysinger [Sun, 5 Apr 2015 08:37:44 +0000 (04:37 -0400)] 
sim: moxie: fix running after nrun conversion

The nrun conversion was slightly incorrect in how it stopped when an
exception occurred.  We still set cpu.asregs.exception, but nothing
was checking it anymore.  Convert all of that to sim_engine_halt.

To keep things from regressing again, add a basic testsuite too.

9 years agosim: mn10300: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 07:52:08 +0000 (03:52 -0400)] 
sim: mn10300: add a basic testsuite

9 years agosim: m68hc11: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 07:17:44 +0000 (03:17 -0400)] 
sim: m68hc11: add a basic testsuite

9 years agosim: iq2000: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 06:28:44 +0000 (02:28 -0400)] 
sim: iq2000: add a basic testsuite

9 years agosim: lm32: add a basic testsuite
Mike Frysinger [Sun, 5 Apr 2015 05:58:00 +0000 (01:58 -0400)] 
sim: lm32: add a basic testsuite

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

9 years agoAlso preserve the SHF_COMPRESSED bit
H.J. Lu [Sat, 4 Apr 2015 15:01:54 +0000 (08:01 -0700)] 
Also preserve the SHF_COMPRESSED bit

For objcopy and relocatable link, we should also preserve the
SHF_COMPRESSED bit if not decompress.

* elf.c (_bfd_elf_init_private_section_data): Also preserve the
SHF_COMPRESSED bit if not decompress.

9 years agoReplace uncompressed_size_buffer with compressed_size_buffer
H.J. Lu [Sat, 4 Apr 2015 14:52:55 +0000 (07:52 -0700)] 
Replace uncompressed_size_buffer with compressed_size_buffer

9 years agoExtract get_uncompressed_size
H.J. Lu [Sat, 4 Apr 2015 14:49:35 +0000 (07:49 -0700)] 
Extract get_uncompressed_size

* compress.c (get_uncompressed_size): New.  Extracted from ...
(bfd_init_section_decompress_status): This.  Use it.

9 years agoAdd a dw2-3.S test
H.J. Lu [Sat, 4 Apr 2015 14:18:17 +0000 (07:18 -0700)] 
Add a dw2-3.S test

This patch adds a dw2-3.S test for upcoming SHF_COMPRESSED test. The
existing dw2-1.S/dw2-2.S tests generate non-compressed debug sections
for SHF_COMPRESSED since SHF_COMPRESSED compressed debug sections are
bigger.

* binutils-all/compress.exp (testfile): Remove suffix.
(compressedfile): Likewise.
(compressedfile2): Likewise.
(libfile): Likewise.
(testfile3): New.
(compressedfile3): Likewise.
Updated.
Add a dw2-3.S test.
* binutils-all/dw2-3.S: New file.
* binutils-all/dw2-3.W: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Apr 2015 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

9 years agoAdd Elf_Internal_Chdr and ElfXX_External_Chdr
H.J. Lu [Fri, 3 Apr 2015 19:49:45 +0000 (12:49 -0700)] 
Add Elf_Internal_Chdr and ElfXX_External_Chdr

* external.h (Elf32_External_Chdr): New.
(Elf64_External_Chdr): Likewise.
* internal.h (Elf_Internal_Chdr): Likewise.

9 years agogdbtypes.c: remove the usuned "top_level" parameter
Pierre-Marie de Rodat [Fri, 3 Apr 2015 12:53:12 +0000 (14:53 +0200)] 
gdbtypes.c: remove the usuned "top_level" parameter

This paramater is no longer useful after the previous commit, so remove
it as a cleanup.

gdb/ChangeLog:

* gdbtypes.c (is_dynamic_type_internal): Remove the unused
"top_level" parameter.
(resolve_dynamic_type_internal): Remove the unused "top_level"
parameter.  Update call to is_dynamic_type_internal.
(is_dynamic_type): Update call to is_dynamic_type_internal.
(resolve_dynamic_range): Update call to
resolve_dynamic_type_internal.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(resolve_dynamic_type): Likewise.

9 years agoDo not consider reference types as dynamic
Pierre-Marie de Rodat [Fri, 3 Apr 2015 08:40:52 +0000 (10:40 +0200)] 
Do not consider reference types as dynamic

Even when referenced types are dynamic, the corresponding referencing
type should not be considered as dynamic: it's only a pointer.  This
prevents reference type for values not in memory to be resolved.

gdb/ChangeLog:

* gdbtypes.c (is_dynamic_type_internal): Remove special handling
of TYPE_CODE_REF types so that they are not considered as
dynamic depending on the referenced type.
(resolve_dynamic_type_internal): Likewise.

gdb/testsuite/ChangeLog:

* gdb.ada/funcall_ref.exp: New file.
* gdb.ada/funcall_ref/foo.adb: New file.

9 years agoMake is_zlib_supported always return 1
H.J. Lu [Fri, 3 Apr 2015 11:03:07 +0000 (04:03 -0700)] 
Make is_zlib_supported always return 1

* lib/binutils-common.exp (is_zlib_supported): Always return 1.

9 years agosim: d10v: fix signal updates
Mike Frysinger [Fri, 3 Apr 2015 00:15:43 +0000 (20:15 -0400)] 
sim: d10v: fix signal updates

Way back in aba6488e0b73756f31f154d12a228baa82a68d8a, a bunch of signal
defines were changed to TARGET_SIGNAL_xxx.  For d10v, the transition was
incomplete which lead to sim_stop_reason using the new set but sim_resume
still using the old set.  Which meant in some cases, the sim would never
actually stop.

Convert all the remaining SIGxxx defines in here to TARGET_SIGNAL_xxx.
This has the nice side effect of fixing the testsuite.

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

9 years agoSecond fix for microblaze gas port's ability to parse constants.
Nick Clifton [Thu, 2 Apr 2015 16:13:12 +0000 (17:13 +0100)] 
Second fix for microblaze gas port's ability to parse constants.

PR gas/18189
* config/tc-microblaze.c (parse_imm): Use offsetT as the type for
min and max parameters.  Sign extend values before testing.

9 years agoFixes a bug in the microblaze assembler where it would not complain about constants...
Nick Clifton [Thu, 2 Apr 2015 15:10:06 +0000 (16:10 +0100)] 
Fixes a bug in the microblaze assembler where it would not complain about constants larger than 32-bits.

PR gas/18189
* config/tc-microblaze.c (parse_imm): Use offsetT as the type for
min and max parameters.

9 years agoFix the binutils readelf.ss test for the AArch64 target.
Nick Clifton [Thu, 2 Apr 2015 14:28:02 +0000 (15:28 +0100)] 
Fix the binutils readelf.ss test for the AArch64 target.

* binutils-all/readelf.ss-64: Move possible location of the $d
mapping symbol.

9 years agoAdd support for configuring an aarch64-freebsd target.
Andrew Turner [Thu, 2 Apr 2015 14:07:27 +0000 (15:07 +0100)] 
Add support for configuring an aarch64-freebsd target.

ld * Makefile.am: Add FreeBSD aarch64 files.
* Makefile.in: Regenerate.
* configure.tgt: Add aarch64-*-freebsd* target triple.
* emulparams/aarch64fbsd.sh: New file.
* emulparams/aarch64fbsdb.sh: New file.

bfd * config.bfd: Add aarch64-*-freebsd* target triple.

9 years ago[AArch64] Emit DATA_MAP in order within text section
Renlin Li [Thu, 2 Apr 2015 13:59:45 +0000 (14:59 +0100)] 
[AArch64] Emit DATA_MAP in order within text section

2015-03-27  Renlin Li  <renlin.li@arm.com>

gas/
  * config/tc-aarch64.c (mapping_state): Emit MAP_DATA within text section in order.
  (mapping_state_2): Don't emit MAP_DATA here.
  (s_aarch64_inst): Align frag during state transition.
  (md_assemble): Likewise.

9 years agoRemove unused functions in tc-aarch64.c.
Ed Maste [Thu, 2 Apr 2015 13:44:59 +0000 (14:44 +0100)] 
Remove unused functions in tc-aarch64.c.

* config/tc-aarch64.c (set_error_kind): Delete.
(set_error_message): Delete.

9 years agokfail two tests in no-unwaited-for-left.exp for remote target
Yao Qi [Thu, 2 Apr 2015 12:51:31 +0000 (13:51 +0100)] 
kfail two tests in no-unwaited-for-left.exp for remote target

I see these two fails in no-unwaited-for-left.exp in remote testing
for aarch64-linux target.

...
continue
Continuing.
warning: Remote failure reply: E.No unwaited-for children left.

[Thread 1084] #2 stopped.
(gdb) FAIL: gdb.threads/no-unwaited-for-left.exp: continue stops when thread 2 exits

....
continue
Continuing.
warning: Remote failure reply: E.No unwaited-for children left.

[Thread 1081] #1 stopped.
(gdb) FAIL: gdb.threads/no-unwaited-for-left.exp: continue stops when the main thread exits

I checked the gdb.log on buildbot, and find that these two fails also
appear on Debian-i686-native-extended-gdbserver and Fedora-ppc64be-native-gdbserver-m64.
I recall that they are about local/remote parity, and related RSP is missing.
There has been already a PR 14618 about it.  This patch is to kfail them
on remote target.

gdb/testsuite:

2015-04-02  Yao Qi  <yao.qi@linaro.org>

* gdb.threads/no-unwaited-for-left.exp: Set up kfail if target
is remote.

9 years agoRegenerate configure in bfd/binutils/gas/gdb/gold
H.J. Lu [Thu, 2 Apr 2015 12:41:50 +0000 (05:41 -0700)] 
Regenerate configure in bfd/binutils/gas/gdb/gold

bfd/

* configure: Regenerated.

binutils/

* configure: Regenerated.

gas/

* configure: Regenerated.

gdb/

* Makefile.in (top_srcdir): New.
* configure: Regenerated.

gold/

* configure: Regenerated.

9 years agoRegenerate configure in sim
H.J. Lu [Thu, 2 Apr 2015 12:38:34 +0000 (05:38 -0700)] 
Regenerate configure in sim

* arm/configure: Regenerated.
* avr/configure: Likewise.
* bfin/configure: Likewise.
* common/configure: Likewise.
* cr16/configure: Likewise.
* cris/configure: Likewise.
* d10v/configure: Likewise.
* erc32/configure: Likewise.
* frv/configure: Likewise.
* ft32/configure: Likewise.
* h8300/configure: Likewise.
* igen/configure: Likewise.
* iq2000/configure: Likewise.
* lm32/configure: Likewise.
* m32c/configure: Likewise.
* m32r/configure: Likewise.
* m68hc11/configure: Likewise.
* mcore/configure: Likewise.
* microblaze/configure: Likewise.
* mips/configure: Likewise.
* mn10300/configure: Likewise.
* moxie/configure: Likewise.
* msp430/configure: Likewise.
* ppc/configure: Likewise.
* rl78/configure: Likewise.
* rx/configure: Likewise.
* sh/configure: Likewise.
* sh64/configure: Likewise.
* v850/configure: Likewise.

9 years agoSet zlibdir/zlibinc with top_builddir/top_srcdir
H.J. Lu [Thu, 2 Apr 2015 12:37:09 +0000 (05:37 -0700)] 
Set zlibdir/zlibinc with top_builddir/top_srcdir

* zlib.m4 (AM_ZLIB): Set zlibdir to -L\$(top_builddir)/../zlib
and set zlibinc to -I\$(top_srcdir)/../zlib.

9 years agoDocument "target:" sysroot changes
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Document "target:" sysroot changes

This commit documents the newly added "target:" sysroot feature.

gdb/ChangeLog:

* NEWS: Announce the new default sysroot of "target:".

gdb/doc/ChangeLog:

* gdb.texinfo (set sysroot): Document "target:".

9 years agoMake the default sysroot be "target:"
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Make the default sysroot be "target:"

This commit makes GDB default to a sysroot of "target:".
One testcase needed updating as a result of this change.

gdb/ChangeLog:

* main.c (captured_main): Set gdb_sysroot to "target:"
if not otherwise set.

gdb/testsuite/ChangeLog:

* gdb.base/break-probes.exp: Cope with "target:" sysroot.

9 years agoUpdate exec_file_attach to cope with "target:" filenames
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Update exec_file_attach to cope with "target:" filenames

This commit adds support for filenames prefixed with "target:" to
exec_file_attach.  This is required to correctly follow inferior
exec* calls when a gdb_sysroot prefixed with "target:" is set.

gdb/ChangeLog:

* exec.c (exec_file_attach): Support "target:" filenames.

9 years agoStrip "target:" prefix in solib_find if accessing local files
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Strip "target:" prefix in solib_find if accessing local files

This commit updates solib_find to strip the "target:" prefix from
gdb_sysroot when accessing local files.  This ensures that the same
search algorithm is used for local files regardless of whether a
"target:" prefix was used or not.  It also avoids cluttering GDB's
output with unnecessary "target:" prefixes on paths.

gdb/ChangeLog:

* solib.c (solib_find): Strip "target:" prefix from sysroot
if accessing local files.

9 years agoRearrange symfile_bfd_open
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Rearrange symfile_bfd_open

symfile_bfd_open handled what were remote files as a special case.
Converting from "remote:" files to "target:" made symfile_bfd_open
look like this:

  if remote:
    open bfd, check format, etc
    return
  local-specific stuff
  open bfd, check format, etc
  return

This commit rearranges symfile_bfd_open to remove the duplicated
code, like this:

  if local:
      local-specific stuff
  open bfd, check format, etc
  return

gdb/ChangeLog:

* symfile.c (symfile_bfd_open): Reorder to remove duplicated
checks and error messages.

9 years agoConvert "remote:" sysroots to "target:" and remove "remote:"
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Convert "remote:" sysroots to "target:" and remove "remote:"

The functionality of "target:" sysroots is a superset of the
functionality of "remote:" sysroots.  This commit causes the
"set sysroot" command to rewrite "remote:" sysroots as "target:"
sysroots and replaces "remote:" specific code with "target:"
specific code where still necessary.

gdb/ChangeLog:

* remote.h (REMOTE_SYSROOT_PREFIX): Remove definition.
(remote_filename_p): Remove declaration.
(remote_bfd_open): Likewise.
* remote.c (remote_bfd_iovec_open): Remove function.
(remote_bfd_iovec_close): Likewise.
(remote_bfd_iovec_pread): Likewise.
(remote_bfd_iovec_stat): Likewise.
(remote_filename_p): Likewise.
(remote_bfd_open): Likewise.
* symfile.h (gdb_bfd_open_maybe_remote): Remove declaration.
* symfile.c (separate_debug_file_exists): Use gdb_bfd_open.
(gdb_bfd_open_maybe_remote): Remove function.
(symfile_bfd_open):  Replace remote filename check with
target filename check.
(reread_symbols): Use gdb_bfd_open.
* build-id.c (gdbcore.h): New include.
(build_id_to_debug_bfd): Use gdb_bfd_open.
* infcmd.c (attach_command_post_wait): Remove remote filename
check.
* solib.c (solib_find): Replace remote-specific handling with
target-specific handling.  Update comments where necessary.
(solib_bfd_open): Replace remote-specific handling with
target-specific handling.
(gdb_sysroot_changed): New function.
(_initialize_solib): Call the above when gdb_sysroot changes.
* windows-tdep.c (gdbcore.h): New include.
(windows_xfer_shared_library): Use gdb_bfd_open.

9 years agoMake gdb_bfd_open able to open BFDs using target fileio
Gary Benson [Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)] 
Make gdb_bfd_open able to open BFDs using target fileio

This commit updates gdb_bfd_open to access files using target
fileio functions if the supplied path starts with "target:"
and if the local and target filesystems are not the same.
This allows users to specify "set sysroot target:" and have
GDB access files locally or from the remote as appropriate.

The new functions in gdb_bfd.c are copies of functions from
remote.c. This duplication is intentional and will be removed
by the next commit in this series.

gdb/ChangeLog:

* gdb/gdb_bfd.h (TARGET_SYSROOT_PREFIX): New definition.
(is_target_filename): New declaration.
(gdb_bfd_has_target_filename): Likewise.
(gdb_bfd_open): Update documentation comment.
* gdb_bfd.c (target.h): New include.
(gdb/fileio.h): Likewise.
(is_target_filename): New function.
(gdb_bfd_has_target_filename): Likewise.
(fileio_errno_to_host): Likewise.
(gdb_bfd_iovec_fileio_open): Likewise.
(gdb_bfd_iovec_fileio_pread): Likewise.
(gdb_bfd_iovec_fileio_close): Likewise.
(gdb_bfd_iovec_fileio_fstat): Likewise.
(gdb_bfd_open): Use target fileio to access paths prefixed
with "target:" where necessary.

9 years agoIntroduce target_filesystem_is_local
Gary Benson [Thu, 2 Apr 2015 12:38:28 +0000 (13:38 +0100)] 
Introduce target_filesystem_is_local

This commit introduces a new target method target_filesystem_is_local
which can be used to determine whether or not the filesystem accessed
by the target_fileio_* methods is the local filesystem.

gdb/ChangeLog:

* target.h (struct target_ops) <to_filesystem_is_local>:
New field.
(target_filesystem_is_local): New macro.
* target-delegates.c: Regenerate.
* remote.c (remote_filesystem_is_local): New function.
(init_remote_ops): Initialize to_filesystem_is_local.

9 years agoIntroduce target_fileio_fstat
Gary Benson [Thu, 2 Apr 2015 12:38:28 +0000 (13:38 +0100)] 
Introduce target_fileio_fstat

This commit introduces a new target method target_fileio_fstat
which can be used to retrieve information about files opened with
target_fileio_open.

gdb/ChangeLog:

* target.h (struct target_ops) <to_fileio_fstat>: New field.
(target_fileio_fstat): New declaration.
* target.c (target_fileio_fstat): New function.
* inf-child.c (inf_child_fileio_fstat): Likewise.
(inf_child_target): Initialize to_fileio_fstat.
* remote.c (init_remote_ops): Likewise.

9 years agobinutils: update my e-mail address
Mike Frysinger [Thu, 2 Apr 2015 04:48:04 +0000 (00:48 -0400)] 
binutils: update my e-mail address

9 years agosim: clean up SIM_EXTRA_OBJS references
Mike Frysinger [Wed, 1 Apr 2015 06:34:00 +0000 (02:34 -0400)] 
sim: clean up SIM_EXTRA_OBJS references

This variable was deleted in previous commits and is not used anymore.
Prune any stray references to it.

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

This page took 0.057672 seconds and 4 git commands to generate.