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

9 years ago[AArch64] Add support for the Samsung Exynos M1 processor
Evandro Menezes [Thu, 26 Mar 2015 20:18:08 +0000 (15:18 -0500)]
[AArch64] Add support for the Samsung Exynos M1 processor

2015-03-26  Evandro Menezes  <e.menezes@samsung.com>

gas/
* config/tc-aarch64.c: Add support for Samsung Exynos M1.
* doc/c-aarch64.texi (-mcpu=): Add "exynos-m1".

9 years ago[ARM] Add support for the Samsung Exynos M1 processor
Evandro Menezes [Thu, 26 Mar 2015 20:51:14 +0000 (15:51 -0500)]
[ARM] Add support for the Samsung Exynos M1 processor

2015-03-26  Evandro Menezes  <e.menezes@samsung.com>

gas/
* config/tc-arm.c: Add support for Samsung Exynos M1.
* doc/c-arm.texi (-mcpu=): Add "exynos-m1".

9 years agoAdd support for writing unwinders in Python.
Sasha Smundak [Wed, 1 Apr 2015 18:49:12 +0000 (11:49 -0700)]
Add support for writing unwinders in Python.

gdb/ChangeLog:

* Makefile.in (SUBDIR_PYTHON_OBJS): Add py-unwind.o.
(SUBDIR_PYTHON_SRCS): Add py-unwind.c.
(py-unwind.o): New recipe.
* NEWS: mention Python frame unwinding.
* data-directory/Makefile.in (PYTHON_FILE_LIST): Add
gdb/unwinder.py and gdb/command/unwinder.py
* python/lib/gdb/__init__.py (packages): Add frame_unwinders
list.
(execute_unwinders): New function.
* python/lib/gdb/command/unwinders.py: New file.
* python/lib/gdb/unwinder.py: New file.
* python/py-objfile.c (objfile_object): Add frame_unwinders field.
(objfpy_dealloc): Decrement frame_unwinders reference count.
(objfpy_initialize): Create frame_unwinders list.
(objfpy_get_frame_unwinders): New function.
(objfpy_set_frame_unwinders): Ditto.
(objfile_getset): Add frame_unwinders attribute to Objfile.
* python/py-progspace.c (pspace_object): Add frame_unwinders field.
(pspy_dealloc): Decrement frame_unwinders reference count.
(pspy_initialize): Create frame_unwinders list.
(pspy_get_frame_unwinders): New function.
(pspy_set_frame_unwinders): Ditto.
(pspy_getset): Add frame_unwinders attribute to gdb.Progspace.
* python/py-unwind.c: New file.
* python/python-internal.h (pspy_get_name_unwinders): New prototype.
(objpy_get_frame_unwinders): New prototype.
(gdbpy_initialize_unwind): New prototype.
* python/python.c (gdbpy_apply_type_printers): Call
gdbpy_initialize_unwind.

gdb/doc/ChangeLog:

* doc/python.texi (Writing a Frame Unwinder in Python): Add
section.

gdb/testsuite/ChangeLog:

* gdb.python/py-unwind-maint.c: New file.
* gdb.python/py-unwind-maint.exp: New test.
* gdb.python/py-unwind-maint.py: New file.
* gdb.python/py-unwind.c: New file.
* gdb.python/py-unwind.exp: New test.
* gdb.python/py-unwind.py: New test.

9 years agoFix sim build
H.J. Lu [Wed, 1 Apr 2015 17:27:34 +0000 (10:27 -0700)]
Fix sim build

* common/Make-common.in (CSEARCH): Remove $(ZLIBINC).
(BFD_LIB): Remove $(ZLIB).
(CONFIG_LIBS): Add $(ZLIB).
* ppc/Makefile.in (ZLIBINC): Removed.
(INCLUDES): Remove $(ZLIBINC).
(BFD_LIB): Remove $(ZLIB).

9 years agoRegenerate configure in sim
H.J. Lu [Wed, 1 Apr 2015 17:15:13 +0000 (10:15 -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 agoWork around a GCC uninitialized warning bug
H.J. Lu [Wed, 1 Apr 2015 15:14:32 +0000 (08:14 -0700)]
Work around a GCC uninitialized warning bug

* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Work
around a GCC uninitialized warning bug fixed in GCC 4.6.

9 years agoinfrun.c:resume: currently_stepping after clearing stepped_breakpoint
Pedro Alves [Mon, 30 Mar 2015 15:39:56 +0000 (16:39 +0100)]
infrun.c:resume: currently_stepping after clearing stepped_breakpoint

My all-stop-on-top-of-non-stop series manages to shows regressions due
to this latent bug.  currently_stepping returns true if
stepped_breakpoint is set.  Obviously we should clear
it before checking currently_stepping, not after.

Tested on x86_64 Fedora 20.

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

* infrun.c (resume): Check currently_stepping after clearing
stepped_breakpoint, not before.

9 years agogdb.threads/manythreads.exp: can't read "test": no such variable
Pedro Alves [Tue, 31 Mar 2015 17:36:51 +0000 (18:36 +0100)]
gdb.threads/manythreads.exp: can't read "test": no such variable

If interrupt_and_wait manages to trigger the FAIL path, we get:

  ERROR OCCURED: can't read "test": no such variable

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

* gdb.threads/manythreads.exp (interrupt_and_wait): Pass $message
to fail instead of non-existent $test.

9 years agoFix gdb_spawn_with_cmdline_opts with non-empty GDBFLAGS
Pedro Alves [Mon, 30 Mar 2015 17:00:28 +0000 (18:00 +0100)]
Fix gdb_spawn_with_cmdline_opts with non-empty GDBFLAGS

Running attach.exp with a DejaGnu board that sets GDBFLAGS, like
e.g.,:

  set GDBFLAGS "-ex \"set displaced off\""

fails with (line breaks added for clarity):

 (gdb) PASS: gdb.base/attach.exp: starting with --pid
 Executing on build: kill -9 3537    (timeout = 300)
 spawn -ignore SIGHUP kill -9 3537
 spawn of build/gdb/gdb -nw -nx \
  -data-directory build/gdb/testsuite/../data-directory  \
  -ex "set displaced off"-iex "set height 0" -iex "set width 0" \
                     ^^^^^^^^
  --pid=4468 -ex "start"  failed
 ERROR: Spawning build/gdb/gdb failed.
 UNRESOLVED: gdb.base/attach.exp: cmdline attach run: run to prompt

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

* lib/gdb.exp (gdb_spawn_with_cmdline_opts): Append space to
GDBFLAGS if not empty.

9 years agoMake print_target_wait_results print the whole ptid
Pedro Alves [Mon, 30 Mar 2015 16:02:01 +0000 (17:02 +0100)]
Make print_target_wait_results print the whole ptid

Makes "set debug infrun 1" a bit clearer.  Before:

infrun: target_wait (-1, status) =
 infrun:   6299 [Thread 0x7ffff7fc1700 (LWP 6340)],

after:

 infrun: target_wait (-1.0.0, status) =
 infrun:   7233.7237.0 [Thread 0x7ffff7fc1700 (LWP 7237)],

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

* infrun.c (print_target_wait_results): Print all the ptid
elements.

9 years agokeep_going: Add missing discard_cleanups call
Pedro Alves [Thu, 26 Mar 2015 19:05:40 +0000 (19:05 +0000)]
keep_going: Add missing discard_cleanups call

By inspection, I noticed a path where we return without discarding the
cleanups.

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

* infrun.c (keep_going): Also discard cleanups if inserting
breakpoints fails.

9 years agowait_for_inferior and errors thrown from target_wait
Pedro Alves [Wed, 1 Apr 2015 13:58:56 +0000 (14:58 +0100)]
wait_for_inferior and errors thrown from target_wait

Noticed that if an error is thrown out of target_wait, we miss running
finish_thread_state_cleanup.

Tested on x86_64 Fedora 20, with "maint set target-async off".

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

* infrun.c (wait_for_inferior): Install the
finish_thread_state_cleanup cleanup across the whole function, not
just around handle_inferior_event.

9 years agoConvert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg
Ilya Tocar [Wed, 1 Apr 2015 13:48:38 +0000 (16:48 +0300)]
Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg

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

PR gold/17640
* i386.cc (Target_i386::can_convert_mov_to_lea): New.
(Target_i386::Scan::local): Don't create GOT entry, when we
can convert GOT to GOTOFF.
(Target_i386::Scan::global): Ditto.
(Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
lea foo@GOTOFF(%reg), %reg if possible.
* testsuite/Makefile.am (i386_mov_to_lea): New test.
* testsuite/i386_mov_to_lea1.s: New.
* testsuite/i386_mov_to_lea2.s: Ditto.
* testsuite/i386_mov_to_lea3.s: Ditto.
* testsuite/i386_mov_to_lea4.s: Ditto.
* testsuite/i386_mov_to_lea5.s: Ditto.
* testsuite/i386_mov_to_lea.sh: Ditto.

9 years agoRegenerate configure in gold
H.J. Lu [Wed, 1 Apr 2015 13:24:42 +0000 (06:24 -0700)]
Regenerate configure in gold

Regenerate configure for zlib.m4 change, which adds --with-system-zlib and
removes --with-zlib in gold.  zlib is enabled unconditionally with builtin
zlib imported from GCC.

* Makefile.am (ZLIB): New.
(ZLIBINC): Likewise.
(AM_CFLAGS): Add $(ZLIBINC).
(AM_CXXFLAGS): Likewise.
(ldadd_varldadd_var): Add $(ZLIB).
(incremental_dump_LDADD): Likewise.
(dwp_LDADD): Likewise.
* compressed_output.cc: Don't check HAVE_ZLIB_H to include
<zlib.h>.
(zlib_compress): Don't check HAVE_ZLIB_H.
(zlib_decompress): Likewise.
* options.h (compress_debug_sections): Likewise.
* configure.ac (AM_CONDITIONAL): Removed.
* testsuite/Makefile.am (ZLIB): New.
(LDADD): Add $(ZLIB).
Don't check HAVE_ZLIB.
* Makefile.in: Regenerated.
* config.in: Likewise.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.

9 years agoUse do_target_resume when stepping past permanent breakpoint too
Pedro Alves [Wed, 1 Apr 2015 14:24:54 +0000 (14:24 +0000)]
Use do_target_resume when stepping past permanent breakpoint too

We can use the recently added do_target_resume do simplify the code a
bit here.

Tested on x86_64 Fedora 20.

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

* infrun.c (resume) <step past permanent breakpoint>: Use
do_target_resume.

9 years agolinux_nat.c: Mark new thread running even if momentarily pausing
Pedro Alves [Tue, 24 Mar 2015 14:24:53 +0000 (14:24 +0000)]
linux_nat.c: Mark new thread running even if momentarily pausing

My all-stop-on-top-of-non-stop series manages to trip on a bug in the
linux-nat.c backend while running the testsuite.  If a thread is
discovered while threads are being momentarily paused (without the
core's intervention), the thread ends up stuck in THREAD_STOPPED
state, even though from the user's perspective, the thread is running
even while it is paused.

From inspection, in the current sources, this can happen if we call
stop_and_resume_callback, though there's no way to test that with
current Linux kernels.

(While trying to come up with test to exercise this, I stumbled on:
  https://sourceware.org/ml/gdb-patches/2015-03/msg00850.html

... which does include a non-trivial test, so I think I can still
claim I come out net positive. :-) )

Tested on x86_64 Fedora 20.

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

* linux-nat.c (linux_handle_extended_wait): Always call set_running.

9 years agoShare the "multi_line" helper among all testcases
Pierre-Marie de Rodat [Tue, 10 Mar 2015 08:51:27 +0000 (09:51 +0100)]
Share the "multi_line" helper among all testcases

gdb/testsuite/ChangeLog:

* gdb.ada/complete.exp: Remove "multi_line".
* gdb.ada/info_exc.exp: Remove "multi_line".
* gdb.ada/packed_tagged.exp: Remove "multi_line".
* gdb.ada/ptype_field.exp: Remove "multi_line".
* gdb.ada/sym_print_name.exp: Remove "multi_line".
* gdb.ada/tagged.exp: Remove "multi_line".
* gdb.btrace/buffer-size.exp: Replace [join [list ...]] with
[multi_line ...]
* gdb.btrace/delta.exp: Likewise.
* gdb.btrace/exception.exp: Likewise.
* gdb.btrace/function_call_history.exp: Likewise.
* gdb.btrace/instruction_history.exp: Likewise.
* gdb.btrace/nohist.exp: Likewise.
* gdb.btrace/record_goto.exp: Likewise.
* gdb.btrace/segv.exp: Likewise.
* gdb.btrace/stepi.exp: Likewise.
* gdb.btrace/tailcall.exp: Likewise.
* gdb.btrace/unknown_functions.exp: Likewise.
* gdb.dwarf2/dw2-undefined-ret-addr.exp: Likewise.
* lib/gdb.exp: Add the "multi_line" helper.

9 years agoAdd myself as a write-after-approval GDB maintainer
Pierre-Marie de Rodat [Wed, 1 Apr 2015 12:53:42 +0000 (14:53 +0200)]
Add myself as a write-after-approval GDB maintainer

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add "Pierre-Marie de
Rodat".

9 years agoCrash on thread id wrap around
Pedro Alves [Wed, 1 Apr 2015 12:38:06 +0000 (13:38 +0100)]
Crash on thread id wrap around

On GNU/Linux, if the target reuses the TID of a thread that GDB still
has in its list marked as THREAD_EXITED, GDB crashes, like:

 (gdb) continue
 Continuing.
 src/gdb/thread.c:789: internal-error: set_running: Assertion `tp->state != THREAD_EXITED' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n) FAIL: gdb.threads/tid-reuse.exp: continue to breakpoint: after_reuse_time (GDB internal error)

Here:

 (top-gdb) bt
 #0  internal_error (file=0x953dd8 "src/gdb/thread.c", line=789, fmt=0x953da0 "%s: Assertion `%s' failed.")
     at src/gdb/common/errors.c:54
 #1  0x0000000000638514 in set_running (ptid=..., running=1) at src/gdb/thread.c:789
 #2  0x00000000004bda42 in linux_handle_extended_wait (lp=0x16f5760, status=0, stopping=0) at src/gdb/linux-nat.c:2114
 #3  0x00000000004bfa24 in linux_nat_filter_event (lwpid=20570, status=198015) at src/gdb/linux-nat.c:3127
 #4  0x00000000004c070e in linux_nat_wait_1 (ops=0xe193d0, ptid=..., ourstatus=0x7fffffffd2c0, target_options=1) at src/gdb/linux-nat.c:3478
 #5  0x00000000004c1015 in linux_nat_wait (ops=0xe193d0, ptid=..., ourstatus=0x7fffffffd2c0, target_options=1) at src/gdb/linux-nat.c:3722
 #6  0x00000000004c92d2 in thread_db_wait (ops=0xd80b60 <thread_db_ops>, ptid=..., ourstatus=0x7fffffffd2c0, options=1)
     at src/gdb/linux-thread-db.c:1525
 #7  0x000000000066db43 in delegate_wait (self=0xd80b60 <thread_db_ops>, arg1=..., arg2=0x7fffffffd2c0, arg3=1) at src/gdb/target-delegates.c:116
 #8  0x000000000067e54b in target_wait (ptid=..., status=0x7fffffffd2c0, options=1) at src/gdb/target.c:2206
 #9  0x0000000000625111 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:3275
 #10 0x0000000000648a3b in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:56
 #11 0x00000000004c2ecb in handle_target_event (error=0, client_data=0x0) at src/gdb/linux-nat.c:4655

I managed to come up with a test that reliably reproduces this.  It
spawns enough threads for the pid number space to wrap around, so
could potentially take a while.  On my box that's 4 seconds; on
gcc110, a PPC box which has max_pid set to 65536, it's over 10
seconds.  So I made the test compute how long that would take, and cap
the time waited if it would be unreasonably long.

Tested on x86_64 Fedora 20.

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

* linux-thread-db.c (record_thread): Readd the thread to gdb's
list if it was marked exited.

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

* gdb.threads/tid-reuse.c: New file.
* gdb.threads/tid-reuse.exp: New file.

9 years ago[AArch64] Workaround for Cortex A53 erratum 843419
Marcus Shawcroft [Tue, 24 Feb 2015 12:04:41 +0000 (12:04 +0000)]
[AArch64] Workaround for Cortex A53 erratum 843419

Some early revisions of the Cortex-A53 have an erratum (843419).  The
details of the erratum are quite complex and involve dynamic
conditions.  For the purposes of the workaround we have simplified the
static conditions to an ADRP in the last two instructions of a 4KByte
page, followed within four instructions by a load/store dependent on
the ADRP.

This patch adds support to conservatively scan for and workaround
Cortex A53 erratum 843419.  There are two different workaround
strategies used.  The first is to rewrite ADRP instructions which form
part of an erratum sequence with an ADR instruction.  In situations
where the ADR provides insufficient offset the dependent load or store
instruction from the sequence is moved to a stub section and branches
are inserted from the original sequence to the relocated instruction
and back again.

Stub section sizes are rounded up to a multiple of 4096 in order to
ensure that the act of inserting work around stubs does not create
more errata sequences.

Workaround stubs are always inserted into the stub section associated
with the input section containing the erratum sequence.  This ensures
that the fully relocated form of the veneered load store instruction
is available at the point in time when the stub section is written.

9 years agoAdd --with-system-zlib to top level configure
H.J. Lu [Wed, 1 Apr 2015 11:57:28 +0000 (04:57 -0700)]
Add --with-system-zlib to top level configure

The top level configure supports --with-system-zlib.  This patch makes
configure --help to display --with-system-zlib.

* configure.ac: Add --with-system-zlib.
* configure: Regenerated.

9 years agoRegenerate configure in bfd/binutils/gas/gdb
H.J. Lu [Wed, 1 Apr 2015 11:55:48 +0000 (04:55 -0700)]
Regenerate configure in bfd/binutils/gas/gdb

bfd/

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

* configure: Regenerated.

binutils/

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

* configure: Regenerated.

gas/

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

* configure: Regenerated.

gdb/

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

* configure: Regenerated.

9 years agoUnset zlibdir/zlibinc only for --with-system-zlib
H.J. Lu [Wed, 1 Apr 2015 11:51:55 +0000 (04:51 -0700)]
Unset zlibdir/zlibinc only for --with-system-zlib

* zlib.m4 (AM_ZLIB): Unset zlibdir and zlibinc only for
--with-system-zlib.

9 years agoAdd a testcase for PR ld/18176
H.J. Lu [Wed, 1 Apr 2015 11:24:05 +0000 (04:24 -0700)]
Add a testcase for PR ld/18176

PR ld/18176
* ld-x86-64/pr18176.d: New file.
* ld-x86-64/pr18176.s: Likewise.
* ld-x86-64/pr18176.t: Likewise.
* ld-x86-64/x86-64.exp: Run pr18176.

9 years agoPrevent multiple definitions for _HEAP_START, _HEAP_MAX, and _STACK_START when perfor...
Chen Gang [Wed, 1 Apr 2015 10:29:46 +0000 (11:29 +0100)]
Prevent multiple definitions for _HEAP_START, _HEAP_MAX, and _STACK_START when performing a relocatable link with a tic6x target.

* emulparams/elf32_tic6x_le.sh: Skip OTHER_BSS_SECTIONS for
relocating operation.

9 years agoGDBServer: give more complete usage information
Pedro Alves [Wed, 1 Apr 2015 10:01:44 +0000 (11:01 +0100)]
GDBServer: give more complete usage information

--attach/--multi are currently only mentioned on the usage info first
lines, the meaning of PROG is completely absent and the COMM text does
not mention '-/stdio'.

A few options are missing:

 . --disable-randomization / --no-disable-randomization is not mentioned.

Although the manual has a comment saying these are superceded by
QDisableRandomization, that only makes sense for "run" in
extended-remote mode.  When we start gdbserver passing it a PROG,
--disable-randomization / --no-disable-randomization do take effect.
So I think we should document these.

 . We show --debug / --remote-debug, so might as well show --disable-packet too.

GDB's --help has this "For more information, consult the GDB manual"
blurb that is missing in GDBserver's --help.

Then shuffle things around a bit into "Operating modes", "Other
options" and "Debug options" sections, similarly to GDB's --help
structure.

Before:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ ./gdbserver/gdbserver --help
Usage:  gdbserver [OPTIONS] COMM PROG [ARGS ...]
        gdbserver [OPTIONS] --attach COMM PID
        gdbserver [OPTIONS] --multi COMM

COMM may either be a tty device (for serial debugging), or
HOST:PORT to listen for a TCP connection.

Options:
  --debug               Enable general debugging output.
  --debug-format=opt1[,opt2,...]
                        Specify extra content in debugging output.
                          Options:
                            all
                            none
                            timestamp
  --remote-debug        Enable remote protocol debugging output.
  --version             Display version information and exit.
  --wrapper WRAPPER --  Run WRAPPER to start new programs.
  --once                Exit after the first connection has closed.
Report bugs to "<http://www.gnu.org/software/gdb/bugs/>".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ ./gdbserver/gdbserver --help
Usage:  gdbserver [OPTIONS] COMM PROG [ARGS ...]
        gdbserver [OPTIONS] --attach COMM PID
        gdbserver [OPTIONS] --multi COMM

COMM may either be a tty device (for serial debugging),
HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use
stdin/stdout of gdbserver.
PROG is the executable program.  ARGS are arguments passed to inferior.
PID is the process ID to attach to, when --attach is specified.

Operating modes:

  --attach              Attach to running process PID.
  --multi               Start server without a specific program, and
                        only quit when explicitly commanded.
  --once                Exit after the first connection has closed.
  --help                Print this message and then exit.
  --version             Display version information and exit.

Other options:

  --wrapper WRAPPER --  Run WRAPPER to start new programs.
  --disable-randomization
                        Run PROG with address space randomization disabled.
  --no-disable-randomization
                        Don't disable address space randomization when
                        starting PROG.

Debug options:

  --debug               Enable general debugging output.
  --debug-format=opt1[,opt2,...]
                        Specify extra content in debugging output.
                          Options:
                            all
                            none
                            timestamp
  --remote-debug        Enable remote protocol debugging output.
  --disable-packet=opt1[,opt2,...]
                        Disable support for RSP packets or features.
                          Options:
                            vCont, Tthread, qC, qfThreadInfo and
                            threads (disable all threading packets).

For more information, consult the GDB manual (available as on-line
info or a printed manual).
Report bugs to "<http://www.gnu.org/software/gdb/bugs/>".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gdb/gdbserver/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>
    Cleber Rosa  <crosa@redhat.com>

* server.c (gdbserver_usage): Reorganize and extend the usage
message.

9 years agoStart of relro segment adjustment
Alan Modra [Wed, 1 Apr 2015 08:49:27 +0000 (19:19 +1030)]
Start of relro segment adjustment

Adjusting the start of the relro segment in order to make it end
exactly on a page boundary runs into difficulties when sections in the
relro segment are aligned;  Adjusting the start by (next_page - end)
sometimes results in more than that adjustment occurring at the end,
overrunning the page boundary.  So when that occurs we try a new lower
start position by masking the adjusted start with the maximum section
alignment.  However, we didn't consider that this masked start address
may in fact be before the initial relro base, which is silly since
that can only increase padding at the relro end.

I've also moved some calculations closer to where they are used, and
comments closer to the relevant statements.

* ldlang.c (lang_size_sections): When alignment of sections
results in relro base adjustment being too large, don't go lower
than the initial value.
* ldexp.c (fold_binary <DATA_SEGMENT_RELRO_END>): Comment.
* scripttempl/elf.sc (DATA_SEGMENT_ALIGN): Omit SEGMENT_SIZE
alignment when SEGMENT_SIZE is the same as MAXPAGESIZE.