binutils-gdb.git
10 years agoor1k: Do not override section for non-TLS symbols.
Christian Svensson [Mon, 28 Apr 2014 22:34:59 +0000 (00:34 +0200)]
or1k: Do not override section for non-TLS symbols.

Outgoing section for relocations was computed by setting a shared
pointer to which section should be used. For TLS this was overriden to
use .rela.got since they use GOT entries but since the pointer is per
section that whole section was relocated to .rela.got, even non-TLS
relocations.

* elf32-or1k.c: Fix a bug where non-TLS relocations would be forced
into .rela.got if it contained TLS relocations as well.

10 years agoFix remote connection to targets that don't support the QNonStop packet.
Pedro Alves [Tue, 29 Apr 2014 13:01:27 +0000 (14:01 +0100)]
Fix remote connection to targets that don't support the QNonStop packet.

... and others.  The recent patch that fixed several "set remote
foo-packet on/off" commands introduced a regression, observable when
connecting GDB to QEMU.  For instance:

        (gdb) set debug remote 1
        (gdb) tar rem :4444
        Remote debugging using :4444
        Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack
        Packet received: PacketSize=1000;qXfer:features:read+
        Packet qSupported (supported-packets) is supported
        Sending packet: $Hgp0.0#ad...Ack
        Packet received: OK
        Sending packet: $qXfer:features:read:target.xml:0,ffb#79...Ack
        Packet received: [...]
        Sending packet: $qXfer:features:read:arm-core.xml:0,ffb#08...Ack
        Packet received: [...]
 !!! -> Sending packet: $QNonStop:0#8c...Ack
        Packet received:
        Remote refused setting all-stop mode with:

The "QNonStop" feature is associated with the PACKET_QNonStop packet,
with a default of PACKET_DISABLE, so GDB should not be sending the
packet at all.

The patch that introduced the regression decoupled packet_config's
'detect' and 'support' fields, making the former (an auto_boolean)
purely the associated "set remote foo-packet" command's variable.  In
the example above, the packet config's 'supported' field does end up
correctly set to PACKET_DISABLE.  However, nothing is presently
initializing packet configs that don't actually have a command
associated.  Those configs's 'detect' field then ends up set to
AUTO_BOOLEAN_TRUE, simply because that happens to be 0.  This forces
GDB to assume the packet is supported, irrespective of what the target
claims it supports, just like if the user had done "set remote
foo-packet on" (this being the associated command, if there was one).

Ideally, all packet configs would have a command associated.  While
that isn't true, make sure all packet configs are initialized, even if
no command is associated, and add an assertion that prevents adding
more packets/features without an associated command.

Tested on x86_64 Fedora 17, against pristine gdbserver, and against a
gdbserver with the QNonStop packet/feature disabled with a local hack.

gdb/
2014-04-29  Pedro Alves  <palves@redhat.com>

* remote.c (struct packet_config) <detect>: Extend comment.
(add_packet_config_cmd): Don't set the config's detect or support
fields here.
(init_all_packet_configs): Also initialize the config's 'detect'
field.
(reset_all_packet_configs_support): New function.
(remote_open_1): Call reset_all_packet_configs_support instead of
init_all_packet_configs.
(_initialize_remote): Initialize all packet configs.  Assert that
all packets have an associated command, except a few known
outliers.

10 years agodaily update
Alan Modra [Tue, 29 Apr 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoAdd gdb.ada/dyn_arrayidx testcase.
Joel Brobecker [Sun, 20 Apr 2014 05:19:02 +0000 (22:19 -0700)]
Add gdb.ada/dyn_arrayidx testcase.

This add a testcases that verifies correct handling of dynamicity
for lower bounds of arrays.

gdb/testsuite/ChangeLog:

        * gdb.ada/dyn_arrayidx: New testcase.

10 years agodwarf2read.c::read_subrange_type: Handle dynamic lower bounds
Joel Brobecker [Sun, 20 Apr 2014 03:41:56 +0000 (20:41 -0700)]
dwarf2read.c::read_subrange_type: Handle dynamic lower bounds

Currently, read_subrange_type handles dynamicity only in the case of
the upper bound, and assumes that the lower bound is always static.
That's rooted in the fact that dynamicity was added to support C99
variable-length arrays, where the lower bound is always zero, and
therefore never dynamic.  But the lower bound can, in fact, be dynamic
in other languages such as Ada.

Consider for instance the following declaration in Ada...

    type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made, and whose value are 5 and 10.  Currently, the debugger
is able to print the value of the upper bound correctly, but not the
lower bound:

    (gdb) ptype array_type
    type = array (1 .. 10) of natural

After this patch, the debugger now prints:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Handle dynamic
        DW_AT_lower_bound attributes.

10 years agoImprove Ada dynamic range type handling.
Joel Brobecker [Sat, 19 Apr 2014 16:55:14 +0000 (09:55 -0700)]
Improve Ada dynamic range type handling.

Consider the following declaration in Ada...

   type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made. At the moment, GDB relies on descriptive types in order
to properly decode the array bounds. For instance, if L was 5, and U
was 10, we would see the following:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural
    (gdb) maintenance set ada ignore-descriptive-types
    (gdb) ptype array_type
    type = array (1 .. 28544912) of natural

This patch enhances ada_discrete_type_{high,low}_bound to resolve
any dynamicity.  This is sufficient to fix the case of the upper bound.
For the lower bound, the dwarf2read module does not handle dynamic
lower bounds yet, but once it does, the lower bound should be correctly
handled as well [1].

gdb/ChangeLog:

        * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's
        dynamic bounds before computing its upper bound.
        (ada_discrete_type_low_bound): Same as above with the lower bound.

[1]: The reason why we do not enhance dwarf2read to handle dynamic
lower bounds ahead of this patch is because it unveils some latent
issues such as this one.

10 years agoEnhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges
Joel Brobecker [Sat, 19 Apr 2014 16:40:53 +0000 (09:40 -0700)]
Enhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges

This change breaks down the resolve_dynamic_bounds function which
works only on arrays and its index range types into two functions,
one that resolves range types, and one that resolves arrays (using
the new routine to resolve the array's index range type). The
is_dynamic_type and resolve_dynamic_type function are then re-organized
to handle range types as well.

One small change worth mentioning is the fact that, now that range
types are resolved on their own (rather than in the limited context
of array index types), the resolved range types are created from
a copy of the dynamic range type, rather than from scratch (first
parameter of create_range_type). This allows us to preserve as many
original properties in the resolved type as possible (Eg. the type's
name).

This is preparation work that will help better support dynamic range
types for languages that allow the declaration of such types (Eg. Ada).

gdb/ChangeLog:

        * dwarf2read.c (is_dynamic_type): Return true for dynamic
        range types.  Adjust the array handling implementation to
        take advantage of this change.
        (resolve_dynamic_range): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_array): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_bounds): Delete.
        (resolve_dynamic_type): Reimplement.  Add handling of
        TYPE_CODE_RANGE types.

10 years agoUnnecessary XA type handling in ada_varobj_describe_simple_array_child
Joel Brobecker [Thu, 24 Apr 2014 16:09:11 +0000 (12:09 -0400)]
Unnecessary XA type handling in ada_varobj_describe_simple_array_child

ada-varobj.c::ada_varobj_describe_simple_array_child only ever gets
called after all GNAT encodings have been applied to (parent_value,
parent_type). So there is no point in redoing it partially by
checking for parallel XA types again.

gdb/ChangeLog:

* ada-varobj.c (ada_varobj_describe_simple_array_child): Remove
handling of parallel ___XA types.

10 years agoremove unnecessary second call to static_unwrap_type in ada_evaluate_subexp
Joel Brobecker [Tue, 18 Mar 2014 17:52:08 +0000 (10:52 -0700)]
remove unnecessary second call to static_unwrap_type in ada_evaluate_subexp

In ada-lang.c::ada_evaluate_subexp, case OP_VAR_VALUE, when noside
is EVAL_AVOID_SIDE_EFFECTS, the first thing we do is set type as
follow:

    type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol));

Later on in the same block, we make the same call:

    return value_zero
      (to_static_fixed_type
       (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
       not_lval);

This patch removes the second call, since it should result in the same
type being returned, so no point in making that call again.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Remove
        unnecessary second call to static_unwrap_type.

10 years agoThis fixes a bootstrapping problem with gcc 4.9 in an x86 PE environment.
Nick Clifton [Mon, 28 Apr 2014 13:32:59 +0000 (14:32 +0100)]
This fixes a bootstrapping problem with gcc 4.9 in an x86 PE environment.
The problem was that references to weak function symbols were being
incorrectly biased by definition's offset.

PR gas/16858
* config/tc-i386.c (md_apply_fix): Do not adjust value of
pc-relative fixes against weak symbols.

10 years ago[gdbserver] Correctly generate i386-avx512.c
Yao Qi [Mon, 28 Apr 2014 10:56:06 +0000 (18:56 +0800)]
[gdbserver] Correctly generate i386-avx512.c

The makefile rule i386-avx512.c is to generate i386-avx512.c, but it
is written to i386-avx.c by mistake.  This patch is to fix this typo.

gdb/gdbserver:

2014-04-28  Yao Qi  <yao@codesourcery.com>

* Makefile.in (i386-avx512.c): Fix the typo of generated file
name.

10 years agoThis patch reworks the fix to avoid a compile time warning so that it will work
Nick Clifton [Mon, 28 Apr 2014 08:34:02 +0000 (09:34 +0100)]
This patch reworks the fix to avoid a compile time warning so that it will work
with later versions of gcc.

PR ld/16821
* peXXigen.c (_bfd_XXi_swap_sym_out): Rework fix to avoid compile
time warning.

10 years agodaily update
Alan Modra [Mon, 28 Apr 2014 00:00:57 +0000 (09:30 +0930)]
daily update

10 years agoMake "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and...
Hui Zhu [Sun, 27 Apr 2014 14:23:43 +0000 (22:23 +0800)]
Make "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME

When GDB debug DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME, even if
"set disassemble-next-line on", it will not output the asm code:
(gdb) set disassemble-next-line on
(gdb) si
<signal handler called>
(gdb)
<signal handler called>
(gdb)
<signal handler called>

So make this patch make they can work together, it will become:
(gdb) si
<signal handler called>
=> 0xffffffff816bfb09 <int_with_check+0>: 65 48 8b 0c 25 c8 c7 00 00 mov    %gs:0xc7c8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb12 <int_with_check+9>: 48 81 e9 d8 1f 00 00 sub    $0x1fd8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb19 <int_with_check+16>: 8b 51 10 mov    0x10(%rcx),%edx

2014-04-27  Hui Zhu  <hui@codesourcery.com>

* stack.c (print_frame_info): Call do_gdb_disassembly with
DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME.

10 years agodaily update
Alan Modra [Sun, 27 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update

10 years ago* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.
Doug Evans [Sat, 26 Apr 2014 20:13:13 +0000 (13:13 -0700)]
* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.

10 years agoRegenerate files for openrisk -> or1k change
Alan Modra [Sat, 26 Apr 2014 13:30:09 +0000 (23:00 +0930)]
Regenerate files for openrisk -> or1k change

bfd/
* po/SRC-POTFILES.in: Regenerate.
* configure: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
opcodes/
* po/POTFILES.in: Regenerate.

10 years agoCompute the function length instead of hard coding it
Yao Qi [Thu, 24 Apr 2014 08:51:33 +0000 (16:51 +0800)]
Compute the function length instead of hard coding it

In Dwarf::assemble in dwz.exp, 10 is hard-coded in it,

      subprogram {
  {name main}
  {low_pc main addr}
{high_pc "main + 10" addr}
      }

however, the length of main function varies on architectures.  The
hard-coded 10 here causes dwz.exp fails on some targets, such as
nios2.

This patch is to add some code to compute the length of function main,
which is similar to what we are doing in entry-values.exp.

gdb/testsuite:

2014-04-26  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwz.exp: Compile main.c to object.  Restart GDB
and compute the length of function main.  Save it in
$main_length.
(Dwarf::assemble): Use $main_length instead of hard-coded 10.
(top-level): Use gdb_compile to compile objects into
executable and restart GDB.  Remove invocation to
prepare_for_testing.

10 years agodaily update
Alan Modra [Sat, 26 Apr 2014 00:00:55 +0000 (09:30 +0930)]
daily update

10 years agoAdd missing gdbserver/ChangeLog entry for previous commit.
Pedro Alves [Fri, 25 Apr 2014 18:22:27 +0000 (19:22 +0100)]
Add missing gdbserver/ChangeLog entry for previous commit.

2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* linux-low.c (linux_attach_fail_reason_string): New function.
(linux_attach_lwp): Delete.
(linux_attach_lwp_1): Rename to ...
(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach): Adjust to call linux_attach_lwp.  Call error on
failure to attach to the tgid.  Call warning when failing to
attach to an lwp.
* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach_fail_reason_string): New declaration.
* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
interface change.  Use linux_attach_fail_reason_string.

10 years agoPR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.
Pedro Alves [Fri, 25 Apr 2014 18:07:33 +0000 (19:07 +0100)]
PR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.

On Linux, we need to explicitly ptrace attach to all lwps of a
process.  Because GDB might not be connected yet when an attach is
requested, and thus it may not be possible to activate thread_db, as
that requires access to symbols (IOW, gdbserver --attach), a while ago
we make linux_attach loop over the lwps as listed by /proc/PID/task to
find the lwps to attach to.

linux_attach_lwp_1 has:

...
  if (initial)
    /* If lwp is the tgid, we handle adding existing threads later.
       Otherwise we just add lwp without bothering about any other
       threads.  */
    ptid = ptid_build (lwpid, lwpid, 0);
  else
    {
      /* Note that extracting the pid from the current inferior is
 safe, since we're always called in the context of the same
 process as this new thread.  */
      int pid = pid_of (current_inferior);
      ptid = ptid_build (pid, lwpid, 0);
    }

That "safe" comment referred to linux_attach_lwp being called by
thread-db.c.  But this was clearly missed when a new call to
linux_attach_lwp_1 was added to linux_attach.  As a result,
current_inferior will be set to some random process, and non-initial
lwps of the second inferior get assigned the pid of the wrong
inferior.  E.g., in the case of attaching to two inferiors, for the
second inferior (and so on), non-initial lwps of the second inferior
get assigned the pid of the first inferior.  This doesn't trigger on
the first inferior, when current_inferior is NULL, add_thread switches
the current inferior to the newly added thread.

Rather than making linux_attach switch current_inferior temporarily
(thus avoiding further reliance on global state), or making
linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls,
and will be wrong in case of the user having originally attached
directly to a non-tgid lwp, and then that lwp spawning new clones (the
ptid.pid field of further new clones should be the same as the
original lwp's pid, which is not the tgid), we note that callers of
linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy
already, so they can pass it down along with the lwpid.

The only other reason for the "initial" parameter is to error out
instead of warn in case of attach failure, when we're first attaching
to a process.  There are only three callers of
linux_attach_lwp/linux_attach_lwp_1, and each wants to print a
different warn/error string, so we can just move the error/warn out of
linux_attach_lwp_1 to the callers, thus getting rid of the "initial"
parameter.

There really nothing gdbserver-specific about attaching to two
threaded processes, so this adds a new test under gdb.multi/.  The
test passes cleanly against the native GNU/Linux target, but
fails/triggers the bug against GDBserver (before the patch), with the
native-extended-remote board (as plain remote doesn't support
multi-process).

Tested on x86_64 Fedora 17, with the native-extended-gdbserver board.

gdb/gdbserver/
2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* linux-low.c (linux_attach_fail_reason_string): New function.
(linux_attach_lwp): Delete.
(linux_attach_lwp_1): Rename to ...
(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach): Adjust to call linux_attach_lwp.  Call error on
failure to attach to the tgid.  Call warning when failing to
attach to an lwp.
* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
argument.  Remove "initial" parameter.  Return int instead of
void.  Don't error or warn here.
(linux_attach_fail_reason_string): New declaration.
* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
interface change.  Use linux_attach_fail_reason_string.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

PR server/16255
* common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ...
(linux_ptrace_attach_fail_reason): ... this.  Remove "warning: "
and newline from built string.
* common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ...
(linux_ptrace_attach_fail_reason): ... this.
* linux-nat.c (linux_nat_attach): Adjust to use
linux_ptrace_attach_fail_reason.

gdb/testsuite/
2014-04-25  Simon Marchi  <simon.marchi@ericsson.com>
    Pedro Alves  <palves@redhat.com>

PR server/16255
* gdb.multi/multi-attach.c: New file.
* gdb.multi/multi-attach.exp: New file.

10 years agoFix several "set remote foo-packet on/off" commands.
Pedro Alves [Fri, 25 Apr 2014 17:07:02 +0000 (18:07 +0100)]
Fix several "set remote foo-packet on/off" commands.

For several RSP packets, there's a corresponding "set remote
foo-packet on/off/auto" command that one can use do bypass
auto-detection of support for the packet or feature.  However, I
noticed that setting several of these commands to 'on' or 'off'
doesn't actually have any effect.  These are, at least:

 set remote breakpoint-commands-packet
 set remote conditional-breakpoints-packet
 set remote fast-tracepoints-packet
 set remote static-tracepoints-packet
 set remote install-in-trace-packet

These are commands that control a remote protocol feature that doesn't
have a corresponding regular packet, and because of that we cache the
knowledge of the remote side support as returned by the qSupported
packet in the remote_state object.

E.g., in the case of the 'set remote breakpoint-commands-packet'
command, whether the feature is supported is recorded in the
'breakpoint_commands' field of the remote_state object.

Whether to bypass packet support auto-detection or not is controlled
by the 'detect' field of the corresponding packet's packet_config
structure.  That field is the variable associated directly with the
"set remote foo-packet" command.  Actual remote stub support for the
packet (or feature) is recorded in the 'support' field of the same
structure.

However, when the user toggles the command, the 'support' field is
also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN,
discarding the knowledge of whether the target actually supports the
feature.  If one toggles back to 'auto', it's no big issue for real
packets, as they'll just end up re-probed the next time they might be
necessary.  But features whose support is only reported through
qSupported don't get their corresponding (manually added/maintained)
fields in remote_state objected updated.  As we lost the actual status
of the target support for the feature, GDB would need to probe the
qSupported features again, which GDB doesn't do.

But we can avoid that extra traffic, and clean things up, IMO.
Instead of going in that direction, this patch completely decouples
struct packet_config's 'detect' and 'support' fields.  E.g., when the
user does "set remote foo-packet off", instead of setting the packet
config's 'support' field to PACKET_DISABLE, the 'support' field is not
touched at all anymore.  That is, we end up respecting this simple
table:

| packet_config->detect | packet_config->support | should use packet/feature? |
|-----------------------+------------------------+----------------------------|
| auto                  | PACKET_ENABLE          | PACKET_ENABLE              |
| auto                  | PACKET_DISABLE         | PACKET_DISABLE             |
| auto                  | PACKET_UNKNOWN         | PACKET_UNKNOWN             |
| yes                   | don't care             | PACKET_ENABLE              |
| no                    | don't care             | PACKET_DISABLE             |

This is implemented by the new packet_support function.  With that, we
need to update this pattern throughout:

  if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE)

to do this instead:

  if (packet_support (PACKET_qAttached) == PACKET_DISABLE)

where as mentioned, the packet_support function takes struct
packet_config's 'detect' field into account, like in the table above.

As when the packet is force-disabled or force-enabled, the 'support'
field is just ignored, if the command is set back to auto, we'll
resume respecting whatever the target said it supports.  IOW, the end
result is that the 'support' field always represents whether the
target actually supports the packet or not.

After all that, the manually maintained breakpoint_commands and
equivalent fields of struct remote_state can then be eliminated, with
references replaced by checking the result of calling the
packet_support function on the corresponding packet or feature.  This
required adding new PACKET_foo enum values for several features that
didn't have it yet.  (The patch does not add corresponding "set remote
foo-packet" style commands though, focusing only on bug fixing and
laying the groundwork).

Tested on x86_64 Fedora 17, native GDBserver.  The new tests all fail
without this patch.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

* remote.c (struct remote_state): Remove multi_process_aware,
non_stop_aware, cond_tracepoints, cond_breakpoints,
breakpoint_commands, fast_tracepoints, static_tracepoints,
install_in_trace, disconnected_tracing,
enable_disable_tracepoints, string_tracing, and
augmented_libraries_svr4_read fields.
(remote_multi_process_p): Move further below in the file.
(struct packet_config): Add comments.
(update_packet_config): Delete function.
(show_packet_config_cmd): Use packet_config_support.
(add_packet_config_cmd): Use NULL as set callback.
(packet_ok): "set remote foo-packet"-style commands no longer
change config->supported -- adjust.
(PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints)
(PACKET_BreakpointCommands, PACKET_FastTracepoints)
(PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments.
(PACKET_QNonStop, PACKET_multiprocess_feature)
(PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature)
(PACKET_DisconnectedTracing_feature)
(PACKET_augmented_libraries_svr4_read_feature): New enum values.
(set_remote_protocol_packet_cmd): Delete function.
(packet_config_support, packet_support): New functions.
(set_remote_protocol_Z_packet_cmd): Don't call
update_packet_config.
(remote_query_attached, remote_pass_signals)
(remote_program_signals, remote_threads_info)
(remote_threads_extra_info, remote_start_remote): Use
packet_support.
(remote_start_remote): Use packet_config_support and
packet_support.
(init_all_packet_configs): Set all packets to unknown support,
instead of calling update_packet_config.
(remote_check_symbols): Use packet_support.
(remote_supported_packet): Unconditionally set the packet config's
support status.
(remote_multi_process_feature, remote_non_stop_feature)
(remote_cond_tracepoint_feature, remote_cond_breakpoint_feature)
(remote_breakpoint_commands_feature)
(remote_fast_tracepoint_feature, remote_static_tracepoint_feature)
(remote_install_in_trace_feature)
(remote_disconnected_tracing_feature)
(remote_enable_disable_tracepoint_feature)
(remote_string_tracing_feature)
(remote_augmented_libraries_svr4_read_feature): Delete functions.
(remote_protocol_features): Adjust to use remote_supported_packet
for "augmented-libraries-svr4-read", "multiprocess", "QNonStop",
"ConditionalTracepoints", "ConditionalBreakpoints",
"BreakpointCommands", "FastTracepoints", "StaticTracepoints",
"InstallInTrace", "DisconnectedTracing", "DisconnectedTracing",
"EnableDisableTracepoints", and "tracenz".
(remote_query_supported): Use packet_support.
(remote_open_1): Adjust.
(extended_remote_attach_1): Use packet_support.  Switch on the
result of packet_ok instead of checking whether the packet ended
up disabled.
(remote_vcont_resume): Use packet_support.
(remote_resume, remote_stop_ns, fetch_register_using_p)
(remote_prepare_to_store, store_register_using_P)
(check_binary_download, remote_write_bytes): Use packet_support.
(remote_vkill): Use packet_support.  Switch on the result of
packet_ok instead of checking whether the packet ended up
disabled.
(extended_remote_supports_disable_randomization): Use
packet_support.
(extended_remote_run): Switch on the result of packet_ok instead
of checking whether the packet ended up disabled.
(remote_insert_breakpoint, remote_remove_breakpoint)
(remote_insert_watchpoint, remote_remove_watchpoint)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use
packet_support.
(remote_search_memory): Use packet_config_support.
(remote_get_thread_local_address, remote_get_tib_address)
(remote_hostio_send_command, remote_can_execute_reverse): Use
packet_support.
(remote_supports_cond_tracepoints)
(remote_supports_cond_breakpoints)
(remote_supports_fast_tracepoints)
(remote_supports_static_tracepoints)
(remote_supports_install_in_trace)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands): Rewrite, checking whether
the packet config says the feature is enabled or disabled.
(remote_download_tracepoint, remote_trace_set_readonly_regions)
(remote_get_trace_status): Use packet_support.
(remote_set_disconnected_tracing): Adjust to check whether the
feature is enabled with packet_support.
(remote_set_trace_buffer_size, remote_use_agent)
(remote_can_use_agent, remote_supports_btrace): Use
packet_support.
(remote_enable_btrace, remote_disable_btrace, remote_read_btrace):
Use packet_config_support.
(remote_augmented_libraries_svr4_read): Rewrite, checking whether
the packet config says the feature is enabled or disabled.
(set_range_stepping): Use packet_support.

gdb/testsuite/
2014-04-25  Pedro Alves  <palves@redhat.com>

* gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to
user.
(top level): Test that "set remote conditional-breakpoints-packet
off" works as intended.
* gdb.base/dprintf.exp: Test that "set remote
breakpoint-commands-packet off" works as intended.
* gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled):
New function.
(top level): Call it.
* gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set
remote fast-tracepoints-packet off" works as intended.
* gdb.trace/qtro.exp (gdb_is_target_remote): Moved ...
* lib/gdb.exp (gdb_is_target_remote): ... here.

10 years agoThis fixes a compile time warning which is being treated as an error. Older
Nick Clifton [Fri, 25 Apr 2014 16:00:20 +0000 (17:00 +0100)]
This fixes a compile time warning which is being treated as an error.  Older
versions of gcc complain about part of a conditional expression always
evaluating to false because of the size of the operands involved, even when
the entire expression is already known to be false.

* peXXigen.c (_bfd_XXi_swap_sym_out): Another fix for building on
a 342-bit host.  This time for older versions of gcc.

10 years agodocument "quit" command's argument
Tom Tromey [Fri, 25 Apr 2014 15:43:47 +0000 (09:43 -0600)]
document "quit" command's argument

2014-04-25  Tom Tromey  <tromey@redhat.com>

* cli/cli-cmds.c (_initialize_cli_cmds): Document "quit" command's
argument.

10 years agonews: mention support for C99 variable length arrays
Sanimir Agovic [Tue, 22 Apr 2014 14:26:33 +0000 (15:26 +0100)]
news: mention support for C99 variable length arrays

* NEWS: Mention support for C99 variable length arrays.

10 years agoEnsure unreferenced static symbols aren't omitted by clang (either marking them __att...
David Blaikie [Fri, 11 Apr 2014 06:45:28 +0000 (23:45 -0700)]
Ensure unreferenced static symbols aren't omitted by clang (either marking them __attribute__((used)) or making them non-static)

gdb/testsuite/
       * gdb.base/catch-syscall.c: Make unreferenced statics non-static to
       ensure clang would not discard them.
       * gdb.base/gdbvars.c: Ditto.
       * gdb.base/memattr.c: Ditto.
       * gdb.base/whatis.c: Ditto.
       * gdb.python/py-prettyprint.c: Ditto.
       * gdb.trace/actions.c: Ditto.
       * gdb.cp/ptype-cv-cp.cc: Mark unused global const int as used to
       ensure clang would not discard it.

10 years agoCause clang to emit the definition of a type used only by pointer
David Blaikie [Fri, 25 Apr 2014 05:16:29 +0000 (22:16 -0700)]
Cause clang to emit the definition of a type used only by pointer

gdb/testsuite/
* gdb.stabs/gdb11479.c (tag_dummy_enum): introduce a variable to cause
clang to emit the full definition of type required by the test
* gdb.stabs/gdb11479.exp (do_test): correct a typo in a test message

10 years agoReturn by value to coax Clang into emitting the full definition of a test type.
David Blaikie [Sun, 13 Apr 2014 07:48:45 +0000 (00:48 -0700)]
Return by value to coax Clang into emitting the full definition of a test type.

gdb/testsuite/
* gdb.cp/pr10728-x.cc: Return by value instead of pointer to coax
Clang into emitting the definition of the type.
* gdb.cp/pr10728-x.h: Ditto.
* gdb.cp/pr10728-y.cc: Ditto.

10 years agoXFAIL under Clang tests using labels
David Blaikie [Sun, 13 Apr 2014 18:42:02 +0000 (11:42 -0700)]
XFAIL under Clang tests using labels

gdb/testsuite/
* gdb.base/label.exp: XFAIL label related tests under Clang.
* gdb.cp/cplabel.exp: Ditto.
* gdb.linespec/ls-errs.exp: Refactor tests to execute directly
and XFAIL under Clang those using labels.

10 years agoRemove unused labels in dwarf assembler
Yao Qi [Thu, 24 Apr 2014 10:46:22 +0000 (18:46 +0800)]
Remove unused labels in dwarf assembler

I happen to see that 'double_label' isn't used in dwz.exp dwarf assembler.
Similarly, partial_label and double_label aren't used in dwzbuildid.exp.
This patch is to remove them.

gdb/testsuite:

2014-04-25  Yao Qi  <yao@codesourcery.com>

* gdb.dwarf2/dwz.exp (Dwarf::assemble): Remove unused
double_label.
* gdb.dwarf2/dwzbuildid.exp (Dwarf::assemble): Remove
partial_label and double_label.

10 years agodaily update
Alan Modra [Fri, 25 Apr 2014 00:00:56 +0000 (09:30 +0930)]
daily update

10 years agoAdd maintainers for OR1K.
Christian Svensson [Thu, 24 Apr 2014 22:40:41 +0000 (00:40 +0200)]
Add maintainers for OR1K.

* MAINTAINERS: Add myself and Stefan as OR1K maintainers.

10 years agoFix and XFAIL test due to GCC PR55641, passes with clang
David Blaikie [Sun, 13 Apr 2014 07:38:47 +0000 (00:38 -0700)]
Fix and XFAIL test due to GCC PR55641, passes with clang

gdb/testsuite/
* gdb.python/lib-types.exp: Fix test and xfail under gcc due to gcc/55641.

10 years agoada-lang.c: Expand standard_exc's introductory comment.
Joel Brobecker [Thu, 24 Apr 2014 20:16:38 +0000 (13:16 -0700)]
ada-lang.c: Expand standard_exc's introductory comment.

This patch expands standard_exc's introductory comment to explain
why this table does not include Numeric_Error.

gdb/ChangeLog:

        * ada-lang.c (standard_exc): Expand introductory comment.

10 years agoAdjust start-of-function braces to be compatible with Clang
David Blaikie [Mon, 14 Apr 2014 00:37:56 +0000 (17:37 -0700)]
Adjust start-of-function braces to be compatible with Clang

gdb/testsuite/
* gdb.cp/cpexprs.cc: Move braces to the same line as the start
of the function to work across GCC and Clang.
* gdb.cp/cpexprs.exp: Account for GCC/Clang difference in vtable
pointer types (const void ** const V void **).

10 years ago * peXXigen.c (rsrc_print_section): Fix compile time warning for
Nick Clifton [Thu, 24 Apr 2014 14:49:37 +0000 (15:49 +0100)]
* peXXigen.c (rsrc_print_section): Fix compile time warning for
32-bit hosts.

10 years agoAdd AVX512 registers support to GDB and GDBserver.
Michael Sturm [Mon, 16 Dec 2013 15:43:05 +0000 (16:43 +0100)]
Add AVX512 registers support to GDB and GDBserver.

This patch adds support for the Intel(R) Advanced Vector
Extensions 512 (Intel(R) AVX-512) registers.  Native and remote
debugging are covered by this patch.

Intel(R) AVX-512 is an extension to AVX to support 512-bit wide
SIMD registers in 64-bit mode (XMM0-XMM31, YMM0-YMM31, ZMM0-ZMM31).
The number of available registers in 32-bit mode is still 8
(XMM0-7, YMM0-7, ZMM0-7).  The lower 256-bits of the ZMM registers
are aliased to the respective 256-bit YMM registers.  The lower
128-bits are aliased to the respective 128-bit XMM registers.

There are also 8 new, dedicated mask registers (K0-K7) in both 32-bit
mode and 64-bit mode.

For more information please see
Intel(R) Developer Zone: Intel(R) AVX
http://software.intel.com/en-us/intel-isa-extensions#pid-16007-1495

Intel(R) Architecture Instruction Set Extensions Programming Reference:
http://software.intel.com/en-us/file/319433-017pdf

2014-04-24  Michael Sturm  <michael.sturm@mintel.com>
            Walfred Tedeschi  <walfred.tedeschi@intel.com>

     * amd64-linux-nat.c (amd64_linux_gregset32_reg_offset): Add
     AVX512 registers.
     (amd64_linux_read_description): Add code to handle AVX512 xstate
     mask and return respective tdesc.
     * amd64-linux-tdep.c: Include features/i386/amd64-avx512-linux.c
     and features/i386/x32-avx512-linux.c.
     (amd64_linux_gregset_reg_offset): Add AVX512 registers.
     (amd64_linux_core_read_description): Add code to handle AVX512
     xstate mask and return respective tdesc.
     (_initialize_amd64_linux_tdep): Initialize AVX512 tdesc.
     * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Adjust regnum
     calculation.
     (AMD64_LINUX_NUM_REGS): Adjust to new number of registers.
     (tdesc_amd64_avx512_linux): New prototype.
     (tdesc_x32_avx512_linux): Likewise.
     * amd64-tdep.c: Include features/i386/amd64-avx512.c and
     features/i386/x32-avx512.c.
     (amd64_ymm_avx512_names): New register names for pseudo
     registers YMM16-31.
     (amd64_ymmh_avx512_names): New register names for raw registers
     YMMH16-31.
     (amd64_k_names): New register names for K registers.
     (amd64_zmmh_names): New register names for ZMM raw registers.
     (amd64_zmm_names): New registers names for ZMM pseudo registers.
     (amd64_xmm_avx512_names): New register names for XMM16-31
     registers.
     (amd64_pseudo_register_name): Add code to return AVX512 pseudo
     registers.
     (amd64_init_abi): Add code to intitialize AVX512 tdep variables
     if feature is present.
     (_initialize_amd64_tdep): Call AVX512 tdesc initializers.
     * amd64-tdep.h (enum amd64_regnum): Add AVX512 registers.
     (AMD64_NUM_REGS): Adjust to new number of registers.
     * i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Extend range of
     registers supplied via XSTATE by AVX512 registers.
     (i386_linux_read_description): Add case for AVX512.
     * i386-linux-tdep.c: Include i386-avx512-linux.c.
     (i386_linux_gregset_reg_offset): Add AVX512 registers.
     (i386_linux_core_read_description): Add case for AVX512.
     (i386_linux_init_abi): Install supported register note section
     for AVX512.
     (_initialize_i386_linux_tdep): Add call to tdesc init function for
     AVX512.
     * i386-linux-tdep.h (I386_LINUX_NUM_REGS): Set number of
     registers to be number of zmm7h + 1.
     (tdesc_i386_avx512_linux): Add tdesc for AVX512 registers.
     * i386-tdep.c: Include features/i386/i386-avx512.c.
     (i386_zmm_names): Add ZMM pseudo register names array.
     (i386_zmmh_names): Add ZMM raw register names array.
     (i386_k_names): Add K raw register names array.
     (num_lower_zmm_regs): Add constant for the number of lower ZMM
     registers. AVX512 has 16 more ZMM registers than there are YMM
     registers.
     (i386_zmmh_regnum_p): Add function to look up register number of
     ZMM raw registers.
     (i386_zmm_regnum_p): Likewise for ZMM pseudo registers.
     (i386_k_regnum_p): Likewise for K raw registers.
     (i386_ymmh_avx512_regnum_p): Likewise for additional YMM raw
     registers added by AVX512.
     (i386_ymm_avx512_regnum_p): Likewise for additional YMM pseudo
     registers added by AVX512.
     (i386_xmm_avx512_regnum_p): Likewise for additional XMM registers
     added by AVX512.
     (i386_register_name): Add code to hide YMMH16-31 and ZMMH0-31.
     (i386_pseudo_register_name): Add ZMM pseudo registers.
     (i386_zmm_type): Construct and return vector registers type for ZMM
     registers.
     (i386_pseudo_register_type): Return appropriate type for YMM16-31,
     ZMM0-31 pseudo registers and K registers.
     (i386_pseudo_register_read_into_value): Add code to read K, ZMM
     and YMM16-31 registers from register cache.
     (i386_pseudo_register_write): Add code to write  K, ZMM and
     YMM16-31 registers.
     (i386_register_reggroup_p): Add code to include/exclude AVX512
     registers in/from respective register groups.
     (i386_validate_tdesc_p): Handle AVX512 feature, add AVX512
     registers if feature is present in xcr0.
     (i386_gdbarch_init): Add code to initialize AVX512 feature
     variables in tdep structure, wire in pseudo registers and call
     initialize_tdesc_i386_avx512.
     * i386-tdep.h (struct gdbarch_tdep): Add AVX512 related
     variables.
     (i386_regnum): Add AVX512 registers.
     (I386_SSE_NUM_REGS): New define for number of SSE registers.
     (I386_AVX_NUM_REGS): Likewise for AVX registers.
     (I386_AVX512_NUM_REGS): Likewise for AVX512 registers.
     (I386_MAX_REGISTER_SIZE): Change to 64 bytes, ZMM registers are
     512 bits wide.
     (i386_xmm_avx512_regnum_p): New prototype for register look up.
     (i386_ymm_avx512_regnum_p): Likewise.
     (i386_k_regnum_p): Likewise.
     (i386_zmm_regnum_p): Likewise.
     (i386_zmmh_regnum_p): Likewise.
     * i387-tdep.c : Update year in copyright notice.
     (xsave_ymm_avx512_offset): New table for YMM16-31 offsets in
     XSAVE buffer.
     (XSAVE_YMM_AVX512_ADDR): New macro.
     (xsave_xmm_avx512_offset): New table for XMM16-31 offsets in
     XSAVE buffer.
     (XSAVE_XMM_AVX512_ADDR): New macro.
     (xsave_avx512_k_offset): New table for K register offsets in
     XSAVE buffer.
     (XSAVE_AVX512_K_ADDR): New macro.
     (xsave_avx512_zmm_h_offset): New table for ZMM register offsets
     in XSAVE buffer.
     (XSAVE_AVX512_ZMM_H_ADDR): New macro.
     (i387_supply_xsave): Add code to supply AVX512 registers to XSAVE
     buffer.
     (i387_collect_xsave): Add code to collect AVX512 registers from
     XSAVE buffer.
     * i387-tdep.h (I387_NUM_XMM_AVX512_REGS): New define for number
     of XMM16-31 registers.
     (I387_NUM_K_REGS): New define for number of K registers.
     (I387_K0_REGNUM): New define for K0 register number.
     (I387_NUM_ZMMH_REGS): New define for number of ZMMH registers.
     (I387_ZMM0H_REGNUM): New define for ZMM0H register number.
     (I387_NUM_YMM_AVX512_REGS): New define for number of YMM16-31
     registers.
     (I387_YMM16H_REGNUM): New define for YMM16H register number.
     (I387_XMM16_REGNUM): New define for XMM16 register number.
     (I387_YMM0_REGNUM): New define for YMM0 register number.
     (I387_KEND_REGNUM): New define for last K register number.
     (I387_ZMMENDH_REGNUM): New define for last ZMMH register number.
     (I387_YMMH_AVX512_END_REGNUM): New define for YMM31 register
     number.
     (I387_XMM_AVX512_END_REGNUM): New define for XMM31 register
     number.
     * common/i386-xstate.h: Add AVX 3.1 feature bits, mask and XSTATE
     size.
     * features/Makefile: Add AVX512 related files.
     * features/i386/32bit-avx512.xml: New file.
     * features/i386/64bit-avx512.xml: Likewise.
     * features/i386/amd64-avx512-linux.c: Likewise.
     * features/i386/amd64-avx512-linux.xml: Likewise.
     * features/i386/amd64-avx512.c: Likewise.
     * features/i386/amd64-avx512.xml: Likewise.
     * features/i386/i386-avx512-linux.c: Likewise.
     * features/i386/i386-avx512-linux.xml: Likewise.
     * features/i386/i386-avx512.c: Likewise.
     * features/i386/i386-avx512.xml: Likewise.
     * features/i386/x32-avx512-linux.c: Likewise.
     * features/i386/x32-avx512-linux.xml: Likewise.
     * features/i386/x32-avx512.c: Likewise.
     * features/i386/x32-avx512.xml: Likewise.
     * regformats/i386/amd64-avx512-linux.dat: New file.
     * regformats/i386/amd64-avx512.dat: Likewise.
     * regformats/i386/i386-avx512-linux.dat: Likewise.
     * regformats/i386/i386-avx512.dat: Likewise.
     * regformats/i386/x32-avx512-linux.dat: Likewise.
     * regformats/i386/x32-avx512.dat: Likewise.
     * NEWS: Add note about new support for AVX512.

testsuite/
     * Makefile.in (EXECUTABLES): Added i386-avx512.
     * gdb.arch/i386-avx512.c: New file.
     * gdb.arch/i386-avx512.exp: Likewise.

gdbserver/
     * Makefile.in: Added rules to handle new files
     i386-avx512.c i386-avx512-linux.c amd64-avx512.c
     amd64-avx512-linux.c x32-avx512.c x32-avx512-linux.c.
     * configure.srv (srv_i386_regobj): Add i386-avx512.o.
     (srv_i386_linux_regobj): Add i386-avx512-linux.o.
     (srv_amd64_regobj): Add amd64-avx512.o and x32-avx512.o.
     (srv_amd64_linux_regobj): Add amd64-avx512-linux.o and
     x32-avx512-linux.o.
     (srv_i386_32bit_xmlfiles): Add i386/32bit-avx512.xml.
     (srv_i386_64bit_xmlfiles): Add i386/64bit-avx512.xml.
     (srv_amd64_xmlfiles): Add i386/amd64-avx512.xml and
     i386/x32-avx512.xml.
     (srv_i386_linux_xmlfiles): Add i386/i386-avx512-linux.xml.
     (srv_amd64_linux_xmlfiles): Add i386/amd64-avx512-linux.xml and
     i386/x32-avx512-linux.xml.
     * i387-fp.c (num_avx512_k_registers): New constant for number
     of K registers.
     (num_avx512_zmmh_low_registers): New constant for number of
     lower ZMM registers (0-15).
     (num_avx512_zmmh_high_registers): New constant for number of
     higher ZMM registers (16-31).
     (num_avx512_ymmh_registers): New contant for number of higher
     YMM registers (ymm16-31 added by avx521 on x86_64).
     (num_avx512_xmm_registers): New constant for number of higher
     XMM registers (xmm16-31 added by AVX512 on x86_64).
     (struct i387_xsave): Add space for AVX512 registers.
     (i387_cache_to_xsave): Change raw buffer size to 64 characters.
     Add code to handle AVX512 registers.
     (i387_xsave_to_cache): Add code to handle AVX512 registers.
     * linux-x86-low.c (init_registers_amd64_avx512_linux): New
     prototypei from generated file.
     (tdesc_amd64_avx512_linux): Likewise.
     (init_registers_x32_avx512_linux): Likewise.
     (tdesc_x32_avx512_linux): Likewise.
     (init_registers_i386_avx512_linux): Likewise.
     (tdesc_i386_avx512_linux): Likewise.
     (x86_64_regmap): Add AVX512 registers.
     (x86_linux_read_description): Add code to handle AVX512 XSTATE
     mask.
     (initialize_low_arch): Add code to initialize AVX512 registers.

doc/
     * gdb.texinfo (i386 Features): Add description of AVX512
     registers.

Change-Id: Ifc4c08c76b85dbec18d02efdbe6182e851584438
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
10 years agoPR16867, linking object with separate debug file
Alan Modra [Thu, 24 Apr 2014 12:29:56 +0000 (21:59 +0930)]
PR16867, linking object with separate debug file

This teaches the DWARF2 find_line functions how to deal with separate
debug relocatable object files.  Also fixes a major bug:
When _bfd_dwarf2_slurp_debug_info was split out, place_sections ran
after .debug_info was relocated.  This defeated the whole purpose of
place_sections.  See the comment I added before place_sections.
Fixes some minor bugs too:
- place_sections didn't set VMA for alloc but non-load sections (bss).
- zero size sections can have symbols, so they need their VMA set too.
- last_vma was incorrectly adjusted.
- my last change to place_sections left VMA unchanged for .debug_info
  when the linker has mapped input to output sections, but this is
  wrong since bfd_simple_get_relocated_section_contents unmaps debug
  sections.

PR 16867
* dwarf2.c: Formatting.
(struct dwarf2_debug): Make adjusted_section_count signed.
(unset_sections): Make i signed.
(set_debug_vma): New function.
(place_sections): Handle separate debug object file.  Set VMA
on debug sections, even if they have an output section.  Also
set VMA on zero size sections, and non-load but alloc sections.
Set adjusted_section_count to -1 when no section adjustment.
Malloc adjusted_sections.  Don't double last_vma.  Transfer
alloc section VMAs to separate debug file.
(_bfd_dwarf2_cleanup_debug_info): Free adjusted_sections.
(_bfd_dwarf2_slurp_debug_info): Add do_place parameter.  Drop
test on symbols being the same before using old stash.  Read
and use separate debug file symbols.  Call place_sections.
(find_line): Don't call place_sections here.
* libbfd-in.h (_bfd_dwarf2_slurp_debug_info): Update proto.
* libbfd.h: Regenerate.
* mach-o.c (bfd_mach_o_find_nearest_line): Adjust
_bfd_dwarf2_slurp_debug_info call.
* simple.c (simple_save_output_info): Clarify comment.

10 years agoFix a problem building the ARM assembler for non-ELF based toolchains.
Nick Clifton [Thu, 24 Apr 2014 10:35:51 +0000 (11:35 +0100)]
Fix a problem building the ARM assembler for non-ELF based toolchains.

* config/tc-arm.c (s_ltorg): Only create a mapping symbol for ELF
based targets.

10 years agoFix PE/COFF resource merging problems. There were two issues:
Nick Clifton [Thu, 24 Apr 2014 10:15:43 +0000 (11:15 +0100)]
Fix PE/COFF resource merging problems.  There were two issues:

  1. Strings (and then resource data) must follow immediately after
     the end of the tables.
  2. Units of resource data must be 8-byte aligned.

PR ld/16807
* peXXigen.c (struct rsrc_regions): New structure.
(rsrc_print_resource_directory): Use new structure.  Include
offset of directory in listing.
(rsrc_print_resource_entry): Likewise.
(rsrc_print_section): Likewise.
(rsrc_count_entries): Do not increment sizeof_strings or
sizeof_leaves.
(rsrc_count_directory): Do not increment sizeof_tables.
(rsrc_compute_region_sizes): New function.
(rsrc_write_leaf): Maintain 8-byte alignment for resource data.
(rsrc_process_section): Compute size of regions after merging
entries.

10 years agodaily update
Alan Modra [Thu, 24 Apr 2014 00:00:44 +0000 (09:30 +0930)]
daily update

10 years agoAdd missing PR ref to ChangeLog entry.
Cary Coutant [Wed, 23 Apr 2014 22:20:56 +0000 (15:20 -0700)]
Add missing PR ref to ChangeLog entry.

10 years agoAdd missing break statement for case elfcpp::R_X86_64_PLTOFF64.
Cary Coutant [Wed, 23 Apr 2014 22:17:16 +0000 (15:17 -0700)]
Add missing break statement for case elfcpp::R_X86_64_PLTOFF64.

gold/
* x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.

10 years agoIntroduce some new MI test suite cleanups for breakpoint and
Keith Seitz [Wed, 23 Apr 2014 19:17:31 +0000 (12:17 -0700)]
Introduce some new MI test suite cleanups for breakpoint and
breakpoint table handling.  This is a patch in five parts (all committed
here in one commit).

----- 1/5: parse_args
parse_args is a very useful utility function which allows you to do
getopt-y kinds of things in Tcl.

Example:
proc myproc {foo args} {
        parse_args {{bar} {baz "abc"} {qux}}
          # ...
}
myproc ABC -bar -baz DEF peanut butter

will define the following variables in myproc:
foo (=ABC), bar (=1), baz (=DEF), and qux (=0)
args will be the list {peanut butter}

----- 2/5: mi_build_kv_pairs
build_kv_pairs simply does what it says: given the input list
and an option join string, it combines list elements into kv-pairs
for MI handling.  It knows how to handle tuples and other special
MI types.

Example:
mi_build_kv_pairs {a b c d e f g \[.*\]}
returns a=\"b\",c=\"d\",e=\"f\",g=\[.*\]

----- 3/5: mi_make_breakpoint
This function builds breakpoint regexps, such as
"bkpt={number=\".*\", [snip]}".

Note that ONLY the options given to mi_make_breakpoint/mi_create_breakpoint
will actually be tested. So if -number is omitted, the regexp will allow
anything [number=\".*\"]

Examples:
mi_make_breakpoint -number 3

mi_create_breakpoint "myfile.c:21" -file myfile.c -line 21

----- 4/5: mi_make_breakpoint_table
This function builds MI breakpoint table regexps.

Example:
set bps {}
lappend bps [mi_make_breakpoint -number 1 -func "main" \
    -file ".*/myfile.c" -line 42
lappend bps [mi_make_breakpoint -number 2 -func "marker" \
    -file ".*myfile.c" -line 21
gdb_test "-break-info" "\\^done,[mi_make_breakpoint_table $bps]" \
    "breakpoint list"

----- 5/5: Update all callers
Self-explanatory

testsuite/ChangeLog
2014-04-23  Keith Seitz  <keiths@redhat.com>

* lib/mi-support.exp (mi_list_breakpoints): Delete.
(mi_make_breakpoint_table): New procedure.
(mi_create_breakpoint): Use mi_make_breakpoint
and return the result.
(mi_make_breakpoint): New procedure.
(mi_build_kv_pairs): New procedure.

* gdb.mi/mi-break.exp: Remove unused globals,
update mi_create_breakpoint usage, and use mi_make_breakpoint_table.
All callers updated.
* gdb.mi/mi-dprintf.exp: Use variable to track command
number.
Update all callers of mi_create_breakpoint and use
mi_make_breakpoint_table.
Remove any unused global variables.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-reverse.exp: Likewise.
* gdb.mi/mi-simplerun.exp: Likewise.
* gdb.mi/mi-stepn.exp: Likewise.
* gdb.mi/mi-syn-frame.exp: Likewise.
* gdb.mi/mi-until.exp: Likewise.
* gdb.mi/mi-var-cp.exp: Likewise.
* gdb.mi/mi-var-display.exp: Likewise.
* gdb.mi/mi2-amd64-entry-value.exp: Likewise.
* gdb.mi/mi2-var-child.exp: Likewise.
* gdb.mi/mi-vla-c99.exp: Likewise.
* lib/mi-support.exp: Likewise.

From Ian Lance Taylor  <iant@cygnus.com>:
* lib/gdb.exp (parse_args): New procedure.

10 years ago[gdbserver] mem-break.c:find_gdb_breakpoint_at: Make static.
Pedro Alves [Tue, 22 Apr 2014 18:47:06 +0000 (19:47 +0100)]
[gdbserver] mem-break.c:find_gdb_breakpoint_at: Make static.

Nothing calls this outside mem-break.c.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

* mem-break.c (find_gdb_breakpoint_at): Make static.
* mem-break.h (find_gdb_breakpoint_at): Delete declaration.

10 years agogdbserver: decouple x86 watchpoint / hw breakpoint routines from Z packet numbers.
Pedro Alves [Tue, 22 Apr 2014 18:47:04 +0000 (19:47 +0100)]
gdbserver: decouple x86 watchpoint / hw breakpoint routines from Z packet numbers.

My main motivation here is moving in the direction of decoupling
insert_point/remove_point from packet numbers, though this bit alone
should make it a little bit easier to merge gdb/gdbserver/i386-low.c
and gdb/i386-nat.c (which are largely the same).

Tested on x86_64 Fedora 17, and cross built for i686-mingw32 too.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

* i386-low.c: Don't include break-common.h here.
(i386_low_insert_watchpoint, i386_low_remove_watchpoint): Change
prototype to take target_hw_bp_type as argument instead of a Z
packet char.
* i386-low.h: Include break-common.h here.
(Z_packet_to_hw_type): Declare.
(i386_low_insert_watchpoint, i386_low_remove_watchpoint): Change
prototypes.
* linux-x86-low.c (x86_insert_point): Convert the packet number to
a target_hw_bp_type before calling i386_low_insert_watchpoint.
(x86_remove_point): Convert the packet number to a
target_hw_bp_type before calling i386_low_remove_watchpoint.
* win32-i386-low.c (i386_insert_point): Convert the packet number
to a target_hw_bp_type before calling i386_low_insert_watchpoint.
(i386_remove_point): Convert the packet number to a
target_hw_bp_type before calling i386_low_remove_watchpoint.

10 years agogdbserver: perror_with_name: Add ATTRIBUTE_NORETURN.
Pedro Alves [Tue, 22 Apr 2014 18:47:03 +0000 (19:47 +0100)]
gdbserver: perror_with_name: Add ATTRIBUTE_NORETURN.

perror_with_name doesn't return, but unlike gdb's version, it wasn't
marked that way.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

* utils.h (perror_with_name): Add ATTRIBUTE_NORETURN.

10 years agoStale breakpoint instructions, spurious SIGTRAPS.
Pedro Alves [Tue, 22 Apr 2014 22:19:19 +0000 (23:19 +0100)]
Stale breakpoint instructions, spurious SIGTRAPS.

Without the code portion of the patch, we get these failures:

 FAIL: gdb.base/break-unload-file.exp: always-inserted on: break: continue
 FAIL: gdb.base/break-unload-file.exp: always-inserted on: hbreak: continue
 FAIL: gdb.base/sym-file.exp: stale bkpts: continue to breakpoint: end here

They all looks like random SIGTRAPs:

 continue
 Continuing.

 Program received signal SIGTRAP, Trace/breakpoint trap.
 0x0000000000400541 in foo () at ../../../src/gdb/testsuite/gdb.base/break-unload-file.c:21
 21      }
 (gdb) FAIL: gdb.base/break-unload-file.exp: always-inserted on: break: continue

(This is a regression caused by the remove-symbol-file command
series.)

break-unload-file.exp is about having breakpoints inserted, and then
doing "file".  I caught this while writing a test that does "file
PROGRAM", while PROGRAM was already loaded, which internally does
"file" first, because I wanted to force a breakpoint_re_set, but the
test is more explicit in case GDB ever optimizes out that re-set.

The problem is that unloading the file with "file" ends up in
disable_breakpoints_in_freed_objfile, which marks all breakpoint
locations of the objfile as both shlib_disabled, _and_ clears the
inserted flag, without actually removing the breakpoints from the
inferior.  Now, usually, in all-stop, breakpoints will already be
removed from the inferior before the user can issue the "file"
command, but, with non-stop, or breakpoints always-inserted on mode,
breakpoints stay inserted even while the user has the prompt.  In the
latter case, then, if we let the program continue, and it executes the
address where we had previously set the breakpoint, it'll actually
execute the breakpoint instruction that we left behind...

Now, one issue is that the intent of
disable_breakpoints_in_freed_objfile is really to handle the unloading
of OBJF_USERLOADED objfiles.  These are objfiles that were added with
add-symbol-file and that are removed with remove-symbol-file.

"add-symbol-file"'s docs in the manual clearly say these commands are
used to let GDB know about dynamically loaded code:

 You would use this command when @var{filename} has been dynamically
 loaded (by some other means) into the program that is running.

Similarly, the online help says:

 (gdb) help add-symbol-file
 Load symbols from FILE, assuming FILE has been dynamically loaded.

So it makes sense to, like when shared libraries are unloaded through
the generic solib machinery, mark the breakpoint locations as
shlib_disabled.  But, the "file" command is not about dynamically
loaded code, it's about the main program.  So the patch makes
disable_breakpoints_in_freed_objfile skip all objfiles but
OBJF_USERLOADED ones, thus skipping the main objfile.

Then, the reason that disable_breakpoints_in_freed_objfile was
clearing the inserted flag isn't clear, but likely to avoid breakpoint
removal errors, assuming remove-symbol-file was called after the
dynamic object was already unmapped from the inferior.  In that case,
it'd okay to simply clear the inserted flag, but not so if the user
for example does remove-symbol-file to remove the library because he
made a mistake in the library's address, and wants to re-do
add-symbol-file with the correct address.

To address all that, I propose an alternative implementation, that
handles both cases.  The patch includes changes to sym-file.exp to
cover them.

This implementation leaves the inserted flag alone, and handles
breakpoint insertion/removal failure gracefully when the locations are
in OBJF_USERLOADED objfiles, just like we handle insertion/removal
failure gracefully for locations in shared libraries.

To try to make sure we aren't patching back stale shadow memory
contents into the inferior, in case the program mapped a different
library at the same address where we had the breakpoint, without the
user having had a chance of remove-symbol-file'ing before, this adds a
new memory_validate_breakpoint function that checks if the breakpoint
instruction is still in memory.  ppc_linux_memory_remove_breakpoint
does this unconditionally for all memory breakpoints, and questions
whether memory_remove_breakpoint should be changed to do this for all
breakpoints.  Possibly yes, though I'm not certain, hence this
baby-steps patch.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-04-23  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location): Tolerate errors if the
breakpoint is set in a user-loaded objfile.
(remove_breakpoint_1): Likewise.  Also tolerate errors if the
location is marked shlib_disabled.  If the breakpoint is set in a
user-loaded objfile is a GDB-side memory breakpoint, validate it
before uninsertion.  (disable_breakpoints_in_freed_objfile): Skip
non-OBJF_USERLOADED objfiles.  Don't clear the location's inserted
flag.
* mem-break.c (memory_validate_breakpoint): New function.
* objfiles.c (userloaded_objfile_contains_address_p): New
function.
* objfiles.h (userloaded_objfile_contains_address_p): Declare.
* target.h (memory_validate_breakpoint): New declaration.

gdb/testsuite/
2014-04-23  Pedro Alves  <palves@redhat.com>

* gdb.base/break-unload-file.c: New file.
* gdb.base/break-unload-file.exp: New file.
* gdb.base/sym-file-lib.c (baz): New function.
* gdb.base/sym-file-loader.c (struct segment) <mapped_size>: New
field.
(load): Store the segment's mapped size.
(unload): New function.
(unload_shlib): New function.
* gdb.base/sym-file-loader.h (unload_shlib): New declaration.
* gdb.base/sym-file-main.c (main): Unload, and reload the library,
set a breakpoint at baz, and call it.
* gdb.base/sym-file.exp: New tests for stale breakpoint
instructions.

10 years agoDon't suppress errors inserting/removing hardware breakpoints in shared
Pedro Alves [Wed, 23 Apr 2014 14:06:47 +0000 (15:06 +0100)]
Don't suppress errors inserting/removing hardware breakpoints in shared
libraries.

As explained in
https://sourceware.org/ml/gdb-patches/2008-08/msg00361.html, after a
shared library was unloaded, we can no longer insert or remove
breakpoints into/from its (no longer present) code segment.  That'll
fail with memory errors.  However, that concern does not apply to
hardware breakpoints.  By definition, hardware breakpoints are
implemented using a mechanism that is not dependent on being able to
modify the target's memory.  Usually, by setting up CPU debug
registers.  IOW, we should be able to set hw breakpoints in an
unmapped address.  We don't seem to have a test that exercises that,
so this patch adds one.

I noticed the error supression because of a related issue -- the
target_insert_hw_breakpoint/target_remove_hw_breakpoint interfaces
don't really distinguish "not supported" from "error" return, and so
remote.c returns -1 in both cases.  This results in hardware
breakpoints set in shared libraries silently ending up pending forever
even though the target doesn't actually support hw breakpoints.

 (gdb) set breakpoint always-inserted on
 (gdb) set remote Z-packet off
 (gdb) info breakpoints
 No breakpoints or watchpoints.
 (gdb) hbreak shrfunc
 Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21.
 (gdb) info break
 Num     Type           Disp Enb Address            What
 3       hw breakpoint  keep y   <PENDING>          shrfunc

After the patch we get the expected:

 (gdb) hbreak shrfunc
 Hardware assisted breakpoint 3 at 0x7ffff7dfb657: file ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c, line 21.
 Warning:
 Cannot insert hardware breakpoint 3.
 Could not insert hardware breakpoints:
 You may have requested too many hardware breakpoints/watchpoints.

 (gdb) info break
 Num     Type           Disp Enb Address            What
 3       hw breakpoint  keep y   0x00007ffff7dfb657 in shrfunc at ../../../src/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c:21

(HW breakpoints set in the main executable, when the target doesn't
support HW breakpoints always resulted in the latter output.)

We probably should improve the insert/remove interface to return a
different error code for unsupported.  But I chose to fix the error
supression first, as it's a deeper and wider issue.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-04-23  Pedro Alves  <palves@redhat.com>

* breakpoint.c (insert_bp_location, remove_breakpoint_1): If
the breakpoint is set in a shared library, only suppress
errors for software breakpoints, not hardware breakpoints.

gdb/testsuite/
2014-04-23  Pedro Alves  <palves@redhat.com>

* gdb.base/hbreak-in-shr-unsupported-shr.c: New file.
* gdb.base/hbreak-in-shr-unsupported.c: New file.
* gdb.base/hbreak-in-shr-unsupported.exp: New file.
* gdb.base/hbreak-unmapped.c: New file.
* gdb.base/hbreak-unmapped.exp: New file.
* gdb.trace/qtro.exp (gdb_is_target_remote): Move ...
* lib/gdb.exp (gdb_is_target_remote): ... here.

10 years agold/arm: Fix testsuite failures for armeb-linux-eabi
Will Newton [Fri, 4 Apr 2014 14:08:50 +0000 (15:08 +0100)]
ld/arm: Fix testsuite failures for armeb-linux-eabi

Fix all the cases where endianness needs to be taken into account
in the ARM ld dump tests.

ld/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* ld-arm/arm-no-rel-plt.ld: Remove OUTPUT_FORMAT and
SEARCH_DIR commands.
* ld-arm/arm-rel32.d: Update regexps to allow test to
pass on armeb-linux-eabi configuration.
* ld-arm/data-only-map.d: Likewise.
* ld-arm/fix-arm1176-off.d: Likewise.
* ld-arm/fix-arm1176-on.d: Likewise.
* ld-arm/ifunc-1.gd: Likewise.
* ld-arm/ifunc-10.gd: Likewise.
* ld-arm/ifunc-11.gd: Likewise.
* ld-arm/ifunc-12.gd: Likewise.
* ld-arm/ifunc-13.gd: Likewise.
* ld-arm/ifunc-14.gd: Likewise.
* ld-arm/ifunc-15.gd: Likewise.
* ld-arm/ifunc-16.gd: Likewise.
* ld-arm/ifunc-17.gd: Likewise.
* ld-arm/ifunc-2.gd: Likewise.
* ld-arm/ifunc-3.gd: Likewise.
* ld-arm/ifunc-4.gd: Likewise.
* ld-arm/ifunc-5.gd: Likewise.
* ld-arm/ifunc-6.gd: Likewise.
* ld-arm/ifunc-7.gd: Likewise.
* ld-arm/ifunc-8.gd: Likewise.
* ld-arm/ifunc-9.gd: Likewise.
* ld-arm/jump-reloc-veneers-long.d: Likewise.
* ld-arm/reloc-boundaries.d: Likewise.

10 years agogas/arm: Fix gas tests to run on armeb-linux-eabi
Will Newton [Fri, 4 Apr 2014 10:52:59 +0000 (11:52 +0100)]
gas/arm: Fix gas tests to run on armeb-linux-eabi

Fix various places where endianness needed to be taken into account
in the gas testsuite for ARM.

gas/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* gas/arm/backslash-at.d: Fix dump output regexps for
armeb-linux-eabi configuration.
* gas/arm/got_prel.d: Likewise.
* gas/arm/inst-po.d: Likewise.
* gas/arm/unwind.d: Likewise.

10 years agogas/arm: Force output of a data mapping symbol for literal pools
Will Newton [Fri, 4 Apr 2014 09:07:06 +0000 (10:07 +0100)]
gas/arm: Force output of a data mapping symbol for literal pools

If there is a a trailing align statement in a code section we may
output data padding with a data mapping followed by a code alignment
with a code mapping. The literal pool may then be output with a code
mapping symbol which will cause it to be endian swapped in a big-endian
configuration. When outputting a literal pool make sure that a data
mapping symbol is output in all cases.

gas/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* config/tc-arm.c (s_ltorg): Call make_mapping_symbol
directly instead of mapping_state.

gas/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

* gas/arm/mapmisc.d: Check literal pool mapping with
a trailing .align statement.
* gas/arm/mapmisc.s: Likewise.

10 years agoAdd support for the MIPS eXtended Physical Address (XPA) ASE.
Andrew Bennett [Wed, 23 Apr 2014 10:24:30 +0000 (11:24 +0100)]
Add support for the MIPS eXtended Physical Address (XPA) ASE.

ChangeLog:

binutils/
* doc/binutils.texi: Document the disassemble MIPS XPA instructions
command line option.

gas/
* config/tc-mips.c (options): Add OPTION_XPA and OPTION_NO_XPA.
  (md_longopts): Add xpa and no-xpa command line options.
  (mips_ases): Add MIPS XPA ASE.
  (mips_cpu_info_table): Update p5600 entry to allow the XPA ASE.
  * doc/as.texinfo: Document the MIPS XPA command line options.
  * doc/c-mips.texi: Document the MIPS XPA command line options,
  and assembler directives.

gas/testsuite/
  * gas/mips/mips.exp: Add xpa tests.
  * gas/mips/xpa.s: New test.
  * gas/mips/xpa.d: Likewise.

include/
  * opcode/mips.h (ASE_XPA): New define.

opcodes/
  * mips-dis.c (mips_arch_choices): Update mips32r2 and mips64r2
  to allow the MIPS XPA ASE.
  (parse_mips_dis_option): Process the -Mxpa option.
  * mips-opc.c (XPA): New define.
  (mips_builtin_opcodes): Add MIPS XPA instructions and move the
  locations of the ctc0 and cfc0 instructions.

10 years agoPR ld/16787, stale dwarf2 stash
Alan Modra [Wed, 23 Apr 2014 04:56:19 +0000 (14:26 +0930)]
PR ld/16787, stale dwarf2 stash

Throw away the dwarf2 stash if it becomes invalid due to section
VMAs changing.  It would be nice to reclaim all the bfd_alloc
memory here when we throw away the stash, perhaps by putting
everything we alloc on a private dwarf2 objalloc, but I haven't done
that with this patch.

I've also fixed a problem with bfd_perform_relocation losing reloc
addends, which meant a second or subsequent look at debug info
sections did not properly relocate the sections.  I can't see why
bfd_perform_relocation should need to change addends except for ld -r,
and the history (985fca12e98e6ec1) doesn't help much.

Finally, the patch tweaks place_sections to avoid unnecessary work.
If we've mapped input to output sections, then input section VMA
isn't used so there's not much point in adjusting it.  Incidentally,
this also means place_sections isn't effective in all cases.

PR ld/16787
* dwarf2.c (struct dwarf2_debug): Add sec_vma field.
(place_sections): Do not modify VMA of sections when called from
linker after sections have been placed in output sections.  Short
circuit single section case.
(save_section_vma, section_vma_same): New functions.
(_bfd_dwarf2_slurp_debug_info): Throw away stash if section VMAs
change.
* reloc.c (bfd_perform_relocation): Do not modify reloc addend
when non-relocatable.

10 years agoAdd missing ChangeLog entries for nios2 gas selftest patch.
Sandra Loosemore [Wed, 23 Apr 2014 02:41:14 +0000 (19:41 -0700)]
Add missing ChangeLog entries for nios2 gas selftest patch.

10 years agodaily update
Alan Modra [Wed, 23 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update

10 years agoFix alignment for the first section frag on xtensa
Max Filippov [Tue, 15 Apr 2014 15:12:46 +0000 (19:12 +0400)]
Fix alignment for the first section frag on xtensa

Linking object files produced by partial linking with link-time
relaxation enabled sometimes fails with the following error message:

dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63)

This happens because no basic block with an XTENSA_PROP_ALIGN flag in the
property table is generated for the first basic block, even if the
.align directive is present.
It was believed that the first frag alignment could be derived from the
section alignment, but this was not implemented for the partial linking
case: after partial linking first frag of a section may become not
first, but no additional alignment frag is inserted before it.
Basic block for such frag may be merged with previous basic block into
extended basic block during relaxation pass losing its alignment
restrictions.

Fix this by always recording alignment for the first section frag.

2014-04-22  Max Filippov  <jcmvbkbc@gmail.com>

gas/
    * config/tc-xtensa.c (xtensa_handle_align): record alignment for the
    first section frag.

gas/testsuite/
    * gas/xtensa/all.exp: Add test for the first section frag alignment.
    * gas/xtensa/first_frag_align.d: First section frag alignment expected
    dump.
    * gas/xtensa/first_frag_align.s: First section frag alignment test
    source.

10 years agoConsecutive step-overs trigger internal error.
Pedro Alves [Tue, 22 Apr 2014 14:00:56 +0000 (15:00 +0100)]
Consecutive step-overs trigger internal error.

If a thread trips on a breakpoint that needs stepping over just after
finishing a step over, GDB currently fails an assertion.  This is a
regression caused by the "Handle multiple step-overs." patch
(99619beac6252113fed212fdb9e1ab97bface423) at
https://sourceware.org/ml/gdb-patches/2014-02/msg00765.html.

 (gdb) x /4i $pc
 => 0x400540 <main+4>:   movl   $0x0,0x2003da(%rip)        # 0x600924 <i>
    0x40054a <main+14>:  movl   $0x1,0x2003d0(%rip)        # 0x600924 <i>
    0x400554 <main+24>:  movl   $0x2,0x2003c6(%rip)        # 0x600924 <i>
    0x40055e <main+34>:  movl   $0x3,0x2003bc(%rip)        # 0x600924 <i>
 (gdb) PASS: gdb.base/consecutive-step-over.exp: get breakpoint addresses
 break *0x40054a
 Breakpoint 2 at 0x40054a: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 23.
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 1: set breakpoint
 condition $bpnum condition
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 1: set condition
 break *0x400554
 Breakpoint 3 at 0x400554: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 24.
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 2: set breakpoint
 condition $bpnum condition
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 2: set condition
 break *0x40055e
 Breakpoint 4 at 0x40055e: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 25.
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 3: set breakpoint
 condition $bpnum condition
 (gdb) PASS: gdb.base/consecutive-step-over.exp: insn 3: set condition
 break 27
 Breakpoint 5 at 0x400568: file ../../../src/gdb/testsuite/gdb.base/consecutive-step-over.c, line 27.
 (gdb) continue
 Continuing.
 ../../src/gdb/infrun.c:5200: internal-error: switch_back_to_stepped_thread: Assertion `!tp->control.trap_expected' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 FAIL: gdb.base/consecutive-step-over.exp: continue to breakpoint: break here (GDB internal error)

The assertion fails, because the code is not expecting that the event
thread itself might need another step over.  IOW, not expecting that
TP in:

     tp = find_thread_needs_step_over (stepping_thread != NULL,
                                      stepping_thread);

could be the event thread.

A small fix for this would be to clear the event thread's
trap_expected earlier, before asserting.  But looking deeper, although
currently_stepping_or_nexting_callback's intention is finding the
thread that is doing a step/next, it also returns the thread that is
doing a step-over dance, with trap_expected set.  If there ever was a
reason for that (it was I who added
currently_stepping_or_nexting_callback , but I can't recall why I put
trap_expected there in the first place), the only remaining reason
nowadays is to aid in implementing switch_back_to_stepped_thread's
assertion that is now triggering, by piggybacking on the walk over all
threads, thus avoiding a separate walk.  This is quite obscure, and I
think we can do even better, by merging the walks that look for the
stepping thread, and the walk that looks for some thread that might
need a step over.

Tested on x86_64 Fedora 17, native and gdbserver, and also native on
top of my "software single-step on x86_64" series.

gdb/
2014-04-22  Pedro Alves  <palves@redhat.com>

* infrun.c (schedlock_applies): New function, factored out from
find_thread_needs_step_over.
(find_thread_needs_step_over): Use it.
(switch_back_to_stepped_thread): Always clear trap_expected if the
step over is finished.  Return early if scheduler locking applies.
Look for the stepping thread and a potential step-over thread with
a single loop.
(currently_stepping_or_nexting_callback): Delete.

2014-04-22  Pedro Alves  <palves@redhat.com>

* gdb.base/consecutive-step-over.c: New file.
* gdb.base/consecutive-step-over.exp: New file.

10 years agoMake gdb_continue_to_breakpoint fail quickly on internal errors.
Pedro Alves [Tue, 22 Apr 2014 18:15:48 +0000 (19:15 +0100)]
Make gdb_continue_to_breakpoint fail quickly on internal errors.

This switches the gdb_continue_to_breakpoint routine to use
gdb_test_multiple instead of send_gdb/gdb_expect, so that an internal
error is detected immediately, instead of failing on timeout.

gdb/testsuite/
2014-04-22  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_continue_to_breakpoint): Use gdb_test_multiple
instead of send_gdb/gdb_expect.

10 years agoFix Nios II assembler self-test mode.
Sandra Loosemore [Tue, 22 Apr 2014 17:56:02 +0000 (10:56 -0700)]
Fix Nios II assembler self-test mode.

2014-04-22  Sandra Loosemore  <sandra@codesourcery.com>

gas/
* config/tc-nios2.c (nios2_consume_arg): Add case for 'E' to
unbreak self-test mode.

gas/testsuite/
* gas/nios2/selftest.s: New.
* gas/nios2/selftest.d: New.

10 years agoAdd tests for PR ld/16846
H.J. Lu [Tue, 22 Apr 2014 17:22:39 +0000 (10:22 -0700)]
Add tests for PR ld/16846

PR ld/16846
* ld-plugin/lto.exp (lto_link_tests): Add tests for PR ld/16846.
* ld-plugin/pr16846a.c: New file.
* ld-plugin/pr16846b.c: Likewise.
* ld-plugin/pr16846c.c: Likewise.

10 years agoAnother fix for building on a 32-bit host.
Nick Clifton [Tue, 22 Apr 2014 15:57:34 +0000 (16:57 +0100)]
Another fix for building on a 32-bit host.

PR ld/16821
* peXXigen.c (_bfd_XXi_swap_sym_out): Fix for 32-bit hosts.

10 years agoRemove support for the (deprecated) openrisc and or32 configurations and replace
Christian Svensson [Tue, 22 Apr 2014 14:57:47 +0000 (15:57 +0100)]
Remove support for the (deprecated) openrisc and or32 configurations and replace
with support for the new or1k configuration.

10 years agoAdd a note to the GDB/NEWS file mentioning that the ARM simulator now
Nick Clifton [Tue, 22 Apr 2014 10:23:05 +0000 (11:23 +0100)]
Add a note to the GDB/NEWS file mentioning that the ARM simulator now
supports instruction tracing with or without disassembly alongside.

* NEWS: Mention that ARM sim now supports tracing.

10 years agoFix build problem on 32-bit hosts with the recent patch for PR 16821.
Yuanhui Zhang [Tue, 22 Apr 2014 10:00:39 +0000 (11:00 +0100)]
Fix build problem on 32-bit hosts with the recent patch for PR 16821.

PR ld/16821
* peXXigen.c (abs_finder): Fix for 32-bit host builds.

10 years agobfd/elfnn-aarch64.c: Remove elfNN_aarch64_section_flags
Will Newton [Mon, 14 Apr 2014 12:37:51 +0000 (13:37 +0100)]
bfd/elfnn-aarch64.c: Remove elfNN_aarch64_section_flags

This function seems to be a left over from some previous
functionality that no longer exists - the comment above seems to
make no sense with the current code. Remove the function as it
breaks handling of SystemTap static probe note sections.

bfd/ChangeLog:

2014-04-22  Will Newton  <will.newton@linaro.org>

* elfnn-aarch64.c (elfNN_aarch64_section_flags): Remove
function.  (elf_backend_section_flags): Remove define.

10 years agoCheck tracefile is generated by binary execution
Yao Qi [Fri, 21 Mar 2014 04:52:24 +0000 (12:52 +0800)]
Check tracefile is generated by binary execution

In gdb.trace/tfile.exp, we execute binary to generate tracefile,

  remote_exec target "$binfile"

however, this fails on bare metal target.  This patch is to
handle binary execution failure by running binary in GDB.
The binary will do some io operation to generate tracefile, so
we need a check 'target_info exists gdb,nofileio'.

This patch is to check whether tracefile is generated.  tfile.exp can
be skipped if generation is failed, while test_tfind_tfile in
mi-traceframe-changed.exp is skipped if generated failed.  The rest of
the mi-traceframe-changed.exp can still be executed, because on some
bare metal targets, the remote stub supports tracepoint but doesn't
support fileio.

gdb/testsuite:

2014-04-22  Yao Qi  <yao@codesourcery.com>

* lib/trace-support.exp (generate_tracefile): New procedure.
* gdb.trace/tfile.exp: Skip the test if generate_tracefile
return 0.
* gdb.trace/mi-traceframe-changed.exp: Invoke test_tfind_tfile
if generate_tracefile returns 1.

10 years agoUnify ctf_fetch_registers and tfile_fetch_registers
Yao Qi [Fri, 18 Apr 2014 11:32:01 +0000 (19:32 +0800)]
Unify ctf_fetch_registers and tfile_fetch_registers

Functions ctf_fetch_registers and tfile_fetch_registers have some
duplicated code about guessing the PC in regcache.  Sometimes, we
may change one function and forget to update the other one, like this
https://www.sourceware.org/ml/gdb-patches/2014-01/msg00292.html

This patch is to move the duplicated code into a new function
tracefile_fetch_registers, and let both ctf_fetch_registers and
tfile_fetch_registers call it.

gdb:

2014-04-22  Yao Qi  <yao@codesourcery.com>

* tracefile-tfile.c (tfile_fetch_registers): Move the bottom to ...
* tracefile.c (tracefile_fetch_registers): ... it.  New function.
* tracefile.h (tracefile_fetch_registers): Declare.
* ctf.c (ctf_fetch_registers): Remove the bottom.  Call
tracefile_fetch_registers.

10 years agodaily update
Alan Modra [Tue, 22 Apr 2014 00:00:39 +0000 (09:30 +0930)]
daily update

10 years agoFix alpha-elf relaxation
Richard Henderson [Mon, 21 Apr 2014 15:14:18 +0000 (08:14 -0700)]
Fix alpha-elf relaxation

ld/
* emultempl/alphaelf.em (alpha_after_parse): Enable 2 relax passes.
bfd/
* elf64-alpha.c (elf64_alpha_size_got_sections): New may_merge
parameter; honor it and disable got merging when false.
(elf64_alpha_relax_got_load): Do not relax to GPREL relocs during
the first pass of relaxation.
(elf64_alpha_relax_with_lituse): Likewise.  Move relaxed relocs to
the end of the LITERAL+LITUSE chain.
(elf64_alpha_relax_section): Only process LITERAL relocs during the
second pass of relaxation.

10 years agoEnable secureplt by default for alpha-linux
Richard Henderson [Mon, 21 Apr 2014 15:05:49 +0000 (08:05 -0700)]
Enable secureplt by default for alpha-linux

* configure.ac (use_secureplt): Enable by default.
* configure: Rebuild.

10 years agodaily update
Alan Modra [Mon, 21 Apr 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agodaily update
Alan Modra [Sun, 20 Apr 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agoPR gdb/14018 -- avoid "PC register not available" errors.
Eli Zaretskii [Sat, 19 Apr 2014 08:12:19 +0000 (11:12 +0300)]
PR gdb/14018 -- avoid "PC register not available" errors.

gdb/windows-nat.c (thread_rec): Don't display a warning when
SuspendThread fails with ERROR_ACCESS_DENIED.  If SuspendThread
fails for any reason, set th->suspended to -1, so that we don't
try to resume such a thread.  Also, don't return NULL in these
cases, to avoid completely ruin the session due to "PC register is
not available" error.
(do_windows_fetch_inferior_registers): Check errors in
GetThreadContext call.
(windows_continue): Accept an additional argument KILLED; if not
zero, ignore errors in the SetThreadContext call, since the
inferior was killed and is shutting down.
(windows_resume, get_windows_debug_event)
(windows_create_inferior, windows_mourn_inferior)
(windows_kill_inferior): All callers of windows_continue changed
to adjust to its new calling sequence.

10 years agoCall post_create_inferior in ctf_open.
Yao Qi [Fri, 18 Apr 2014 11:19:22 +0000 (19:19 +0800)]
Call post_create_inferior in ctf_open.

We don't call post_create_inferior at the end of ctf_open.  It is an
oversight in patch

  [PATCH 2/2] Create inferior for ctf target.
  https://sourceware.org/ml/gdb-patches/2014-01/msg01056.html

This patch is to call post_create_inferior at the end of ctf_open,
like the end of tfile_open.

gdb:

2014-04-19  Yao Qi  <yao@codesourcery.com>

* ctf.c (ctf_open): Call post_create_inferior.

10 years agoGet trace_regblock_size from metadata instead of event
Yao Qi [Sat, 19 Apr 2014 02:14:58 +0000 (10:14 +0800)]
Get trace_regblock_size from metadata instead of event

In ctf trace, for each 'R' block, we save it as a "register" event,
as defined below in metadata.

event {
        name = "register";
        id = 0;
        fields := struct {
                ascii contents[440];
        };
}

Nowadays, we initialize trace_regblock_size by getting the length of
"contents" from a "register" event.  However, 'R' block may not exist
in traceframe, as a result, "register" event doesn't exist in trace file
and trace_regblock_size isn't set.

This patch changes to get trace_regblock_size from metadata (or declaration)
which always exists.

gdb:

2014-04-19  Yao Qi  <yao@codesourcery.com>

* ctf.c (handle_id): New static variable.
(ctf_open_dir): Get handle_id from bt_context_add_trace return
value.  Get the declaration of event "register" and get length
of field "contents".

10 years agoAdd null pointer check in ctf_xfer_partial
Yao Qi [Fri, 18 Apr 2014 11:22:23 +0000 (19:22 +0800)]
Add null pointer check in ctf_xfer_partial

I find a gdb crash when gdb reads ctf trace.  The crash is caused by passing
NULL to strcmp.  This patch is to add null pointer check, as what we did
somewhere else in ctf.c.

gdb:

2014-04-19  Yao Qi  <yao@codesourcery.com>

* ctf.c (ctf_xfer_partial): Check 'name' is NULL before strcmp.

10 years agoRemove unnecessary argument METHOD to valops.c:oload_method_static.
Siva Chandra [Mon, 3 Mar 2014 13:08:47 +0000 (05:08 -0800)]
Remove unnecessary argument METHOD to valops.c:oload_method_static.

* valops.c (oload_method_static): Remove unnecessary argument
METHOD.  Update all callers.

10 years agodaily update
Alan Modra [Sat, 19 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update

10 years agomach-o: layout executables
Tristan Gingold [Thu, 3 Apr 2014 12:45:31 +0000 (14:45 +0200)]
mach-o: layout executables

bfd/
* mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content,
bind_content, weak_bind_content, lazy_bind_content,
export_content.
(bfd_mach_o_load_command): Add comments, add next field.
(mach_o_data_struct): Replace commands field by first_command
and last_command.
* mach-o.c (bfd_mach_o_append_command): New function.
(bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines.
(bfd_mach_o_bfd_copy_private_section_data): Check flavour,
copy fields.
(bfd_mach_o_bfd_copy_private_header_data): Copy load commands.
(bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions.
(bfd_mach_o_write_thread): Use macro instead of literal.
(bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib)
(bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New
functions.
(bfd_mach_o_write_symtab_content): New function (extracted
from bfd_mach_o_write_symtab).
(bfd_mach_o_write_symtab): Split.
(bfd_mach_o_count_indirect_symbols): Move
(bfd_mach_o_build_dysymtab): Remove layout code.
(bfd_mach_o_write_contents): Rewritten to build commands in order.
(bfd_mach_o_count_sections_for_seg): Remove.
(bfd_mach_o_build_obj_seg_command): New function (extracted from
bfd_mach_o_build_seg_command).
(bfd_mach_o_build_exec_seg_command): New function.
(bfd_mach_o_build_dysymtab_command): Remove.
(bfd_mach_o_layout_commands): New function.
(bfd_mach_o_init_segment): New function.
(bfd_mach_o_build_commands): Major rework to handle non-object
files.
(bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New
function.
(bfd_mach_o_read_dyld_info): Clear content fields.
(bfd_mach_o_read_segment): Adjust call.
(bfd_mach_o_flatten_sections): Adjust as now load commands are
chained.
(bfd_mach_o_scan_start_address, bfd_mach_o_scan)
(bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address)
(bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment):
Likewise.

binutils/
* od-macho.c (dump_section_map): Adjust as load commands
are now chained.
(dump_load_command, dump_section_content): Likewise.

10 years agomach-o: Define copy_private_header instead of copy_private_bfd.
Tristan Gingold [Wed, 9 Apr 2014 08:16:39 +0000 (10:16 +0200)]
mach-o: Define copy_private_header instead of copy_private_bfd.

bfd/
* mach-o-target.c (bfd_mach_o_bfd_copy_private_header_data):
Define instead of bfd_mach_o_bfd_copy_private_bfd_data.
* mach-o.c (bfd_mach_o_bfd_copy_private_bfd_data): Rename.
* mach-o.h (bfd_mach_o_bfd_copy_private_bfd_data): Likewise.

10 years agomach-o: remove name_len field.
Tristan Gingold [Wed, 9 Apr 2014 08:15:50 +0000 (10:15 +0200)]
mach-o: remove name_len field.

bfd/
* mach-o.h (bfd_mach_o_dylinker_command)
(bfd_mach_o_dylib_command, bfd_mach_o_fvmlib_command): Remove
name_len field.
* mach-o.c (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib)
(bfd_mach_o_read_fvmlib): Adjust after name_len removal.

10 years agoFix PR backtrace/15558
Pedro Alves [Fri, 18 Apr 2014 09:15:21 +0000 (10:15 +0100)]
Fix PR backtrace/15558

This PR is about an assertion failure in GDB that can be triggered by
setting "backtrace limit" to a value that causes GDB to stop unwinding
after an inline frame.  In this case, an assertion in
inline_frame_this_id will trigger:

  /* We need a valid frame ID, so we need to be based on a valid
     frame.  (...).  */
  gdb_assert (frame_id_p (*this_id));

Looking at the function:

 static void
 inline_frame_this_id (struct frame_info *this_frame,
       void **this_cache,
       struct frame_id *this_id)
 {
   struct symbol *func;

   /* In order to have a stable frame ID for a given inline function,
      we must get the stack / special addresses from the underlying
      real frame's this_id method.  So we must call get_prev_frame.
      Because we are inlined into some function, there must be previous
      frames, so this is safe - as long as we're careful not to
      create any cycles.  */
   *this_id = get_frame_id (get_prev_frame (this_frame));

we see we're computing the frame id for the inline frame.  If this is
an inline frame, which is a virtual frame constructed based on debug
info, on top of a real stack frame, we should _always_ be able to find
where the frame was inlined into, as that ultimately just means
peeling off the virtual frames on top of the real stack frame.  If
there ultimately was no prev (real) stack frame, then we wouldn't have
been able to construct the inline frame either, by design.  That's
what the assertion catches.

So we have an inline frame, we should _always_ be able to compute its
ID, even if that means bypassing the user backtrace limits to get at
the real stack frame's info.  The problem is that inline_frame_id
calls get_prev_frame, and that takes user backtrace limits into
account.  Code that wants to bypass the limits calls get_prev_frame_1
instead.

Note how get_prev_frame_1 already skips all checks for inline frames:

   /* If we are unwinding from an inline frame, all of the below tests
      were already performed when we unwound from the next non-inline
      frame.  We must skip them, since we can not get THIS_FRAME's ID
      until we have unwound all the way down to the previous non-inline
      frame.  */
   if (get_frame_type (this_frame) == INLINE_FRAME)
     return get_prev_frame_if_no_cycle (this_frame);

And note how the related frame_unwind_caller_id function also uses
get_prev_frame_1:

 struct frame_id
 frame_unwind_caller_id (struct frame_info *next_frame)
 {
   struct frame_info *this_frame;

   /* Use get_prev_frame_1, and not get_prev_frame.  The latter will truncate
      the frame chain, leading to this function unintentionally
      returning a null_frame_id (e.g., when a caller requests the frame
      ID of "main()"s caller.  */

   next_frame = skip_artificial_frames (next_frame);
   this_frame = get_prev_frame_1 (next_frame);
   if (this_frame)
     return get_frame_id (skip_artificial_frames (this_frame));
   else
     return null_frame_id;
 }

get_prev_frame_1 is currently static in frame.c.  As a _1 suffix is
not a good name for an extern function, I've renamed it.

Tested on x86-64 Fedora 17.

gdb/
2014-04-18  Pedro alves  <palves@redhat.com>
    Tom Tromey  <tromey@redhat.com>

PR backtrace/15558
* frame.c (get_prev_frame_1): Rename to ...
(get_prev_frame_always): ... this, and make extern.  Adjust.
(skip_artificial_frames): Use get_prev_frame_always.
(frame_unwind_caller_id, frame_pop, get_prev_frame)
(get_frame_unwind_stop_reason): Adjust to rename.
* frame.h (get_prev_frame_always): Declare.
* inline-frame.c: Include frame.h.
(inline_frame_this_id): Use get_prev_frame_always.

gdb/testsuite/
2014-04-18  Tom Tromey  <palves@redhat.com>
    Pedro alves  <tromey@redhat.com>

PR backtrace/15558
* gdb.opt/inline-bt.exp: Test backtracing from an inline function
with a backtrace limit.
* gdb.python/py-frame-inline.exp: Test running to an inline
function with a backtrace limit, and printing the newest frame.
* gdb.python/py-frame-inline.c (main): Call f.

10 years agosolib-darwin: simplify code.
Tristan Gingold [Fri, 18 Apr 2014 09:03:46 +0000 (11:03 +0200)]
solib-darwin: simplify code.

Use bfd_mach_o_get_base_address to extract load address.

gdb/
* solib-darwin.c (darwin_solib_create_inferior_hook): Simplify
code by using bfd_mach_o_get_base_address.

10 years agomach-o: add page_size to backend data.
Tristan Gingold [Wed, 9 Apr 2014 08:10:44 +0000 (10:10 +0200)]
mach-o: add page_size to backend data.

This is preliminary work to layout executables.

bfd/
* mach-o.h (bfd_mach_o_backend_data): Add page_size field.
* mach-o-target.c: Check TARGET_PAGESIZE is defined.
(TARGET_NAME_BACKEND): Add TARGET_PAGESIZE.
* mach-o.c (TARGET_PAGESIZE): Define and undefined for
each targets declared.
* mach-o-x86-64.c (TARGET_PAGESIZE): Define.
* mach-o-i386.c (TARGET_PAGESIZE): Define.

10 years agomach-o.c: use boolean instead of int to return status.
Tristan Gingold [Wed, 16 Apr 2014 14:01:47 +0000 (16:01 +0200)]
mach-o.c: use boolean instead of int to return status.

bfd/
* mach-o.c (bfd_mach_o_write_thread)
(bfd_mach_o_write_section_32, bfd_mach_o_write_section_64)
(bfd_mach_o_write_segment_32, bfd_mach_o_write_segment_64)
(bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib)
(bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_prebind_cksum)
(bfd_mach_o_read_twolevel_hints, bfd_mach_o_read_fvmlib)
(bfd_mach_o_read_thread, bfd_mach_o_read_dysymtab)
(bfd_mach_o_read_symtab, bfd_mach_o_read_uuid)
(bfd_mach_o_read_linkedit, bfd_mach_o_read_str)
(bfd_mach_o_read_dyld_info, bfd_mach_o_read_segment)
(bfd_mach_o_read_segment_32, bfd_mach_o_read_segment_64)
(bfd_mach_o_read_command): Now return a boolean status.
Adjust return statements.
(bfd_mach_o_write_contents, bfd_mach_o_scan): Adjust tests.
(bfd_mach_o_core_file_failing_command): Remove useless initialization.

10 years agodaily update
Alan Modra [Fri, 18 Apr 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoDrop srcdir from untested source path.
Marcus Shawcroft [Thu, 17 Apr 2014 14:26:37 +0000 (15:26 +0100)]
Drop srcdir from untested source path.

10 years agoThis patch causes local GOT entries addressed via a 16-bit index to
Kwok Cheung Yeung [Thu, 17 Apr 2014 13:13:44 +0000 (14:13 +0100)]
This patch causes local GOT entries addressed via a 16-bit index to
be placed towards the front of local GOT space, while entries addressed
via a 32-bit index are placed towards the rear.

Provided that there are fewer than ~16K local GOT entries addressed via
a 16-bit index in total, this should eliminate any relocation overflows
caused by such GOT entries being allocated beyond the addressable range.

bfd/
* elfxx-mips.c (struct mips_got_info): Delete assigned_gotno
field.  Add assigned_low_gotno and assigned_high_gotno fields.
(mips_elf_create_local_got_entry): Update out-of-space condition.
Set index of new GOT entry to assigned_low_gotno if required by
the current relocation, else set it to assigned_high_gotno.
(mips_elf_set_global_gotidx): Replace uses of assigned_gotno
with assigned_low_gotno.
(mips_elf_multi_got): Initialize assigned_low_gotno and
assigned_high_gotno in secondary GOTs.  Use assigned_low_gotno
in place of assigned_gotno when handling global GOT entries.
(mips_elf_lay_out_got): Initialize assigned_low_gotno and
assigned_high_gotno.
(_bfd_mips_elf_finish_dynamic_sections): Account for a possible
gap in the middle of local GOT space.

ld/testsuite/
* ld-mips-elf/elf-rel-xgot-n32.d: Update for new GOT layout.
* ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise.

10 years agoEnable DWARF unwinders for SPU
Ulrich Weigand [Thu, 17 Apr 2014 12:09:49 +0000 (14:09 +0200)]
Enable DWARF unwinders for SPU

This patch enables use of DWARF unwinders for the SPU target.

In addition to appending the DWARF unwinders, we also need to install
a spu_dwarf_reg_to_regnum that maps the raw stack pointer register to
the cooked version (to avoid mismatches with gdbarch_sp_regnum).

This also causes confusion with the AX collect handling, so we also
install ax_pseudo_register routines to handle the cooked SP.

gdb/
2014-04-17  Ulrich Weigand  <uweigand@de.ibm.com>

* spu-tdep.c: Include "dwarf2-frame.h" and "ax.h".
(spu_ax_pseudo_register_collect): New function.
(spu_ax_pseudo_register_push_stack): Likewise.
(spu_dwarf_reg_to_regnum): Likewise.
(spu_gdbarch_init): Install them.  Append DWARF unwinders.

10 years agoUse address_from_register in dwarf2-frame.c:read_addr_from_reg
Ulrich Weigand [Thu, 17 Apr 2014 12:01:39 +0000 (14:01 +0200)]
Use address_from_register in dwarf2-frame.c:read_addr_from_reg

This patch fixes a problem that prevented use of the Dwarf unwinders on SPU,
because dwarf2-frame.c common code did not support the situation where the
stack and/or frame pointer is maintained in a *vector* register.  This is
because read_addr_from_reg is hard-coded to assume that such pointers can
be read from registers via a simple get_frame_register / unpack_pointer
operation.

Now, there *is* a routine address_from_register that calls into the
appropriate tdep routines to handle pointer values in "weird" registers
like on SPU, but it turns out I cannot simply change dwarf2-frame.c to
use address_from_register.  This is because address_from_register uses
value_from_register to create a (temporary) value, and that routine
at some point calls get_frame_id in order to set up that value's
VALUE_FRAME_ID entry.

However, the dwarf2-frame.c read_addr_from_reg routine will be called
during early unwinding (to unwind the frame's CFA), at which point the
frame's ID is not actually known yet!  This would cause an assert.

On the other hand, we may notice that VALUE_FRAME_ID is only needed in the
value returned by value_from_register if that value is later used as an
lvalue.  But this is obviously never done to the temporary value used in
address_from_register.  So, if we could change address_from_register to
not call value_from_register but instead accept constructing a value
that doesn't have VALUE_FRAME_ID set, things should be fine.

To do that, we can change the value_from_register callback to accept
a FRAME_ID instead of a FRAME; the only existing uses of the FRAME
argument were either to extract its frame ID, or its gdbarch.  (To
keep a way of getting at the latter, we also change the callback's
type from "f" to "m".)  Together with the required follow-on changes
in the existing value_from_register implementations (including the
default one), this seems to fix the problem.

As another minor interface cleanup, I've removed the explicit TYPE
argument from address_from_register.  This routine really always
uses a default pointer type, and in the new implementation it -to
some extent- relies on that fact, in that it will now no longer
handle types that require gdbarch_convert_register_p handling.

gdb:
2014-04-17  Ulrich Weigand  <uweigand@de.ibm.com>

* gdbarch.sh (value_from_register): Make class "m" instead of "f".
Replace FRAME argument with FRAME_ID.
* gdbarch.c, gdbarch.h: Regenerate.
* findvar.c (default_value_from_register): Add GDBARCH argument;
replace FRAME by FRAME_ID.  No longer call get_frame_id.
(value_from_register): Update call to gdbarch_value_from_register.
* value.h (default_value_from_register): Update prototype.
* s390-linux-tdep.c (s390_value_from_register): Update interface
and call to default_value_from_register.
* spu-tdep.c (spu_value_from_register): Likewise.

* findvar.c (address_from_register): Remove TYPE argument.
Do not call value_from_register; use gdbarch_value_from_register
with null_frame_id instead.
* value.h (address_from_register): Update prototype.
* dwarf2-frame.c (read_addr_from_reg): Use address_from_register.
* dwarf2loc.c (dwarf_expr_read_addr_from_reg): Update for
address_from_register interface change.

10 years agoDrop prefix from unsupported source path.
Marcus Shawcroft [Thu, 17 Apr 2014 09:52:43 +0000 (10:52 +0100)]
Drop prefix from unsupported source path.

10 years agoFix LTO mismatched TLS reference
Alan Modra [Thu, 17 Apr 2014 03:38:32 +0000 (13:08 +0930)]
Fix LTO mismatched TLS reference

PR 16846
* elflink.c (_bfd_elf_merge_symbol): Ignore TLS mismatch when
current bfd is a plugin.  Don't always set type_change_ok
when old bfd is a plugin.

10 years ago[testsuite] Set target-charset to ascii
Yao Qi [Mon, 24 Mar 2014 03:26:06 +0000 (11:26 +0800)]
[testsuite] Set target-charset to ascii

Hi,
We find gdb.base/printcmds.exp fails a lot on windows host, like this,

 p ctable1[163]
 $204 = 163 '£'
 (gdb) FAIL: gdb.base/printcmds.exp: p ctable1[163]

however, on linux host,

 p ctable1[163]
 $205 = 163 '\243'
 (gdb) PASS: gdb.base/printcmds.exp: p ctable1[163]

The printing related code is in valprint.c:print_wchar,

  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
    && w != LCST ('8')
    && w != LCST ('9'))))
    {
      gdb_wchar_t wchar = w;

      if (w == gdb_btowc (quoter) || w == LCST ('\\'))
obstack_grow_wstr (output, LCST ("\\"));
      obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
    }
  else
   {
      // print W in hex or octal digits
   }

When I debug gdb on different hosts, I find
on windows host, gdb_iswprint (iswprint) returns true if 'w' is 163.
However, on linux host, iswprint returns false if 'w' is 163.  Looks
this difference is caused by the charset.  On Linux host,
the target-charset is ANSI_X3.4-1968, while on windows host, the
target-charset is CP1252.

We can see how target-charset affects the output.  On linux host,

 (gdb) set target-charset ASCII
 (gdb) p ctable1[163]
 $1 = 163 '\243'
 (gdb) set target-charset CP1252
 (gdb) p ctable1[163]
 $2 = 163 '£'

we can print the pound sign too, and it shows target-charset does
affect the output.

This patch is to set target-charset temporarily to ASCII for some
charset-sensitive tests.  Tested on arm-none-eabi and
powerpc-linux-gnu on mingw32 host.  More than one hundred fails are
fixed.

gdb/testsuite:

2014-04-17  Yao Qi  <yao@codesourcery.com>

* lib/gdb.exp (with_target_charset): New proc.
* gdb.base/printcmds.exp (test_print_all_chars): Wrap tests with
with_target_charset.
(test_print_strings): Likewise.
(test_repeat_bytes): Likewise.
* gdb.base/setvar.exp: Set target-charset to ASCII temporarily
for some tests.

10 years agoAutomatic link generation by doxygen
Yao Qi [Thu, 13 Mar 2014 06:07:26 +0000 (14:07 +0800)]
Automatic link generation by doxygen

Nowadays, we have one page on "GDB Types" generated by doxygen, but types
and macros referenced in doc are not linked to their definitions.  This
patch tweaks the comments a little to use doxygen syntax so that these
types and macros are linked their definitions.

Is it OK?

gdb:

2014-04-17  Yao Qi  <yao@codesourcery.com>

* gdbtypes.h: Update comments to link to types and macros'
definitions.

10 years agodaily update
Alan Modra [Thu, 17 Apr 2014 00:01:10 +0000 (09:31 +0930)]
daily update

10 years agoAdd the ChangeLog entry missed in 8000c58e455259951daa4370631aa616b367d1a7.
Siva Chandra [Wed, 16 Apr 2014 22:41:35 +0000 (15:41 -0700)]
Add the ChangeLog entry missed in 8000c58e455259951daa4370631aa616b367d1a7.

10 years agoRemove unused and incorrect macro TYPE_FN_FIELDS.
Siva Chandra [Mon, 14 Apr 2014 13:50:24 +0000 (06:50 -0700)]
Remove unused and incorrect macro TYPE_FN_FIELDS.

* gdbtypes.h: Remove definition of the macro TYPE_FN_FIELDS.

10 years agoPR gdb/15827
Keith Seitz [Wed, 16 Apr 2014 21:39:10 +0000 (14:39 -0700)]
PR gdb/15827

Install some sanity checks that sibling DIE offsets are not beyond the
defined limits of the DWARF input buffer in read_partial_die and skip_one_die.

2014-03-20  Keith Seitz  <keiths@redhat.com>

PR gdb/15827
* dwarf2read.c (skip_one_die): Check that all relative-offset
sibling DIEs fall within range of the current reader's buffer.
(read_partial_die): Likewise.

2014-03-20  Keith Seitz  <keiths@redhat.com>

PR gdb/15827
* gdb.dwarf2/corrupt.c: New file.
* gdb.dwarf2/corrupt.exp: New file.

10 years agoPR c++/16597
Keith Seitz [Wed, 16 Apr 2014 21:20:19 +0000 (14:20 -0700)]
PR c++/16597

[forgot to commit/push these with previous push]

If lookup_symbol_file tries to locate a member variable with NULL name:

      /* A simple lookup failed.  Check if the symbol was defined in
         a base class.  */

      cleanup = make_cleanup (null_cleanup, NULL);

      /* Find the name of the class and the name of the method,
         variable, etc.  */
      prefix_len = cp_entire_prefix_len (name);

      /* If no prefix was found, search "this".  */
      if (prefix_len == 0)
        {
          struct type *type;
          struct symbol *this;

         this = lookup_language_this (language_def (language_cplus), block);
          if (this == NULL)
            {
              do_cleanups (cleanup);
              return NULL;
            }

          type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
          klass = xstrdup (TYPE_NAME (type));
          nested = xstrdup (name);
        }

TYPE_NAME (type) is NULL, so xstrdup (NULL) and boom!

This can happen, e.g., with clang++.  See testsuite/gdb.cp/namelessclass.exp
or the bugzilla report.

This patch simply adds a fencepost against this case, allowing the caller
of lookup_symbol_file to search other blocks for the right symbol.