binutils-gdb.git
11 years ago* gdb.python/py-breakpoint.exp: Make tests have unique names.
Doug Evans [Fri, 15 Nov 2013 07:07:55 +0000 (23:07 -0800)]
* gdb.python/py-breakpoint.exp: Make tests have unique names.

11 years ago* gdb.python/py-breakpoint.exp: Reformat for 80 columns.
Doug Evans [Fri, 15 Nov 2013 06:36:19 +0000 (22:36 -0800)]
* gdb.python/py-breakpoint.exp: Reformat for 80 columns.

11 years ago* gdb.python/py-breakpoint.exp: Split up into several functions,
Doug Evans [Fri, 15 Nov 2013 06:23:16 +0000 (22:23 -0800)]
* gdb.python/py-breakpoint.exp: Split up into several functions,
each with their own test prefix.

11 years agoAdd missing ChangeLog for 88b8e63904fda25c029deaf25d7b4e489b351470
Alan Modra [Fri, 15 Nov 2013 05:54:29 +0000 (16:24 +1030)]
Add missing ChangeLog for 88b8e63904fda25c029deaf25d7b4e489b351470

11 years agoFix DW_OP_GNU_regval_type with FP registers
Joel Brobecker [Thu, 31 Oct 2013 05:36:21 +0000 (01:36 -0400)]
Fix DW_OP_GNU_regval_type with FP registers

Consider the following code, compiled at -O2 on ppc-linux:

    procedure Increment (Val : in out Float; Msg : String);

The implementation does not really matter in this case). In our example,
this function is being called from a function with Param_1 set to 99.0.
Trying to break inside that function, and running until reaching that
breakpoint yields:

    (gdb) b increment
    Breakpoint 1 at 0x100014b4: file callee.adb, line 6.
    (gdb) run
    Starting program: /[...]/foo

    Breakpoint 1, callee.increment (val=99.0, val@entry=0.0, msg=...)
        at callee.adb:6
    6             if Val > 200.0 then

The @entry value for parameter "val" is incorrect, it should be 99.0.

The associated call-site parameter DIE looks like this:

        .uleb128 0xc     # (DIE (0x115) DW_TAG_GNU_call_site_parameter)
        .byte   0x2      # DW_AT_location
        .byte   0x90     # DW_OP_regx
        .uleb128 0x21
        .byte   0x3      # DW_AT_GNU_call_site_value
        .byte   0xf5     # DW_OP_GNU_regval_type
        .uleb128 0x3f
        .uleb128 0x25

The DW_AT_GNU_call_site_value uses a DW_OP_GNU_regval_type
operation, referencing register 0x3f=63, which is $f31,
an 8-byte floating register. In that register, the value is
stored using the usual 8-byte float format:

    (gdb) info float
    f31            99.0 (raw 0x4058c00000000000)

The current code evaluating DW_OP_GNU_regval_type operations
currently is (dwarf2expr.c:execute_stack_op):

            result = (ctx->funcs->read_reg) (ctx->baton, reg);
            result_val = value_from_ulongest (address_type, result);
            result_val = value_from_contents (type,
                                              value_contents_all (result_val));

What the ctx->funcs->read_reg function does is read the contents
of the register as if it contained an address. The rest of the code
continues that assumption, thinking it's OK to then use that to
create an address/ulongest struct value, which we then re-type
to the type specified by DW_OP_GNU_regval_type.

We're getting 0.0 above because the read_reg implementations
end up treating the contents of the FP register as an integral,
reading only 4 out of the 8 bytes. Being a big-endian target,
we read the high-order ones, which gives us zero.

This patch fixes the problem by introducing a new callback to
read the contents of a register as a given type, and then adjust
the handling of DW_OP_GNU_regval_type to use that new callback.

gdb/ChangeLog:

        * dwarf2expr.h (struct dwarf_expr_context_funcs) <read_reg>:
        Extend the documentation a bit.
        <get_reg_value>: New field.
        * dwarf2loc.c (dwarf_expr_get_reg_value)
        (needs_frame_get_reg_value): New functions.
        (dwarf_expr_ctx_funcs, needs_frame_ctx_funcs): Add "get_reg_value"
        callback.
        * dwarf2-frame.c (get_reg_value): New function.
        (dwarf2_frame_ctx_funcs): Add "get_reg_value" callback.
        * dwarf2expr.c (execute_stack_op) <DW_OP_GNU_regval_type>:
        Use new callback to compute result_val.

gdb/testsuite/ChangeLog:

        * gdb.ada/O2_float_param: New testcase.

11 years agoFixes to powerpc64 gold ELFv2 support
Alan Modra [Fri, 15 Nov 2013 00:06:34 +0000 (10:36 +1030)]
Fixes to powerpc64 gold ELFv2 support

* powerpc.cc (Target_powerpc::glink_section): Provide non-const
accessor.
(Target_powerpc::Branch_info::make_stub): Make global entry stubs.
Only call ppc64_local_entry_offset for 64-bit.  Restrict
symval_for_branch lookup to ELFv1.
(Stub_table::add_plt_call_entry): Use unsigned int off.
(Output_data_glink::Address, invalid_address): New.
(Output_data_glink::add_eh_frame): Move out of line.  Add
support for ELFv2.
(Output_data_glink::add_global_entry, find_global_entry,
global_entry_address): New functions.
(Output_data_glink::global_entry_stubs_, end_branch_table_,
ge_size): New variables.
(Output_data_glink::set_final_data_size): Add global entry
stub sizing.
(Output_data_glink::do_write): Write global entry stubs.
(Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
parameter.  Return true for ELFv2.  Adjust callers.
(Target_powerpc::Scan::local, global): Restrict opd lookup to
ELFv1.  Similarly for ifunc and dynamic relocation processing
specific to ELFv1.  Recognize that symbols are defined on
their plt entries for ELFv2.
(Target_powerpc::symval_for_branch): Assert if called for
ELFv2 or ppc32.
(Target_powerpc::Relocate::relocate): Use global entry plt
stub for symbol value if such exists on ELFv2.
(Target_powerpc::Relocate::relocate): Don't call
symval_for_branch when ELFv2.  Do adjust for local entry
offset when ELFv2.
(Target_powerpc::do_dynsym_value): Set symbols to global entry
plt stub for ELFv2.
(Target_powerpc::do_plt_address_for_global): Similarly.

11 years agoPowerPC64 ELFv2 trampoline match
Alan Modra [Mon, 11 Nov 2013 03:44:40 +0000 (14:14 +1030)]
PowerPC64 ELFv2 trampoline match

ELFv2 needs different plt call stubs to ELFv1, register usage differs
too.  When I added these to ld I changed register usage in the ELFv1
stubs as well, simplifying the linker code and (perhaps) future
maintenance.  All well and good, but this means gdb needs to cope with
more stub variants.  This patch also handles skipping over addis/addi
setting up r2 in ELFv2 global entry code.  We want breakpoints to be
set past this point to catch calls via the local entry point.

* ppc64-tdep.c (ppc64_plt_entry_point): Renamed from..
(ppc64_desc_entry_point): ..this.  Update comments here and at
call points.
(ppc64_standard_linkage1, ppc64_standard_linkage2,
ppc64_standard_linkage3): Update comments.
(ppc64_standard_linkage4, ppc64_standard_linkage5,
(ppc64_standard_linkage6, ppc64_standard_linkage7): New insn
patterns.
(ppc64_standard_linkage4_target): New function.
(ppc64_skip_trampoline_code): Skip ELFv2 patterns too.
* rs6000-tdep.c (skip_prologue): Skip ELFv2 r2 setup.  Correct
nop match.  Fix comment wrap.

11 years agodaily update
Alan Modra [Thu, 14 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agoprint summary from "make check"
Tom Tromey [Wed, 6 Nov 2013 19:24:21 +0000 (12:24 -0700)]
print summary from "make check"

Pedro pointed out that it is handy for "make check" to print a summary
of the results.  This happens in the check-single case and also if you
invoke runtest by hand.

This patch implements the same thing for check-parallel.

2013-11-14  Tom Tromey  <tromey@redhat.com>

* Makefile.in (check-parallel): Print summary from gdb.sum.

11 years agoRevert "Fix race condition while building EH frame header."
Cary Coutant [Thu, 14 Nov 2013 21:15:06 +0000 (13:15 -0800)]
Revert "Fix race condition while building EH frame header."

This reverts commit 7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20.

11 years agofix grammar oddity in the manual
Tom Tromey [Thu, 14 Nov 2013 21:03:06 +0000 (14:03 -0700)]
fix grammar oddity in the manual

This patch fixes a buglet in the manual.
It's wrong to say that a method is defined "as" a subclass.
Instead it should say that a method is defined "in" a subclass.

I'm checking this in under the obvious rule.

2013-11-14  Tom Tromey  <tromey@redhat.com>

* gdb.texinfo (Breakpoints In Python): Replace "as" with "in".

11 years agoinfrun.c:handle_signal_stop: Move initial connection/attachment handling code earlier.
Pedro Alves [Thu, 14 Nov 2013 19:43:27 +0000 (19:43 +0000)]
infrun.c:handle_signal_stop: Move initial connection/attachment handling code earlier.

Before all this stop_soon handling, we have code that can end in
keep_going.  Particularly, the thread_hop_needed code looked
suspicious considering breakpoint always-inserted mode, though on
closer inspection, it'd take connecting to multiple remote targets
that shared the same address space to trigger that.

Still, I think it's clearer if all this remote connection setup /
attach code is placed early, before any keep_going path could be
reached.

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* infrun.c (handle_signal_stop): Move STOP_QUIETLY,
STOP_QUIETLY_REMOTE and 'stop_after_trap' handling earlier.

11 years agoinfrun.c: Split handle_inferior_event further.
Pedro Alves [Thu, 14 Nov 2013 19:43:27 +0000 (19:43 +0000)]
infrun.c: Split handle_inferior_event further.

After the previous patches, we only ever reach the code after the
initial 'switch (ecs->ws.kind)' switch for TARGET_WAITKIND_STOPPED.
We can now factor out all that to its own function.

Unfortunately, stepped_after_stopped_by_watchpoint needed to move to
the ecs.  I think that indicates a state machine bug -- no event other
than TARGET_WAITKIND_STOPPED indicates a single-step actually
finished.  TARGET_WAITKIND_SYSCALL_XXX, TARGET_WAITKIND_FORK, etc. are
all events that are triggered from the kernel, _within_ a syscall,
IOW, from userspace's perspective, halfway through an instruction
being executed.  This might actually matter for the syscall events, as
syscalls can change memory (and thus trigger watchpoints).

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* infrun.c (struct execution_control_state)
<stepped_after_stopped_by_watchpoint>: New field.
(get_inferior_stop_soon): New function.
(handle_inferior_event): 'stepped_after_stopped_by_watchpoint' was
moved to struct execution_control_state -- adjust.  Use
get_inferior_stop_soon.  Split TARGET_WAITKIND_STOPPED handling to
new function.
(handle_signal_stop): New function, factored out from
handle_inferior_event.

11 years agoEliminate enum bpstat_signal_value, simplify random signal checks further.
Pedro Alves [Thu, 14 Nov 2013 19:43:27 +0000 (19:43 +0000)]
Eliminate enum bpstat_signal_value, simplify random signal checks further.

After the previous patch, there's actually no breakpoint type that
returns BPSTAT_SIGNAL_HIDE, so we can go back to having
bpstat_explains_signal return a boolean.  The signal hiding actually
disappears.

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* break-catch-sig.c (signal_catchpoint_explains_signal): Adjust to
return a boolean.
* breakpoint.c (bpstat_explains_signal): Adjust to return a
boolean.
(explains_signal_watchpoint, base_breakpoint_explains_signal):
Adjust to return a boolean.
* breakpoint.h (enum bpstat_signal_value): Delete.
(struct breakpoint_ops) <explains_signal>: New returns a boolean.
(bpstat_explains_signal): Likewise.
* infrun.c (handle_inferior_event) <random signal checks>:
bpstat_explains_signal now returns a boolean - adjust.  No longer
consider hiding signals.

11 years agoinfrun.c:handle_inferior_event: Rework random signal checks.
Pedro Alves [Thu, 14 Nov 2013 19:43:26 +0000 (19:43 +0000)]
infrun.c:handle_inferior_event: Rework random signal checks.

Looking at the current random signal checks:

  if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
    random_signal
      = !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
   GDB_SIGNAL_TRAP)
   != BPSTAT_SIGNAL_NO)
  || stopped_by_watchpoint
  || ecs->event_thread->control.trap_expected
  || (ecs->event_thread->control.step_range_end
      && (ecs->event_thread->control.step_resume_breakpoint
  == NULL)));
  else
    {
      enum bpstat_signal_value sval;

      sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
     ecs->event_thread->suspend.stop_signal);
      random_signal = (sval == BPSTAT_SIGNAL_NO);

      if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
    }

We can observe:

  - the stepping checks bit:

          ...
  || ecs->event_thread->control.trap_expected
  || (ecs->event_thread->control.step_range_end
      && (ecs->event_thread->control.step_resume_breakpoint
  == NULL)));
          ...

    is just like currently_stepping:

     static int
     currently_stepping (struct thread_info *tp)
     {
       return ((tp->control.step_range_end
                && tp->control.step_resume_breakpoint == NULL)
               || tp->control.trap_expected
               || bpstat_should_step ());
     }

    except it misses the bpstat_should_step check (***).

    It's not really necessary to check bpstat_should_step in the
    random signal tests, because software watchpoints always end up in
    the bpstat list anyway, which means bpstat_explains_signal with
    GDB_SIGNAL_TRAP always returns at least BPSSTAT_SIGNAL_HIDE, but I
    think the code is clearer if we reuse currently_stepping.

    *** - bpstat_should_step checks to see if there's any software
    watchpoint in the breakpoint list, because we need to force the
    target to single-step all the way, to evaluate the watchpoint's
    value at each step.

  - we never hide GDB_SIGNAL_TRAP, even if the bpstat returns
    BPSTAT_SIGNAL_HIDE, which is actually the default for all
    breakpoints.  If we make the default be BPSTAT_SIGNAL_PASS, then
    we can merge the two bpstat_explains_signal paths.

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* breakpoint.c (bpstat_explains_signal) <Moribund locations>:
Return BPSTAT_SIGNAL_PASS instead of BPSTAT_SIGNAL_HIDE.
(explains_signal_watchpoint): Return BPSTAT_SIGNAL_PASS instead of
BPSTAT_SIGNAL_HIDE.
(base_breakpoint_explains_signal): Return BPSTAT_SIGNAL_PASS
instead of BPSTAT_SIGNAL_HIDE.
* infrun.c (handle_inferior_event): Rework random signal checks.

11 years agoinfrun.c: Don't set ecs->random_signal for "catchpoint" events (eliminate ecs->random...
Pedro Alves [Thu, 14 Nov 2013 19:43:26 +0000 (19:43 +0000)]
infrun.c: Don't set ecs->random_signal for "catchpoint" events (eliminate ecs->random_signal).

This goes a step forward in making only TARGET_WAITKIND_STOPPED talk
about signals.

There's no reason for the "catchpoint" TARGET_WAITKIND_XXXs to consult
bpstat about signals -- unlike breakpoints, all these events are
continuable, so we don't need to do a remove-break/step/reinsert-break
-like dance.  That means we don't actually need to run them through
process_event_stop_test (for the bpstat_what checks), and can just use
bpstat_causes_stop instead.  Note we were already using it in the
TARGET_WAITKIND_(V)FORKED cases.

Then, these "catchpoint" waitkinds don't need to set
ecs->random_signal for anything, because they check it immediately
afterwards (and the value they set is never used again).

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* infrun.c (struct execution_control_state): Remove
'random_signal' field.
(handle_syscall_event): Use bpstat_causes_stop instead of
bpstat_explains_signal.  Don't set ecs->random_signal.
(handle_inferior_event): New 'random_signal' local.
<TARGET_WAITKIND_FORKED, TARGET_WAITKIND_VFORKED,
TARGET_WAITKIND_EXECD>: Use bpstat_causes_stop instead of
bpstat_explains_signal.  Don't set ecs->random_signal.
<TARGET_WAITKIND_STOPPED>: Adjust to use local instead of
ecs->random_signal.

11 years agoinfrun.c:handle_inferior_event: Move comment.
Pedro Alves [Thu, 14 Nov 2013 19:43:25 +0000 (19:43 +0000)]
infrun.c:handle_inferior_event: Move comment.

This comment applies to the whole handle_inferior_event flow, top to
bottom.  Best move it to the function's intro.

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* infrun.c (handle_inferior_event): Move comment from the
function's body to the function's description, adjusted.

11 years agoinfrun.c:handle_inferior_event: Don't fall through in TARGET_WAITKIND_LOADED handling.
Pedro Alves [Thu, 14 Nov 2013 19:43:25 +0000 (19:43 +0000)]
infrun.c:handle_inferior_event: Don't fall through in TARGET_WAITKIND_LOADED handling.

Of all the TARGET_WAITKIND_XXXs event kinds other than
TARGET_WAITKIND_STOPPED, TARGET_WAITKIND_LOADED is the only kind that
doesn't end in a return, instead falling through to all the
signal/breakpoint/stepping handling code.  But it only falls through
in the STOP_QUIETLY_NO_SIGSTOP and STOP_QUIETLY_REMOTE cases, which
means the

  /* This is originated from start_remote(), start_inferior() and
     shared libraries hook functions.  */
  if (stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_REMOTE)
    {
      if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n");
      stop_stepping (ecs);
      return;
    }

bit is eventually reached.  All tests before that is reached will
always fail.  It's simpler to inline the stop_soon checks close to the
TARGET_WAITKIND_LOADED code, which allows removing the fall through.

Tested on x86_64 Fedora 17, but that doesn't exercise this
TARGET_WAITKIND_LOADED.

Also ran gdb.base/solib-disc.exp on Cygwin/gdbserver, which exercises
reconnection while the inferior is stopped at an solib event, but then
again, gdbserver always replies a regular trap on initial connection,
instead of the last event the program had seen:

 Sending packet: $?#3f...Packet received: T0505:4ca72800;04:f8a62800;08:62fcc877;thread:d28;
 Sending packet: $Hc-1#09...Packet received: E01
 Sending packet: $qAttached#8f...Packet received: 0
 Packet qAttached (query-attached) is supported
 infrun: clear_proceed_status_thread (Thread 3368)
 Sending packet: $qOffsets#4b...Packet received:
 infrun: wait_for_inferior ()
 infrun: target_wait (-1, status) =
 infrun:   42000 [Thread 3368],
 infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_STOPPED
 infrun: stop_pc = 0x77c8fc62
 infrun: quietly stopped
 infrun: stop_stepping

So the only way to exercise this would be to hack gdbserver.  I didn't
go that far though.  I'm reasonably confident this is correct.

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* infrun.c (handle_inferior_event) <TARGET_WAITKIND_LOADED>:
Handle STOP_QUIETLY_NO_SIGSTOP and STOP_QUIETLY_REMOTE here.
Assert we never fall through out of the TARGET_WAITKIND_LOADED
case.

11 years agoAdd --verify-only option to DWP.
Cary Coutant [Tue, 14 May 2013 21:19:08 +0000 (14:19 -0700)]
Add --verify-only option to DWP.

gold/
* dwp.cc (Dwo_file_entry): New type.
(File_list): Use Dwo_file_entry.
(Dwo_file::verify): New function.
(Dwo_file::verify_dwo_list): New function.
(Dwo_file::sized_verify_dwo_list): New function.
(Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
list.
(Dwp_options): New enum type.
(dwp_options): Add --verify-only.
(usage): Likewise.
(main): Likewise.
* dwp.h (gold_info): Add declaration.

11 years agoFix race condition while building EH frame header.
Cary Coutant [Fri, 11 Oct 2013 21:12:16 +0000 (14:12 -0700)]
Fix race condition while building EH frame header.

gold/
PR gold/14860
* ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
(Ehframe_hdr::set_final_data_size): Allocate a Lock.
* ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
updating fde_offsets_.
(Eh_frame_hdr::lock_): New data member.

11 years agooff-by-one fix for py-linetable.c
Tom Tromey [Thu, 14 Nov 2013 18:09:14 +0000 (11:09 -0700)]
off-by-one fix for py-linetable.c

While digging into a different memory corruption error, I happened to
notice one coming from the linetable code.  In a couple of spots, the
wrong termination condition was used in a loop, leading gdb to read
one element past the end of the linetable.

Built and regtested on x86-64 Fedora 18.  Also verified using
valgrind.  I'm checking this in.

2013-11-14  Tom Tromey  <tromey@redhat.com>

* python/py-linetable.c (ltpy_has_line)
(ltpy_get_all_source_lines): Fix loop termination condition.

11 years ago PR ld/16017
Nick Clifton [Thu, 14 Nov 2013 15:39:51 +0000 (15:39 +0000)]
PR ld/16017
* elf32-arm.c (elf32_arm_populate_plt_entry): Return a boolean
value, TRUE for success, FALSE for failure.
Fail if attempting to create a PLT entry for a thumb only target.
(elf32_arm_final_link_relocate): Check result of calling
elf32_arm_populate_plt_entry.
(elf32_arm_finish_dynamic_symbol): Likewise.

11 years agotestsuite/gdb.dwarf2: dw2-case-insensitive.exp: p fuNC_lang fails on arm
Omair Javaid [Thu, 14 Nov 2013 15:16:20 +0000 (15:16 +0000)]
testsuite/gdb.dwarf2: dw2-case-insensitive.exp: p fuNC_lang fails on arm

dw2-case-insensitive.exp: p fuNC_lang fails on arm. The problem occurs
when thumb mode code is generated. On ARM last bit of function pointer
value indicates whether the target function is an ARM (if 0) or Thumb
(if 1) routine. The PC address should refer to actual address in
either case. This patch adds new compile unit and function labels to
code which act as address ranges of compile unit and functions in
debug information. Therefore address ranges will have correct
addresses and not the ones with an incremented least significant bit.
This patch has been tested on x86_64 and arm machines.

gdb/testsuite/ChangeLog:

2013-11-14  Omair Javaid  <Omair.Javaid@linaro.org>

        * gdb.dwarf2/dw2-case-insensitive-debug.S: Updated compile unit
and function label names.
        * gdb.dwarf2/dw2-case-insensitive.c: Created function and
compile unit labels.

11 years ago PR ld/16082
Nick Clifton [Thu, 14 Nov 2013 14:24:34 +0000 (14:24 +0000)]
PR ld/16082
* elf32-hppa.c (elf32_hppa_hide_symbol): Remove old version
information when forcing a symbol to be local.

11 years agoGDB/MI: Add new "--language LANG" command option.
Joel Brobecker [Mon, 11 Nov 2013 05:21:44 +0000 (09:21 +0400)]
GDB/MI: Add new "--language LANG" command option.

Frontend sometimes need to evaluate expressions that are
language-specific. For instance, Eclipse uses the following
expression to determine the size of an address on the target:

    -data-evaluate-expression "sizeof (void*)"

Unfortunately, if the main of the program being debugged is not C,
this may not work. For instance, if the main is in Ada, you get...

    -data-evaluate-expression "sizeof (void*)"
    ^error,msg="No definition of \"sizeof\" in current context."

... and apparently decides to stop the debugging session as a result.
The  recommendation sent was to specifically set the language to C
before trying to evaluate the expression.  Something such as:

    1. save current language
    2. set language c
    3. -data-evaluate-expression "sizeof (void*)"
    4. Restore language

This has the same disadvantages as the ones outlined in the "Context
Management" section of the GDB/MI documentation regarding setting
the current thread or the current frame, thus recommending the use of
general command-line switches such as --frame, or --thread instead.

This patch follows the same steps for the language, adding a similar
new command option: --language LANG. Example of use:

    -data-evaluate-expression --language c "sizeof (void*)"
    ^done,value="4"

gdb/ChangeLog:

        * mi/mi-parse.h (struct mi_parse) <language>: New field.
        * mi/mi-main.c (mi_cmd_execute): Temporarily set language to
        PARSE->LANGUAGE during command execution, if set.
        * mi/mi-parse.c: Add "language.h" #include.
        (mi_parse): Add parsing of "--language" command option.

        * NEWS: Add entry mentioning the new "--language" command option.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-language.exp: New file.

gdb/doc/ChangeLog:

        * gdb.texinfo (Show): Add xref anchor for "show language" command.
        (Context management): Place current subsection text into its own
        subsubsection.  Add new subsubsection describing the "--language"
        command option.

11 years agoNew function cli-utils.c:extract_arg_const
Joel Brobecker [Mon, 11 Nov 2013 05:19:32 +0000 (09:19 +0400)]
New function cli-utils.c:extract_arg_const

This function provides the exact same functionality as extract_arg,
except that it takes a "const char**" instead of a "char **".
It allows us also to re-implement extract_arg almost as a simple
wrapper around the new function.

gdb/ChangeLog:

        Pedro Alves  <palves@redhat.com>
        Joel Brobecker  <brobecker@adacore.com>

        * cli/cli-utils.h (extract_arg_const): Add declaration.
        * cli/cli-utils.c (extract_arg_const): New function.
        (extract_arg): Reimplement using extract_arg_const.

11 years agolanguage.h: Add "symtab.h" #include
Joel Brobecker [Mon, 11 Nov 2013 05:13:57 +0000 (09:13 +0400)]
language.h: Add "symtab.h" #include

In addition to the fact that language.h depends on a number of struct
types declared in symtab.h, language.h also depends on an enumerated
type (domain_enum). So language.h should #include "symtab.h".

gdb/ChangeLog:

        * language.h: Add "symtab.h" #include.

11 years agold/ARM: Fix script-type testsuite failure.
Will Newton [Tue, 12 Nov 2013 11:44:18 +0000 (11:44 +0000)]
ld/ARM: Fix script-type testsuite failure.

Commit 34a79995c4cc34f6f41e2a4b2df477db31b31f0c changed how STT_FILE
symbols were emitted but this testcase got missed in the cleanup.

ld/testsuite/ChangeLog:

2013-11-14  Will Newton  <will.newton@linaro.org>

* ld-arm/script-type.sym: Remove redundant STT_FILE symbol.

11 years ago* breakpoint.c (bpstat_check_breakpoint_conditions): For thread
Doug Evans [Thu, 14 Nov 2013 07:35:18 +0000 (23:35 -0800)]
* breakpoint.c (bpstat_check_breakpoint_conditions): For thread
specific breakpoints, don't evaluate breakpoint condition if
different thread.

11 years agodaily update
Alan Modra [Wed, 13 Nov 2013 23:00:02 +0000 (09:30 +1030)]
daily update

11 years agoFix PR # dyslexia in ChangeLog for previous commit. It should have
Keith Seitz [Wed, 13 Nov 2013 22:19:10 +0000 (14:19 -0800)]
Fix PR # dyslexia in ChangeLog for previous commit. It should have
been for c++/7935 (not 7539).

11 years agoPR c++/7539
Keith Seitz [Wed, 13 Nov 2013 20:33:34 +0000 (12:33 -0800)]
PR c++/7539
PR c++/10541

This patch fixes some namespace alias bugs reported in the above bugs.
Links to all mailing list discussion:

https://sourceware.org/ml/gdb-patches/2013-07/msg00649.html
https://sourceware.org/ml/gdb-patches/2013-09/msg00557.html
https://sourceware.org/ml/gdb-patches/2013-11/msg00156.html

11 years agoFix regressions caused by const-ify linespec patch:
Keith Seitz [Wed, 13 Nov 2013 19:29:22 +0000 (11:29 -0800)]
Fix regressions caused by const-ify linespec patch:
https://sourceware.org/ml/gdb-patches/2013-10/msg00478.html

11 years agofix multi-arch-exec for parallel mode
Tom Tromey [Wed, 13 Nov 2013 17:01:25 +0000 (10:01 -0700)]
fix multi-arch-exec for parallel mode

I noticed today that multi-arch-exec.exp was failing in parallel mode.

The bug is that multi-arch-exec.c assumes the non-parallel directory
layout.

This patch fixes the problem using the same "BASEDIR" approach used in
other tests.

Tested both ways on x86-64 Fedora 18.
I'm checking this in.

2013-11-13  Tom Tromey  <tromey@redhat.com>

* gdb.multi/multi-arch-exec.exp: Define BASEDIR when compiling.
* gdb.multi/multi-arch-exec.c (main): Use BASEDIR.

11 years agobfd/
Yufeng Zhang [Wed, 13 Nov 2013 14:47:04 +0000 (14:47 +0000)]
bfd/

* elfnn-aarch64.c (elfNN_aarch64_howto_table): Use
R_AARCH64_TLS_DTPMOD64 instead of R_AARCH64_TLS_DTPMOD;
likewise for R_AARCH64_TLS_DTPREL and R_AARCH64_TLS_TPREL.

include/elf/

* aarch64.h: Define R_AARCH64_TLS_DTPMOD64,
R_AARCH64_TLS_DTPREL64 and R_AARCH64_TLS_TPREL64; guard
R_AARCH64_TLS_DTPMOD, R_AARCH64_TLS_DTPREL and
R_AARCH64_TLS_TPREL with RELOC_MACROS_GEN_FUNC.

11 years ago * rescoff.c (write_coff_file): Use 64-bit alignment for resource
Nick Clifton [Wed, 13 Nov 2013 12:54:29 +0000 (12:54 +0000)]
* rescoff.c (write_coff_file): Use 64-bit alignment for resource
data.
(coff_res_to_bin): Likewise.

11 years ago* breakpoint.c (breakpoint_cond_eval): Fix and enhance comment.
Doug Evans [Wed, 13 Nov 2013 05:40:41 +0000 (21:40 -0800)]
* breakpoint.c (breakpoint_cond_eval): Fix and enhance comment.

11 years agofix email address in earlier commit
Doug Evans [Wed, 13 Nov 2013 05:39:00 +0000 (21:39 -0800)]
fix email address in earlier commit

11 years agoReplace "info-ada-exceptions" by "ada-exceptions" in -list-features
Joel Brobecker [Tue, 12 Nov 2013 09:43:44 +0000 (13:43 +0400)]
Replace "info-ada-exceptions" by "ada-exceptions" in -list-features

Rather than having -list-features report support for the GDB/MI
commands providing access to Ada exception catchpoints with one entry,
and the GDB/MI command providing the list of Ada exceptions with
a second entry, this patch merges it all within one single entry.
This is OK, because all these commands were added within a short
amount of time, and within the same release cycle; and it reduces
a bit the size of the output.

gdb/ChangeLog:

        * mi/mi-main.c (mi_cmd_list_features): Replace "info-ada-exceptions"
        entry with "ada-exceptions".

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Delete
        the documentation of "info-ada-exceptions" in the output
        of the "-list-features" command.  Add the documentation
        of the "ada-exception" entry instead.

11 years agocrash while re-reading symbols from objfile on ppc-aix.
Joel Brobecker [Tue, 5 Nov 2013 12:01:45 +0000 (07:01 -0500)]
crash while re-reading symbols from objfile on ppc-aix.

This patch aims at fixing the following problem, where the user:

  . debugs its program
  . makes a modification and rebuilds it *without exiting the debugger*
  . returns to its debugging session and restarts the inferior

In that situation, the debugger notices that the underlying executable
has changed and that re-reading its symbols is needed. Shortly after
displaying a message informing the user of the situation, GDB crashes:

   (gdb) run
   [...]
   `/[...]/dest' has changed; re-reading symbols.
   zsh: 13434922 segmentation fault (core dumped)

The crash occurs while trying to allocate some memory on the bfd_bfd
obstack.  But, at some point in time, the whole obstack data gets
corrupted, nullified. So the memory allocation fails trying to call
a function at a NULL address. (side note: when debugging GDB in GDB,
top-gdb reports a SIGILL, while the shell makes it look like it was
a SIGSEGV - the discrepancy is not critical to the investigation
and therefore was not explored)

The corruption occurred because the region where the per_bfd data
got free'ed nearly after it got allocated! This is what happens,
in chronological order (see reread_symbols):

  1. GDB notices that the executable has changed, decides to
     re-read its symbols.

  2. Opens a new bfd, unrefs the old one

  3. Calls set_objfile_per_bfd (objfile);

  4. Re-initializes the objfile's obstack:
     obstack_init (&objfile->objfile_obstack);

I think that the normal behavior for set_objfile_per_bfd would
be to search for already-allocated shared per_bfd data, and
allocate new one if not found.  The critical difference between
a platform such as x86_64-linuxe where it works, and ppc-aix,
where it doesn't lies in the fact that bfd-data sharing is not
activated on ppc-aix, and as a result, the per-bfd data gets
allocated on the objfile's obstack instead of in the bfd objalloc:

      /* If the object requires gdb to do relocations, we simply fall
         back to not sharing data across users.  These cases are rare
         enough that this seems reasonable.  */
      if (abfd != NULL && !gdb_bfd_requires_relocations (abfd))
        {
          storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
          set_bfd_data (abfd, objfiles_bfd_data, storage);
        }
      else
        storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
                                  struct objfile_per_bfd_storage);

Allocating that per_bfd storage is of course nearly useless since
we end up free-ing right after in step (4) above. Eventually,
the memory region ends up being re-used, hence the corruption
leading to the crash.

This fix was simply to move the call to set_objfile_per_bfd after
the objfile's obstack re-initialization.

gdb/ChangeLog:

        * symfile.c (reread_symbols): Move call to set_objfile_per_bfd
        after re-initialization of OBJFILE's obstack.

11 years ago* breakpoint.c (bpstat_check_breakpoint_conditions): Assert
Doug Evans [Wed, 13 Nov 2013 02:23:12 +0000 (18:23 -0800)]
* breakpoint.c (bpstat_check_breakpoint_conditions): Assert
bs->stop != 0 on entry.  Update function comment.  Simplify early
exit for frame mismatch.  Reindent rest of function.

11 years agodaily update
Alan Modra [Tue, 12 Nov 2013 23:00:07 +0000 (09:30 +1030)]
daily update

11 years ago * gdb.base/fileio.exp: Make $dir2 writable after the test is done
Doug Evans [Tue, 12 Nov 2013 22:27:04 +0000 (14:27 -0800)]
* gdb.base/fileio.exp: Make $dir2 writable after the test is done
so that "rm -rf $builddir" Just Works.

11 years agoFix GDB crash with upstream GCC due to qsort(NULL, ...)
Andreas Arnez [Tue, 12 Nov 2013 17:03:54 +0000 (18:03 +0100)]
Fix GDB crash with upstream GCC due to qsort(NULL, ...)

Upstream GCC's new pass '-fisolate-erroneous-paths' may introduce
traps at places where GCC has determined undefined behavior, e.g. when
passing a NULL pointer to a function that defines this argument as
__attribute__(__nonnull__(...)).  In particular this applies to
uniquify_strings(), because it invokes qsort() with NULL when the
'strings' vector is empty.  I hit this problem on s390x when trying to
execute "break main" on a C program.

gdb/
2013-11-12  Andreas Arnez  <arnez@linux.vnet.ibm.com>

* objc-lang.c (uniquify_strings): Prevent invoking qsort with
NULL.

11 years agoWork around gold/15646.
Doug Evans [Tue, 12 Nov 2013 17:43:17 +0000 (09:43 -0800)]
Work around gold/15646.

* dwarf2read.c (read_index_from_section): Update comment.
(struct dw2_symtab_iterator): New member global_seen.
(dw2_symtab_iter_init): Initialize it.
(dw2_symtab_iter_next): Skip duplicate global symbols.
(dw2_expand_symtabs_matching): Ditto.

11 years agoSmall fix (first word of sentence to start with capital letter)
Joel Brobecker [Tue, 12 Nov 2013 03:31:04 +0000 (07:31 +0400)]
Small fix (first word of sentence to start with capital letter)

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Fix the first
        word of a couple of sentences to start with a capital letter.

11 years agoAdd missing ChangeLog entry for a7e332c24b77168bc61d4ee776bf29c831fbbc88
Joel Brobecker [Tue, 12 Nov 2013 03:20:02 +0000 (07:20 +0400)]
Add missing ChangeLog entry for a7e332c24b77168bc61d4ee776bf29c831fbbc88

(Implement GDB/MI equivalent of "info exceptions" CLI command)

11 years agoDocument "info exceptions" and "-info-ada-exception" new commands.
Joel Brobecker [Fri, 8 Nov 2013 10:21:14 +0000 (14:21 +0400)]
Document "info exceptions" and "-info-ada-exception" new commands.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
        (Ada Exceptions): New node.
        (GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
        Commands" node.
        (GDB/MI Ada Exceptions Commands): New node.
        (GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
        field in the output of the "-list-features" command.
        * NEWS: Add entry for the new "info exceptions" CLI command,
        and for the new "-info-ada-exceptions" GDB/MI command.

11 years agoImplement GDB/MI equivalent of "info exceptions" CLI command.
Joel Brobecker [Thu, 7 Nov 2013 13:15:46 +0000 (17:15 +0400)]
Implement GDB/MI equivalent of "info exceptions" CLI command.

This patch implements a new GDB/MI command implementing the equivalent
of the "info exceptions" CLI command.  The command syntax is:

    -info-ada-exceptions [REGEXP]

Here is an example of usage (slightly formatted by hand to make it
easier to read):

    -info-ada-exceptions ions\.a_
    ^done,ada-exceptions=
      {nr_rows="2",nr_cols="2",
       hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
            {width="1",alignment="-1",col_name="address",colhdr="Address"}],
       body=[{name="global_exceptions.a_global_exception",
              address="0x0000000000613a80"},
             {name="global_exceptions.a_private_exception",
              address="0x0000000000613ac0"}]}

Also, in order to allow graphical frontends to easily determine
whether this command is available or not, the output of the
"-list-features" command has been augmented to contain
"info-ada-exceptions".

gdb/Changelog:

        * mi/mi-cmds.h (mi_cmd_info_ada_exceptions): Add declaration.
        * mi/mi-cmds.c (mi_cmds): Add entry for -info-ada-exceptions
        command.
        * mi/mi-cmd-info.c: #include "ada-lang.c" and "arch-utils.c".
        (mi_cmd_info_ada_exceptions): New function.
        * mi/mi-main.c (mi_cmd_list_features): Add "info-ada-exceptions".

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_exc_info: New testcase.

11 years agoAdd command to list Ada exceptions
Joel Brobecker [Thu, 7 Nov 2013 13:40:48 +0000 (17:40 +0400)]
Add command to list Ada exceptions

This patch adds a new command "info exceptions" whose purpose is to
provide the list of exceptions currently defined in the inferior.
The usage is:

    (gdb) info exceptions [REGEXP]

Without argument, the command lists all exceptions.  Otherwise,
only those whose name match REGEXP are listed.

For instance:

    (gdb) info exceptions
    All defined Ada exceptions:
    constraint_error: 0x613dc0
    program_error: 0x613d40
    storage_error: 0x613d00
    tasking_error: 0x613cc0
    global_exceptions.a_global_exception: 0x613a80
    global_exceptions.a_private_exception: 0x613ac0

The name of the command, as well as its output is part of a legacy
I inherited long ago. It's output being parsed by frontends such as
GPS, I cannot easily change it. Same for the command name.

The implementation is mostly self-contained, and is written in a way
that should make it easy to implement the GDB/MI equivalent. The
careful reviewer will notice that the code added in ada-lang.h could
normally be made private inside ada-lang.c.  But these will be used
by the GDB/MI implementation.  Rather than making those private now,
only to move them later, I've made them public right away.

gdb/ChangeLog:

        * ada-lang.h: #include "vec.h".
        (struct ada_exc_info): New.
        (ada_exc_info): New typedef.
        (DEF_VEC_O(ada_exc_info)): New vector.
        (ada_exceptions_list): Add declaration.
        * ada-lang.c (ada_is_exception_sym)
        (ada_is_non_standard_exception_sym, compare_ada_exception_info)
        (sort_remove_dups_ada_exceptions_list)
        (ada_exc_search_name_matches, ada_add_standard_exceptions)
        (ada_add_exceptions_from_frame, ada_add_global_exceptions)
        (ada_exceptions_list_1, ada_exceptions_list)
        (info_exceptions_command): New function.
        (_initialize_ada_language): Add "info exception" command.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc: New testcase.

11 years ago * gdb.arch/arm-bl-branch-dest.exp: Use gdb_test_file_name instead
Doug Evans [Mon, 11 Nov 2013 23:58:06 +0000 (15:58 -0800)]
* gdb.arch/arm-bl-branch-dest.exp: Use gdb_test_file_name instead
of testfile.

11 years agoFix ChangeLog entries from earlier commit.
Catherine Moore [Mon, 11 Nov 2013 23:34:48 +0000 (15:34 -0800)]
Fix ChangeLog entries from earlier commit.

11 years agodaily update
Alan Modra [Mon, 11 Nov 2013 23:00:02 +0000 (09:30 +1030)]
daily update

11 years ago2013-11-11 Phil Muldoon <pmuldoon@redhat.com>
Phil Muldoon [Mon, 11 Nov 2013 19:49:45 +0000 (19:49 +0000)]
2013-11-11  Phil Muldoon  <pmuldoon@redhat.com>

PR python/15629
* NEWS: Add linetable feature.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-linetable entries.
* python/py-linetable.c: New file.
* python/py-symtab.c (stpy_get_linetable): New function.
* python/python-internal.h (symtab_to_linetable_object): Declare.
(gdbpy_initialize_linetable): Ditto.
* python/python.c (_initialize_python): Call
gdbpy_initialize_linetable.

2013-11-11  Phil Muldoon  <pmuldoon@redhat.com>

  * gdb.python/py-linetable.S: New file.
* gdb.python/py-linetable.c: New file.
  * gdb.python/py-linetable.exp: New file.

2013-11-11  Phil Muldoon  <pmuldoon@redhat.com>

* gdb.texinfo (Symbol Tables In Python): Add linetable method entry.
(Line Tables In Python): New node.

11 years ago2013-11-11 Catherine Moore <clm@codesourcery.com>
Catherine Moore [Mon, 11 Nov 2013 16:03:47 +0000 (08:03 -0800)]
2013-11-11  Catherine Moore  <clm@codesourcery.com>

gas/
* config/mips/tc-mips.c (convert_reg_type): Use
INSN_LOAD_MEMORY instead of INSN_LOAD_MEMORY_DELAY.
(reg_needs_delay): Likewise.
(insns_between): Likewise.

include/
* opcode/mips.h (INSN_LOAD_MEMORY_DELAY): Rename to...
(INSN_LOAD_MEMORY): ...this.

opcodes/
* mips-dis.c (print_insn_mips): Use
INSN_LOAD_MEMORY instead of INSN_LOAD_MEMORY_DELAY.
(print_insn_micromips): Likewise.
* mips-opc.c (LDD): Remove.
(CLD): Include INSN_LOAD_MEMORY.
(LM): New.
(mips_builtin_opcodes): Use LM instead of LDD.
        Add LM to load instructions.

11 years agoDandling memory pointers in Ada catchpoints with GDB/MI.
Joel Brobecker [Wed, 30 Oct 2013 10:18:24 +0000 (11:18 +0100)]
Dandling memory pointers in Ada catchpoints with GDB/MI.

When using the GDB/MI commands to insert a catchpoint on a specific
Ada exception, any re-evaluation of that catchpoint (for instance
a re-evaluation performed after a shared library got mapped by the
inferior) fails. For instance, with any Ada program:

    (gdb)
    -catch-exception -e program_error
    ^done,bkptno="1",bkpt={[...]}
    (gdb)
    -exec-run
    =thread-group-started,id="i1",pid="28315"
    =thread-created,id="1",group-id="i1"
    ^running
    *running,thread-id="all"
    (gdb)
    =library-loaded,[...]
    &"warning: failed to reevaluate internal exception condition for catchpoint 1: No definition of \"exec\" in current context.\n"
    &"warning: failed to reevaluate internal exception condition for catchpoint 1: No definition of \"exec\" in current context.\n"
    [...]

The same is true if using an Ada exception catchpoint.

The problem comes from the fact that that we deallocate the strings
given as arguments to create_ada_exception_catchpoint, while the latter
just makes shallow copies of those strings, thus creating dandling
pointers.

This patch fixes the issue by passing freshly allocated strings to
create_ada_exception_catchpoint, while at the same time updating
create_ada_exception_catchpoint's documentation to make it clear
that deallocating the strings is no longer the responsibility of
the caller.

gdb/ChangeLog:

        * ada-lang.c (create_ada_exception_catchpoint): Enhance
        the documentation of fields "except_string" and "condition".
        * mi/mi-cmd-catch.c (mi_cmd_catch_assert): Reallocate
        CONDITION on the heap before passing it to
        create_ada_exception_catchpoint.
        (mi_cmd_catch_exception): Likewise for EXCEPTION_NAME and
        CONDITION.

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_ex_cond: New testcase.

Tested on x86_64-linux.  The "-break-list" test FAILs without
this patch.

11 years agofix "tkill" check
Tom Tromey [Mon, 11 Nov 2013 14:35:57 +0000 (07:35 -0700)]
fix "tkill" check

An earlier patch removed the check for "syscall" since the results
were not used in the C code.  However, the result was used, via the
cache variable, elsewhere in configure.

This patch fixes the problem by checking for "syscall" at the point at
which HAVE_TKILL_SYSCALL is defined.

2013-11-11  Tom Tromey  <tromey@redhat.com>

* config.in, configure: Rebuild.
* configure.ac (HAVE_TKILL_SYSCALL): Check for "syscall".

11 years agoMinor reformatting in remote-sim.c (gdbsim_detach declaration).
Joel Brobecker [Mon, 11 Nov 2013 14:13:40 +0000 (18:13 +0400)]
Minor reformatting in remote-sim.c (gdbsim_detach declaration).

gdb/ChangeLog:

        * remote-sim.c (gdbsim_detach): Break declaration into
        shorter lines.  No code change.

11 years agoFix argument type on gdbsim_detach prototype.
Edjunior Barbosa Machado [Mon, 11 Nov 2013 13:00:14 +0000 (07:00 -0600)]
Fix argument type on gdbsim_detach prototype.

2013-11-11  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* remote-sim.c (gdbsim_detach): Fix prototype.

11 years ago * elfxx-aarch64.c (_bfd_aarch64_elf_grok_prstatus): Fix hard-coded
Yufeng Zhang [Mon, 11 Nov 2013 10:26:41 +0000 (10:26 +0000)]
* elfxx-aarch64.c (_bfd_aarch64_elf_grok_prstatus): Fix hard-coded
size of struct elf_prstatus.

11 years ago2013-11-08 Jan-Benedict Glaw <jbglaw@lug-owl.de
Jan-Benedict Glaw [Mon, 11 Nov 2013 08:35:51 +0000 (09:35 +0100)]
2013-11-08  Jan-Benedict Glaw  <jbglaw@lug-owl.de

* config/tc-ppc.c (ppc_elf_localentry): Add cast.

[BR]: https://sourceware.org/ml/binutils/2013-11/msg00064.html

11 years agoPowerPC64 ELFv2, allocate dynreloc space for ifunc
Alan Modra [Mon, 11 Nov 2013 03:16:26 +0000 (13:46 +1030)]
PowerPC64 ELFv2, allocate dynreloc space for ifunc

* elf64-ppc.c (allocate_dynrelocs): Revert 2013-11-04 change.

11 years agoCorrect elf64-ppc.c handling of protected symbols
Alan Modra [Tue, 5 Nov 2013 23:50:52 +0000 (10:20 +1030)]
Correct elf64-ppc.c handling of protected symbols

Some places in elf64-ppc.c carelessly used SYMBOL_CALLS_LOCAL when
the proper test is SYMBOL_REFERENCES_LOCAL for cases where we take the
address of a protected symbol.  This works OK for function descriptors
but not for ELFv2.  Setting symbols to their global entry stub a
little earlier is to ensure _bfd_elf_hash_symbol allows such symbols
in .gnu.hash.

* elf64-ppc.c (ppc64_elf_edit_toc): Use SYMBOL_REFERENCES_LOCAL
here, not SYMBOL_CALLS_LOCAL.
(ppc64_elf_relocate_section): Likewise.
(size_global_entry_stubs): Set undefined symbols on their global
entry stubs here..
(build_global_entry_stubs): ..rather than here.
(ppc64_elf_build_stubs): Don't reset glink->size before calling
build_global_entry_stubs.

11 years agodaily update
Alan Modra [Sun, 10 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agodaily update
Alan Modra [Sat, 9 Nov 2013 23:00:02 +0000 (09:30 +1030)]
daily update

11 years agodaily update
Alan Modra [Fri, 8 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agoChange "set debug dwarf2-read" to take a verbosity level.
Doug Evans [Fri, 8 Nov 2013 19:47:08 +0000 (11:47 -0800)]
Change "set debug dwarf2-read" to take a verbosity level.

* dwarf2read.c (dwarf2_read_debug): Change to unsigned int.
(create_debug_types_hash_table): Only print debugging messages for
each TU if dwarf2-read >= 2.
(process_queue): Ditto.
(_initialize_dwarf2_read): Make "set debug dwarf2-read" a zuinteger.
Update doc string.

doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug dwarf2-read".

11 years agoremove unused gdbserver configury
Tom Tromey [Tue, 5 Nov 2013 17:06:21 +0000 (10:06 -0700)]
remove unused gdbserver configury

This updates gdbserver's configure.ac to remove checks that aren't
directly needed by gdbserver.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* configure, config.in: Rebuild.
* configure.ac: Remove unused configury.

11 years agofix a comment in configure.ac
Tom Tromey [Tue, 5 Nov 2013 16:54:13 +0000 (09:54 -0700)]
fix a comment in configure.ac

My grepping around showed that HAVE_MULTIPLE_PROC_FDS is only ever
mentioned in a comment in configure.ac.  Since the macro is long dead,
let's remove the last mention.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* configure: Rebuild.
* configure.ac: Remove mentions of HAVE_MULTIPLE_PROC_FDS.

11 years agogdb configure updates
Tom Tromey [Tue, 5 Nov 2013 16:54:03 +0000 (09:54 -0700)]
gdb configure updates

Now that the configury needed for the "common" and "target"
directories is in common.m4, some code in gdb's configure.ac is
redundant.

I ran this script after making an "ID" file using mkid:

   sed -n 's/^.*\(HAVE_[A-Z0-9_]*\).*$/\1/p' config.in |
   while read x; do
     echo ===== $x
     gid $x | egrep -v '^(testsuite|gnulib|common|target|gdbserver)/'
   done

This finds all the spots using HAVE_ defines, and, more importantly,
makes it clear which defines aren't used in the main parts of gdb.

From this I came up with this patch to remove all the unused bits.

There are a few that are subtly used -- for example the configure
script sometimes checks internal configure cache variables, meaning
some checks cannot be removed.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* configure, config.in: Rebuild.
* configure.ac: Remove unused configury.

11 years agouse gdb_string.h in m32c-tdep.c
Tom Tromey [Tue, 5 Nov 2013 16:48:26 +0000 (09:48 -0700)]
use gdb_string.h in m32c-tdep.c

m32c-tdep.c is the last user of HAVE_STRING_H in gdb proper.  It
really ought to be using gdb_string.h instead, as the rest of gdb
does.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* m32c-tdep.c: Use gdb_string.h.

11 years agoremove link.h checks
Tom Tromey [Tue, 5 Nov 2013 16:45:03 +0000 (09:45 -0700)]
remove link.h checks

The removal of solib-sunos.c also removed the last user of various
macros defined by configure.

This patch removes the corresponding configure code.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* configure, config.in: Rebuild.
* configure.ac: Remove all link.h-related checks.

11 years agointroduce common.m4
Tom Tromey [Wed, 24 Apr 2013 16:45:45 +0000 (10:45 -0600)]
introduce common.m4

It has bothered me for a while that files in common/ use macros
defined via autoconf checks, but rely on each configure.ac doing the
proper checks independently.

This patch introduces common/common.m4 which consolidates the checks
assumed by code in common.

The rule I propose is that if something is needed or used by common,
it should be checked for by common.m4.  However, if the check is also
needed by gdb or gdbserver, then it should be duplicated there.

Built and regtested on x86-64 Fedora 18 (though this is hardly the
most strenuous case) and using the Fedora 18 mingw cross compilers.  I
also examined the config.in diffs to ensure that symbols did not go
missing.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* acinclude.m4: Include common.m4.
* common/common.m4: New file.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* acinclude.m4: Include common.m4, codeset.m4.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.

11 years agoChange "set debug symtab-create" to take a verbosity level.
Doug Evans [Fri, 8 Nov 2013 18:43:23 +0000 (10:43 -0800)]
Change "set debug symtab-create" to take a verbosity level.

* NEWS: Mention that "set debug symtab-create" now accepts a
verbosity level.
* buildsym.c (end_symtab_from_static_block): Call set_symtab_primary
to set the symtab's primary flag.
* jit.c (finalize_symtab): Ditto.
* mdebugread.c (psymtab_to_symtab_1): Ditto.
* symfile.c (allocate_symtab): Only print debugging messages for
symtab_create_debug levels 2 and higher.
* symtab.c (symtab_create_debug): Change type to unsigned int.
(set_symtab_primary): New function.
(_initialize_symtab): Change "set debug symtab-create" to a
zuinteger option.
* symtab.h (set_symtab_primary): Declare.
(symtab_create_debug): Update decl.

doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug symtab-create".

11 years ago* Makefile.in: Regenerate.
tschwinge [Thu, 7 Nov 2013 18:09:31 +0000 (18:09 +0000)]
* Makefile.in: Regenerate.

Follow-up to r204173.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204536 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago* Makefile.tpl: Fix typo. * Makefile.in: Regenerate.
tschwinge [Thu, 7 Nov 2013 15:08:10 +0000 (15:08 +0000)]
* Makefile.tpl: Fix typo. * Makefile.in: Regenerate.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204520 138bc75d-0d04-0410-961f-82ee72b054a4

11 years agoDisable libcilkrts when C++ is not used.
bviyer [Tue, 5 Nov 2013 14:43:37 +0000 (14:43 +0000)]
Disable libcilkrts when C++ is not used.

2013-11-04  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        * configure.ac: Added libcilkrts to noconfig list when C++ is not
        supported.
        * configure: Regenerated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204396 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago/ * Makefile.tpl (STAGE1_CONFIGURE_FLAGS): Pass --disable-build-format-warnings....
jason [Wed, 30 Oct 2013 17:30:05 +0000 (17:30 +0000)]
/ * Makefile.tpl (STAGE1_CONFIGURE_FLAGS): Pass --disable-build-format-warnings. gcc/ * configure.ac (loose_warn): Add -Wno-format if --disable-build-format-warnings.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204217 138bc75d-0d04-0410-961f-82ee72b054a4

11 years agoAdded Cilk runtime library (libcilkrts) into GCC.
bviyer [Tue, 29 Oct 2013 18:37:47 +0000 (18:37 +0000)]
Added Cilk runtime library (libcilkrts) into GCC.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204173 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago2013-10-29 Marc Glisse <marc.glisse@inria.fr>
glisse [Tue, 29 Oct 2013 13:15:48 +0000 (13:15 +0000)]
2013-10-29 Marc Glisse <marc.glisse@inria.fr>

PR tree-optimization/58689
include/
* ansidecl.h (ATTRIBUTE_RETURNS_NONNULL): New macro.
* libiberty.h (basename, lbasename, dos_lbasename, unix_lbasename,
concat_copy): Mark with attributes nonnull(1) and returns_nonnull.
(concat, reconcat, concat_copy2, choose_temp_base, xstrerror,
xmalloc, xrealloc, xcalloc, xstrdup, xstrndup, xmemdup, pex_init):
Mark with attribute returns_nonnull.

libiberty/
* concat.c: Remove note about xmalloc.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204159 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago* testsuite/test-demangle.c: Include unistd.h.
gerald [Sun, 27 Oct 2013 18:35:20 +0000 (18:35 +0000)]
* testsuite/test-demangle.c: Include unistd.h.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204107 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago* Makefile.def (target_modules): Remove libmudflap (languages): Remove check-target...
law [Sat, 26 Oct 2013 10:14:34 +0000 (10:14 +0000)]
* Makefile.def (target_modules): Remove libmudflap (languages): Remove check-target-libmudflap). * Makefile.in: Rebuilt. * Makefile.tpl (check-target-libmudflap-c++): Remove. * configure.ac (target_libraries): Remove target-libmudflap. Remove checks which disabled libmudflap on some systems. * configure: Rebuilt. * libmudflap: Directory removed.

* Makefile.in (C_COMMON_OBJS): Remove tree-mudflap.
(OBJS): Remove tree-nomudflap.o
(GTFILES): Remove tree-mudflap.c
* builtins.c (expand_builtin_alloc): Remove mudflap support.
* gcc.c (MFWRAP_SPEC, MFLIB_SPEC): Likewise.
(mfwrap_spec, mflib_spec): Likewise.
(cpp_unique_options, cc1_options, static_specs): Likewise.
* gimplify (gimplify_vla_decl, build_va_arg_indirect_ref): Likewise.
* passes.def: Likewise.
* toplev.c (compile_file, process_options): Likewise.
* tree-inline.c (copy_tree_r): Likewise.
* tree-pass.,h (make_pass_mudflap_1, make_pass_mudflap_2): Likewise.
* varasm.c (make_decl_rtl, make_decl_rtl_for_debug): Likewise.
(build_constant_desc, output_constant_def_contents): Likewise.
(categorize_decl_for_section): Likewise.
* tree-mudflap.c: Removed.
* tree-mudflap.h: Removed.
* tree-nomudflap.c: Removed.
* bfin/uclinux.h (MFWRAP_SPEC): Remove.
* moxie/uclinux.h (MFWRAP_SPEC): Likewise.
* rs6000/aix.h (MFWRAP_SPEC, MFLIB_SPEC): Likewise.
* config/sol2.h (MFLIB_SPEC): Likewise.
* doc/install.texi: Remove mudflap references.
* doc/passes.texi: Similarly.
* doc/sourcebuild.texi: Similarly.
* doc/invoke.texi: Remove mudlfap related options.

* c-family/c-common.c (c_define_builtins): Remove mudflap support.
* c-family/c.opt: Ignore and warn for mudflap options.

* g++.dg/torture/pr49309.C: Removed.
* gcc.dg/dfp/pr35739.c: Removed.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204090 138bc75d-0d04-0410-961f-82ee72b054a4

11 years agolibiberty/ 2013-10-25 Gary Benson <gbenson@redhat.com>
gary [Fri, 25 Oct 2013 13:56:51 +0000 (13:56 +0000)]
libiberty/ 2013-10-25 Gary Benson <gbenson@redhat.com>

* cp-demangle.c (struct d_saved_scope): New structure.
(struct d_print_info): New fields saved_scopes and
num_saved_scopes.
(d_print_init): Initialize the above.
(d_print_free): New function.
(cplus_demangle_print_callback): Call the above.
(d_copy_templates): New function.
(d_print_comp): New variables saved_templates and
need_template_restore.
[DEMANGLE_COMPONENT_REFERENCE,
DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
time the component is traversed, and use the captured scope for
subsequent traversals.
* testsuite/demangle-expected: Add regression test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204068 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago* testsuite/test-expandargv.c: Include unistd.h.
gerald [Wed, 23 Oct 2013 21:31:45 +0000 (21:31 +0000)]
* testsuite/test-expandargv.c: Include unistd.h.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203993 138bc75d-0d04-0410-961f-82ee72b054a4

11 years agoFix up ChangeLog entries (name, e-mail, formatting, otherwise).
gerald [Wed, 23 Oct 2013 21:30:54 +0000 (21:30 +0000)]
Fix up ChangeLog entries (name, e-mail, formatting, otherwise).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203992 138bc75d-0d04-0410-961f-82ee72b054a4

11 years ago2013-10-22 Sterling Augustine <saugustine@google.com>
sterling [Tue, 22 Oct 2013 18:12:28 +0000 (18:12 +0000)]
2013-10-22 Sterling Augustine <saugustine@google.com>

* gdb/gdb-index.h: Merge from gdb tree.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203931 138bc75d-0d04-0410-961f-82ee72b054a4

11 years agoRemove CpuNop from CPU_K6_2_FLAGS
H.J. Lu [Fri, 8 Nov 2013 17:42:08 +0000 (09:42 -0800)]
Remove CpuNop from CPU_K6_2_FLAGS

PR gas/16140
* i386-gen.c (cpu_flag_init): Remove CpuNop from CPU_K6_2_FLAGS.
* i386-init.h: Regenerated.

11 years agoRemove strayed entry
H.J. Lu [Fri, 8 Nov 2013 16:46:07 +0000 (08:46 -0800)]
Remove strayed entry

11 years agoconstify to_detach
Tom Tromey [Tue, 19 Mar 2013 15:23:17 +0000 (09:23 -0600)]
constify to_detach

This patch constifies the target_ops method to_detach.

This is a small cleanup, but also, I think, a bug-prevention fix,
since gdb already acts as if the "args" argument here was const.

In particular, top.c:quit_force calls kill_or_detach via
iterate_over_inferiors.  kill_or_detach calls target_detach, passing
the same argument each time.  So, if one of these methods was not
const-correct, then kill_or_detach would change its behavior in a
strange way.

I could not build every target I modified in this patch.  I've
inspected them all by hand, though.  Many targets do not use the
"args" parameter; a couple pass it to atoi; and a few pass it on to
the to_detach method of the target beneath.  The only code that
required a real change was in linux-nat.c, and that only needed the
introduction of a temporary variable for const-correctness.

2013-11-08  Tom Tromey  <tromey@redhat.com>

* aix-thread.c (aix_thread_detach): Update.
* corelow.c (core_detach): Update.
* darwin-nat.c (darwin_detach): Update.
* dec-thread.c (dec_thread_detach): Update.
* gnu-nat.c (gnu_detach): Update.
* go32-nat.c (go32_detach): Update.
* inf-ptrace.c (inf_ptrace_detach): Update.
* inf-ttrace.c (inf_ttrace_detach): Update.
* linux-fork.c (linux_fork_detach): Update.
* linux-fork.h (linux_fork_detach): Update.
* linux-nat.c (linux_nat_detach): Update.  Introduce "tem"
local for const-correctness.
* linux-thread-db.c (thread_db_detach): Update.
* monitor.c (monitor_detach): Update.
* nto-procfs.c (procfs_detach): Update.
* procfs.c (procfs_detach): Update.
* record.c (record_detach): Update.
* record.h (record_detach): Update.
* remote-m32r-sdi.c (m32r_detach): Update.
* remote-mips.c (mips_detach): Update.
* remote-sim.c (gdbsim_detach): Update.
* remote.c (remote_detach_1, remote_detach)
(extended_remote_detach): Update.
* sol-thread.c (sol_thread_detach): Update.
* target.c (target_detach): Make "args" const.
(init_dummy_target): Update.
* target.h (struct target_ops) <to_detach>: Make argument const.
(target_detach): Likewise.
* windows-nat.c (windows_detach): Update.

11 years agoFix email address in earlier entry.
Doug Evans [Fri, 8 Nov 2013 07:27:58 +0000 (23:27 -0800)]
Fix email address in earlier entry.

11 years agoPR 11786
Doug Evans [Fri, 8 Nov 2013 00:43:39 +0000 (16:43 -0800)]
PR 11786
*  solib-svr4.c (svr4_exec_displacement): Ignore filesz, memsz, flags
and align fields for PT_GNU_RELRO segments.

testsuite/
* gdb.base/gcore-relro-pie.c: New file.
* gdb.base/gcore-relro-pie.exp: New file.

11 years ago Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes.
Doug Evans [Thu, 7 Nov 2013 22:58:41 +0000 (14:58 -0800)]
Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes.
* dwarf.c (get_gdb_index_symbol_kind_name): New function.
(display_debug_pubnames_worker): Renamed from display_debug_pubnames.
Add support for .debug_gnu_pubnames, .debug_gnu_pubtypes.
(display_debug_pubnames, display_debug_pubnames_gnu): New functions.
(display_gdb_index): Redo printing of symbol kind.
(debug_displays): Add .debug_gnu_pubnames, .debug_gnu_pubtypes.
* dwarf.h (dwarf_section_display_enum): Add gnu_pubnames, gnu_pubtypes.
* readelf.c (process_section_headers): Add gnu_pubnames, gnu_pubtypes.

11 years agodaily update
Alan Modra [Thu, 7 Nov 2013 23:00:01 +0000 (09:30 +1030)]
daily update

11 years agoSet CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets
Roland McGrath [Wed, 6 Nov 2013 22:47:05 +0000 (14:47 -0800)]
Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets

bfd/
* archures.c (bfd_mach_i386_nacl): Fix definition so it doesn't
collide with bfd_mach_l1om.
* bfd-in2.h: Regenerate.

* elf32-i386.c (elf32_i386_nacl_elf_object_p): New function.
(elf_backend_object_p): Use that in elf32-i386-nacl definition.
* elf64-x86-64.c (elf64_x86_64_nacl_elf_object_p): New function.
(elf_backend_object_p): Use that in elf64-x86-64-nacl definition.
(elf32_x86_64_nacl_elf_object_p): New function.
(elf_backend_object_p): Use that in elf32-x86-64-nacl definition.

binutils/
* objdump.c (dump_dwarf): Grok bfd_mach_x86_64_nacl and
bfd_mach_x64_32_nacl as equivalent to bfd_mach_x86_64.

ld/testsuite/
* ld-x86-64/x86-64.exp (mixed1, mixed2): Loosen error string match
so it accepts "i386:nacl" in place of "i386".
* ld-x86-64/ilp32-2.d: Likewise.
* ld-x86-64/ilp32-3.d: Likewise.
* ld-x86-64/lp64-2.d: Likewise.
* ld-x86-64/lp64-3.d: Likewise.

11 years agosim/ChangeLog: Correct bug number in previous commit.
Will Newton [Thu, 7 Nov 2013 16:14:51 +0000 (16:14 +0000)]
sim/ChangeLog: Correct bug number in previous commit.

11 years agosim/arm: Prevent crash when running sim with no binary.
Will Newton [Tue, 29 Oct 2013 16:43:07 +0000 (09:43 -0700)]
sim/arm: Prevent crash when running sim with no binary.

2013-11-07  Will Newton  <will.newton@linaro.org>

PR gdb/15508
* arm/wrapper.c (sim_create_inferior): Call init before
accessing STATE.

11 years agosim/arm: Prevent NULL pointer dereference in sim_create_inferior.
Will Newton [Tue, 29 Oct 2013 16:20:48 +0000 (09:20 -0700)]
sim/arm: Prevent NULL pointer dereference in sim_create_inferior.

2013-11-07  Will Newton  <will.newton@linaro.org>

PR gdb/9195
* arm/wrapper.c (sim_create_inferior): Avoid calling
bfd_get_mach with a NULL bfd.

11 years ago2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
Phil Muldoon [Thu, 7 Nov 2013 13:08:40 +0000 (13:08 +0000)]
2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

      * ChangeLog: Fix blank lines between entry and PR.

11 years ago2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
Phil Muldoon [Thu, 7 Nov 2013 12:32:31 +0000 (12:32 +0000)]
2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/15747
        * python/py-cmd.c: Add COMPLETE_EXPRESSION constant.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

        * gdb.python/py-cmd.exp: Add COMPLETE_EXPRESSION tests.
        * gdb.python/py-cmd.c: New File.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

        * gdb.texinfo (Commands In Python): Document COMPLETE_EXPRESSION
        constant.

11 years ago2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
Phil Muldoon [Thu, 7 Nov 2013 12:04:45 +0000 (12:04 +0000)]
2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

* python/py-breakpoint.c (bppy_get_temporary): New function.
(bppy_init): New keyword: temporary. Parse it and set breakpoint
to temporary if True.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

* gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

* gdb.texinfo (Breakpoints In Python): Document temporary
option in breakpoint constructor, and add documentation to the
temporary attribute.