binutils-gdb.git
8 years agoPass Ctrl-C to the target in target_terminal_inferior
Pedro Alves [Tue, 12 Apr 2016 15:49:31 +0000 (16:49 +0100)]
Pass Ctrl-C to the target in target_terminal_inferior

If the user presses Ctrl-C immediately before target_terminal_inferior
is called and the target is resumed, instead of after, the Ctrl-C ends
up pending in the quit flag until the target next stops.

remote.c has this bit to handle this:

      if (!target_is_async_p ())
{
  ofunc = signal (SIGINT, sync_remote_interrupt);
  /* If the user hit C-c before this packet, or between packets,
     pretend that it was hit right here.  */
  if (check_quit_flag ())
    sync_remote_interrupt (SIGINT);
}

But that's only reachable if async is off, while async is on by
default nowadays.  It's also obviously not reacheable on native
targets.

This patch generalizes that to all targets.

We can't remove that remote.c bit yet, until we get rid of the sync
SIGINT handler though.  That'll be done later in the series.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* remote.c (remote_pass_ctrlc): New function.
(init_remote_ops): Install it.
* target.c (target_terminal_inferior): Pass pending Ctrl-C to the
target.
(target_pass_ctrlc, default_target_pass_ctrlc): New functions.
* target.h (struct target_ops) <to_pass_ctrlc>: New method.
(target_pass_ctrlc, default_target_pass_ctrlc): New declarations.
* target-delegates.c: Regenerate.

8 years agoDecouple target_interrupt from all-stop/non-stop modes
Pedro Alves [Tue, 12 Apr 2016 15:49:31 +0000 (16:49 +0100)]
Decouple target_interrupt from all-stop/non-stop modes

In non-stop mode, "interrupt" results in a "stop with no signal",
while in all-stop mode, it results in a remote interrupt request /
stop with SIGINT.  This is currently implemented in both the Linux and
remote target backends.  Move it to the core code instead, making
target_interrupt specifically always about "Interrupting as if with
Ctrl-C", just like it is documented.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* infcmd.c (interrupt_target_1): Call target_stop is in non-stop
mode.
* linux-nat.c (linux_nat_interrupt): Delete.
(linux_nat_add_target): Don't install linux_nat_interrupt.
* remote.c (remote_interrupt_ns): Change return type to void.
Throw error if interrupting the target is not supported.
(remote_interrupt): Don't call the remote_stop_ns/remote_stop_as.

8 years agoEliminate clear_quit_flag
Pedro Alves [Tue, 12 Apr 2016 15:49:31 +0000 (16:49 +0100)]
Eliminate clear_quit_flag

Nothing calls this anymore.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* defs.h (clear_quit_flag): Remove declaration.
* extension-priv.h (struct extension_language_ops)
<clear_quit_flag>: Remove field and update comments.
* extension.c (clear_quit_flag): Delete.
* guile/guile.c (guile_extension_ops): Adjust.
* python/python.c (python_extension_ops): Adjust.
(gdbpy_clear_quit_flag): Delete.

8 years agoDon't call clear_quit_flag in captured_main
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Don't call clear_quit_flag in captured_main

This call seems pointless.  For instance, a SIGINT handler is only
installed later on.  And if wasn't, I can't see why we'd want to lose
a Ctrl-C request.

Getting rid of this allows getting rid of clear_quit_flag.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* main.c (captured_main): Don't clear the quit flag.

8 years agoDon't call clear_quit_flag in prepare_to_throw_exception
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Don't call clear_quit_flag in prepare_to_throw_exception

I think this is reminiscent of the time when a longjmp would always
jump to the top level.  Nowaways code that throw exceptions other than
a quit, which may even be caught and handled without reaching the top
level.  Certainly such exceptions shouldn't clear an interrupt
request...

(We also need to get rid of prepare_to_throw_exception in order to be
able to just do "throw ex;" in C++.)

One could argue that we should clear the quit flag when we throw a
quit from the SIGINT handler, when immediate_quit is in effect, to
handle a race, here:

 immediate_quit++;
 QUIT;

... that's the usual pattern code must use when enabling
immediate_quit.  The QUIT is there to catch the case of Ctrl-C having
already been pressed before immediate_quit was enabled.  However, this
can happen:

 immediate_quit++;
<< Ctrl-C pressed here too.
 QUIT;

And in that case, if the quit flag was already set, it'll stay set
even after throwing a quit from the SIGINT handler.  The end result is
a double quit.  But OTOH, the user did press Ctrl-C two times.  Since
I'm getting rid of immediate_quit, I'm not bothering with this.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* exceptions.c (prepare_to_throw_exception): Don't clear the quit
flag.

8 years agoDon't call clear_quit_flag in command_handler
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Don't call clear_quit_flag in command_handler

This just looks totally wrong to me, for completetly discarding a
user-requested Ctrl-C.  I can't think of why we'd want do this here.

Actually, I digged the history, and found out that this has been here
since at least 7b4ac7e1ed2c (gdb-2.4, the initial revision, 1988), at
a time were we had a top level setjmp/longjmp, long before that got
wrapped in throw_exception and friends, and this code was in an
explicit loop, with the quit_flag cleared on every iteration, before
executing a command...

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* event-top.c (command_handler): Don't call clear_quit_flag.

8 years agoDon't call clear_quit_flag after check_quit_flag
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Don't call clear_quit_flag after check_quit_flag

Obviously not necessary since check_quit_flag clears the flag as side
effect.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* remote-sim.c (gdb_os_poll_quit): Don't call clear_quit_flag.
* remote.c (remote_wait_as): Don't call clear_quit_flag.

8 years agoMake Python use a struct serial event
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Make Python use a struct serial event

Now that we have an abstract for wakeable events, use it instead of a
(heavier) serial pipe.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* python/python.c: Include "ser-event.h".
(gdbpy_event_fds): Delete.
(gdbpy_serial_event): New.
(gdbpy_run_events): Change prototype.  Use serial_event_clear
instead of serial_readchar.
(gdbpy_post_event): Use serial_event_set instead of serial_write.
(gdbpy_initialize_events): Use make_serial_event instead of
serial_pipe.

8 years agoIntroduce interruptible_select
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Introduce interruptible_select

We have places where we call a blocking gdb_select expecting that a
Ctrl-C will unblock it.  However, if the Ctrl-C is pressed just before
gdb_select, the SIGINT handler runs before gdb_select, and thus
gdb_select won't return.

For example gdb_readline_no_editing:

       QUIT;

       /* Wait until at least one byte of data is available.  Control-C
          can interrupt gdb_select, but not fgetc.  */
       FD_ZERO (&readfds);
       FD_SET (fd, &readfds);
       if (gdb_select (fd + 1, &readfds, NULL, NULL, NULL) == -1)

and stdio_file_read:

     /* For the benefit of Windows, call gdb_select before reading from
the file.  Wait until at least one byte of data is available.
Control-C can interrupt gdb_select, but not read.  */
     {
       fd_set readfds;
       FD_ZERO (&readfds);
       FD_SET (stdio->fd, &readfds);
       if (gdb_select (stdio->fd + 1, &readfds, NULL, NULL, NULL) == -1)
 return -1;
     }
     return read (stdio->fd, buf, length_buf);

This is a race classically fixed with either the self-pipe trick, or
by blocking SIGINT and then using pselect instead of select.

Blocking SIGINT most of the time would mean that check_quit_flag (and
thus QUIT) would need to do a syscall every time it is called, which
sounds best avoided, since QUIT is called in many loops.  Thus we take
the self-pipe trick route (wrapped in a serial event).

Instead of having all places that need this manually add an extra file
descriptor to the set of gdb_select's watched file descriptors, we
introduce a wrapper, interruptible_select, that does that.

The Windows version of gdb_select actually does not suffer from this,
because mingw-hdep.c:gdb_call_async_signal_handler sets a Windows
event that gdb_select always waits on.  So this patch can be seen as
generalization of that technique.  We can't remove that extra event
from mingw-hdep.c until we get rid of immediate_quit though.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* defs.h: Extend QUIT-related comments to mention
interruptible_select.
(quit_serial_event_set, quit_serial_event_clear): Declare.
* event-top.c: Include "ser-event.h" and "gdb_select.h".
(quit_serial_event): New global.
(async_init_signals): Make quit_serial_event.
(quit_serial_event_set, quit_serial_event_clear)
(quit_serial_event_fd, interruptible_select): New functions.
* extension.c (set_quit_flag): Set the quit serial event.
(check_quit_flag): Clear the quit serial event.
* gdb_select.h (interruptible_select): New declaration.
* guile/scm-ports.c (ioscm_input_waiting): Use
interruptible_select instead of gdb_select.
* top.c (gdb_readline_no_editing): Likewise.
* ui-file.c (stdio_file_read): Likewise.

8 years agoFix signal handler/event-loop races
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Fix signal handler/event-loop races

GDB's core signal handling suffers from a classical signal handler /
mainline code race:

  int
  gdb_do_one_event (void)
  {
  ...
  /* First let's see if there are any asynchronous signal handlers
       that are ready.  These would be the result of invoking any of the
       signal handlers.  */
    if (invoke_async_signal_handlers ())
      return 1;
  ...
    /* Block waiting for a new event.  (...).  */

    if (gdb_wait_for_event (1) < 0)
      return -1;
  ...
  }

If a signal is delivered while gdb is blocked in the poll/select
inside gdb_wait_for_event, then the select/poll breaks with EINTR,
we'll loop back around and call invoke_async_signal_handlers.

However, if the signal handler runs between
invoke_async_signal_handlers and gdb_wait_for_event,
gdb_wait_for_event will block, until the next unrelated event...

The fix is to a struct serial_event, and register it in the set of
files that select/poll in gdb_wait_for_event waits on.  The signal
handlers that defer work to invoke_async_signal_handlers call
mark_async_signal_handler, which is adjusted to also set the new
serial event in addition to setting a flag, and is thus now is
garanteed to immediately unblock the next gdb_select/poll call, up
until invoke_async_signal_handlers is called and the event is cleared.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* event-loop.c: Include "ser-event.h".
(async_signal_handlers_serial_event): New global.
(async_signals_handler, initialize_async_signal_handlers): New
functions.
(mark_async_signal_handler): Set
async_signal_handlers_serial_event.
(invoke_async_signal_handlers): Clear
async_signal_handlers_serial_event.
* event-top.c (async_init_signals): Call
initialize_async_signal_handlers.

8 years agoIntroduce a serial interface for select'able events
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Introduce a serial interface for select'able events

This patch adds a new "event" struct serial type, that is an
abstraction specifically for waking up blocking waits/selects,
implemented on top of a pipe on POSIX, and on top of a native Windows
event (CreateEvent, etc.) on Windows.

This will be used to plug signal handler / mainline code races.

For example, GDB can indefinitely delay handling a quit request if the
user presses Ctrl-C between the last QUIT call and the next (blocking)
gdb_select call in the event loop:

      QUIT;
                  <<< press ctrl-c here and end up blocked in gdb_select
      indefinitely.

      gdb_select (...); // whoops, SIGINT was already handled, no EINTR.

A global alone (either the quit flag, or the "ready" flag of the async
signal handlers in the event loop) is not sufficient.

To plug races such as these on POSIX systems, we have to register some
waitable file descriptor in the set of files gdb_select waits on, and
write to it from the signal handler.  This is classically a pipe, and
the pattern called the self-pipe trick.  On Linux, it could be a more
efficient eventfd instead, but I'm sticking with a pipe for
simplifity, as we need it for portability anyway.

(Alternatively, we could use pselect/ppoll, and block signals until
the pselect.  The latter is not a design I think GDB could use,
because we want the QUIT macro to be super cheap, as it is used in
loops.  Plus, Windows.)

This is a "struct serial" because Windows's gdb_select relies on that.
Windows's gdb_select, our "select" replacement, knows how to wait on
all kinds of handles (regular files, pipes, sockets, console, etc.)
unlike the native Windows "select" function, which can only wait on
sockets.  Each file descriptor for a "serial" type that is not
normally waitable with WaitForMultipleObjects must have a
corresponding struct serial instance.  gdb_select then internally
looks up the struct serial instance that wraps each file descriptor,
and asks it for the corresponding Windows waitable handle.

We could use serial_pipe() to create a "struct serial"-wrapped pipe
that is usable everywhere, including Windows.  That's what currently
python/python.c uses for cross-thread posting of events.

However, serial_write and serial_readchar are not designed to be
async-signal-safe on POSIX hosts.  It's easier to bypass those when
setting/clearing the event source.

And writing and a serial pipe is a bit heavy weight on Windows.
gdb_select requires an extra thread to wait on the pipe and several
Windows events, when a single manual-reset Windows event, with no
extra thread is sufficient.

The intended usage is simply:

- Call make_serial_event to create a serial event object.

- From the signal handler call serial_event_set to set the event.

- From mainline code, have select/poll wait for serial_event_fd(), in
  addition to whatever other files you're about to wait for.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* Makefile.in (SFILES): Add ser-event.c.
(HFILES_NO_SRCDIR): Add ser-event.h.
(COMMON_OBS): Add ser-event.o.
* ser-event.c, ser-event.h: New files.
* serial.c (new_serial): New function, factored out from
(serial_fdopen_ops): ... this.
(serial_open_ops_1): New function, factored out from
(serial_open): ... this.
(serial_open_ops): New function.
* serial.h (struct serial): Forware declare.
(serial_open_ops): New declaration.

8 years agoRemove unused struct serial::name field
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Remove unused struct serial::name field

Not used by anything.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* serial.c (serial_open, serial_fdopen_ops, do_serial_close):
Remove references to name.
* serial.h (struct serial) <name>: Delete.

8 years agoStop remote-fileio.c from throwing from SIGINT handler
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Stop remote-fileio.c from throwing from SIGINT handler

This code installs a custom signal handler that throws a quit
exception if remote_fio_no_longjmp is not set.

AFAICS, the only real reason for this might have been to unblock the
ui_file_read call, in remote_fileio_func_read.  But ever since:

  2009-11-13  Daniel Jacobowitz  <dan@codesourcery.com>

* ui-file.c (stdio_file_read): Call gdb_select before read.

at:

  https://sourceware.org/ml/gdb-patches/2009-11/msg00321.html

that call is interruptible.

This is not only useful for switching to native C++ exceptions, but
AFAICS, also fixes a potential mess up of the remote protocol
connection, since there are target_read_memory calls done while
remote_fio_no_longjmp is clear.  If the user presses ctrl-c while GDB
is sending or receiving a packet, we'll stop the communication
immediately, at a point where it isn't safe.

gdbserver doesn't support the File I/O remote protocol extension so I
can't test this.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* remote-fileio.c (sigint_fileio_token, remote_fio_no_longjmp):
Delete.
(async_remote_fileio_interrupt): Delete.
(remote_fileio_ctrl_c_signal_handler): Don't call the async signal
handler.  Instead just always set the ctrl_c flag.
(remote_fileio_reply): Clear remote_fio_ctrl_c_flag before
re-enabling the SIGINT handler.
(remote_fileio_func_open, remote_fileio_func_close)
(remote_fileio_func_read, remote_fileio_func_write)
(remote_fileio_func_lseek, remote_fileio_func_rename)
(remote_fileio_func_unlink, remote_fileio_func_stat)
(remote_fileio_func_fstat, remote_fileio_func_gettimeofday)
(remote_fileio_func_isatty, remote_fileio_func_system)
(remote_fileio_request): Remove references to
remote_fio_no_longjmp.
(initialize_remote_fileio): Don't create an async signal handler.

8 years agoDon't set immediate_quit in prompt_for_continue
Pedro Alves [Tue, 12 Apr 2016 15:49:30 +0000 (16:49 +0100)]
Don't set immediate_quit in prompt_for_continue

immediate_quit used to be necessary back when prompt_for_continue used
blocking fread, but nowadays it uses gdb_readline_wrapper, which is
implemented in terms of a nested event loop, which already knows how
to react to SIGINT:

 #0  throw_it (reason=RETURN_QUIT, error=GDB_NO_ERROR, fmt=0x9d6d7e "Quit", ap=0x7fffffffcb88)
     at .../src/gdb/common/common-exceptions.c:324
 #1  0x00000000007bab5d in throw_vquit (fmt=0x9d6d7e "Quit", ap=0x7fffffffcb88) at .../src/gdb/common/common-exceptions.c:366
 #2  0x00000000007bac9f in throw_quit (fmt=0x9d6d7e "Quit") at .../src/gdb/common/common-exceptions.c:385
 #3  0x0000000000773a2d in quit () at .../src/gdb/utils.c:1039
 #4  0x000000000065d81b in async_request_quit (arg=0x0) at .../src/gdb/event-top.c:893
 #5  0x000000000065c27b in invoke_async_signal_handlers () at .../src/gdb/event-loop.c:949
 #6  0x000000000065aeef in gdb_do_one_event () at .../src/gdb/event-loop.c:280
 #7  0x0000000000770838 in gdb_readline_wrapper (prompt=0x7fffffffcd40 "---Type <return> to continue, or q <return> to quit---")
     at .../src/gdb/top.c:873

The need for the QUIT in stdin_event_handler is then exposed by the
gdb.base/double-prompt-target-event-error.exp test, which has:

# We're now stopped in a pagination query while handling a
# target event (printing where the program stopped).  Quitting
# the pagination should result in only one prompt being
# output.
send_gdb "\003p 1\n"

Without that change we'd get:

 Continuing.
 ---Type <return> to continue, or q <return> to quit---PASS: gdb.base/double-prompt-target-event-error.exp: ctrlc target event: continue: continue to pagination
 ^CpQuit
 (gdb)  1
 Undefined command: "1".  Try "help".
 (gdb) PASS: gdb.base/double-prompt-target-event-error.exp: ctrlc target event: continue: first prompt
 ERROR: Undefined command "".
 UNRESOLVED: gdb.base/double-prompt-target-event-error.exp: ctrlc target event: continue: no double prompt

Vs:

 Continuing.
 ---Type <return> to continue, or q <return> to quit---PASS: gdb.base/double-prompt-target-event-error.exp: ctrlc target event: continue: continue to pagination
 ^CQuit
 (gdb) p 1
 $1 = 1
 (gdb) PASS: gdb.base/double-prompt-target-event-error.exp: ctrlc target event: continue: first prompt
 PASS: gdb.base/double-prompt-target-event-error.exp: ctrlc target event: continue: no double prompt

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* event-top.c (stdin_event_handler): Call QUIT;
(prompt_for_continue): Don't run with immediate_quit set.

8 years agoTUI: check whether in secondary prompt instead of immediate_quit
Pedro Alves [Tue, 12 Apr 2016 15:49:29 +0000 (16:49 +0100)]
TUI: check whether in secondary prompt instead of immediate_quit

As can be seen in the tui_redisplay_readline comment:

 "The command could call prompt_for_continue and we must not restore
 SingleKey so that the prompt and normal keymap are used."

immediate_quit is being used as proxy for "secondary prompt".

We have a better predicate nowadays, so use it.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* tui/tui-io.c (tui_redisplay_readline): Check
gdb_in_secondary_prompt_p instead of immediate_quit.
* tui/tui.c: Include top.h.
(tui_rl_startup_hook): Check gdb_in_secondary_prompt_p instead of
immediate_quit.

8 years agoInline command_loop in read_command_line
Pedro Alves [Tue, 12 Apr 2016 15:49:29 +0000 (16:49 +0100)]
Inline command_loop in read_command_line

read_command_line is the only caller, and here we can assume we're
reading a regular file, not stdin.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* top.c (read_command_file): Inline command_loop here.
(command_loop): Delete.

8 years agoDon't rely on immediate_quit in command_line_input
Pedro Alves [Tue, 12 Apr 2016 15:49:29 +0000 (16:49 +0100)]
Don't rely on immediate_quit in command_line_input

AFAICS, immediate_quit was only needed here nowdays to be able to
interrupt gdb_readline_no_editing.

command_line_input can also take the gdb_readline_wrapper path, but
since that is built on top of the event loop (gdb_select / poll and
asynchronous signal handlers), it can be interrupted.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* top.c: Include "gdb_select.h".
(gdb_readline_no_editing): Wait for input with gdb_select instead
of blocking in fgetc.
(command_line_input): Don't set immediate_quit.

8 years agoAdd support for .extCondCode, .extCoreRegister and .extAuxRegister.
Claudiu Zissulescu [Wed, 6 Apr 2016 14:08:04 +0000 (16:08 +0200)]
Add support for .extCondCode, .extCoreRegister and .extAuxRegister.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

* testsuite/gas/arc/textauxregister.d: New file.
* testsuite/gas/arc/textauxregister.s: Likewise.
* testsuite/gas/arc/textcondcode.d: Likewise.
* testsuite/gas/arc/textcondcode.s: Likewise.
* testsuite/gas/arc/textcoreregister.d: Likewise.
* testsuite/gas/arc/textcoreregister.s: Likewise.
* testsuite/gas/arc/textpseudoop.d: Likewise.
* testsuite/gas/arc/textpseudoop.s: Likewise.
* testsuite/gas/arc/ld2.d: Update test.
* testsuite/gas/arc/st.d: Likewise.
* testsuite/gas/arc/taux.d: Likewise.
* doc/c-arc.texi (ARC Directives): Add .extCondCode,
.extCoreRegister and .extAuxRegister documentation.
* config/tc-arc.c (arc_extcorereg): New function.
(md_pseudo_table): Add .extCondCode, .extCoreRegister and
.extAuxRegister pseudo-ops.
(extRegister_t): New type.
(ext_condcode, arc_aux_hash): New global variable.
(find_opcode_match): Check for extensions.
(preprocess_operands): Likewise.
(md_begin): Add aux registers in a hash.
(assemble_insn): Update use arc_flags member.
(tokenize_extregister): New function.
(create_extcore_section): Likewise.
* config/tc-arc.h (MAX_FLAG_NAME_LENGHT): Increase to 10.
(arc_flags): Delete code, add flgp.

include/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

* opcode/arc.h (flag_class_t): Update.
(ARC_OPCODE_NONE): Define.
(ARC_OPCODE_ARCALL): Likewise.
(ARC_OPCODE_ARCFPX): Likewise.
(ARC_REGISTER_READONLY): Likewise.
(ARC_REGISTER_WRITEONLY): Likewise.
(ARC_REGISTER_NOSHORT_CUT): Likewise.
(arc_aux_reg): Add cpu.

opcodes/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-dis.c (find_format): Check for extension flags.
(print_flags): New function.
(print_insn_arc): Update for .extCondCode, .extCoreRegister and
.extAuxRegister.
* arc-ext.c (arcExtMap_coreRegName): Use
LAST_EXTENSION_CORE_REGISTER.
(arcExtMap_coreReadWrite): Likewise.
(dump_ARC_extmap): Update printing.
* arc-opc.c (arc_flag_classes): Add F_CLASS_EXTEND flag.
(arc_aux_regs): Add cpu field.
* arc-regs.h: Add cpu field, lower case name aux registers.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
8 years agoUpdate ARC instruction data-base.
Claudiu Zissulescu [Wed, 6 Apr 2016 14:47:56 +0000 (16:47 +0200)]
Update ARC instruction data-base.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

* testsuite/gas/arc/noargs_a7.d: New file.
* testsuite/gas/arc/noargs_a7.s: Likewise.
* testsuite/gas/arc/noargs_hs.d: Likewise.
* testsuite/gas/arc/noargs_hs.s: Likewise.

opcode/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-tbl.h: Add rtsc, sleep with no arguments.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
8 years agoAdd support for .extInstruction pseudo-op.
Claudiu Zissulescu [Mon, 4 Apr 2016 14:03:53 +0000 (16:03 +0200)]
Add support for .extInstruction pseudo-op.

gas/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

* testsuite/gas/arc/textinsn-errors.d: New File.
* testsuite/gas/arc/textinsn-errors.err: Likewise.
* testsuite/gas/arc/textinsn-errors.s: Likewise.
* testsuite/gas/arc/textinsn2op.d: Likewise.
* testsuite/gas/arc/textinsn2op.s: Likewise.
* testsuite/gas/arc/textinsn2op01.d: Likewise.
* testsuite/gas/arc/textinsn2op01.s: Likewise.
* testsuite/gas/arc/textinsn3op.d: Likewise.
* testsuite/gas/arc/textinsn3op.s: Likewise.
* doc/c-arc.texi (ARC Directives): Add .extInstruction
documentation.
* config/tc-arc.c (arcext_section): New variable.
(arc_extinsn): New function.
(md_pseudo_table): Add .extInstruction pseudo op.
(attributes_t): New type.
(suffixclass, syntaxclass, syntaxclassmod): New constant
structures.
(find_opcode_match): Remove arc_num_opcodes.
(md_begin): Likewise.
(tokenize_extinsn): New function.
(arc_set_ext_seg): Likewise.
(create_extinst_section): Likewise.

include/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

* opcode/arc.h (arc_num_opcodes): Remove.
(ARC_SYNTAX_3OP, ARC_SYNTAX_2OP, ARC_OP1_MUST_BE_IMM)
(ARC_OP1_IMM_IMPLIED, ARC_SUFFIX_NONE, ARC_SUFFIX_COND)
(ARC_SUFFIX_FLAG): Define.
(flags_none, flags_f, flags_cc, flags_ccf): Declare.
(arg_none, arg_32bit_rarbrc, arg_32bit_zarbrc, arg_32bit_rbrbrc)
(arg_32bit_rarbu6, arg_32bit_zarbu6, arg_32bit_rbrbu6)
(arg_32bit_rbrbs12, arg_32bit_ralimmrc, arg_32bit_rarblimm)
(arg_32bit_zalimmrc, arg_32bit_zarblimm, arg_32bit_rbrblimm)
(arg_32bit_ralimmu6, arg_32bit_zalimmu6, arg_32bit_zalimms12)
(arg_32bit_ralimmlimm, arg_32bit_zalimmlimm, arg_32bit_rbrc)
(arg_32bit_zarc, arg_32bit_rbu6, arg_32bit_zau6, arg_32bit_rblimm)
(arg_32bit_zalimm, arg_32bit_limmrc, arg_32bit_limmu6)
(arg_32bit_limms12, arg_32bit_limmlimm): Likewise.

opcodes/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-opc.c (flags_none, flags_f, flags_cc, flags_ccf):
Initialize.
(arg_none, arg_32bit_rarbrc, arg_32bit_zarbrc, arg_32bit_rbrbrc)
(arg_32bit_rarbu6, arg_32bit_zarbu6, arg_32bit_rbrbu6)
(arg_32bit_rbrbs12, arg_32bit_ralimmrc, arg_32bit_rarblimm)
(arg_32bit_zalimmrc, arg_32bit_zarblimm, arg_32bit_rbrblimm)
(arg_32bit_ralimmu6, arg_32bit_zalimmu6, arg_32bit_zalimms12)
(arg_32bit_ralimmlimm, arg_32bit_zalimmlimm, arg_32bit_rbrc)
(arg_32bit_zarc, arg_32bit_rbu6, arg_32bit_zau6, arg_32bit_rblimm)
(arg_32bit_zalimm, arg_32bit_limmrc, arg_32bit_limmu6)
(arg_32bit_limms12, arg_32bit_limmlimm): Likewise.
(arc_opcode arc_opcodes): Null terminate the array.
(arc_num_opcodes): Remove.
* arc-ext.h (INSERT_XOP): Define.
(extInstruction_t): Likewise.
(arcExtMap_instName): Delete.
(arcExtMap_insn): New function.
(arcExtMap_genOpcode): Likewise.
* arc-ext.c (ExtInstruction): Remove.
(create_map): Zero initialize instruction fields.
(arcExtMap_instName): Remove.
(arcExtMap_insn): New function.
(dump_ARC_extmap): More info while debuging.
(arcExtMap_genOpcode): New function.
* arc-dis.c (find_format): New function.
(print_insn_arc): Use find_format.
(arc_get_disassembler): Enable dump_ARC_extmap only when
debugging.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
8 years agoRemove unneeded AUX register symbols.
Claudiu Zissulescu [Thu, 31 Mar 2016 10:40:13 +0000 (12:40 +0200)]
Remove unneeded AUX register symbols.

gas/
2016-03-31  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (preprocess_operands): Mark AUX symbol.
(arc_adjust_symtab): New function.
* config/tc-arc.h (ARC_FLAG_AUX): Define.
(obj_adjust_symtab): Likewise.
* testsuite/gas/arc/taux.d: New file.
* testsuite/gas/arc/taux.s: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
8 years agoProperly handle dynamic reloc against normal symbol
H.J. Lu [Tue, 12 Apr 2016 02:41:37 +0000 (19:41 -0700)]
Properly handle dynamic reloc against normal symbol

We shouldn't issue an error for read-only segment with dynamic IFUNC
relocations when dynamic relocations are against normal symbols.

bfd/

PR ld/19939
* elf-bfd.h (_bfd_elf_allocate_ifunc_dyn_relocs): Add a pointer
to bfd_boolean.
* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
Set *readonly_dynrelocs_against_ifunc_p to TRUE if dynamic reloc
applies to read-only section.
* elf32-i386.c (elf_i386_link_hash_table): Add
readonly_dynrelocs_against_ifunc.
(elf_i386_allocate_dynrelocs): Updated.
(elf_i386_size_dynamic_sections): Issue an error for read-only
segment with dynamic IFUNC relocations only if
readonly_dynrelocs_against_ifunc is TRUE.
* elf64-x86-64.c (elf_x86_64_link_hash_table): Add
readonly_dynrelocs_against_ifunc.
(elf_x86_64_allocate_dynrelocs): Updated.
(elf_x86_64_size_dynamic_sections): Issue an error for read-only
segment with dynamic IFUNC relocations only if
readonly_dynrelocs_against_ifunc is TRUE.
* elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
Updated.

ld/

PR ld/19939
* testsuite/ld-i386/i386.exp: Run PR ld/19939 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr19939.s: New file.
* testsuite/ld-i386/pr19939a.d: Likewise.
* testsuite/ld-i386/pr19939b.d: Likewise.
* testsuite/ld-x86-64/pr19939.s: Likewise.
* testsuite/ld-x86-64/pr19939a.d: Likewise.
* testsuite/ld-x86-64/pr19939b.d: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 12 Apr 2016 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMIPS/opcodes: Fix undecoded MIPS16 extended instruction bit disassembly
Maciej W. Rozycki [Mon, 11 Apr 2016 16:56:01 +0000 (17:56 +0100)]
MIPS/opcodes: Fix undecoded MIPS16 extended instruction bit disassembly

Correct the disassembly of hardware don't cares in MIPS16 extended
instructions.  Rather than e.g.:

   0: f008 0231  addiu v0,sp,16433
   4: f520 3260  sll v0,v1,-12

print:

   0: f008 0231  addiu v0,sp,16401
   4: f520 3260  sll v0,v1,20

respectively instead.

opcodes/
* mips-dis.c (print_mips16_insn_arg): Mask unused extended
instruction bits out.

binutils/
* testsuite/binutils-all/mips/mips16-undecoded.d: New test.
* testsuite/binutils-all/mips/mips16-undecoded.s: New test
source.
* testsuite/binutils-all/mips/mips.exp: Run the new test.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Apr 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix primary reason why the SH simulation hasn't been working on 64 bit hosts.
Oleg Endo [Sun, 10 Apr 2016 02:00:01 +0000 (11:00 +0900)]
Fix primary reason why the SH simulation hasn't been working on 64 bit hosts.

sim/sh/
* interp.c (dmul): Split into dmul_s and dmul_u.  Use explicit integer
width types and simplify implementation.
* gencode.c (dmuls.l, dmulu.l): Use new functions dmul_s and dmul_u.

8 years agoMove ChangeLog entries from sim/ChangeLog to sim/sh/ChangeLog.
Oleg Endo [Sun, 10 Apr 2016 01:53:20 +0000 (10:53 +0900)]
Move ChangeLog entries from sim/ChangeLog to sim/sh/ChangeLog.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 10 Apr 2016 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMIPS/GAS: Sanitize `.option picX' pseudo-op
Maciej W. Rozycki [Sat, 9 Apr 2016 20:35:50 +0000 (21:35 +0100)]
MIPS/GAS: Sanitize `.option picX' pseudo-op

gas/
* config/tc-mips.c (s_option): Sanitize `.option picX'
pseudo-op.
* testsuite/gas/mips/option-pic-1.d: New test.
* testsuite/gas/mips/option-pic-2.l: New list test.
* testsuite/gas/mips/option-pic-1.s: New test source.
* testsuite/gas/mips/option-pic-2.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

8 years agoMIPS/GAS: Disallow `.option picX' with VxWorks PIC
Maciej W. Rozycki [Sat, 9 Apr 2016 20:23:40 +0000 (21:23 +0100)]
MIPS/GAS: Disallow `.option picX' with VxWorks PIC

gas/
* config/tc-mips.c (s_option): Reject `.option picX' if VxWorks
PIC.
* testsuite/gas/mips/option-pic-vxworks-1.l: New list test.
* testsuite/gas/mips/option-pic-vxworks-2.l: New list test.
* testsuite/gas/mips/option-pic-vxworks-1.s: New test source.
* testsuite/gas/mips/option-pic-vxworks-2.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

8 years agogdb.python/py-mi-events-gdb.py: Add parentheses to print
Simon Marchi [Sat, 9 Apr 2016 12:41:41 +0000 (08:41 -0400)]
gdb.python/py-mi-events-gdb.py: Add parentheses to print

Required for Python 3

gdb/testsuite/ChangeLog:

* gdb.python/py-mi-events-gdb.py (signal_stop_handler): Add
parentheses to print.
(continue_handler): Likewise.

8 years agoMIPS/GAS: Correct call formatting in `can_swap_branch_p'
Maciej W. Rozycki [Sat, 9 Apr 2016 12:27:30 +0000 (13:27 +0100)]
MIPS/GAS: Correct call formatting in `can_swap_branch_p'

gas/
* config/tc-mips.c (can_swap_branch_p): Correct call formatting.

8 years agoGAS: Fix a typo in `as_bad' description
Maciej W. Rozycki [Sat, 9 Apr 2016 12:22:54 +0000 (13:22 +0100)]
GAS: Fix a typo in `as_bad' description

gas/
* messages.c (as_bad): Fix a typo in description.

8 years agoMIPS/GAS: Unify messages in `mips_check_options'
Maciej W. Rozycki [Sat, 9 Apr 2016 12:19:00 +0000 (13:19 +0100)]
MIPS/GAS: Unify messages in `mips_check_options'

gas/
* config/tc-mips.c (mips_check_options): Unify messages.

8 years agoMIPS/GAS: Use `opts->isa' consistently in `mips_check_options'
Maciej W. Rozycki [Sat, 9 Apr 2016 11:55:09 +0000 (12:55 +0100)]
MIPS/GAS: Use `opts->isa' consistently in `mips_check_options'

gas/
* config/tc-mips.c (mips_check_options): Use `opts->isa'
consistently.

8 years agoAdjust default memory size and stack base address for SH simulator.
Oleg Endo [Sat, 9 Apr 2016 01:24:00 +0000 (10:24 +0900)]
Adjust default memory size and stack base address for SH simulator.

ld/ChangeLog:
* sh/interp.c (sim_memory_size): Default init to 30.
(parse_and_set_memory_size): Adjust upper bound to 31.

sim/ChangeLog:
* sh/interp.c (sim_memory_size): Default init to 30.
(parse_and_set_memory_size): Adjust upper bound to 31.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Apr 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMake gdb.server/solib-list.exp work for remote targets
Simon Marchi [Fri, 8 Apr 2016 22:45:29 +0000 (18:45 -0400)]
Make gdb.server/solib-list.exp work for remote targets

There are a few small changes needed to make it work with a real remote
target.

 - Remove the [is_remote target] check.
 - Remove soname setting when building the lib, it's done by default now
   anyway.
 - In the compilation of the executable, pass the shared lib using the
   shlib option, so that RPATH is set.
 - Download the program to the target using gdb_remote_download, and
   record the remote path.  Remove loading of the program using
   gdb_load_shlibs, which was not really appropriate anyway.
 - Run the remote path through readlink (see comment in the code).
 - Start gdbserver with the remote path.

Also, don't set executable and objfile variables, as they are unused.

Tested with native, native-gdbserver, native-extended-gdbserver, and a
remote gdbserver.

gdb/testsuite/ChangeLog:

* gdb.server/solib-list.exp: Remove is_remote check.
Pass shlib= to gdb_compile.  Don't link shared library with
-soname.  Call gdb_remote_download instead of gdb_load_shlibs.
Run binary filename through "readlink -f" on the target.

8 years agoFix gdb.server/solib-list.exp regression
Pedro Alves [Thu, 7 Apr 2016 22:36:50 +0000 (23:36 +0100)]
Fix gdb.server/solib-list.exp regression

Commit 7817ea46148d (Improve gdb_remote_download, remove gdb_download)
caused:

 FAIL: gdb.server/solib-list.exp: non-stop 0: target extended-remote (timeout)
 FAIL: gdb.server/solib-list.exp: non-stop 0: continue (the program is no longer running)
 FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar
 FAIL: gdb.server/solib-list.exp: non-stop 1: target extended-remote (timeout)
 FAIL: gdb.server/solib-list.exp: non-stop 1: continue (the program is no longer running)
 FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar

gdb.log shows:

 system interpreter is: /lib64/ld-linux-x86-64.so.2
 ...
 spawn ../gdbserver/gdbserver --once :2347 /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/ld-linux-x86-64.so.2 /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/solib-list
 Process /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/ld-linux-x86-64.so.2 created; pid = 18637
 Cannot exec /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/ld-linux-x86-64.so.2: No such file or directory.
 ...

The test copied the interpreter to the outputs directory, however
ld-linux-x86-64.so.2 is a relative symlink that when copied points
nowhere:

 $ ls -l testsuite/outputs/gdb.server/solib-list/
 total 52
 -rwxrwxr-x. 1 pedro pedro 13450 Apr  7 10:52 gdb.log
 -rw-rw-r--. 1 pedro pedro  1512 Apr  7 10:52 gdb.sum
 lrwxrwxrwx. 1 pedro pedro    10 Apr  7 11:39 ld-linux-x86-64.so.2 -> ld-2.22.so
 -rwxrwxr-x. 1 pedro pedro  9464 Apr  7 11:39 solib-list
 -rw-rw-r--. 1 pedro pedro  3472 Apr  7 11:39 solib-list-lib.c.o
 -rw-rw-r--. 1 pedro pedro  2760 Apr  7 11:39 solib-list.o
 -rwxrwxr-x. 1 pedro pedro  9232 Apr  7 11:39 solib-list.so

The copying comes from gdbserver_spawn ->
gdbserver_download_current_prog -> gdb_remote_download.

There's actually no need to download the interpreter to the target -
it's part of the target system/environment.  So fix this by making the
test just not use gdb_load (and gdb_file_cmd as consequence) at all,
and instead pass the interpreter filename to gdbserver as an argument.

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

* gdb.server/solib-list.exp: Don't use gdb_load.  Instead pass the
interpreter filename as argument to gdbserver_spawn.
* lib/gdbserver-support.exp (gdbserver_download_current_prog):
Return empty if $last_loaded_file does not exist.

8 years agovalue: Make accessor methods' parameters const-correct
Martin Galvan [Fri, 8 Apr 2016 18:05:45 +0000 (15:05 -0300)]
value: Make accessor methods' parameters const-correct

I did a quick pass over value.c and value.h and made some of the accessor methods'
pass-by-reference parameters const-correct. Besides the obvious benefits, this is
required if we want to use them on values that are already declared as const
(such as the parameters to lval_funcs).

There's probably a lot more stuff that can be made const, here and elsewhere.

gdb/ChangeLog:
2016-04-08  Martin Galvan  <martin.galvan@tallertechnologies.com>

    * value.c (value_next): Make pass-by-reference parameters const-correct.
    (value_parent): Likewise.
    (value_enclosing_type): Likewise.
    (value_lazy): Likewise.
    (value_stack): Likewise.
    (value_embedded_offset): Likewise.
    (value_pointed_to_offset): Likewise.
    (value_raw_address): Likewise.
    (deprecated_value_modifiable): Likewise.
    (value_free_to_mark): Likewise.
    (value_release_to_mark): Likewise.
    (internalvar_name): Likewise.
    (readjust_indirect_value_type): Likewise.
    (value_initialized): Likewise.
    * value.h (value_next): Likewise.
    (value_parent): Likewise.
    (value_enclosing_type): Likewise.
    (value_lazy): Likewise.
    (value_stack): Likewise.
    (value_embedded_offset): Likewise.
    (value_pointed_to_offset): Likewise.
    (value_raw_address): Likewise.
    (deprecated_value_modifiable): Likewise.
    (value_free_to_mark): Likewise.
    (value_release_to_mark): Likewise.
    (internalvar_name): Likewise.
    (readjust_indirect_value_type): Likewise.
    (value_initialized): Likewise.

8 years agoPR18452, ld allows overlapping sections
Alan Modra [Fri, 8 Apr 2016 08:22:03 +0000 (17:52 +0930)]
PR18452, ld allows overlapping sections

PR 18452
* ldlang.c (maybe_overlays): Delete.
(lang_size_sections_1): Remove code setting maybe_overlays.
(lang_check_section_addresses): Instead detect overlays by
exact match of section VMAs here.  Fix memory leak.

8 years agotestsuite: Fix for gcc-4.8: gdb.base/jit.exp gdb.base/jit-so.exp
Jan Kratochvil [Fri, 8 Apr 2016 13:38:53 +0000 (15:38 +0200)]
testsuite: Fix for gcc-4.8: gdb.base/jit.exp gdb.base/jit-so.exp

on CentOS-7.2 I get

Running /home/jkratoch/redhat/gdb-test-reg/gdb/testsuite/gdb.base/jit.exp ...
FAIL: gdb.base/jit.exp: one_jit_test-1: continue to breakpoint: break here 2 (the program exited)
FAIL: gdb.base/jit.exp: one_jit_test-2: continue to breakpoint: break here 2 (the program exited)
FAIL: gdb.base/jit.exp: attach: one_jit_test-2: continue to breakpoint: break here 2 (the program exited)
FAIL: gdb.base/jit.exp: attach: one_jit_test-2: break here 2: set var wait_for_gdb = 1
FAIL: gdb.base/jit.exp: attach: one_jit_test-2: break here 2: detach (the program is no longer running)
FAIL: gdb.base/jit.exp: attach: one_jit_test-2: break here 2: attach
FAIL: gdb.base/jit.exp: attach: one_jit_test-2: break here 2: set var wait_for_gdb = 0
FAIL: gdb.base/jit.exp: PIE: one_jit_test-1: continue to breakpoint: break here 2 (the program exited)
Running /home/jkratoch/redhat/gdb-test-reg/gdb/testsuite/gdb.base/jit-so.exp ...
FAIL: gdb.base/jit-so.exp: one_jit_test-1: continue to breakpoint: break here 2 (the program exited)
FAIL: gdb.base/jit-so.exp: one_jit_test-2: continue to breakpoint: break here 2 (the program exited)

since:

85af34ee0211eedf8d30a5c44dfc59dddf8b512a is the first bad commit
commit 85af34ee0211eedf8d30a5c44dfc59dddf8b512a
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Mar 31 19:28:47 2016 +0100
    Add regression test for PR gdb/19858 (JIT code registration on attach)

The compiled code's .debug_line is wrong (for the simplistic approach of GDB
to put a breakpoint on the first address belonging to that source line) and so
GDB misses the breakpoint at the last line:
          WAIT_FOR_GDB; return 0;  /* gdb break here 2  */

Most of the patch is just about reindentation, no changes there.

gdb/testsuite/ChangeLog
2016-04-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix compatibility with gcc-4.8.5-4.el7.x86_64.
* gdb.base/jit-main.c: Use exit after usage.

8 years agoFix regexps in PR19910 test to cope with COFF and AOUT sparc targets.
Nick Clifton [Fri, 8 Apr 2016 09:36:49 +0000 (10:36 +0100)]
Fix regexps in PR19910 test to cope with COFF and AOUT sparc targets.

PR target/19910
* testsuite/gas/sparc/pr19910-1.d: Adjust regexps to work with
COFF and AOUT sparc targets.

8 years agoShow sizes in linker map in target machine address units
Dan Gisselquist [Thu, 7 Apr 2016 12:57:47 +0000 (22:27 +0930)]
Show sizes in linker map in target machine address units

* ldlang.c (print_output_section_statement): Show minfo size
in target machine address units.
(print_reloc_statement): Likewise.
(print_padding_statement): Likewise.
(print_data_statement): Likewise.  Ensure minimum print_dot
increment of one address unit.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 8 Apr 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agotestsuite: Fix false FAILs with .bashrc GDBHISTFILE=...
Jan Kratochvil [Thu, 7 Apr 2016 20:18:49 +0000 (22:18 +0200)]
testsuite: Fix false FAILs with .bashrc GDBHISTFILE=...

$ GDBHISTFILE=/tmp/gdbhistfile runtest gdb.base/gdbhistsize-history.exp gdb.base/gdbinit-history.exp
Running ./gdb.base/gdbinit-history.exp ...
FAIL: gdb.base/gdbinit-history.exp: home=gdbinit-history/unlimited gdbhistsize=1000: show commands
FAIL: gdb.base/gdbinit-history.exp: home=gdbinit-history/unlimited gdbhistsize=foo: show commands
Running ./gdb.base/gdbhistsize-history.exp ...
FAIL: gdb.base/gdbhistsize-history.exp: histsize=: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=20: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize= 20 : show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=-5: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=not_an_integer: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=10zab: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=-5ab: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=99999999999999999999999999999999999: show commands
FAIL: gdb.base/gdbhistsize-history.exp: histsize=50: show commands

This happens for my setup due to my:
$ grep GDB ~/.bashrc
export GDBHISTFILE="$HOME/.gdb_history"

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

* gdb.base/gdbhistsize-history.exp: Save and unset GDBHISTFILE and
GDBHISTSIZE prior to the tests.
* gdb.base/gdbinit-history.exp: Likewise.

8 years agoFix gdb.compile/compile.exp shlib regression
Pedro Alves [Thu, 7 Apr 2016 18:28:40 +0000 (19:28 +0100)]
Fix gdb.compile/compile.exp shlib regression

Commit 6e774b13c3b8 (Make ftrace tests work with remote targets) made
a few gdb.compile/compile.exp tests disappear:

 -PASS: gdb.compile/compile.exp: call shared library function
 -PASS: gdb.compile/compile.exp: expect 1
 -PASS: gdb.compile/compile.exp: modify shared library variable
 -PASS: gdb.compile/compile.exp: expect 15

This is because the test uses ldflags instead of using the shlib
option, so it misses linking with -rpath, resulting in:

 (gdb) run
 Starting program: .../compile/compile-shlib
 .../compile/compile-shlib: error while loading shared libraries: compile-shlib.so: cannot open shared object file: No such file or directory
 [Inferior 1 (process 18014) exited with code 0177]

We were missing a gdb_load_shlibs call, which is needed for remote
testing.

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

* gdb.compile/compile.exp: Use gdb_compile with "shlib=" option
instead of build_executable.  Use gdb_load_shlibs.

8 years agoarc/nps400: Add new instructions
Andrew Burgess [Mon, 28 Mar 2016 22:05:09 +0000 (23:05 +0100)]
arc/nps400: Add new instructions

Add some new control instructions to the opcodes library, and a new test
for these new instructions to the assembler.  The new instructions use
an instruction flag longer than any seen before (on arc), and so the max
flag length is extended to accommodate this.

gas/ChangeLog:

* config/tc-arc.h (MAX_FLAG_NAME_LENGTH): Increase to 7.
* testsuite/gas/arc/nps400-2.d: New file.
* testsuite/gas/arc/nps400-2.s: New file.

opcodes/ChangeLog:

* arc-nps400-tbl.h: Add schd, sync, and hwschd instructions.
* arc-opc.c (arc_flag_operands): Add new flags.
(arc_flag_classes): Add new classes.

8 years agogas/arc: Handle multiple arc_opcode chains for same mnemonic
Andrew Burgess [Mon, 28 Mar 2016 16:08:29 +0000 (17:08 +0100)]
gas/arc: Handle multiple arc_opcode chains for same mnemonic

This commit completes support for having multiple instructions with the
same mnemonic in non-contiguous blocks within the arc_opcodes table.

The commit adds an iterator mechanism for the arc_opcode_hash_entry
structure, which is then used in find_opcode_match to consider all
arc_opcode entries with the same mnemonic, even when these instructions
are stored in non-contiguous blocks.

I extend the comment on the arc_opcodes table to discuss how entries
within the table are organised, and to mention how instructions can be
split into multiple groups if needed, but that the table is still
searched in table order.

There should be no user visible changes after this commit.

gas/ChangeLog:

* config/tc-arc.c (struct arc_opcode_hash_entry_iterator): New
structure.
(arc_opcode_hash_entry_iterator_init): New function.
(arc_opcode_hash_entry_iterator_next): New function.
(find_opcode_match): Iterate over all arc_opcode entries
referenced by the arc_opcode_hash_entry passed in as a parameter.

opcodes/ChangeLog:

* arc-opc.c (arc_opcodes): Extend comment to discus table layout.

8 years agogas/arc: Additional work to support multiple arc_opcode chains
Andrew Burgess [Mon, 28 Mar 2016 15:04:58 +0000 (16:04 +0100)]
gas/arc: Additional work to support multiple arc_opcode chains

Building on earlier commits, this commit moves along support for having
multiple arc_opcode entries in the arc_opcodes table that have the same
mnemonic (name) field, but are not stored in a contiguous block in the
table.

In this commit we support looking up the arc_opcode_hash_entry from the
hash table, and passing this along to the find_opcode_match function,
which then finds the specific arc_opcode that we're assembling.  We
still don't actually support the multiple chains of arc_opcode entries
in this commit, but the limitation is now isolated to the
find_opcode_match function.

There is no user visible change after this commit.

gas/ChangeLog:

* config/tc-arc.c (arc_find_opcode): Now returns
arc_opcode_hash_entry pointer.
(find_opcode_match): Update argument type, extract arc_opcode from
incoming arc_opcode_hash_entry.
(find_special_case_pseudo): Update return type.
(find_special_case_flag): Update return type.
(find_special_case): Update return type.
(assemble_tokens): Lookup arc_opcode_hash_entry based on
instruction mnemonic, then use find_opcode_match to identify
specific arc_opcode.

8 years agogas/arc: Modify structure used to hold opcodes
Andrew Burgess [Mon, 28 Mar 2016 13:27:43 +0000 (14:27 +0100)]
gas/arc: Modify structure used to hold opcodes

The arc assembler builds a hash table to hold references to arc_opcode
entries in the arc_opcodes table.  This hash assumes that each mnemonic
will always appear in a contiguous blocks within the arc_opcodes table;
all ADD instruction will be together, all AND instructions will likewise
be together and so on.

The problem with this is that as different variations of arc are added,
then it is often more convenient to split instructions apart, so all the
base ADD instructions are together, but, variants of ADD specific to one
variation of arc are grouped with other instructions specific to that
arc variant.  The current data structures don't support splitting the
instructions in this way.

This commit is a first step towards addressing this limitation.  In this
commit the hash table that currently holds arc_opcode pointers directly,
instead holds a pointer to a new, intermediate, data structure.  This
new data structure holds the pointer to the arc_opcode.  In this way, we
can, in the future support having the intermediate structure hold
multiple pointers to different arc_opcode groups.

There should be no visible functional change after this commit.

gas/ChangeLog:

* config/tc-arc.c (struct arc_opcode_hash_entry): New structure.
(arc_find_opcode): New function.
(find_special_case_pseudo): Use arc_find_opcode.
(find_special_case_flag): Likewise.
(assemble_tokens): Likewise.
(md_begin): Build hash using struct arc_opcode_hash_entry.

8 years agoFix gdb.reverse/finish-reverse-bkpt.exp
Yao Qi [Thu, 7 Apr 2016 16:06:14 +0000 (17:06 +0100)]
Fix gdb.reverse/finish-reverse-bkpt.exp

I see the following fail on aarch64-linux

 break void_func
 Breakpoint 2 at 0x4007a0: file gdb/testsuite/gdb.reverse/finish-reverse.c, line 44.
 (gdb) PASS: gdb.reverse/finish-reverse-bkpt.exp: set breakpoint on void_func
 continue
 Continuing.

 Breakpoint 2, void_func () at gdb/testsuite/gdb.reverse/finish-reverse.c:44^M
 44        void_test = 1;                /* VOID FUNC */^M
 (gdb) PASS: gdb.reverse/finish-reverse-bkpt.exp: continue to breakpoint: void_func
 break *void_func^M
 Note: breakpoint 2 also set at pc 0x4007a0.^M
 Breakpoint 3 at 0x4007a0: file gdb/testsuite/gdb.reverse/finish-reverse.c, line 44.
 (gdb) PASS: gdb.reverse/finish-reverse-bkpt.exp: set breakpoint at void_func's entry
 reverse-finish^M
 Run back to call of #0  void_func () at gdb/testsuite/gdb.reverse/finish-reverse.c:44
 main (argc=1, argv=0x7ffffffb78) at gdb/testsuite/gdb.reverse/finish-reverse.c:98
 98        void_func ();                                 /* call to void_func */^M
 (gdb) FAIL: gdb.reverse/finish-reverse-bkpt.exp: reverse-finish from void_func trips breakpoint at entry

The test assumes that brekapoints on "void_func" and "*void_func" are
set on different places because of function prologue.  However, on
aarch64-linux, there is no prologue in void_func, so two breakpoints
are set at the same place (0x4007a0).

(gdb) disassemble void_func
Dump of assembler code for function void_func:
   0x00000000004007a0 <+0>: adrp x0, 0x410000
   0x00000000004007a4 <+4>: add x0, x0, #0xc14
   0x00000000004007a8 <+8>: mov w1, #0x1
   0x00000000004007ac <+12>: str w1, [x0]
   0x00000000004007b0 <+16>: ret

The fix to this problem is to single step forward before setting
breakpoint on *void_func.

gdb/testsuite:

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

* gdb.reverse/finish-reverse-bkpt.exp: Use temporary breakpoint.
Execute "si" command.

8 years agoFix gdb.reverse/next-reverse-bkpt-over-sr.exp
Yao Qi [Thu, 7 Apr 2016 15:57:09 +0000 (16:57 +0100)]
Fix gdb.reverse/next-reverse-bkpt-over-sr.exp

I see the fail on aarch64-linux,

(gdb) reverse-next

Breakpoint 2, callee () at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/step-reverse.c:26^M
26        myglob++; return 0;   /* ARRIVED IN CALLEE */
(gdb) FAIL: gdb.reverse/next-reverse-bkpt-over-sr.exp: reverse-next over call trips user breakpoint at function entry

The test expects program stops at line 25, but program stops at line 26.

(gdb) maintenance info line-table
objfile: /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.reverse/next-reverse-bkpt-over-sr/next-reverse-bkpt-over-sr ((struct objfile *) 0x613000002880)
compunit_symtab: ((struct compunit_symtab *) 0x621000121760)
symtab: /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/step-reverse.c ((struct symtab *) 0x6210001217e0)
linetable: ((struct linetable *) 0x6210001520d0):
INDEX    LINE ADDRESS
0          25 0x0000000000400890
1          26 0x0000000000400890
2          27 0x00000000004008b0

(gdb) disassemble callee
Dump of assembler code for function callee:
   0x0000000000400890 <+0>:     adrp    x0, 0x410000
   0x0000000000400894 <+4>:     add     x0, x0, #0xcac

the line-table show that the first instruction of function callee is
mapped line 25 and 26.  I am not sure the line-table is correct, but
it is not the point of this test.  The goal of this test is to test
program hits the breakpoint on the first instruction of function after
'reverse-next', so I change this test to expect the breakpoint number
the program hits.

gdb/testsuite:

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

* gdb.reverse/next-reverse-bkpt-over-sr.exp: Match the breakpoint
number instead of the comments on some line.

8 years agoMake breakpoint handling in record-full idempotent
Yao Qi [Thu, 7 Apr 2016 15:47:26 +0000 (16:47 +0100)]
Make breakpoint handling in record-full idempotent

Some test fails in gdb.reverse/break-reverse.exp on arm-linux lead me
seeing the following error message,

continue^M
Continuing.^M
Cannot remove breakpoints because program is no longer writable.^M
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Further execution is probably impossible.^M
^M
Breakpoint 3, bar () at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/break-reverse.c:22^M
22        xyz = 2; /* break in bar */^M
(gdb) PASS: gdb.reverse/break-reverse.exp: continue to breakpoint: bar backward

this is caused by two entries in record_full_breakpoints, and their addr
is the same, but in_target_beneath is different.

during the record, we do continue,

Continuing.
infrun: clear_proceed_status_thread (Thread 13772.13772)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [Thread 13772.13772] for step-over
infrun: skipping breakpoint: stepping past insn at: 0x8620
Sending packet: $Z0,85f4,4#1d...Packet received: OK  <----
.....
Sending packet: $vCont;c#a8...infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [process -1],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [process -1],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: T05swbreak:;0b:9cf5ffbe;0d:9cf5ffbe;0f:f4850000;thread:p35cc.35cc;core:1;
Sending packet: $Z0,85f4,4#1d...Packet received: OK <-----
....
Sending packet: $z0,85f4,4#3d...Packet received: OK <-----

we can see breakpoint on 0x85f4 are inserted *twice*, but only removed
once.  That is fine to remote target, because Z/z packets are
idempotent, but there is a leftover in record_full_breakpoints
in record-full target.  The flow can be described as below,

                                record_full_breakpoints   remote target
  -----------------------------------------------------------------------
  forward execution, continue,    in_target_beneath 1     breakpoint inserted
  insert breakpoints on 0x85f4    in_target_beneath 1
  twice

  program stops,
  remove breakpoint on 0x85f4     in_target_beneath 1     breakpoint removed

  reverse execution, continue,    in_target_beneath 1     none is requested
  insert breakpoints on 0x85f4,   in_target_beneath 0

  program stops,
  remote breakpoint on 0x85f4,    in_target_beneath 0     request to remove,
                                                          but GDBserver
  doesn't know

now, the question is why breakoint on 0x85f4 is inserted twice?  One
is the normal breakpoint, and the other is the single step breakpoint.
GDB inserts single step breakpoint to do single step.  When program
stops at 0x85f4, both of them are set on 0x85f4, and GDB deletes
single step breakpoint, so in update_global_location_list, this
breakpoint location is no longer found, GDB call
force_breakpoint_reinsertion to mark it condition_updated, and insert
it again.

The reason force_breakpoint_reinsertion is called to update the
conditions in the target side, because the conditions may be
changed.  My original fix is to not call force_breakpoint_reinsertion
if OLD_LOC->cond is NULL, but it is not correct if another location
on the same address has condition, GDB doesn't produce condition for
target side, but GDB should do.

Then, I change my mind back to make record-full handling breakpoint
idempotent, to align with remote target.  Before insert a new entry
into record_full_breakpoints, look for existing one on the same
address first.  I also add an assert on
"bp->in_target_beneath == in_target_beneath", to be safer.

gdb:

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

* record-full.c (record_full_insert_breakpoint): Return
early if entry on the address is found in
record_full_breakpoints.

8 years agoSet bp_tgt->reqstd_address and bp_tgt->placed_size in record_full_insert_breakpoint
Yao Qi [Thu, 7 Apr 2016 15:47:26 +0000 (16:47 +0100)]
Set bp_tgt->reqstd_address and bp_tgt->placed_size in record_full_insert_breakpoint

I notice that bp_tgt won't be fully initialized if to_insert_breakpoint
isn't called in record_full_insert_breakpoint, and bp_tgt->reqstd_address
is zero, so an entry is added to record_full_breakpoints, but its address
is zero, which is wrong.  This patch is to call gdbarch_breakpoint_from_pc
in the else branch to set bp_tgt->reqstd_address and bp_tgt->placed_size.

gdb:

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

* record-full.c (record_full_insert_breakpoint): Set
bp_tgt->reqstd_address and bp_tgt->placed_size.

8 years agold/arc: Make little endian default choice for linker scripts
Andrew Burgess [Thu, 7 Apr 2016 15:17:08 +0000 (16:17 +0100)]
ld/arc: Make little endian default choice for linker scripts

When building with --enable-targets=all the target string is not set to
something that matches the pattern arc*-*, and so the script used to
decide if we should build big or little endian linker script currently
exits with an error.

This commit makes little endian linker script be the default, which will
be used when building for all targets, this matches the behaviour from
before I made the endianness switchable, when we only ever built little
endian linker scripts anyway.

ld/ChangeLog:

* emulparams/arc-endianness.sh: Make little endian default choice.

8 years agoFix gas/ChangeLog
Alan Modra [Thu, 7 Apr 2016 13:43:14 +0000 (23:13 +0930)]
Fix gas/ChangeLog

8 years ago[ARC] Prepare strings for automatic translation.
Claudiu Zissulescu [Thu, 7 Apr 2016 12:01:17 +0000 (14:01 +0200)]
[ARC] Prepare strings for automatic translation.

gas/
2016-04-07  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (arc_option): Prepare string for automatic
translation.
(declare_register): Likewise.

8 years agoUpdate AArch64 documentation regarding architecture extensions.
James Greenhalgh [Thu, 7 Apr 2016 12:29:50 +0000 (13:29 +0100)]
Update AArch64 documentation regarding architecture extensions.

* doc/c-aarch64.texi (Architecture Extensions): Add entry for LSE.
Correct entry for RDMA.  Alpha sort entries.

8 years agogas/arc: Allow greater range of characters into flag names
Andrew Burgess [Mon, 28 Mar 2016 21:51:12 +0000 (22:51 +0100)]
gas/arc: Allow greater range of characters into flag names

An upcoming commit will add a new arc instruction flag that uses
characters that have never appeared in an arc instruction flag before.
Currently the assembler is very conservative about which characters can
or cannot appear in an instruction flag.

This commit relaxes these constraints a little.  After this commit all
alpha-numeric characters are now allowed into instruction flags.  This
complete set is not required for the upcoming change, however, having
this slightly larger set does not impact the assemblers ability to
correctly parse input, but does make it easier to add new flag to the
instruction table.

gas/ChangeLog:

* config/tc-arc.c (tokenize_flags): Allow greater range of
characters into flag names.

8 years agogas/arc: Remove preprocess_operands function
Andrew Burgess [Mon, 28 Mar 2016 14:49:25 +0000 (15:49 +0100)]
gas/arc: Remove preprocess_operands function

The preprocess_operands function changes the incoming list of assembler
tokens based on the assumption that the first arc_operand found will be
the same instruction class as all of the arc_operands for the same
mnemonic.

Though this assumption is probably fine, removing this assumption, and
pushing the token change down into assemble_tokens makes the code no
more complex, and might even be easier to follow.

There should be no user visible changes after this commit.

gas/ChangeLog:

* config/tc-arc.c (find_opcode_match): Handle O_symbol case, add
new de_fault label.
(preprocess_operands): Delete.
(assemble_tokens): Remove call to preprocess_operands.

8 years agoAllow integer contants to have a U suffix. Improve error reporting for missing closi...
Nick Clifton [Thu, 7 Apr 2016 11:34:06 +0000 (12:34 +0100)]
Allow integer contants to have a U suffix.  Improve error reporting for missing closing parentheses.

PR gas/19910
* config/tc-sparc.c (sparc_ip): Report an error if the expression
inside a %-macro could not be fully parsed.
* expr.c (integer_constant): Accept and ignore U suffixes to
integers.
(operand): When a missing closing parenthesis is encountered,
report the character that was found instead.
* testsuite/gas/mips/tls-ill.l: Update expected error message.
* testsuite/gas/sparc/pr19910-1.d: New test driver.
* testsuite/gas/sparc/pr19910-1.s: New test.
* testsuite/gas/sparc/pr19910-2.l: Expected error output.
* testsuite/gas/sparc/pr19910-2.s: New test.
* testsuite/gas/sparc/sparc.exp: Run the new tests.

8 years agoFix typo in name of MSP430 attribute section.
Nick Clifton [Thu, 7 Apr 2016 11:09:20 +0000 (12:09 +0100)]
Fix typo in name of MSP430 attribute section.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 7 Apr 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoEliminate -var-create error for optzd ptr to struct
Don Breazeal [Wed, 6 Apr 2016 21:18:31 +0000 (14:18 -0700)]
Eliminate -var-create error for optzd ptr to struct

This patch eliminates an error thrown when accessing the value of a
pointer to a structure where the pointer has been optimized out and
'set print object' is 'on'.  The error shows up as the rather ugly
value of the pointer variable in Eclipse.

If 'set print object' is 'on', GDB tries to determine the actual
(derived) type of the object rather than the declared type, which
requires dereferencing the pointer, which in this cases throws an
error because the pointer has been optimized out.

The fix is to simply ignore the 'print object on' setting for
pointers or references to structures when they have been optimized
out.  This means we just get the declared type instead of the actual
type, because in this case that's the best that we can do.

To implement the fix, value_optimized_out was modified so that it
no longer throws an error when it fails to fetch the specified
value.  Instead, it just checks value->optimized_out.  If we can't
definitively say that the value is optimized out, then we assume
it is not.

gdb/ChangeLog:
2016-04-06  Don Breazeal  <donb@codesourcery.com>

* value.c (value_actual_type): Don't try to get rtti type
of the value if it has been optimized out.
(value_optimized_out): If a memory access error occurs,
just check vaue->optimized_out.

8 years agoOptimized-out pointer: New test for error handling
Don Breazeal [Wed, 6 Apr 2016 21:01:50 +0000 (14:01 -0700)]
Optimized-out pointer: New test for error handling

This patch implements a test that ensures that with "set print object
on", -var-create returns "<optimized out>" for an optimized out pointer
to structure, rather than throwing an error, while also ensuring that
any attempt to dereference the pointer *will* throw an error.

It uses the dwarf assembler to construct the appropriate debug info
to represent a pointer-to-struct in the program as optimized out,
and then accesses that pointer in various ways.  The test uses both
the console interpreter and the MI interpreter.

gdb/testsuite/ChangeLog:
2016-04-06  Don Breazeal  <donb@codesourcery.com>

* gdb.dwarf2/dw2-opt-structptr.c: New test program.
* gdb.dwarf2/dw2-opt-structptr.exp: New test script.

8 years agoFix gdb.threads/dlopen-libpthread.exp crash
Simon Marchi [Wed, 6 Apr 2016 20:49:37 +0000 (16:49 -0400)]
Fix gdb.threads/dlopen-libpthread.exp crash

Following, commit

  6e774b13c3b81ac2599812adf058796948ce7e95 Make ftrace tests work with remote targets

the test gdb.threads/dlopen-libpthread.exp started to fail with:

  ERROR: error copying "/home/emaisin/build/binutils-gdb/gdb/testsuite/gdb.threads/dlopen-libpthread.so": no such file or directory

This is because the library path is not computed using
standard_output_file, so we try to gdb_load_shlibs an unexisting file.

gdb/testsuite/ChangeLog:

* gdb.threads/dlopen-libpthread.exp: Set binfile_lib using
standard_output_file.  Remove unused binfile variable.

8 years agoRevert the previous commit adding unknown_v_replies_ok.
Jan Kratochvil [Wed, 6 Apr 2016 19:05:16 +0000 (21:05 +0200)]
Revert the previous commit adding unknown_v_replies_ok.

It broke the compatibility with gdbserver-7.6 due to:
warning: remote target does not support file transfer, attempting to access files from local filesystem.

gdb/ChangeLog
2016-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

Revert the previous commit adding unknown_v_replies_ok.

8 years agoWorkaround gdbserver<7.7 for setfs
Jan Kratochvil [Wed, 6 Apr 2016 15:13:12 +0000 (17:13 +0200)]
Workaround gdbserver<7.7 for setfs

With current FSF GDB HEAD and old FSF gdbserver I expected I could do:
gdb -ex 'file target:/root/redhat/threadit' -ex 'target remote :1234'
(supplying that unsupported qXfer:exec-file:read by "file")
But that does not work because:
Sending packet: $vFile:setfs:0#bf...Packet received: OK
Packet vFile:setfs (hostio-setfs) is supported
...
Sending packet: $vFile:setfs:104#24...Packet received: OK
"target:/root/redhat/threadit": could not open as an executable file: Invalid argument

GDB documentation says:
The valid responses to Host I/O packets are:
An empty response indicates that this operation is not recognized.

This "empty response" vs. "OK" was a bug in gdbserver < 7.7.  It was fixed by:
commit e7f0d979dd5cc4f8b658df892e93db69d6d660b7
Author: Yao Qi <yao@codesourcery.com>
Date:   Tue Dec 10 21:59:20 2013 +0800
    Fix a bug in matching notifications.
Message-ID: <1386684626-11415-1-git-send-email-yao@codesourcery.com>
https://sourceware.org/ml/gdb-patches/2013-12/msg00373.html
2013-12-10  Yao Qi  <yao@codesourcery.com>
* notif.c (handle_notif_ack): Return 0 if no notification
matches.

with unpatched old FSF gdbserver and patched FSF GDB HEAD:
gdb -ex 'file target:/root/redhat/threadit' -ex 'target remote :1234'
Sending packet: $vFile:setfs:0#bf...Packet received: OK
Packet vFile:setfs (hostio-setfs) is NOT supported
...
(gdb) info sharedlibrary
From                To                  Syms Read   Shared Object Library
0x00007ffff7ddbae0  0x00007ffff7df627a  Yes (*)     target:/lib64/ld-linux-x86-64.so.2
0x00007ffff7bc48a0  0x00007ffff7bcf514  Yes (*)     target:/lib64/libpthread.so.0

gdb/ChangeLog
2016-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

* remote.c (struct remote_state): New field unknown_v_replies_ok.
(packet_config_support): Read it.
(remote_start_remote): Set it.

8 years agoFix MSP430 assembler's detection of NOP and EINT.
Nick Clifton [Wed, 6 Apr 2016 14:57:19 +0000 (15:57 +0100)]
Fix MSP430 assembler's detection of NOP and EINT.

* config/tc-msp430.c (msp430_operands): Check for a NOP preceding
an EINT instruction.  Warn/fix as necessary.
* testsuite/gas/msp430/bad.s: Add test of EINT without preceding NOP.
* testsuite/gas/msp430/bad.l: Update expected messages.

8 years agoRevert check-in by a mistake in the previous commit.
Jan Kratochvil [Wed, 6 Apr 2016 14:48:27 +0000 (16:48 +0200)]
Revert check-in by a mistake in the previous commit.

gdb/ChangeLog
2016-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

* remote.c: Revert check-in by a mistake in the previous commit.

8 years agoPrint the "file" command suggestion in exec_file_locate_attach
Jan Kratochvil [Wed, 6 Apr 2016 13:57:08 +0000 (15:57 +0200)]
Print the "file" command suggestion in exec_file_locate_attach

currently:
$ gdbserver-7.9 :1234 true &
$ gdb -q -ex 'target remote :1234' # that -q is not relevant here
Remote debugging using :1234
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0x00007ffff7ddcc80 in ?? ()
(gdb) b main
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) _

Provide more suggestive message to use the "file" command.

gdb/ChangeLog
2016-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Pedro Alves  <palves@redhat.com>

* exec.c (exec_file_locate_attach): Print warning for unsupported
target_pid_to_exec_file.
* symfile-mem.c (add_vsyscall_page): Remove the "file" command
message part.

8 years agoFix memory leak in ld ARM backend
Thomas Preud'homme [Wed, 6 Apr 2016 08:26:42 +0000 (09:26 +0100)]
Fix memory leak in ld ARM backend

2016-04-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (elf32_arm_size_stubs): Move error_ret_free_local to be
a fall through from error_ret_free_internal.  Free local_syms in
error_ret_free_local if allocated from bfd_elf_get_elf_syms ().

8 years agotestsuite: Update py-mi-objfile to expect console format print
Catalin Udma [Tue, 5 Apr 2016 09:55:14 +0000 (12:55 +0300)]
testsuite: Update py-mi-objfile to expect console format print

Starting with this commit:

  commit e7ea3ec7c623be0b9be1eaf4929794652a84be11
  Author: Catalin Udma <catalin.udma@freescale.com>
  Date:   Mon Feb 29 16:16:19 2016 +0200

    python: Use console format for output of gdb.execute command

the python script would use console format for gdb.execute output.
This patch fixes py-mi-objfile to expect the console format when is
checking for gdb.execute printing.

gdb/testsuite/ChangeLog:
2016-04-05  Catalin Udma  <catalin.udma@freescale.com>

        * gdb.python/py-mi-objfile-gdb.py: Use "list main" command.
        * gdb.python/py-mi-objfile.exp: Match "list main" output
        in console format.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
8 years agoFix IPA detection in ftrace-insn-reloc.exp
Simon Marchi [Wed, 6 Apr 2016 00:35:42 +0000 (20:35 -0400)]
Fix IPA detection in ftrace-insn-reloc.exp

In commit 6e774b13c3b, I forgot to update this test.

gdb/testsuite/ChangeLog:

* gdb.arch/ftrace-insn-reloc.exp: Check for IPA basename instead of
absolute.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 6 Apr 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agold/arc: Fix linker for big-endian arc targets
Andrew Burgess [Tue, 29 Mar 2016 14:57:40 +0000 (15:57 +0100)]
ld/arc: Fix linker for big-endian arc targets

This aims to bring the linker for big-endian arc targets into line with
the linker for (the default) little endian arc targets.

The bulk of the changes are to extend the target pattern in the test
files from 'arc-*...' to 'arc*-*...' and so match both big and little
endian arc targets.

In the ld/emulparams/ directory the existing scripts checked for a
variable ARC_ENDIAN to switch between big and little endian targets,
however, this variable is never set up.

So, a new script snippet is introduced which sets up ARC_ENDIAN based on
the value of target, this snippet is then included from all of the
existing arc scripts.

The existing big-endian variants of all the scripts, which existed, but
were never used, are deleted in this commit.

ld/ChangeLog:

* emulparams/arc-endianness.sh: New file.
* emulparams/arcebelf.sh: Deleted.
* emulparams/arcebelf_prof.sh: Deleted.
* emulparams/arceblinux.sh: Deleted.
* emulparams/arceblinux_prof.sh: Deleted.
* emulparams/arcelf.sh: Include arc-endinness.sh.
* emulparams/arcelf_prof.sh: Include arc-endinness.sh.
* emulparams/arclinux.sh: Include arc-endinness.sh.
* emulparams/arclinux_prof.sh: Include arc-endinness.sh.
* emulparams/arcv2elf.sh: Include arc-endinness.sh.
* emulparams/arcv2elfx.sh: Include arc-endinness.sh.
* testsuite/ld-elf/compressed1d.d: Update pattern for big and
little endian arc targets.
* testsuite/ld-elf/eh-frame-hdr.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.

8 years agoarc/nps400: Add additional instructions
Andrew Burgess [Mon, 21 Mar 2016 18:49:34 +0000 (18:49 +0000)]
arc/nps400: Add additional instructions

Adds the movbi, decode1, fbset, fbclear, encode0, encode1, rflt, crc16,
and crc32 instructions for the nps400 arc machine type.

gas/ChangeLog:

* testsuite/gas/arc/nps400-1.d: Update expected results.
* testsuite/gas/arc/nps400-1.s: Additional test cases.

opcodes/ChangeLog:

* arc-nps400-tbl.h: Add movbi, decode1, fbset, fbclear, encode0,
encode1, rflt, crc16, and crc32 instructions.
* arc-opc.c (arc_flag_operands): Add F_NPS_R.
(arc_flag_classes): Add C_NPS_R.
(insert_nps_bitop_size_2b): New function.
(extract_nps_bitop_size_2b): Likewise.
(insert_nps_bitop_uimm8): Likewise.
(extract_nps_bitop_uimm8): Likewise.
(arc_operands): Add new operand entries.

8 years agoMake ftrace tests work with remote targets
Simon Marchi [Tue, 5 Apr 2016 17:59:50 +0000 (13:59 -0400)]
Make ftrace tests work with remote targets

When we build a shared library for testing, it is built differently
whether it is meant for the local system or a remote one.  When it is
for the local system, the library is built with no SONAME.  So when the
executable is built, roughly in this way:

  $ gcc testfile.c /path/to/library.so

the executable will contain an absolute reference to the library.  For
example:

  $ readelf -a testsuite/gdb.python/py-shared | grep NEEDED
   0x0000000000000001 (NEEDED)             Shared library: [/home/emaisin/build/binutils-gdb/gdb/testsuite/gdb.python/py-shared-sl.sl]

When testing is done remotely, the absolute path obviously doesn't work.
Therefore, we build the library with an SONAME:

  $ readelf -a testsuite/gdb.python/py-shared-sl.sl | grep SONAME
   0x000000000000000e (SONAME)             Library soname: [py-shared-sl.sl]

which ends up in the executable's NEEDED field:

  $ readelf -a testsuite/gdb.python/py-shared | grep NEEDED
   0x0000000000000001 (NEEDED)             Shared library: [py-shared-sl.sl]

The executable and the library are then uploaded side-by-side on the
remote system.  To allow the dynamic linker to find the shared library,
we have to add the special RPATH value $ORIGIN, which tells it to search
in the executable's directory:

  $ readelf -a testsuite/gdb.python/py-shared | grep ORIGIN
   0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]

The problem with the IPA library is that it doesn't have an SONAME,
making it very difficult to do testing on a remote board.  When a
test executable is linked with it, it contains an absolute reference to
the library path.  Therefore, unless the paths on the target are the
same as on the build system, it won't work.

To make it possible for tests using the IPA library to run test on
remote boards, I suggest adding an SONAME to libinproctrace.so.  I don't
think it should be a big problem for users.  All the libraries installed
on my system have an SONAME, so it should be fine if libinproctrace.so
does too.

As a consequence, native testing does not work anymore, since
executables do not contain the absolute path to the library anymore.  To
keep them working, we can have gdb_load_shlibs copy the library to the
test directory when testing natively.  That's done by modifying
gdb_load_shlibs.  We also have to add RPATH=$ORIGIN to executables, even
when testing natively.

I think it's a good change in general, as it reduces the differences
between testing a native and a remote target.  To further reduce those
differences, we can also always build test shared libraries with an
SONAME.

ftrace.exp and ftrace-lock.exp need to be modified slightly.  The code
checks that the IPA library is loaded using the absolute path on the
build machine.  That obviously doesn't work if the test is done
remotely, as the path will be different.  I changed the tests to only
search for the library basename (e.g. libinproctrace.so).

gdb/gdbserver/ChangeLog:

* Makefile.in ($(IPA_LIB)): Set SONAME of the IPA lib.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace-lock.exp: Check for IPA basename instead of
absolute.
* gdb.trace/ftrace.exp: Likewise.
* lib/gdb.exp (gdb_compile): Set rpath $ORIGIN for non-remote
targets as well.
(gdb_compile_shlib): Set SONAME for non-remote targets as well.
(gdb_load_shlibs): Copy libraries to test directory when testing
natively.  Only set solib-search-path if testing remotely.
* lib/mi-support.exp (mi_load_shlibs): Likewise.

8 years agoImprove gdb_remote_download, remove gdb_download
Simon Marchi [Tue, 5 Apr 2016 17:59:49 +0000 (13:59 -0400)]
Improve gdb_remote_download, remove gdb_download

This patch removes gdb_download in favor of gdb_remote_download, since
they are very close in functionality.  Also, in preparation for the
following patch about shared library handling during tests, it improves
gdb_remote_download so that it uses standard_output_file for any
destination board that is local, not only host.

If the destination board is remote, gdb_remote_download will use the
standard remote_download from DejaGnu, resulting in the file being
transferred on the remote system.

If the destination is local, gdb_remote_download will copy the file to
the standard test directory (found using standard_output_file).  Tcl's
file copy seems to handle gracefully cases where the source file is the
same as the destination, so I don't think it's necessary to check for
that case ourselves, as a previous version of the patch did.

I'd prefer to keep the name gdb_download instead of gdb_remote_download,
since I don't like the fact that gdb_remote_download implies that the
destination is remote, when it's not always the case.  However,
gdb_remote_download is used at many more places than gdb_download, so
it's easier to reuse that.  Also, since it's a wrapper around DejaGnu's
remote_download, it might be better to keep that name.  I don't know.

I ran the testsuite native, with native-gdbserver and with a
remote gdbserver, and didn't see any related failure.

gdb/testsuite/ChangeLog:

* gdb.base/jit-so.exp: Use gdb_remote_download instead of
gdb_download.  Use it even if the target is not remote.
* gdb.base/jit.exp (compile_jit_test): Likewise.
* lib/gdb.exp (gdb_remote_download): Copy files to the standard
output directory if the destination board is local, otherwise use
the standard remote_download from DejaGnu.
(gdb_download): Remove.
(gdb_load_shlibs): Use gdb_remote_download instead of
gdb_download.
* lib/gdbserver-support.exp (gdbserver_download_current_prog):
Use gdb_remote_download instead of gdb_download.  Use it even if
the target is not remote.
* lib/mi-support.exp (mi_load_shlibs): Use gdb_remote_download
instead of gdb_download.

8 years agoIPA: Move getauxval out of #ifndef IN_PROCESS_AGENT
Marcin Koƛcielnicki [Tue, 5 Apr 2016 13:23:35 +0000 (15:23 +0200)]
IPA: Move getauxval out of #ifndef IN_PROCESS_AGENT

The getauxval code was wrongly included in code area only compiled for
gdbserver.  Move it to a #ifdef IN_PROCESS_AGENT area that already
contains lots of IPA-only code.

gdb/gdbserver/ChangeLog:

* tracepoint.c (getauxval): Move to #ifdef IN_PROCESS_AGENT.

8 years ago[ARC] Fix support for double assist instructions.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:37:29 +0000 (17:37 +0200)]
[ARC] Fix support for double assist instructions.

opcodes/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-regs.h: Add a new subclass field.  Add double assist
        accumulator register values.
        * arc-tbl.h: Use DPA subclass to mark the double assist
        instructions.  Use DPX/SPX subclas to mark the FPX instructions.
        * arc-opc.c (RSP): Define instead of SP.
        (arc_aux_regs): Add the subclass field.

include/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * opcode/arc.h (DPA, DPX, SPX): New subclass enums.
        (ARC_FPUDA): Define.
        (arc_aux_reg): Add new field.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * config/tc-arc.c (is_code_density_p): Compare directly the
        subclass field.
        (is_spfp_p, is_dpfp_p, is_spfp_p): Define.
        (check_cpu_feature): New function.
        (find_opcode_match): Use check_cpu_feature function.
        (preprocess_operands): Likewise.
        (md_parse_option): Use mfpuda, mdpfp, mspfp options.
        * testsuite/gas/arc/tdpfp.d: New file.
        * testsuite/gas/arc/tfpuda.d: Likewise.
        * testsuite/gas/arc/tfpx.s: Likewise.

8 years ago[ARC] PLT content endianess awareness.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:23:24 +0000 (17:23 +0200)]
[ARC] PLT content endianess awareness.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (plt_do_relocs_for_symbol): Changed.
(relocate_plt_for_entry): Likewise.

8 years ago[ARC] Fix to pass ld-elf-ehdr_start-shared.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:14:03 +0000 (17:14 +0200)]
[ARC] Fix to pass ld-elf-ehdr_start-shared.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_check_relocs): Changed

8 years ago[ARC] 24 bit reloc and overflow detection fix.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:05:09 +0000 (17:05 +0200)]
[ARC] 24 bit reloc and overflow detection fix.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (name_for_global_symbol): Changed assert.
(get_replace_function): Created.:
(struct arc_relocation_data): Changed to signed types.
(defines S, L, P, PDATA): Casted to signed type.
(defines SECTSTART, _SDA_BASE_, TLS_REL): Likewise.
(PRINT_DEBUG_RELOC_INFO_BEFORE): Changed.
(arc_do_relocation): Changed.

include/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* opcode/arc-func.h (replace_bits24): Changed.
(replace_bits24_be): Created.

8 years ago[ARM] Add ARMv8.2 FP16 vmul/vmla/vmls (by scalar)
Jiong Wang [Tue, 5 Apr 2016 14:54:00 +0000 (15:54 +0100)]
[ARM] Add ARMv8.2 FP16 vmul/vmla/vmls (by scalar)

gas/
  * config/tc-arm.c (do_neon_mac_maybe_scalar): Allow F16.
  * testsuite/gas/arm/armv8-2-fp16-simd.s: New tests.
  * testsuite/gas/arm/armv8-2-fp16-simd.d: New expected results.
  * testsuite/gas/arm/armv8-2-fp16-simd-thum.d: Likewise for Thumb.
  * testsuite/gas/arm/armv8-2-fp16-simd-warning.l: New warning results.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.s: New test source.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.d: New testcase.
  * testsuite/gas/arm/simd_by_scalar_low_regbank_thumb.d: Likewise for Thumb.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.l: New warning results.

opcodes/
  * arm-dis.c: Support FP16 vmul, vmla, vmls (by scalar).

8 years ago[ARC] Dynamic relocs verification for dynindx == -1.
Claudiu Zissulescu [Tue, 5 Apr 2016 14:34:12 +0000 (16:34 +0200)]
[ARC] Dynamic relocs verification for dynindx == -1.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (name_for_global_symbol): Added assert to check for
symbol index.
(elf_arc_relocate_section): Added and changed asserts, validating
the synamic symbol index.
(elf_arc_finish_dynamic_symbol): Do not fill the dynamic
relocation if symbol has dynindx set to -1.

8 years ago[ARC] Don't allow pc-rel relocations for J* instructions.
Claudiu Zissulescu [Tue, 5 Apr 2016 14:22:19 +0000 (16:22 +0200)]
[ARC] Don't allow pc-rel relocations for J* instructions.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * config/tc-arc.c (assemble_insn): Prohibit pc-rel relocations for
        JUMP instructions type.
        * testsuite/gas/arc/relocs-errors.d: New file.
        * testsuite/gas/arc/relocs-errors.err: Likewise.
        * testsuite/gas/arc/relocs-errors.s: Likewise.

8 years agoELF/LD: Avoid producing hidden and internal dynamic symbols
Maciej W. Rozycki [Tue, 5 Apr 2016 14:10:05 +0000 (15:10 +0100)]
ELF/LD: Avoid producing hidden and internal dynamic symbols

Always turn hidden and internal symbols which have a dynamic index into
local ones.  This is required by the the ELF gABI[1]:

"A hidden symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object."

"An internal symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object."

The ELF linker usually respects this requirement, however in the case
where a dynamic symbol has been preallocated due to a reference of the
default export class aka visibility from the object being linked, and
then merged with a hidden or internal symbol definition from within the
same object, then the original export class is carried over to the
output dynamic symbol table, because while merging the generic ELF
linker only converts affected dynamic symbols to local when they are
defined or referenced by the object being linked and a dynamic object
involved in the link both at a time.

The dynamic symbol produced confuses then the dynamic loader at the run
time -- the hidden or internal export class is ignored and the symbol
follows preemption rules as with the default export class.

In the MIPS target it happens when `mips_elf_record_global_got_symbol'
creates a dynamic symbol when a call relocation is encountered.
Additionally if the undefined symbol referred by such a relocation does
specify the intended export class, then a local dynamic symbol is
created instead, which is harmless and allowed, but useless.  Normally
no local dynamic symbols are created, except for a single dummy one at
the beginning.

Correct the problem by removing the extra check for a dynamic symbol
being defined or referenced by the object being linked and a dynamic
object involved in the link both at a time.  The test cases included
cover the internal and hidden symbol cases, as well as a protected
symbol for a reference, the handling of which is unchanged by this fix.
Both cases described above are covered, that is where an internal or
hidden dynamic symbol is produced and where a local one is.

NB this change affects CRIS results where some symbols in the static
table produced in a final link are now converted from STV_HIDDEN to
STB_LOCAL.  This happens whenever the `elf_backend_hide_symbol' handler
is called, so the affected symbols must have been chosen for entering
into the dynamic symbol table, except in these test cases no such symbol
table is produced.  In fully linked binaries the static symbol table is
only used for debugging though, so such a change is fine.

References:

[1] "System V Application Binary Interface - DRAFT - 24 April 2001",
    The Santa Cruz Operation, Inc., "Symbol Table",
    <http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html>

bfd/
PR ld/19908
* elflink.c (elf_link_add_object_symbols): Always turn hidden
and internal symbols which have a dynamic index into local
ones.

ld/
PR ld/19908
* testsuite/ld-cris/tls-e-20.d: Adjust for hidden symbol
handling fix.
* testsuite/ld-cris/tls-e-20a.d: Likewise.
* testsuite/ld-cris/tls-e-21.d: Likewise.
* testsuite/ld-cris/tls-e-23.d: Likewise.
* testsuite/ld-cris/tls-e-80.d: Likewise.
* testsuite/ld-cris/tls-gd-3h.d: Likewise.
* testsuite/ld-cris/tls-leie-19.d: Likewise.
* testsuite/ld-mips-elf/export-class-ref-lib.sd: New test.
* testsuite/ld-mips-elf/export-hidden-ref.sd: New test.
* testsuite/ld-mips-elf/export-internal-ref.sd: New test.
* testsuite/ld-mips-elf/export-protected-ref.sd: New test.
* testsuite/ld-mips-elf/export-class-ref-f0.s: New test source.
* testsuite/ld-mips-elf/export-class-ref-f1.s: New test source.
* testsuite/ld-mips-elf/export-class-ref-f2.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

8 years ago[ARC] Fix ld testsuite failures.
Claudiu Zissulescu [Tue, 5 Apr 2016 11:46:44 +0000 (13:46 +0200)]
[ARC] Fix ld testsuite failures.

ld/
016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-discard/extern.d: Removed xfail for ARC.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
* testsuite/ld-scripts/crossref.exp: Add __SDATA_BEGIN__ symbol
through linker flags.
* testsuite/ld-srec/srec.exp: Set as xfail.

8 years agoDon't use vec_disp8 encoding with the .d32 suffix
H.J. Lu [Tue, 5 Apr 2016 04:19:27 +0000 (21:19 -0700)]
Don't use vec_disp8 encoding with the .d32 suffix

Since the .d32 suffix prefers 32-bit displacement in encoding, try
vec_disp8 encoding only if i.disp_encoding != disp_encoding_32bit.

PR gas/19909
* config/tc-i386.c (check_VecOperands): Try vec_disp8 encoding
only if i.disp_encoding != disp_encoding_32bit.
* gas/testsuite/gas/i386/disp32.s: Add tests for vmovdqu64.d32.
* gas/testsuite/gas/i386/x86-64-disp32.s: Likewise.
* gas/testsuite/gas/i386/disp32.d: Updated.
* gas/testsuite/gas/i386/x86-64-disp32.d: Likewise.

8 years agoAdd missing pr19827-nacl.rd for i386/x86-64 NaCl
H.J. Lu [Tue, 5 Apr 2016 03:50:19 +0000 (20:50 -0700)]
Add missing pr19827-nacl.rd for i386/x86-64 NaCl

PR ld/19827
* testsuite/ld-i386/pr19827-nacl.rd: New file.
* testsuite/ld-x86-64/pr19827-nacl.rd: Likewise.

8 years agoAdd a testcase for PR gas/19498
H.J. Lu [Tue, 5 Apr 2016 03:45:30 +0000 (20:45 -0700)]
Add a testcase for PR gas/19498

PR gas/19498
* testsuite/gas/i386/i386.exp: Run pr19498.
* testsuite/gas/i386/pr19498.d: New file.
* testsuite/gas/i386/pr19498.s: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 5 Apr 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoObvious function doc and formatting
Simon Marchi [Mon, 4 Apr 2016 20:46:36 +0000 (16:46 -0400)]
Obvious function doc and formatting

gdb/ChangeLog:

* cli/cli-decode.c (help_cmd_list): Fix function doc and remove
trailing spaces.

8 years agoFix gdb.mi/mi-breakpoint-changed.exp for remote targets
Simon Marchi [Mon, 4 Apr 2016 14:31:30 +0000 (10:31 -0400)]
Fix gdb.mi/mi-breakpoint-changed.exp for remote targets

The libraries are never downloaded to the target for the first test
(test_insert_delete_modify), so the executable can't run properly.

I also added some with_test_prefix to help differentiate between the
different test case phases.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-breakpoint-changed.exp: Add some with_test_prefix.
(test_insert_delete_modify): Call mi_load_shlibs before trying to
run.

8 years agoMore fixes for COFF/PE lanker garbage collection.
Nick Clifton [Mon, 4 Apr 2016 12:44:57 +0000 (13:44 +0100)]
More fixes for COFF/PE lanker garbage collection.

PR 19803
* emultempl/pe.em (change_undef): New function.  Encapsulates
duplicated code in pe_fixup_stdcalls and adds the newly defined
sym to the gc root list.
(pe_fixup_stdcall): Use the new function.
* pe-dll.c (process_def_file_and_drectve); Add alias of exported
symbol to gc root list.

8 years agoIgnore DWARF debug information with a version of 0 - assume that it is padding.
Nick Clifton [Mon, 4 Apr 2016 11:53:33 +0000 (12:53 +0100)]
Ignore DWARF debug information with a version of 0 - assume that it is padding.

PR 19872
bfd * dwarf2.c (parse_comp_unit): Skip warning about unrecognised
version number if the version is zero.

bin * dwarf.c (display_debug_aranges): Skip warning about unrecognised
version number if the version is zero.

8 years agogas/arc: Use #define from include/opcode/arc.h
Andrew Burgess [Fri, 1 Apr 2016 17:35:29 +0000 (18:35 +0100)]
gas/arc: Use #define from include/opcode/arc.h

In tc-arc.h we redefine constants that are also defined in the
include/opcode/arc.h header file.  The problem is that changing one
without changing the other resulting in strange crashes.

We could comment both locations to stress the importance of remembering
to update the other location too, or we could just include the
opcode/arc.h header file into the assembler.

Given that other targets include their opcode/ARCH.h header file, and
only having a single definition, where possible, is usually the safest
solution, that's what I switch too with this commit.

gas/ChangeLog:

* config/tc-arc.h: Include 'opcode/arc.h'.
(MAX_INSN_ARGS): Delete.
(MAX_INSN_FLGS): Delete.

8 years agoPR19498, Invalid "symbol definition loop"
Alan Modra [Mon, 4 Apr 2016 06:49:27 +0000 (16:19 +0930)]
PR19498, Invalid "symbol definition loop"

PR 19498
* symbols.c (resolve_symbol_value): Clear sy_resolving on exit
from function on all paths that set sy_resolving.