]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
10 years agoPatch for PR binutils/16664 which triggers a seg-fault when attempting to
Nick Clifton [Thu, 6 Mar 2014 10:57:13 +0000 (10:57 +0000)] 
Patch for PR binutils/16664 which triggers a seg-fault when attempting to
display the contents of a corrupt attribute section.

* readelf.c (process_attributes): Add checks for corrupt
attribute section names.

* elf-attrs.c (_bfd_elf_parse_attributes): Add checks for corrupt
attribute section names.

10 years agoRemove argument optional_p from get_tracepoint_by_number
Yao Qi [Sat, 22 Feb 2014 05:53:37 +0000 (13:53 +0800)] 
Remove argument optional_p from get_tracepoint_by_number

This patch is to remove parameter optional_p as it is always true,
in order to simplify get_tracepoint_by_number.

'optional_p' was added by this change,

1999-11-18  Tom Tromey  <tromey@cygnus.com>

* tracepoint.h (get_tracepoint_by_number): Updated
declaration.
* tracepoint.c (trace_pass_command): Better error message.
Fixed logic when `all' not specified.
(get_tracepoint_by_number): Added `optional_p' argument.  Fixed
all callers.

but after this patch,

 FYI: remove `static's from cli-utils.c
 https://sourceware.org/ml/gdb-patches/2011-03/msg00636.html

'optional_p' passed to get_tracepoint_by_number become always true.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* breakpoint.c (get_tracepoint_by_number): Remove argument
optional_p.  All callers updated.  Adjust comments.  Update
output message.
* breakpoint.h (get_tracepoint_by_number): Update declaration.

10 years agoHandle parse number error in goto_bookmark_command
Yao Qi [Sat, 22 Feb 2014 06:42:12 +0000 (14:42 +0800)] 
Handle parse number error in goto_bookmark_command

In GDB mainline, the error message for goto-bookmark
isn't perfect.

 (gdb) goto-bookmark 1.1
 goto-bookmark: no bookmark found for ''.

This patch tweaks the error message by checking the return value of
get_number.  With patch applied, it becomes:

 (gdb) goto-bookmark 1.1
 goto-bookmark: invalid bookmark number '1.1'.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* reverse.c (goto_bookmark_command): Add local 'p'.  Emit error
early if get_number returns zero.  Use 'p' instead of 'args'.

10 years agoAdd a newline in output messages
Yao Qi [Thu, 20 Feb 2014 09:35:31 +0000 (17:35 +0800)] 
Add a newline in output messages

Hi,
GDB prints two warnings in one single line, as below:

 (gdb) p 1.2
 $1 = 1.2
 (gdb) enable $1.2
 History value must have integer type.Bad breakpoint number '$1'

This patch adds '\n' at the end of message.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* cli/cli-utils.c (get_number_trailer): Add '\n' at the end of
message.

10 years agoFix PR16508
Yao Qi [Sat, 15 Feb 2014 00:48:53 +0000 (08:48 +0800)] 
Fix PR16508

This patch fixes PR16508, which is about MI "-trace-find frame-number 0"
behaves differently from CLI "tfind 0".  In CLI, we check both
status->running and status->filename, but in MI, we only check
status->running, which looks wrong to me.  This patch moves the code
of checking to a new function check_trace_running, and use it in
both CLI and MI.

This patch also adds a test case pr16508.exp, which fails without this
fix, and passes with the fix applied.

  FAIL: gdb.trace/pr16508.exp: interpreter-exec mi "-trace-find frame-number 0"

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

PR breakpoints/16508
* tracepoint.c (check_trace_running): New function.
(trace_find_command): Move code to check_trace_running and
call check_trace_running.
(trace_find_pc_command): Likewise.
(trace_find_tracepoint_command): Likewise.
(trace_find_line_command): Likewise.
(trace_find_range_command): Likewise.
* tracepoint.h (check_trace_running): Likewise.
* mi/mi-main.c (mi_cmd_trace_find): Call check_trace_running.

gdb/testsuite:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* gdb.trace/pr16508.exp: New file.

10 years agoChange the default implementation of to_traceframe_info to tcomplain
Yao Qi [Tue, 4 Mar 2014 09:39:10 +0000 (17:39 +0800)] 
Change the default implementation of to_traceframe_info to tcomplain

This patch is to change the default implementation of to_traceframe_info
from 'return NULL' to tcomplain, which is intended.  If new target
supports tracepoint, this method should be implemented, otherwise,
an error is thrown.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* target.h (struct target_ops) <to_traceframe_info>: Use
TARGET_DEFAULT_NORETURN (tcomplain ()).
* target-delegates.c: Regenerated.

10 years agodaily update
Alan Modra [Wed, 5 Mar 2014 23:01:23 +0000 (09:31 +1030)] 
daily update

10 years agoPR gdb/16575: stale breakpoint instructions in the code cache
Pedro Alves [Wed, 5 Mar 2014 14:18:28 +0000 (14:18 +0000)] 
PR gdb/16575: stale breakpoint instructions in the code cache

In non-stop mode, or rather, breakpoints always-inserted mode, the
code cache can easily end up with stale breakpoint instructions:

All it takes is filling a cache line when breakpoints already exist in
that memory region, and then delete the breakpoint.

Vis. (from the new test):

 (gdb) set breakpoint always-inserted on
 (gdb) b 23
 Breakpoint 2 at 0x400540: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 23.
 (gdb) b 24
 Breakpoint 3 at 0x400547: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 24.
 disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

So far so good.  Now flush the code cache:

 (gdb) set code-cache off
 (gdb) set code-cache on

Requesting a disassembly works as expected, breakpoint shadowing is
applied:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

However, now delete the breakpoints:

 (gdb) delete
 Delete all breakpoints? (y or n) y

And disassembly shows the old breakpoint instructions:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     int3
    0x0000000000400541 <+5>:     rex.RB cld
    0x0000000000400543 <+7>:     add    %eax,(%rax)
    0x0000000000400545 <+9>:     add    %al,(%rax)
    0x0000000000400547 <+11>:    int3
    0x0000000000400548 <+12>:    rex.RB cld
    0x000000000040054a <+14>:    add    (%rax),%al
    0x000000000040054c <+16>:    add    %al,(%rax)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

Those breakpoint instructions are no longer installed in target memory
they're stale in the code cache.  Easily confirmed by just disabling
the code cache:

 (gdb) set code-cache off
 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

I stumbled upon this when writing a patch to infrun.c, that made
handle_inferior_event & co fill in the cache before breakpoints were
removed from the target.  Recall that wait_for_inferior flushes the
dcache for every event.  So in that case, always-inserted mode was not
necessary to trigger this.  It's just a convenient way to expose the
issue.

The dcache works at the raw memory level.  We need to update it
whenever memory is written, no matter what kind of target memory
object was originally passed down by the caller.  The issue is that
the dcache update code isn't reached when a caller explicitly writes
raw memory.  Breakpoint insertion/removal is one such case --
mem-break.c uses target_write_read_memory/target_write_raw_memory.

The fix is to move the dcache update code from memory_xfer_partial_1
to raw_memory_xfer_partial so that it's always reachable.

When we do that, we can actually simplify a series of things.
memory_xfer_partial_1 no longer needs to handle writes for any kind of
memory object, and therefore dcache_xfer_memory no longer needs to
handle writes either.  So the latter (dcache_xfer_memory) and its
callees can be simplified to only care about reads.  While we're
touching dcache_xfer_memory's prototype, might as well rename it to
reflect that fact that it only handles reads, and make it follow the
new target_xfer_status/xfered_len style.  This made me notice that
dcache_xfer_memory loses the real error status if a memory read fails:
we could have failed to read due to TARGET_XFER_E_UNAVAILABLE, for
instance, but we always return TARGET_XFER_E_IO, hence the FIXME note.
I felt that fixing that fell out of the scope of this patch.

Currently dcache_xfer_memory handles the case of a write failing.  The
whole cache line is invalidated when that happens.  However,
dcache_update, the sole mechanism for handling writes that will remain
after the patch, does not presently handle that scenario.  That's a
bug.  The patch makes it handle that, by passing down the
target_xfer_status status from the caller, so that it can better
decide what to do itself.  While I was changing the function's
prototype, I constified the myaddr parameter, getting rid of the need
for the cast as seen in its existing caller.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-03-05  Pedro Alves  <palves@redhat.com>

PR gdb/16575
* dcache.c (dcache_poke_byte): Constify ptr parameter.  Return
void.  Update comment.
(dcache_xfer_memory): Delete.
(dcache_read_memory_partial): New, based on the read bits of
dcache_xfer_memory.
(dcache_update): Add status parameter.  Use ULONGEST for len, and
adjust.  Discard cache lines if the reason for the update was
error.
* dcache.h (dcache_xfer_memory): Delete declaration.
(dcache_read_memory_partial): New declaration.
(dcache_update): Update prototype.
* target.c (raw_memory_xfer_partial): Update the dcache here.
(memory_xfer_partial_1): Don't handle dcache writes here.

gdb/testsuite/
2014-03-05  Pedro Alves  <palves@redhat.com>

PR gdb/16575
* gdb.base/breakpoint-shadow.exp (compare_disassembly): New
procedure.
(top level): Adjust to use it.  Add tests that exercise breakpoint
interaction with the code-cache.

10 years agoUpdate copyright years
Alan Modra [Wed, 5 Mar 2014 11:46:15 +0000 (22:16 +1030)] 
Update copyright years

10 years agoSupport R_PPC64_ADDR64_LOCAL
Alan Modra [Wed, 5 Mar 2014 09:27:39 +0000 (19:57 +1030)] 
Support R_PPC64_ADDR64_LOCAL

This adds support for "func@localentry", an expression that returns the
ELFv2 local entry point address of function "func".  I've excluded
dynamic relocation support because that obviously would require glibc
changes.

include/elf/
* ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
bfd/
* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
(ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
(ppc64_elf_check_relocs): Likewise.
(ppc64_elf_relocate_section): Likewise.
* Add BFD_RELOC_PPC64_ADDR64_LOCAL.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Support @localentry.
(md_apply_fix): Support R_PPC64_ADDR64_LOCAL.
ld/testsuite/
* ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files.
* ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files.
* ld-powerpc/powerpc.exp: Run new test.
elfcpp/
* powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
gold/
* powerpc.cc (Target_powerpc::Scan::local, global): Support
R_PPC64_ADDR64_LOCAL.
(Target_powerpc::Relocate::relocate): Likewise.

10 years agoSupport more relocs on 16-bit insn fields
Alan Modra [Wed, 5 Mar 2014 09:01:45 +0000 (19:31 +1030)] 
Support more relocs on 16-bit insn fields

This patch allows gas to assemble a testcase like
li 3,ext_sym
which oddly was not accepted while the following is OK:
li 3,ext_sym@l

* config/tc-ppc.c (md_assemble): Move code adjusting reloc types
later.  Merge absolute and relative branch reloc selection.
Generate 16-bit relocs for most 16-bit insn fields given a
non-constant expression.

10 years agoRemove magic treatment of toc symbols for powerpc ELF
Alan Modra [Wed, 5 Mar 2014 08:57:57 +0000 (19:27 +1030)] 
Remove magic treatment of toc symbols for powerpc ELF

The XCOFF assembler does some wierd things with instructions like
`lwz 9,sym(30'.  See the comment in md_apply_fix.  From an ELF
perspective, it's weird even to magically select a TOC16 reloc
when a symbol is in the TOC/GOT.  ELF assemblers generally use
modifiers like @toc to select relocs, so remove this "feature"
for ELF.  I believe this was to support gcc -m32 -mcall-aixdesc
but that combination of gcc options has been broken for a long
time.

* config/tc-ppc.c (ppc_is_toc_sym): Remove OBJ_ELF support.
(md_assemble): Don't call ppc_is_toc_sym for ELF.

10 years agosim: constify prog_name
Mike Frysinger [Thu, 20 Feb 2014 05:13:48 +0000 (00:13 -0500)] 
sim: constify prog_name

There's no need for the prog_name handed down to the core to be mutable,
so add const markings to it and all the related funcs.

10 years agodaily update
Alan Modra [Tue, 4 Mar 2014 23:01:07 +0000 (09:31 +1030)] 
daily update

10 years agoFix changelog formatting in last commit -- sorry
Richard Sandiford [Tue, 4 Mar 2014 21:30:39 +0000 (21:30 +0000)] 
Fix changelog formatting in last commit -- sorry

10 years agobfd/
Richard Sandiford [Tue, 4 Mar 2014 21:18:02 +0000 (21:18 +0000)] 
bfd/
2014-02-04  Heiher <r@hev.cc>

* elfxx-mips.c (mips_set_isa_flags): Use E_MIPS_ARCH_64R2 for
Loongson-3A.
(mips_mach_extensions): Make bfd_mach_mips_loongson_3a an
extension of bfd_mach_mipsisa64r2.

opcodes/
2014-02-04  Heiher <r@hev.cc>

* mips-dis.c (mips_arch_choices): Usee ISA_MIPS64R2 for Loongson-3A.

gas/
2014-02-04  Heiher <r@hev.cc>

* config/tc-mips.c (mips_cpu_info_table): Use ISA_MIPS64R2 for
Loongson-3A.

10 years agoopcodes/
Richard Sandiford [Tue, 4 Mar 2014 21:16:38 +0000 (21:16 +0000)] 
opcodes/
* mips-opc.c (mips_builtin_opcodes): Move the udi* instructions
so that they come after the Loongson extensions.

10 years agoRemove default-manifest from ALL_EMUL_EXTRA_BINARIES so that it is not mistakenly
Nick Clifton [Tue, 4 Mar 2014 17:22:46 +0000 (17:22 +0000)] 
Remove default-manifest from ALL_EMUL_EXTRA_BINARIES so that it is not mistakenly
built when constructing a toolchain configued from all targets.

* Makefile.am (ALL_EMUL_EXTRA_BINARIES): Remove default-manifest.
* Makefile.in: Regenerate.

10 years agoInstall patch for PR ld/16017. This adds support for generating PLT entries
Nick Clifton [Tue, 4 Mar 2014 15:25:53 +0000 (15:25 +0000)] 
Install patch for PR ld/16017.  This adds support for generating PLT entries
using Thumb2 instructions for those cores which do not support the ARM ISA.

* elf32-arm.c (elf32_thumb2_plt0_entry): New array.
(elf32_thumb2_plt_entry): New array.
(elf32_arm_create_dynamic_sections): Set PLT entry sizes when
using thumb2 based PLT.
(elf32_arm_populate_plt_entry): Handle generating Thumb2 based PLT
entries.
(elf32_arm_final_link_relocate): Do not bias jumps to Thumb based
PLT entries.
(elf32_arm_finish_dynamic_sections): Handle creation of Thumb2
based PLT 0-entry.
(elf32_arm_output_plt_map_1): Handle creation of local symbols for
Thumb2 based PLT 0-entry.
(elf32_arm_output_arch_local_syms): Handle creation of local
symbols for Thumb2 based PLT entries.

10 years agosim: convert old style prototypes
Mike Frysinger [Thu, 20 Feb 2014 03:29:37 +0000 (22:29 -0500)] 
sim: convert old style prototypes

Most of these prototypes have been killed off, but we have a few left
in the sim tree.  Clean them up so we can enable the -W flag for it.

10 years agodaily update
Alan Modra [Mon, 3 Mar 2014 23:00:37 +0000 (09:30 +1030)] 
daily update

10 years agomove probes to be per-bfd
Tom Tromey [Tue, 3 Dec 2013 17:21:20 +0000 (10:21 -0700)] 
move probes to be per-bfd

This patch moves the probe data from the objfile to the per-BFD
object.  This lets the probes be shared between different inferiors
(and different objfiles when dlmopen is in use, should gdb ever handle
that).

2014-03-03  Tom Tromey  <tromey@redhat.com>

* elfread.c (probe_key): Change to bfd_data.
(elf_get_probes, probe_key_free, _initialize_elfread): Probes are
now per-BFD, not per-objfile.
* stap-probe.c (stap_probe_destroy): Update comment.
(handle_stap_probe): Allocate on the per-BFD obstack.

10 years agochange probes to be program-space-independent
Tom Tromey [Mon, 2 Dec 2013 20:58:59 +0000 (13:58 -0700)] 
change probes to be program-space-independent

This changes the probes to be independent of the program space.

After this, when a probe's address is needed, it is determined by
applying offsets at the point of use.

This introduces a bound_probe object, similar to bound minimal
symbols.  Objects of this type are used when it's necessary to pass a
probe and its corresponding objfile.

This removes the backlink from probe to objfile, which was primarily
used to fetch the architecture to use.

This adds a get_probe_address function which calls a probe method to
compute the probe's relocated address.  Similarly, it adds an objfile
parameter to the semaphore methods so they can do the relocation
properly as well.

2014-03-03  Tom Tromey  <tromey@redhat.com>

* break-catch-throw.c (fetch_probe_arguments): Use bound probes.
* breakpoint.c (create_longjmp_master_breakpoint): Use
get_probe_address.
(add_location_to_breakpoint, bkpt_probe_insert_location)
(bkpt_probe_remove_location): Update.
* breakpoint.h (struct bp_location) <probe>: Now a bound_probe.
* elfread.c (elf_symfile_relocate_probe): Remove.
(elf_probe_fns): Update.
(insert_exception_resume_breakpoint): Change type of "probe"
parameter to bound_probe.
(check_exception_resume): Update.
* objfiles.c (objfile_relocate1): Don't relocate probes.
* probe.c (bound_probe_s): New typedef.
(parse_probes): Use get_probe_address.  Set sal's objfile.
(find_probe_by_pc): Return a bound_probe.
(collect_probes): Return a VEC(bound_probe_s).
(compare_probes): Update.
(gen_ui_out_table_header_info): Change type of "probes"
parameter.  Update.
(info_probes_for_ops): Update.
(get_probe_address): New function.
(probe_safe_evaluate_at_pc): Update.
* probe.h (struct probe_ops) <get_probe_address>: New field.
<set_semaphore, clear_semaphore>: Add objfile parameter.
(struct probe) <objfile>: Remove field.
<arch>: New field.
<address>: Update comment.
(struct bound_probe): New.
(find_probe_by_pc): Return a bound_probe.
(get_probe_address): Declare.
* solib-svr4.c (struct probe_and_action) <address>: New field.
(hash_probe_and_action, equal_probe_and_action): Update.
(register_solib_event_probe): Add address parameter.
(solib_event_probe_at): Update.
(svr4_create_probe_breakpoints): Add objfile parameter.  Use
get_probe_address.
* stap-probe.c (struct stap_probe) <sem_addr>: Update comment.
(stap_get_probe_address): New function.
(stap_can_evaluate_probe_arguments, compute_probe_arg)
(compile_probe_arg): Update.
(stap_set_semaphore, stap_clear_semaphore): Compute semaphore's
address.
(handle_stap_probe): Don't relocate the probe.
(stap_relocate): Remove.
(stap_gen_info_probes_table_values): Update.
(stap_probe_ops): Remove stap_relocate.
* symfile-debug.c (debug_sym_relocate_probe): Remove.
(debug_sym_probe_fns): Update.
* symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove.
* symtab.c (init_sal): Use memset.
* symtab.h (struct symtab_and_line) <objfile>: New field.
* tracepoint.c (start_tracing, stop_tracing): Update.

10 years agocomment fixes
Tom Tromey [Mon, 2 Dec 2013 18:12:15 +0000 (11:12 -0700)] 
comment fixes

This fixes up a few mildly erroneous comments in probe.h.

2014-03-03  Tom Tromey  <tromey@redhat.com>

* probe.h (parse_probes, find_probe_by_pc)
(find_probes_in_objfile): Fix comments.

10 years agoThis patch enhances the MSP430 port of GAS so that, if requested, it will
Nick Clifton [Mon, 3 Mar 2014 17:27:55 +0000 (17:27 +0000)] 
This patch enhances the MSP430 port of GAS so that, if requested, it will
generate warning messages about an instruction that changes the interrupt
state not being followed by a NOP instruction.

* config/msp430/msp430.c: Replace known mcu array with known
msp430 ISA mcu name array.
Accept any name for -mmcu option.
Add -mz option to warn about missing NOP following an interrupt
status change.
(check_for_nop): New.
(msp430_operands): Emit a warning, if requested, when an interrupt
changing instruction is not followed by a NOP.
* doc/c-msp430.c: Document -mz option.

* gas/msp430/bad.d: Add -mz option.
* gas/msp430/bad.s: Add more cases where warnings should be
generated.
* gas/msp430/bad.l: Add expected warning messages.

10 years agoMore copyright fixes
Alan Modra [Mon, 3 Mar 2014 03:11:34 +0000 (13:41 +1030)] 
More copyright fixes

* config/obj-fdpicelf.c: Correct copyright date.
* config/obj-fdpicelf.h: Likewise.

10 years agoFix various copyright issues
Alan Modra [Sat, 1 Mar 2014 11:25:26 +0000 (21:55 +1030)] 
Fix various copyright issues

binutils/
* README: Add "Copyright Notices" paragraph.
gas/
* config/bfin-lex-wrapper.c: Correct copyright date.
* config/tc-frv.c: Correct copyright punctuation.
* config/tc-ip2k.c: Likewise.
* config/tc-iq2000.c: Likewise.
* config/tc-mep.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic4x.h: Likewise.
ld/testsuite/
* ld-scripts/phdrs2.exp: Correct copyright punctuation.
* ld-v850/v850.exp: Correct copyright typo.
opcodes/
* i386-gen.c (process_copyright): Emit copyright notice on one line.
gold/
* dwp.cc (print_version): Update copyright year to current.

10 years agodaily update
Alan Modra [Sun, 2 Mar 2014 23:00:42 +0000 (09:30 +1030)] 
daily update

10 years ago* infrun.c (handle_signal_stop): Replace test for
Doug Evans [Sun, 2 Mar 2014 21:51:35 +0000 (16:51 -0500)] 
* infrun.c (handle_signal_stop): Replace test for
TARGET_WAITKIND_STOPPED with an assert.

10 years agoguile/scm-objfile.c (ofscm_mark_objfile_smob): Fix typo in comment.
Doug Evans [Sun, 2 Mar 2014 18:30:46 +0000 (10:30 -0800)] 
guile/scm-objfile.c (ofscm_mark_objfile_smob): Fix typo in comment.

10 years agoguile/lib/gdb/printing.scm (append-pretty-printer!): Fix thinko.
Doug Evans [Sun, 2 Mar 2014 17:17:46 +0000 (09:17 -0800)] 
guile/lib/gdb/printing.scm (append-pretty-printer!): Fix thinko.

10 years agodaily update
Alan Modra [Sat, 1 Mar 2014 23:00:37 +0000 (09:30 +1030)] 
daily update

10 years agoSilence ARI warning.
Mark Kettenis [Sat, 1 Mar 2014 16:13:47 +0000 (17:13 +0100)] 
Silence ARI warning.

gdb/ChangeLog:

        * obsd-nat.c: Include "gdb_wait.h" instead of <sys/wait.h>.

10 years agoEnable rhreads support on OpenBSD/i386.
Mark Kettenis [Sat, 1 Mar 2014 14:29:34 +0000 (15:29 +0100)] 
Enable rhreads support on OpenBSD/i386.

gdb/ChangeLog:

        * i386obsd-nat.c: Include "obsd-nat.h".
        (_initialize_i386obsd_nat): Call obsd_add_target instead of
        add_target.
        * config/i386/obsd.mh (NATDEPFILES): Add obsd-nat.o.

10 years agoEliminate pointer signedness warning.
Mark Kettenis [Sat, 1 Mar 2014 12:06:49 +0000 (13:06 +0100)] 
Eliminate pointer signedness warning.

gdb/ChangeLog:

        * i386obsd-nat.c (i386obsd_supply_pcb): Cast 'sf' to 'gdb_byte *'.

10 years agold-arm/long-plt-format.d, ld-arm/arm-elf.exp: Adjust for arm-eabi.
Yuri Gribov [Sat, 1 Mar 2014 11:19:53 +0000 (12:19 +0100)] 
ld-arm/long-plt-format.d, ld-arm/arm-elf.exp: Adjust for arm-eabi.

10 years agoFix ChangeLog.
Mark Kettenis [Sat, 1 Mar 2014 11:03:30 +0000 (12:03 +0100)] 
Fix ChangeLog.

10 years agoEnable rthreads support on OpenBSD/mips64.
Mark Kettenis [Sat, 1 Mar 2014 11:00:19 +0000 (12:00 +0100)] 
Enable rthreads support on OpenBSD/mips64.

gdb/ChangeLog:

        * mips64obsd-nat.c: Include "obsd-nath".
        (_initialize_mips64obsd_nat): Call obsd_add_target instead of
        add_target
        * config/mips/obsd64.mh (NATDEPFILES): Add obsd-nat.o.

10 years agoEnable rthreads support on OpenBSD/amd64.
Mark Kettenis [Sat, 1 Mar 2014 10:49:58 +0000 (11:49 +0100)] 
Enable rthreads support on OpenBSD/amd64.

gdb/ChangeLog:

        * amd64obsd-nat.c (_initialize_amd64obsd_nat): Call
        obsd_add_target instead of add_target.
        * config/i386/obsd64.mh (NATDEPFILES): Add obsd-nat.o.

10 years ago * config/tc-avr.c: Remove atxmega16x1.
Denis Chertykov [Sat, 1 Mar 2014 09:12:49 +0000 (13:12 +0400)] 
* config/tc-avr.c: Remove atxmega16x1.

10 years agoRemove the unnecesary argument METHOD to valops.c:find_oload_champ.
Siva Chandra [Thu, 27 Feb 2014 13:51:46 +0000 (05:51 -0800)] 
Remove the unnecesary argument METHOD to valops.c:find_oload_champ.

* valops.c (find_oload_champ): Remove unneccesary argument METHOD.
(find_overload_match): Update call to find_oload_champ.
(find_oload_champ_namespace_loop): Likewise

10 years agodaily update
Alan Modra [Fri, 28 Feb 2014 23:01:08 +0000 (09:31 +1030)] 
daily update

10 years agoAdd sparc64obsd-nat.c to ALLDEPFILES.
Mark Kettenis [Fri, 28 Feb 2014 22:20:57 +0000 (23:20 +0100)] 
Add sparc64obsd-nat.c to ALLDEPFILES.

gdb/ChangeLog:

        * Makefile.in (ALLDEPFILES): Add sparc64obsd-nat.c.

10 years agoEnable rthreads supports on OpenBSD/sparc64.
Mark Kettenis [Fri, 28 Feb 2014 22:06:14 +0000 (23:06 +0100)] 
Enable rthreads supports on OpenBSD/sparc64.

gdb/ChangeLog:

        * configure.host (sparc64-*-openbsd*): Set gdb_host to obsd64.
        * config/sparc/obsd64.mh: New file.
        * sparc64obsd-nat.c: New file.

10 years agoStupid git never fucking does what I want!
Mark Kettenis [Fri, 28 Feb 2014 21:58:57 +0000 (22:58 +0100)] 
Stupid git never fucking does what I want!

10 years agoSupport rthreads on OpenBSD 5.2 and later.
Mark Kettenis [Thu, 27 Feb 2014 22:23:46 +0000 (23:23 +0100)] 
Support rthreads on OpenBSD 5.2 and later.

OpenBSD 5.2 and later have a proper threads implementation based on
kernel threads.  Debugging support is provided through additional
ptrace(2) requests, so this diff extends the generic code in
inf-ptrace.c with OpenBSD-specific code to discover additional threads.

gdb/ChangeLog:

        * obsd-nat.h: New file.
        * obsd-nat.c: New file.
        * Makefile.in (HFILES_NO_SRCDIR): Add obsd-nat.h.
        (ALLDEPFILES): Add obsd-nat.c.

10 years agoconstify ui_out_impl
Tom Tromey [Tue, 24 Dec 2013 03:53:23 +0000 (20:53 -0700)] 
constify ui_out_impl

This patch constifies ui_out_impl in struct ui_out, and various
instances of ui_out_impl.

This removes a couple of FIXME comments (near cli_ui_out_impl and
mi_ui_out_impl) that did not make sense to me.

Tested by rebuilding.

2014-02-28  Tom Tromey  <tromey@redhat.com>

* cli-out.c (cli_ui_out_impl): Now const.  Remove comment.
* cli-out.h (cli_ui_out_impl): Now const.
* mi/mi-out.c (mi_ui_out_impl): Now const.  Remove comment.
* ui-out.c (struct ui_out) <impl>: Now const.
(default_ui_out_impl): Now const.
(ui_out_new): Make 'impl' parameter const.
* ui-out.h (ui_out_new): Update.

10 years agoIncorrect .debug_line prologue header length for 64-bit DWARF
Alan Modra [Fri, 28 Feb 2014 04:39:32 +0000 (15:09 +1030)] 
Incorrect .debug_line prologue header length for 64-bit DWARF

Don't be clever, calculate the length directly as the difference of
two symbols.

* dwarf2dbg.c (out_debug_line): Correct .debug_line header_length
field for 64-bit dwarf.

10 years agoFix check_relocs/gc_sweep_hook mismatch
Alan Modra [Fri, 28 Feb 2014 04:08:27 +0000 (14:38 +1030)] 
Fix check_relocs/gc_sweep_hook mismatch

PR ld/16643
* elflink.c (elf_gc_sweep): Call gc_sweep_hook for exactly
the same conditions we called check_relocs.

10 years agoRegenerate opcodes/msp430-decode.c
Alan Modra [Fri, 28 Feb 2014 04:02:26 +0000 (14:32 +1030)] 
Regenerate opcodes/msp430-decode.c

Cosmetic changes.

* msp430-decode.c: Regenerate.

10 years agodaily update
Alan Modra [Thu, 27 Feb 2014 23:01:17 +0000 (09:31 +1030)] 
daily update

10 years agoPrevent compiler warning.
Mark Kettenis [Thu, 27 Feb 2014 20:51:08 +0000 (21:51 +0100)] 
Prevent compiler warning.

GCC 4.2.1 complains about first_l_name may be used uninitialized, and my brain
agrees.

gdb/ChangeLog:

        * solib-svr4.c (svr4_read_so_list): Initialize first_l_name to 0.

10 years agoStackGhost cookie is per-process.
Mark Kettenis [Thu, 27 Feb 2014 20:22:29 +0000 (21:22 +0100)] 
StackGhost cookie is per-process.

gdb/ChangeLog:

        * sparc-nat.c (sparc_xfer_wcookie): Always use process ID.

10 years agoAdditional PR 8882 fix.
Jan Kratochvil [Thu, 27 Feb 2014 20:16:04 +0000 (21:16 +0100)] 
Additional PR 8882 fix.

runtest gdb.base/corefile.exp

==23174== ERROR: AddressSanitizer: heap-use-after-free on address 0x604400008c88 at pc 0x68f0be bp 0x7fffae9d7490 sp
0x7fffae9d7480
READ of size 8 at 0x604400008c88 thread T0
    #0 0x68f0bd in svr4_read_so_list (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68f0bd)
    #1 0x68f64e in svr4_current_sos_direct (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68f64e)
    #2 0x68f757 in svr4_current_sos (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68f757)
    #3 0xcebbff in update_solib_list (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xcebbff)
0x604400008c88 is located 8 bytes inside of 1104-byte region [0x604400008c80,0x6044000090d0)
freed by thread T0 here:
    #0 0x7f52677500f9 (/lib64/libasan.so.0+0x160f9)
    #1 0xd2c68a in xfree (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xd2c68a)
    #2 0xceb364 in free_so (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xceb364)
    #3 0xca59f8 in do_free_so (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xca59f8)
    #4 0x93432a in do_my_cleanups (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x93432a)
    #5 0x934406 in do_cleanups (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x934406)
    #6 0x68efa9 in svr4_read_so_list (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x68efa9)

I did not notice it during my review in:
Re: [PATCH v2] Skip vDSO when reading SO list (PR 8882)
https://sourceware.org/ml/gdb-patches/2013-09/msg00888.html

gdb/
2014-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

Additional PR 8882 fix.
* solib-svr4.c (svr4_read_so_list): Change first to first_l_name.

Message-ID: <20140226220918.GA10431@host2.jankratochvil.net>

10 years agoopcodes/
Yufeng Zhang [Thu, 27 Feb 2014 15:06:56 +0000 (15:06 +0000)] 
opcodes/

* aarch64-tbl.h (aarch64_opcode_table): Replace IMM0 with
FPIMM0 for fcmeq, fcmgt, fcmge, fcmlt and fcmle.

gas/testsuite/

* gas/aarch64/fp-const0-parsing.s: New test.
* gas/aarch64/fp-const0-parsing.d: Likewise.

10 years agoopcodes/
Yufeng Zhang [Thu, 27 Feb 2014 14:55:46 +0000 (14:55 +0000)] 
opcodes/

* aarch64-opc.c (print_register_offset_address): Call
get_int_reg_name to prepare the register name.

gas/testsuite/

* gas/aarch64/ldst-reg-reg-offset.s: Add tests.
* gas/aarch64/ldst-reg-reg-offset.d: Update.

10 years agoLinux waitpid/__WALL emulation wrapper: If WNOHANG is set, don't touch sigprocmask.
Pedro Alves [Thu, 27 Feb 2014 14:44:16 +0000 (14:44 +0000)] 
Linux waitpid/__WALL emulation wrapper: If WNOHANG is set, don't touch sigprocmask.

Just a small optimization.  No need to block/unblock signals if we're
not going to call sigsuspend.

gdb/
2014-02-27  Pedro Alves  <palves@redhat.com>

* nat/linux-waitpid.c (my_waitpid): Only block signals if WNOHANG
isn't set.

10 years agoThis patch adds support for ARM PLT entries that support a full 32-bit offset range.
Yuri Gribov [Thu, 27 Feb 2014 14:35:37 +0000 (14:35 +0000)] 
This patch adds support for ARM PLT entries that support a full 32-bit offset range.
Enabled via the use of a new linker command line option: --long-plt.

* bfd-in.h: Add export of bfd_elf32_arm_use_long_plt.
* bfd-in2.h: Regenerate.
* elf32-arm.c (elf32_arm_plt_entry_long): New array.
(elf32_arm_link_hash_table_create): Set plt_entry_size to 16 if
using long PLT entries.
(bfd_elf32_arm_use_long_plt): New function.
(elf32_arm_populate_plt_entry): Add support for long PLT entries.

* emultempl/armelf.em (OPTION_LONG_PLT): Define.
(PARSE_AND_LIST_LONGOPTS): Add long-plt.
(PARSE_AND_LIST_OPTIONS): Likewise.
(PARSE_AND_LIST_ARGS_CASES): Handle long-plt.
* ld.texinfo: Document --long-plt.

* ld-arm/long-plt-format.s: New test case.
* ld-arm/long-plt-format.d: Expected disassembly.
* ld-arm/arm-elf.exp: Run the new test.

10 years agoTeach GDBserver's Linux backend about no unwaited-for children (TARGET_WAITKIND_NO_RE...
Pedro Alves [Thu, 27 Feb 2014 14:30:08 +0000 (14:30 +0000)] 
Teach GDBserver's Linux backend about no unwaited-for children (TARGET_WAITKIND_NO_RESUMED).

GDBserver currently hangs forever in waitpid if the leader thread
exits before other threads, or if all resumed threads exit - e.g.,
next over a thread exit with sched-locking on.  This is exposed by
leader-exit.exp.  leader-exit.exp is part of a series of tests for a
set of related problems.  See
<http://www.sourceware.org/ml/gdb-patches/2011-10/msg00704.html>:

 "
 To recap, on the Linux kernel, ptrace/waitpid don't allow reaping the
 leader thread until all other threads in the group are reaped.  When
 the leader exits, it goes zombie, but waitpid will not return an exit
 status until the other threads are gone.  This is presently exercised
 by the gdb.threads/leader-exit.exp test.  The fix for that test, in
 linux-nat.c:wait_lwp, handles the case where we see the leader gone
 when we're stopping all threads to report an event to some other
 thread to the core.

 (...)

 The latter bit about not blocking if there no resumed threads in the
 process also applies to some other thread exiting, not just the main
 thread.  E.g., this test starts a thread, and runs to a breakpoint in
 that thread:

 ...
 (gdb) c
 Continuing.
 [New Thread 0x7ffff75a4700 (LWP 23397)]
 [Switching to Thread 0x7ffff75a4700 (LWP 23397)]

 Breakpoint 2, thread_a (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/no-unwaited-for-left.c:28
 28        return 0; /* break-here */
 (gdb) info threads
 * 2 Thread 0x7ffff75a4700 (LWP 23397)  thread_a (arg=0x0) at ../../../src/gdb/testsuite/gdb.threads/no-unwaited-for-left.c:28
   1 Thread 0x7ffff7fcb720 (LWP 23391)  0x00007ffff7bc606d in pthread_join (threadid=140737343276800, thread_return=0x0) at pthread_join.c:89

 The thread will exit as soon as we resume it.  But if we only resume
 that thread, leaving the rest of the threads stopped:

 (gdb) set scheduler-locking on
 (gdb) c
 Continuing.
 ^C^C^C^C^C^C^C^C
 "

This patch fixes the issues by implementing TARGET_WAITKIND_NO_RESUMED
on GDBserver, similarly to what the patch above did for native
Linux GDB.

gdb.threads/leader-exit.exp now passes.

gdb.threads/no-unwaited-for-left.exp now at least errors out instead
of hanging:

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

 [Thread 15454] #1 stopped.
 0x00000034cf408e60 in pthread_join (threadid=140737353922368, thread_return=0x0) at pthread_join.c:93
 93          lll_wait_tid (pd->tid);
 (gdb) FAIL: gdb.threads/no-unwaited-for-left.exp: continue stops when the main thread exits

The gdb.threads/non-ldr-exc-*.exp tests are skipped because GDBserver
unfortunately doesn't support fork/exec yet, but I'm confident this
fixes the related issues.

I'm leaving modeling TARGET_WAITKIND_NO_RESUMED in the RSP for a
separate pass.

(BTW, in case of error in response to a vCont, it would be better for
GDB to query the target for the current thread, or re-select one,
instead of assuming current inferior_ptid is still the selected
thread.)

This implementation is a little different from GDB's, because I'm
avoiding bringing in more of this broken use of waitpid(PID) into
GDBserver.  Specifically, this avoids waitpid(PID) when stopping all
threads.  There's really no need for wait_for_sigstop to wait for each
LWP in turn.  Instead, with some refactoring, we make it reuse
linux_wait_for_event.

gdb/gdbserver/
2014-02-27  Pedro Alves  <palves@redhat.com>

PR 12702
* inferiors.h (A_I_NEXT, ALL_INFERIORS_TYPE, ALL_PROCESSES): New
macros.
* linux-low.c (delete_lwp, handle_extended_wait): Add debug
output.
(last_thread_of_process_p): Take a PID argument instead of a
thread pointer.
(linux_wait_for_lwp): Delete.
(num_lwps, check_zombie_leaders, not_stopped_callback): New
functions.
(linux_low_filter_event): New function, party factored out from
linux_wait_for_event.
(linux_wait_for_event): Rename to ...
(linux_wait_for_event_filtered): ... this.  Add new filter ptid
argument.  Partly rewrite.  Always use waitpid(-1, WNOHANG) and
sigsuspend.  Check for zombie leaders.
(linux_wait_for_event): Reimplement as wrapper around
linux_wait_for_event_filtered.
(linux_wait_1): Handle TARGET_WAITKIND_NO_RESUMED.  Assume that if
a normal or signal exit is seen, it's the whole process exiting.
(wait_for_sigstop): No longer a for_each_inferior callback.
Rewrite on top of linux_wait_for_event_filtered.
(stop_all_lwps): Call wait_for_sigstop directly.
* server.c (resume, handle_target_event): Handle
TARGET_WAITKIND_NO_RESUMED.

10 years agoMove linux-nat.c:status_to_str to nat/linux-waitpid.c.
Pedro Alves [Thu, 27 Feb 2014 14:30:08 +0000 (14:30 +0000)] 
Move linux-nat.c:status_to_str to nat/linux-waitpid.c.

So that gdbserver's Linux backend can use it too.

gdb/
2014-02-27  Pedro Alves  <palves@redhat.com>

PR 12702
* linux-nat.c (status_to_str): Moved to nat/linux-waitpid.c.
* nat/linux-waitpid.c: Include string.h.
(status_to_str): Moved here and made extern.
* nat/linux-waitpid.h (status_to_str): New declaration.

10 years agoMove ptid_match to common/ptid.c.
Hui Zhu [Thu, 27 Feb 2014 14:30:07 +0000 (14:30 +0000)] 
Move ptid_match to common/ptid.c.

So that gdbserver can use it too.

gdb/
2014-02-27  Hui Zhu  <hui@codesourcery.com>

PR 12702
* infrun.c (ptid_match): Move ...
* common/ptid.c (ptid_match): ... here.
* inferior.h (ptid_match): Move ...
* common/ptid.h (ptid_match): ... here.

10 years agoThis patch adds a default manifest in to the final links performed by the Cygwin...
Nick Clifton [Thu, 27 Feb 2014 14:09:29 +0000 (14:09 +0000)] 
This patch adds a default manifest in to the final links performed by the Cygwin and MinGW targets.
The manifest is necessary in order for the linked binaries to be executed in a Windows 8 environment.

The manifest is added using a linker script so that this feature will be compiler-neutral.  The resource
merging code in the linker means that if an application provides its own manifest then the default
manifest will be ignored.

* configure.in (all_emul_extra_binaries): New variable.  Populated
by invoking configure.tgt.
(EMUL_EXTRA_BINARIES): New substitution.
* configure: Regenerate.
* configure.tgt (target_extra_binaries): New variable.  Set to
default-manifest.o for Cygwin and MinGW targets.
* Makefile.am (EMUL_EXTRA_BINARIES): New variable.  Initialised
by the configure script.
(ALL_EMUL_EXTRA_BINARIES): New variable.
(default-manifest.o): New rule to build the default manifest.
(ld_new_DEPENDENCIES): Add EMUL_EXTRA_BINARIES.
(install-data-local): Add EMUL_EXTRA_BINARIES.
* Makefile.in: Regenerate.
* ld.texinfo: Document default manifest support.
* emulparams/i386pe.sh (DEFAULT_MANIFEST): Define.
* emulparams/i386pep.sh (DEFAULT_MANIFEST): Define.
* emultempl/default-manifest.rc: New file.
* scripttempl/pe.sc (R_RSRC): Include DEFAULT_MANIFEST, if defined.
* scripttempl/pep.sc (R_RSRC): Likewise.

* ld-pe/longsecn-1.d: Allow for extra sections.
* ld-pe/longsecn-2.d: Likewise.
* ld-pe/longsecn.d: Likewise.
* ld-pe/secrel.d: Likewise.

10 years agoFix ELF ppc32 targets that don't use ppc32elf.em
Alan Modra [Thu, 27 Feb 2014 13:01:35 +0000 (23:31 +1030)] 
Fix ELF ppc32 targets that don't use ppc32elf.em

5446cbdf82892a800ed7eef563a795e75223ec52 broke powerpc-lynxos,
powerpc-netware, powerpc-windiss and powerpc-vxworks.

bfd/
* elf32-ppc.c (ppc_elf_link_hash_table_create): Provide default
params for targets that don't use ppc32elf.em.
ld/
* emulparams/elf32ppcvxworks.sh: Source plt_unwind.sh and
use ppc32elf.em.
* emultempl/ppc32elf.em (ppc_after_open): Don't compile for
vxworks.
(LDEMUL_AFTER_OPEN): Don't set for vxworks.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Exclude
-secure-plt, -bss-plt and -sdata-got when vxworks.

10 years agoCall common OpenBSD ABI init code on OpenBSD/mips64.
Mark Kettenis [Thu, 27 Feb 2014 13:07:10 +0000 (14:07 +0100)] 
Call common OpenBSD ABI init code on OpenBSD/mips64.

        * mips64obsd-tdep.c (mips64obsd_init_abi): Call obsd_init_abi.
        * configure.tgt (mips64*-*-openbsd*): Add obsd-tdep.c to
        gdb_target_obs.

10 years agoAdd gdbarch auxv parsing for OpenBSD.
Mark Kettenis [Thu, 27 Feb 2014 12:47:00 +0000 (13:47 +0100)] 
Add gdbarch auxv parsing for OpenBSD.

gdb/Changelog:

        * obsd-tdep.c (obsd_auxv_parse): New function.
        (obsd_init_abi): Set auxv_parse.

10 years agoAdd auxv parsing to the architecture vector.
Mark Kettenis [Thu, 27 Feb 2014 12:40:15 +0000 (13:40 +0100)] 
Add auxv parsing to the architecture vector.

Necessary to fix parsing auxv entries from core files on systems that use
the layout specified by ELF instead of the incompatible variant used by Linux.

gdb/Changelog:

        * gdbarch.sh (auxv_parse): New.
        * gdbarch.h: Regenerated.
        * gdbarch.c: Regenerated.
        * auxv.c (target_auxv_parse): Call gdbarch_parse_auxv if provided.

10 years agodaily update
Alan Modra [Wed, 26 Feb 2014 23:01:09 +0000 (09:31 +1030)] 
daily update

10 years agoguile: Add 'history-append!' procedure.
Ludovic Courtès [Tue, 18 Feb 2014 22:35:46 +0000 (23:35 +0100)] 
guile: Add 'history-append!' procedure.

gdb/
2014-02-26  Ludovic Courtès  <ludo@gnu.org>

* guile/scm-value.c (gdbscm_history_append_x): New function.
(value_functions): Add it.

gdb/testsuite/
2014-02-26  Ludovic Courtès  <ludo@gnu.org>

* gdb.guile/scm-value.exp (test_value_in_inferior): Add
test for 'history-append!'.

gdb/doc/
2014-02-26  Ludovic Courtès  <ludo@gnu.org>

* gdb/doc/guile.texi (Basic Guile): Document 'history-append!'.

10 years agogdbserver/Windows: Rely purely on event info when handling DLL load event
Joel Brobecker [Mon, 24 Feb 2014 23:21:14 +0000 (15:21 -0800)] 
gdbserver/Windows: Rely purely on event info when handling DLL load event

This is the GDBserver counterpart of a change we recently made in
GDB to only rely on get_image_name to determine its name.

This simplification, in turn, allows us to remove a fair amount of
functions and globals which now become unused.

gdb/gdbserver/ChangeLog:

* win32-low.c (psapi_get_dll_name,
* win32_CreateToolhelp32Snapshot): Delete.
(win32_CreateToolhelp32Snapshot, win32_Module32First)
(win32_Module32Next, load_toolhelp, toolhelp_get_dll_name):
Delete.
(handle_load_dll): Add function description.
Remove code using psapi_get_dll_name and toolhelp_get_dll_name.

10 years agowindows: Factorize handling of DLL load address offset
Joel Brobecker [Mon, 24 Feb 2014 23:21:13 +0000 (15:21 -0800)] 
windows: Factorize handling of DLL load address offset

This patch is a small cleanup that moves the magic 0x1000 offset
to apply to a DLL's base address inside the win32_add_one_solib
function, rather than delegate that reponsibility to its callers.

gdb/gdbserver/ChangeLog:

* win32-low.c (win32_add_one_solib): Add 0x1000 to load_addr.
Add comment.
(win32_add_all_dlls): Remove 0x1000 offset applied to DLL
base address when calling win32_add_one_solib.
(handle_load_dll): Delete local variable load_addr.
Remove 0x1000 offset applied to DLL base address when calling
win32_add_one_solib.
(handle_unload_dll): Add comment.

10 years agogdbserver/windows: Ignore DLL load/unload events during child initialization.
Joel Brobecker [Mon, 24 Feb 2014 23:21:12 +0000 (15:21 -0800)] 
gdbserver/windows: Ignore DLL load/unload events during child initialization.

This GDBserver patch mirrors a change made in GDB wich aims at
simplifying DLL handling during the inferior initialization
(process creation during the "run", or during an "attach").
Instead of processing each DLL load event, which is sometimes
incomplete, we ignore these events until the inferior has completed
its startup phase, and then just iterate over all DLLs via
EnumProcessModules.

As a side-effect, it fixes a small bug where win32_ensure_ntdll_loaded
was missing a 0x1000 offset in the DLL base address. This problem
should only be visible on the 64bit version of Windows 8.1, since
this is the only platform where win32_ensure_ntdll_loaded is actually
needed.

gdb/gdbserver/ChangeLog:

* win32-low.c (win32_add_all_dlls): Renames
win32_ensure_ntdll_loaded.  Rewrite function documentation.
Adjust implementation to always load all DLLs.
Add 0x1000 offset to DLL base address when calling
win32_add_one_solib.
(child_initialization_done): New static global.
(do_initial_child_stuff): Set child_initialization_done to
zero during child initialization, and 1 after.  Replace call
to win32_ensure_ntdll_loaded by call to win32_add_all_dlls.
Add comment.
(match_dll_by_basename, dll_is_loaded_by_basename): Delete.
(handle_unload_dll): Add function documentation.
(get_child_debug_event): Ignore load and unload DLL events
during child initialization.

10 years agoDWARF: Read constant-class addresses correctly
Joel Brobecker [Sat, 15 Feb 2014 15:09:58 +0000 (19:09 +0400)] 
DWARF: Read constant-class addresses correctly

Starting with DWARF version 4, the description of the DW_AT_high_pc
attribute was amended to say:

   if it is of class constant, the value is an unsigned integer offset
   which when added to the low PC gives the address of the first
   location past the last instruction associated with the entity.

A change was made in Apr 27th, 2012 to reflect that change:

  | commit 91da14142c0171e58a91ad58a32fd010b700e761
  | Author: Mark Wielaard <mjw@redhat.com>
  | Date:   Fri Apr 27 18:55:19 2012 +0000
  |
  |     * dwarf2read.c (dwarf2_get_pc_bounds): Check DW_AT_high_pc form to
  |     see whether it is an address or a constant offset from DW_AT_low_pc.
  |     (dwarf2_record_block_ranges): Likewise.
  |     (read_partial_die): Likewise.

Unfortunately, this new interpretation is now used regardless of
the CU's DWARF version. It turns out that one of WindRiver's compilers
(FTR: Diabdata 4.4) is generating DWARF version 2 info with
DW_AT_high_pc attributes improperly using the data4 form. Because of
that, we miscompute all high PCs incorrectly. This leads to a lot of
symtabs having overlapping ranges, which in turn causes havoc in
pc-to-symtab-and-line translations.

One visible effect is when inserting a breakpoint on a given function:

    (gdb) b world
    Breakpoint 1 at 0x4005c4

The source location of the breakpoint is missing. The output should be:

    (gdb) b world
    Breakpoint 1 at 0x4005c8: file dw2-rel-hi-pc-world.c, line 24.

What happens in this case is that the pc-to-SAL translation first
starts be trying to find the symtab associated to our PC using
each symtab's ranges. Because of the high_pc miscomputation,
many symtabs end up matching, and the heuristic trying to select
the most probable one unfortunately returns one that is unrelated
(it really had no change in this case to do any better). Once we
have the wrong symtab, the start searching the associated linetable,
where the addresses are correct, thus finding no match, and therefore
no SAL.

This patch is an attempt at handling the situation as gracefully
as we can, without guarantees.  It introduces a new function
"attr_value_as_address" which uses the correct accessor for getting
the value of a given attribute.  It then adjust the code throughout
this unit to use this function instead of assuming that addresses always
have the DW_FORM_addr format.

It also fixes the original issue of miscomputing the high_pc
by limiting the new interpretation of constant form DW_AT_high_pc
attributes to units using DWARF version 4 or later.

gdb/ChangeLog:

        * dwarf2read.c (attr_value_as_address): New function.
        (dwarf2_find_base_address, read_call_site_scope): Use
        attr_value_as_address in place of DW_ADDR.
        (dwarf2_get_pc_bounds): Use attr_value_as_address to get
        the low and high addresses.  Slight rework of the handling
        of the high pc being a constant form, and limit it to
        DWARF verson 4 or higher.
        (dwarf2_record_block_ranges): Likewise.
        (read_partial_die): Likewise.
        (new_symbol_full): Use attr_value_as_address in place of DW_ADDR.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-hello.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-world.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc.exp: New file.

Tested on x86_64-linux.

10 years agomake "file" use the BFD cache better
Tom Tromey [Thu, 17 Oct 2013 18:03:06 +0000 (12:03 -0600)] 
make "file" use the BFD cache better

Right now the "file" command will discard the exec_bfd and then
possibly open a new one.

If this ends up reopening the same file, it can cause needless work by
gdb -- destroying all the per-BFD data just to re-read it again.

This patch changes the code to hold a reference to the old exec_bfd
while opening the new one.

The possible downside of this is a higher peak memory use.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* exec.c (exec_file_attach): Hold a reference to exec_bfd.

10 years agoadd short-circuit logic to elfread.c
Tom Tromey [Tue, 15 Oct 2013 17:50:58 +0000 (11:50 -0600)] 
add short-circuit logic to elfread.c

If minimal symbols have already been read into a per-BFD object, then
a symbol reader can skip re-reading them.  This changes the ELF reader
to do so.

We only skip the work if the file is ELF+DWARF.  If it has stabs or
mdebug sections, then I think extra information is computed during the
minsym creation pass; and so we must still repeat it.  Eventually even
this will go away, once all symbol types have switched to being
progspace-independent.  In the meantime this has no negative effect --
it is just a missing optimization for a small set of users.

This change also required a somewhat non-obvious change to the OBJSTAT
accounting code.  If a symbol reader skips re-reading minimal symbols,
then the corresponding OBJSTAT will not be updated.  This leads to a
test failure in gdb.base/maint.exp.

To fix this, I've moved the needed stat field out of objfile and into
the per-BFD object.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* elfread.c (elf_read_minimal_symbols): Return early if
minimal symbols have already been read.  Add "ei" parameter.
(elf_symfile_read): Call elf_read_minimal_symbols earlier.
* minsyms.c (prim_record_minimal_symbol_full): Update.
* objfiles.h (struct objstats) <n_minsyms>: Move...
(struct objfile_per_bfd_storage) <n_minsyms>: ... here.
* symmisc.c (print_objfile_statistics): Update.

10 years agosplit out elf_read_minimal_symbols
Tom Tromey [Tue, 15 Oct 2013 17:43:46 +0000 (11:43 -0600)] 
split out elf_read_minimal_symbols

This is just a simple refactoring in elfread.c to split out the
minsym-reading code into its own function.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* elfread.c (elf_read_minimal_symbols): New function, from
elf_symfile_read.
(elf_symfile_read): Call it.

10 years agomove minimal symbols to per-bfd
Tom Tromey [Tue, 15 Oct 2013 17:37:19 +0000 (11:37 -0600)] 
move minimal symbols to per-bfd

Now that minimal symbols are independent of the program space, we can
move them to the per-BFD object.  This lets us save memory in the
multi-inferior case; and, once the symbol readers are updated, time.

The other prerequisite for this move is that all the objects referred
to by the minimal symbols have a lifetime at least as long as the
per-BFD object.  I think this is satisfied partially by this patch
(moving the copied names there) and partially by earlier patches
moving the demangled name hash.

This patch contains a bit of logic to avoid creating new minimal
symbols if they have already been read for a given BFD.  This allows
us to avoid trying to update all the symbol readers for this
condition.  At first glance this may seem like a hack, but some symbol
readers mix psym and minsym reading, and would require logic just like
this regardless -- and it is simpler and less error-prone to just do
the work in a central spot.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* minsyms.c (lookup_minimal_symbol, iterate_over_minimal_symbols)
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline)
(lookup_minimal_symbol_by_pc_section_1)
(lookup_minimal_symbol_and_objfile): Update.
(prim_record_minimal_symbol_full): Use the per-BFD obstack.
Don't allocate a minimal symbol if minsyms have already been read.
(build_minimal_symbol_hash_tables): Update.
(install_minimal_symbols): Do nothing if minsyms already read.
Use the per-BFD obstack.
(terminate_minimal_symbol_table): Use the per-BFD obstack.
* objfiles.c (allocate_objfile): Call
terminate_minimal_symbol_table later.
(have_minimal_symbols): Update.
* objfiles.h (struct objfile_per_bfd_storage) <msymbols,
minimal_symbol_count, msymbol_hash, msymbol_demangled_hash>:
Move from struct objfile.
<minsyms_read>: New field.
(struct objfile) <msymbols, minimal_symbol_count,
msymbol_hash, msymbol_demangled_hash>: Move.
(ALL_OBJFILE_MSYMBOLS): Update.
* symfile.c (read_symbols): Set minsyms_read.
(reread_symbols): Update.
* symmisc.c (dump_objfile, dump_msymbols): Update.

10 years agochange minsyms not to be relocated at read-time
Tom Tromey [Tue, 15 Oct 2013 19:28:57 +0000 (13:28 -0600)] 
change minsyms not to be relocated at read-time

This removes the runtime offsets from minsyms.  Instead, these offsets
will now be applied whenever the minsym's address is computed.

This patch redefines MSYMBOL_VALUE_ADDRESS to actually use the offsets
from the given objfile.  Then, it updates all the symbol readers,
changing them so that they do not add in the section offset when
creating the symbol.

This change also lets us remove relocation of minsyms from
objfile_relocate1 and also msymbols_sort.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* minsyms.c (msymbols_sort): Remove.
* minsyms.h (msymbols_sort): Remove.
* objfiles.c (objfile_relocate1): Don't relocate minsyms.
* symtab.h (MSYMBOL_VALUE_ADDRESS): Use objfile offsets.
* elfread.c (elf_symtab_read): Don't add section offsets.
* xcoffread.c (record_minimal_symbol): Don't add section offset
to minimal symbol address.
* somread.c (text_offset, data_offset): Remove.
(som_symtab_read): Don't add section offsets to minimal symbol
addresses.
* coff-pe-read.c (add_pe_forwarded_sym, read_pe_exported_syms):
Don't add section offsets to minimal symbols.
* coffread.c (coff_symtab_read): Don't add section offsets
to minimal symbol addresses.
* machoread.c (macho_symtab_add_minsym): Don't add section offset
to minimal symbol addresses.
* mipsread.c (read_alphacoff_dynamic_symtab): Don't add
section offset to minimal symbol addresses.
* mdebugread.c (parse_partial_symbols): Don't add section
offset to minimal symbol addresses.
* dbxread.c (read_dbx_dynamic_symtab): Don't add section
offset to minimal symbol addresses.

10 years agostart change to progspace independence
Tom Tromey [Thu, 15 Aug 2013 14:46:35 +0000 (08:46 -0600)] 
start change to progspace independence

This patch starts changing minimal symbols to be independent of the
program space.

Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS
and changes all the code to use it.  This is needed so we can change
gdb to apply the section offset when a minsym's address is computed,
as opposed to baking the offsets into the symbol itself.

A few spots still need the unrelocated address.  For these, we
introduce MSYMBOL_VALUE_RAW_ADDRESS.

As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS,
which computes the address of a bound minimal symbol.  This just does
the obvious thing with the fields.

Note that this change does not actually enable program space
independence.  That requires more changes to gdb.  However, to ensure
that these changes compile properly, this patch does add the needed
section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has
no effect at runtime by multiplying the offset by 0.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* ada-lang.c (ada_main_name): Update.
(ada_add_standard_exceptions): Update.
* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
* arm-tdep.c (skip_prologue_function, arm_skip_stub): Update.
* auxv.c (ld_so_xfer_auxv): Update.
* avr-tdep.c (avr_scan_prologue): Update.
* ax-gdb.c (gen_var_ref): Update.
* blockframe.c (get_pc_function_start)
(find_pc_partial_function_gnu_ifunc): Update.
* breakpoint.c (create_overlay_event_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint): Update.
* bsd-uthread.c (bsd_uthread_lookup_address): Update.
* c-valprint.c (c_val_print): Update.
* coff-pe-read.c (add_pe_forwarded_sym): Update.
* common/agent.c (agent_look_up_symbols): Update.
* dbxread.c (find_stab_function_addr, end_psymtab): Update.
* dwarf2loc.c (call_site_to_target_addr): Update.
* dwarf2read.c (dw2_find_pc_sect_symtab): Update.
* elfread.c (elf_gnu_ifunc_record_cache)
(elf_gnu_ifunc_resolve_by_got): Update.
* findvar.c (default_read_var_value): Update.
* frame.c (inside_main_func): Update.
* frv-tdep.c (frv_frame_this_id): Update.
* glibc-tdep.c (glibc_skip_solib_resolver): Update.
* gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline):
Update.
* hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence)
(hppa_hpux_find_dummy_bpaddr): Update.
* hppa-tdep.c (hppa_symbol_address): Update.
* infcmd.c (until_next_command): Update.
* jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal):
Update.
* linespec.c (minsym_found, add_minsym): Update.
* linux-nat.c (get_signo): Update.
* linux-thread-db.c (inferior_has_bug): Update.
* m32c-tdep.c (m32c_return_value)
(m32c_m16c_address_to_pointer): Update.
* m32r-tdep.c (m32r_frame_this_id): Update.
* m68hc11-tdep.c (m68hc11_get_register_info): Update.
* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
* maint.c (maintenance_translate_address): Update.
* minsyms.c (lookup_minimal_symbol_by_pc_name): Update.
(frob_address): New function.
(lookup_minimal_symbol_by_pc_section_1): Use raw addresses,
frob_address.  Rename parameter to "pc_in".
(compare_minimal_symbols, compact_minimal_symbols): Use raw
addresses.
(find_solib_trampoline_target, minimal_symbol_upper_bound):
Update.
* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
* mips-tdep.c (mips_skip_pic_trampoline_code): Update.
* objc-lang.c (find_objc_msgsend): Update.
* objfiles.c (objfile_relocate1): Update.
* obsd-tdep.c (obsd_skip_solib_resolver): Update.
* p-valprint.c (pascal_val_print): Update.
* parse.c (write_exp_msymbol): Update.
* ppc-linux-tdep.c (ppc_linux_spe_context_lookup)
(ppc_elfv2_skip_entrypoint): Update.
* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
* printcmd.c (build_address_symbolic, msym_info)
(address_info): Update.
* proc-service.c (ps_pglobal_lookup): Update.
* psymtab.c (find_pc_sect_psymtab_closer)
(find_pc_sect_psymtab, find_pc_sect_symtab_from_partial):
Change msymbol parameter to bound_minimal_symbol.
* ravenscar-thread.c (get_running_thread_id): Update.
* remote.c (remote_check_symbols): Update.
* sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw
address.
* sol2-tdep.c (sol2_skip_solib_resolver): Update.
* solib-dsbt.c (lm_base): Update.
* solib-frv.c (lm_base, main_got): Update.
* solib-irix.c (locate_base): Update.
* solib-som.c (som_solib_create_inferior_hook)
(link_map_start): Update.
* solib-spu.c (spu_enable_break, ocl_enable_break): Update.
* solib-svr4.c (elf_locate_base, enable_break): Update.
* spu-tdep.c (spu_get_overlay_table, spu_catch_start)
(flush_ea_cache): Update.
* stabsread.c (define_symbol, scan_file_globals): Update.
* stack.c (find_frame_funname): Update.
* symfile-debug.c (debug_qf_expand_symtabs_matching)
(debug_qf_find_pc_sect_symtab): Update.
* symfile.c (simple_read_overlay_table)
(simple_overlay_update): Update.
* symfile.h (struct quick_symbol_functions)
<find_pc_sect_symtab>: Change type of msymbol to
bound_minimal_symbol.
* symmisc.c (dump_msymbols): Update.
* symtab.c (find_pc_sect_symtab_via_partial)
(find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal)
(search_symbols, print_msymbol_info): Update.
* symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro.
(MSYMBOL_VALUE_ADDRESS): Redefine.
(BMSYMBOL_VALUE_ADDRESS): New macro.
* tracepoint.c (scope_info): Update.
* tui/tui-disasm.c (tui_find_disassembly_address)
(tui_get_begin_asm_address): Update.
* valops.c (find_function_in_inferior): Update.
* value.c (value_static_field, value_fn_field): Update.

10 years agouse bound_minsym as result for lookup_minimal_symbol et al
Tom Tromey [Tue, 15 Oct 2013 01:53:29 +0000 (19:53 -0600)] 
use bound_minsym as result for lookup_minimal_symbol et al

This patch changes a few minimal symbol lookup functions to return a
bound_minimal_symbol rather than a pointer to the minsym.  This change
helps prepare gdb for computing a minimal symbol's address at the
point of use.

Note that this changes even those functions that ostensibly search a
single objfile.  That was necessary because, in fact, those functions
can search an objfile and its separate debug objfiles; and it is
important for the caller to know in which objfile the minimal symbol
was actually found.

The bulk of this patch is mechanical.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* ada-lang.c (ada_update_initial_language): Update.
(ada_main_name, ada_has_this_exception_support): Update.
* ada-tasks.c (ada_tasks_inferior_data_sniffer): Update.
* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
* arm-tdep.c (arm_skip_stub): Update.
* auxv.c (ld_so_xfer_auxv): Update.
* avr-tdep.c (avr_scan_prologue): Update.
* ax-gdb.c (gen_var_ref): Update.
* breakpoint.c (struct breakpoint_objfile_data)
<overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change
type to bound_minimal_symbol.
(create_overlay_event_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint): Update.
* bsd-uthread.c (bsd_uthread_lookup_address): Update.
* c-exp.y (classify_name): Update.
* coffread.c (coff_symfile_read): Update.
* common/agent.c (agent_look_up_symbols): Update.
* d-lang.c (d_main_name): Update.
* dbxread.c (find_stab_function_addr, end_psymtab): Update.
* dec-thread.c (enable_dec_thread): Update.
* dwarf2loc.c (call_site_to_target_addr): Update.
* elfread.c (elf_gnu_ifunc_resolve_by_got): Update.
* eval.c (evaluate_subexp_standard): Update.
* findvar.c (struct minsym_lookup_data) <result>: Change type
to bound_minimal_symbol.
<objfile>: Remove.
(minsym_lookup_iterator_cb, default_read_var_value): Update.
* frame.c (inside_main_func): Update.
* frv-tdep.c (frv_frame_this_id): Update.
* gcore.c (call_target_sbrk): Update.
* glibc-tdep.c (glibc_skip_solib_resolver): Update.
* gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline):
Update.
* go-lang.c (go_main_name): Update.
* hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code)
(hppa_hpux_find_import_stub_for_addr): Update.
* hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol):
Update.  Change return type.
* hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return
type.
* jit.c (jit_breakpoint_re_set_internal): Update.
* linux-fork.c (inferior_call_waitpid, checkpoint_command):
Update.
* linux-nat.c (get_signo): Update.
* linux-thread-db.c (inferior_has_bug): Update
* m32c-tdep.c (m32c_return_value)
(m32c_m16c_address_to_pointer): Update.
* m32r-tdep.c (m32r_frame_this_id): Update.
* m68hc11-tdep.c (m68hc11_get_register_info): Update.
* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
* minsyms.c (lookup_minimal_symbol_internal): Rename to
lookup_minimal_symbol.  Change return type.
(lookup_minimal_symbol): Remove.
(lookup_bound_minimal_symbol): Update.
(lookup_minimal_symbol_text): Change return type.
(lookup_minimal_symbol_solib_trampoline): Change return type.
* minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text)
(lookup_minimal_symbol_solib_trampoline): Change return type.
* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
* objc-lang.c (lookup_objc_class, lookup_child_selector)
(value_nsstring, find_imps): Update.
* obsd-tdep.c (obsd_skip_solib_resolver): Update.
* p-lang.c (pascal_main_name): Update.
* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update.
* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
* proc-service.c (ps_pglobal_lookup): Update.
* ravenscar-thread.c (get_running_thread_msymbol): Change
return type.
(has_ravenscar_runtime, get_running_thread_id): Update.
* remote.c (remote_check_symbols): Update.
* sol-thread.c (ps_pglobal_lookup): Update.
* sol2-tdep.c (sol2_skip_solib_resolver): Update.
* solib-dsbt.c (lm_base): Update.
* solib-frv.c (lm_base, frv_relocate_section_addresses):
Update.
* solib-irix.c (locate_base): Update.
* solib-som.c (som_solib_create_inferior_hook)
(som_solib_desire_dynamic_linker_symbols, link_map_start):
Update.
* solib-spu.c (spu_enable_break): Update.
* solib-svr4.c (elf_locate_base, enable_break): Update.
* spu-tdep.c (spu_get_overlay_table, spu_catch_start)
(flush_ea_cache): Update.
* stabsread.c (define_symbol): Update.
* symfile.c (simple_read_overlay_table): Update.
* symtab.c (find_pc_sect_line): Update.
* tracepoint.c (scope_info): Update.
* tui-disasm.c (tui_get_begin_asm_address): Update.
* value.c (value_static_field): Update.

10 years agomake MSYMBOL_VALUE_ADDRESS an rvalue
Tom Tromey [Thu, 15 Aug 2013 14:44:43 +0000 (08:44 -0600)] 
make MSYMBOL_VALUE_ADDRESS an rvalue

This changes MSYMBOL_VALUE_ADDRESS to be an rvalue.  In a later patch
we change this macro to compute its value; this patch introduces a
setter to make the break a bit cleaner.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* minsyms.c (prim_record_minimal_symbol_full): Use
SET_MSYMBOL_VALUE_ADDRESS.
* objfiles.c (objfile_relocate1): Use SET_MSYMBOL_VALUE_ADDRESS.
* sh64-tdep.c (sh64_elf_make_msymbol_special): Use
SET_MSYMBOL_VALUE_ADDRESS.
* symtab.h (MSYMBOL_VALUE_ADDRESS): Expand to an rvalue.
(SET_MSYMBOL_VALUE_ADDRESS): New macro.

10 years agochange minsym representation
Tom Tromey [Thu, 15 Aug 2013 14:43:43 +0000 (08:43 -0600)] 
change minsym representation

In a later patch we're going to change the minimal symbol address
calculation to apply section offsets at the point of use.  To make it
simpler to catch potential problem spots, this patch changes the
representation of minimal symbols and introduces new
minimal-symbol-specific variants of the various accessors.  This is
necessary because it would be excessively ambitious to try to convert
all the symbol types at once.

The core of this change is just renaming a field in minimal_symbol;
the rest is just a fairly mechanical rewording.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* symtab.h (struct minimal_symbol) <mginfo>: Rename from ginfo.
(MSYMBOL_VALUE, MSYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_BYTES)
(MSYMBOL_BLOCK_VALUE, MSYMBOL_VALUE_CHAIN, MSYMBOL_LANGUAGE)
(MSYMBOL_SECTION, MSYMBOL_OBJ_SECTION, MSYMBOL_NATURAL_NAME)
(MSYMBOL_LINKAGE_NAME, MSYMBOL_PRINT_NAME, MSYMBOL_DEMANGLED_NAME)
(MSYMBOL_SET_LANGUAGE, MSYMBOL_SEARCH_NAME)
(MSYMBOL_MATCHES_SEARCH_NAME, MSYMBOL_SET_NAMES): New macros.
* ada-lang.c (ada_main_name): Update.
(ada_lookup_simple_minsym): Update.
(ada_make_symbol_completion_list): Update.
(ada_add_standard_exceptions): Update.
* ada-tasks.c (read_atcb, ada_tasks_inferior_data_sniffer): Update.
* aix-thread.c (pdc_symbol_addrs, pd_enable): Update.
* amd64-windows-tdep.c (amd64_skip_main_prologue): Update.
* arm-tdep.c (skip_prologue_function): Update.
(arm_skip_stack_protector, arm_skip_stub): Update.
* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
(arm_wince_skip_main_prologue): Update.
* auxv.c (ld_so_xfer_auxv): Update.
* avr-tdep.c (avr_scan_prologue): Update.
* ax-gdb.c (gen_var_ref): Update.
* block.c (call_site_for_pc): Update.
* blockframe.c (get_pc_function_start): Update.
(find_pc_partial_function_gnu_ifunc): Update.
* breakpoint.c (create_overlay_event_breakpoint): Update.
(create_longjmp_master_breakpoint): Update.
(create_std_terminate_master_breakpoint): Update.
(create_exception_master_breakpoint): Update.
(resolve_sal_pc): Update.
* bsd-uthread.c (bsd_uthread_lookup_address): Update.
* btrace.c (ftrace_print_function_name, ftrace_function_switched):
Update.
* c-valprint.c (c_val_print): Update.
* coff-pe-read.c (add_pe_forwarded_sym): Update.
* coffread.c (coff_symfile_read): Update.
* common/agent.c (agent_look_up_symbols): Update.
* dbxread.c (find_stab_function_addr): Update.
(end_psymtab): Update.
* dwarf2loc.c (call_site_to_target_addr): Update.
(func_verify_no_selftailcall): Update.
(tailcall_dump): Update.
(call_site_find_chain_1): Update.
(dwarf_expr_reg_to_entry_parameter): Update.
* elfread.c (elf_gnu_ifunc_record_cache): Update.
(elf_gnu_ifunc_resolve_by_got): Update.
* f-valprint.c (info_common_command): Update.
* findvar.c (read_var_value): Update.
* frame.c (get_prev_frame_1): Update.
(inside_main_func): Update.
* frv-tdep.c (frv_skip_main_prologue): Update.
(frv_frame_this_id): Update.
* glibc-tdep.c (glibc_skip_solib_resolver): Update.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Update.
* gnu-v3-abi.c (gnuv3_rtti_type): Update.
(gnuv3_skip_trampoline): Update.
* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline): Update.
(hppa64_hpux_in_solib_call_trampoline): Update.
(hppa_hpux_skip_trampoline_code): Update.
(hppa64_hpux_search_dummy_call_sequence): Update.
(hppa_hpux_find_import_stub_for_addr): Update.
(hppa_hpux_find_dummy_bpaddr): Update.
* hppa-tdep.c (hppa_symbol_address)
(hppa_lookup_stub_minimal_symbol): Update.
* i386-tdep.c (i386_skip_main_prologue): Update.
(i386_pe_skip_trampoline_code): Update.
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update.
* infcall.c (get_function_name): Update.
* infcmd.c (until_next_command): Update.
* jit.c (jit_breakpoint_re_set_internal): Update.
(jit_inferior_init): Update.
* linespec.c (minsym_found): Update.
(add_minsym): Update.
* linux-fork.c (info_checkpoints_command): Update.
* linux-nat.c (get_signo): Update.
* linux-thread-db.c (inferior_has_bug): Update.
* m32c-tdep.c (m32c_return_value): Update.
(m32c_m16c_address_to_pointer): Update.
(m32c_m16c_pointer_to_address): Update.
* m32r-tdep.c (m32r_frame_this_id): Update.
* m68hc11-tdep.c (m68hc11_get_register_info): Update.
* machoread.c (macho_resolve_oso_sym_with_minsym): Update.
* maint.c (maintenance_translate_address): Update.
* minsyms.c (add_minsym_to_hash_table): Update.
(add_minsym_to_demangled_hash_table): Update.
(msymbol_objfile): Update.
(lookup_minimal_symbol): Update.
(iterate_over_minimal_symbols): Update.
(lookup_minimal_symbol_text): Update.
(lookup_minimal_symbol_by_pc_name): Update.
(lookup_minimal_symbol_solib_trampoline): Update.
(lookup_minimal_symbol_by_pc_section_1): Update.
(lookup_minimal_symbol_and_objfile): Update.
(prim_record_minimal_symbol_full): Update.
(compare_minimal_symbols): Update.
(compact_minimal_symbols): Update.
(build_minimal_symbol_hash_tables): Update.
(install_minimal_symbols): Update.
(terminate_minimal_symbol_table): Update.
(find_solib_trampoline_target): Update.
(minimal_symbol_upper_bound): Update.
* mips-linux-tdep.c (mips_linux_skip_resolver): Update.
* mips-tdep.c (mips_stub_frame_sniffer): Update.
(mips_skip_pic_trampoline_code): Update.
* msp430-tdep.c (msp430_skip_trampoline_code): Update.
* objc-lang.c (selectors_info): Update.
(classes_info): Update.
(find_methods): Update.
(find_imps): Update.
(find_objc_msgsend): Update.
* objfiles.c (objfile_relocate1): Update.
* objfiles.h (ALL_OBJFILE_MSYMBOLS): Update.
* obsd-tdep.c (obsd_skip_solib_resolver): Update.
* p-valprint.c (pascal_val_print): Update.
* parse.c (write_exp_msymbol): Update.
* ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code)
(ppc_linux_spe_context_lookup, ppc_elfv2_skip_entrypoint): Update.
* ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update.
* printcmd.c (build_address_symbolic): Update.
(sym_info): Update.
(address_info): Update.
* proc-service.c (ps_pglobal_lookup): Update.
* psymtab.c (find_pc_sect_psymtab_closer): Update.
(find_pc_sect_psymtab): Update.
* python/py-framefilter.c (py_print_frame): Update.
* ravenscar-thread.c (get_running_thread_id): Update.
* record-btrace.c (btrace_call_history, btrace_get_bfun_name):
Update.
* remote.c (remote_check_symbols): Update.
* rs6000-tdep.c (rs6000_skip_main_prologue): Update.
(rs6000_skip_trampoline_code): Update.
* sh64-tdep.c (sh64_elf_make_msymbol_special): Update.
* sol2-tdep.c (sol2_skip_solib_resolver): Update.
* solib-dsbt.c (lm_base): Update.
* solib-frv.c (lm_base): Update.
(main_got): Update.
* solib-irix.c (locate_base): Update.
* solib-som.c (som_solib_create_inferior_hook): Update.
(som_solib_desire_dynamic_linker_symbols): Update.
(link_map_start): Update.
* solib-spu.c (spu_enable_break): Update.
(ocl_enable_break): Update.
* solib-svr4.c (elf_locate_base): Update.
(enable_break): Update.
* spu-tdep.c (spu_get_overlay_table): Update.
(spu_catch_start): Update.
(flush_ea_cache): Update.
* stabsread.c (define_symbol): Update.
(scan_file_globals): Update.
* stack.c (find_frame_funname): Update.
(frame_info): Update.
* symfile.c (simple_read_overlay_table): Update.
(simple_overlay_update): Update.
* symmisc.c (dump_msymbols): Update.
* symtab.c (fixup_section): Update.
(find_pc_sect_line): Update.
(skip_prologue_sal): Update.
(search_symbols): Update.
(print_msymbol_info): Update.
(rbreak_command): Update.
(MCOMPLETION_LIST_ADD_SYMBOL): New macro.
(completion_list_objc_symbol): Update.
(default_make_symbol_completion_list_break_on): Update.
* tracepoint.c (scope_info): Update.
* tui/tui-disasm.c (tui_find_disassembly_address): Update.
(tui_get_begin_asm_address): Update.
* valops.c (find_function_in_inferior): Update.
* value.c (value_static_field): Update.
(value_fn_field): Update.

10 years agointroduce minimal_symbol_upper_bound
Tom Tromey [Mon, 19 Aug 2013 13:58:44 +0000 (07:58 -0600)] 
introduce minimal_symbol_upper_bound

This introduces minimal_symbol_upper_bound and changes various bits of
code to use it.  Since this function is intimately tied to the
implementation of minimal symbol tables, I believe it belongs in
minsyms.c.

The new function is extracted from find_pc_partial_function_gnu_ifunc.
This isn't a "clean" move because the old function interleaved the
caching and the computation; but this doesn't make sense for the new
code.

2014-02-26  Tom Tromey  <tromey@redhat.com>

* blockframe.c (find_pc_partial_function_gnu_ifunc): Use
bound minimal symbols.  Move code that knows about minsym
table layout...
* minsyms.c (minimal_symbol_upper_bound): ... here.  New
function.
* minsyms.h (minimal_symbol_upper_bound): Declare.
* objc-lang.c (find_objc_msgsend): Use bound minimal symbols,
minimal_symbol_upper_bound.

10 years ago[Python] Make regexp collection printers work with typedefs as well.
Joel Brobecker [Thu, 30 Jan 2014 03:37:08 +0000 (07:37 +0400)] 
[Python] Make regexp collection printers work with typedefs as well.

Consider the following type for which we would like to provide
a pretty-printer and manage it via RegexpCollectionPrettyPrinter:

        typedef long time_t;

Currently, this does not work because this framework only considers
the type's tag name:

        typename = gdb.types.get_basic_type(val.type).tag
        if not typename:
            return None

This patch extends it to use the type's name if the basic type
does not have a tag name, thus allowing the framework to also
work with typedefs like the above.

gdb/ChangeLog:

        * python/lib/gdb/printing.py (RegexpCollectionPrettyPrinter):
        Use the type's name if its basic type does not have a tag.

gdb/testsuite/ChangeLog:

        * testsuite/gdb.python/py-pp-re-notag.c: New file.
        * testsuite/gdb.python/py-pp-re-notag.ex: New file.
        * testsuite/gdb.python/py-pp-re-notag.p: New file.

10 years agoAdd comment in dwarf2read.c::read_subrange_type
Joel Brobecker [Wed, 26 Feb 2014 18:53:05 +0000 (10:53 -0800)] 
Add comment in dwarf2read.c::read_subrange_type

This comment explains why we sometimes sign-extend the range type
bounds when we normally shouldn't have to.

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Add comment.

10 years agoDWARF: Set enum type "flag_enum" and "unsigned" flags at type creation.
Joel Brobecker [Wed, 22 Jan 2014 14:40:20 +0000 (18:40 +0400)] 
DWARF: Set enum type "flag_enum" and "unsigned" flags at type creation.

Consider the following Ada code:

   --  An array whose index is an enumeration type with 128 enumerators.
   type Enum_T is (Enum_000, Enum_001, [...], Enum_128);
   type Table is array (Enum_T) of Boolean;

When the compiler is configured to generate pure DWARF debugging info,
trying to print type Table's description yields:

    ptype pck.table
    type = array (enum_000 .. -128) of boolean

The expected output was:

    ptype pck.table
    type = array (enum_000 .. enum_128) of boolean

The DWARF debugging info for our array looks like this:

    <1><44>: Abbrev Number: 5 (DW_TAG_array_type)
       <45>   DW_AT_name        : pck__table
       <50>   DW_AT_type        : <0x28>
    <2><54>: Abbrev Number: 6 (DW_TAG_subrange_type)
       <55>   DW_AT_type        : <0x5c>
       <59>   DW_AT_lower_bound : 0
       <5a>   DW_AT_upper_bound : 128

The array index type is, by construction with the DWARF standard,
a subrange of our enumeration type, defined as follow:

    <2><5b>: Abbrev Number: 0
    <1><5c>: Abbrev Number: 7 (DW_TAG_enumeration_type)
       <5d>   DW_AT_name        : pck__enum_t
       <69>   DW_AT_byte_size   : 1
    <2><6b>: Abbrev Number: 8 (DW_TAG_enumerator)
       <6c>   DW_AT_name        : pck__enum_000
       <7a>   DW_AT_const_value : 0
    [etc]

Therefore, while processing these DIEs, the array index type ends
up being a TYPE_CODE_RANGE whose target type is our enumeration type.
But the problem is that we read the upper bound as a negative value
(-128), which is then used as is by the type printer to print the
array upper bound. This negative value explains the "-128" in the
output.

To understand why the range type's upper bound is read as a negative
value, one needs to look at how it is determined, in read_subrange_type:

  orig_base_type = die_type (die, cu);
  base_type = check_typedef (orig_base_type);
  [... high is first correctly read as 128, but then ...]
  if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
    high |= negative_mask;

The negative_mask is applied, here, because BASE_TYPE->FLAG_UNSIGNED
is not set. And the reason for that is because the base_type was only
partially constructed during the call to die_type. While the enum
is constructed on the fly by read_enumeration_type, its flag_unsigned
flag is only set later on, while creating the symbols corresponding to
the enum type's enumerators (see process_enumeration_scope), after
we've already finished creating our range type - and therefore too
late.

My first naive attempt at fixing this problem consisted in extracting
the part in process_enumeration_scope which processes all enumerators,
to generate the associated symbols, but more importantly set the type's
various flags when necessary. However, this does not always work well,
because we're still in the subrange_type's scope, and it might be
different from the scope where the enumeration type is defined.

So, instead, what this patch does to fix the issue is to extract
from process_enumeration_scope the part that determines whether
the enumeration type should have the flag_unsigned and/or the
flag_flag_enum flags set. It turns out that, aside from the code
implementing the loop, this part is fairly independent of the symbol
creation. With that part extracted, we can then use it at the end
of our enumeration type creation, to produce a type which should now
no longer need any adjustment.

Once the enumeration type produced is correctly marked as unsigned,
the subrange type's upper bound is then correctly read as an unsigned
value, therefore giving us an upper bound of 128 instead of -128.

gdb/ChangeLog:

        * dwarf2read.c (update_enumeration_type_from_children): New
        function, mostly extracted from process_structure_scope.
        (read_enumeration_type): Call update_enumeration_type_from_children.
        (process_enumeration_scope): Do not set THIS_TYPE's flag_unsigned
        and flag_flag_enum fields.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/arr-subrange.c, gdb.dwarf2/arr-subrange.exp: New files.

10 years agoMention PR breakpoints/16292 in corresponding ChangeLog entry.
Pedro Alves [Wed, 26 Feb 2014 16:33:13 +0000 (16:33 +0000)] 
Mention PR breakpoints/16292 in corresponding ChangeLog entry.

10 years agobsd-uthread.c: Don't install a to_xfer_partial method
Pedro Alves [Wed, 26 Feb 2014 14:36:05 +0000 (14:36 +0000)] 
bsd-uthread.c: Don't install a to_xfer_partial method

Whatever the comment about deprecated_xfer_memory referred to,
deprecated_xfer_memory is gone now.  There's no need to install a
target method that just delegates, as that's what the default
delegator does already.

Tested by building an --enable-targets=all gdb on x86_64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* bsd-uthread.c (bsd_uthread_xfer_partial): Delete function.
(bsd_uthread_target): Don't install bsd_uthread_xfer_partial as
to_xfer_partial method.

10 years agoeliminate target_ops->deprecated_xfer_memory
Pedro Alves [Wed, 26 Feb 2014 14:36:04 +0000 (14:36 +0000)] 
eliminate target_ops->deprecated_xfer_memory

As no target uses it anymore, it can finally go away.

After removing the deprecated_xfer_memory handling from
default_xfer_partial, we can delete the latter, because the only thing
it does is delegate to the target beneath unconditionally, which is
what the delegator installed by target-delegates.c will do for us if
no to_xfer_partial method is installed.

This was the last user of de_fault, so that goes away too.

Tested on x86_64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* target.c (complete_target_initialization): Don't install
default_xfer_partial as to_xfer_partial hook.
(nomemory): Delete.
(update_current_target): Don't INHERIT nor de_fault
deprecated_xfer_memory.  Delete de_fault macro.
(default_xfer_partial, deprecated_debug_xfer_memory): Delete.
(setup_target_debug): Don't install a deprecated_xfer_memory hook.
* target.h (struct target_ops) <deprecated_xfer_memory>: Delete
field.

10 years agogo32-nat.c: Don't install a deprecated_xfer_memory method
Pedro Alves [Wed, 26 Feb 2014 14:36:04 +0000 (14:36 +0000)] 
go32-nat.c: Don't install a deprecated_xfer_memory method

This removes yet another instance of a deprecated_xfer_memory user.

Unfortunately djgpp's write_child function takes a non-const buffer
pointer, while GDB's xfer_partial api passes a const pointer.  To be
const-correct, we need to copy that buffer to a non-const buffer, and
pass the copy to write_child.  This is actually what
target.c:default_xfer_partial itself does, when calling into the
ops->deprecated_xfer_memory hook.

Tested by cross-building djgpp gdb, on x86-64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* go32-nat.c (my_write_child): New function.
(go32_xfer_memory): Rewrite as to_xfer_partial helper.
(go32_xfer_partial): New function.
(init_go32_ops): Don't install a deprecated_xfer_memory hook.
Instead install a to_xfer_partial hook.

10 years agonto-procfs.c: Don't install a deprecated_xfer_memory method
Pedro Alves [Wed, 26 Feb 2014 14:36:04 +0000 (14:36 +0000)] 
nto-procfs.c: Don't install a deprecated_xfer_memory method

This removes yet another instance of a deprecated_xfer_memory user.

Completely untested.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* nto-procfs.c (procfs_xfer_memory): Adjust interface as a
to_xfer_partial helper.  Rewrite.
(procfs_xfer_partial): New function.
(init_procfs_ops): Don't install a deprecated_xfer_memory hook.
Install a to_xfer_partial hook.

10 years agoremote-m32r-sdi.c: Don't install a deprecated_xfer_memory method
Pedro Alves [Wed, 26 Feb 2014 14:36:03 +0000 (14:36 +0000)] 
remote-m32r-sdi.c: Don't install a deprecated_xfer_memory method

This removes yet another instance of a deprecated_xfer_memory user.

Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* remote-m32r-sdi.c (send_data): Constify 'buf' parameter.
(m32r_xfer_memory): Adjust as a to_xfer_partial helper.
(m32r_xfer_partial): New function.
(init_m32r_ops): Don't install a deprecated_xfer_memory hook.
Install a to_xfer_partial hook.

10 years agoremote-mips.c: Don't install a deprecated_xfer_memory method
Pedro Alves [Wed, 26 Feb 2014 14:36:03 +0000 (14:36 +0000)] 
remote-mips.c: Don't install a deprecated_xfer_memory method

This removes another yet instance of a deprecated_xfer_memory user.

Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* remote-mips.c (mips_xfer_memory): Adjust as to_xfer_partial
helper.
(mips_xfer_partial): New function.
(_initialize_remote_mips): Don't install a deprecated_xfer_memory
hook.  Install a to_xfer_partial hook.

10 years agoDWARF: Add array DW_AT_bit_stride and DW_AT_byte_stride support
Joel Brobecker [Wed, 29 Jan 2014 13:39:56 +0000 (17:39 +0400)] 
DWARF: Add array DW_AT_bit_stride and DW_AT_byte_stride support

Consider the following declarations in Ada...

   type Item is range -32 .. 31;
   for Item'Size use 6;

   type Table is array (Natural range 0 .. 4) of Item;
   pragma Pack (Table);

... which declare a packed array whose elements are 6 bits long.
The debugger currently does not notice that the array is packed,
and thus prints values of this type incorrectly. This can be seen
in the "ptype" output:

    (gdb) ptype table
    type = array (0 .. 4) of foo.item

Normally, the debugger should print:

    (gdb) ptype table
    type = array (0 .. 4) of foo.item <packed: 6-bit elements>

The debugging information for this array looks like this:

        .uleb128 0xf    # (DIE (0x15c) DW_TAG_array_type)
        .long   .LASF9  # DW_AT_name: "pck__table"
        .byte   0x6     # DW_AT_bit_stride
        .long   0x1a9   # DW_AT_type
        .uleb128 0x10   # (DIE (0x16a) DW_TAG_subrange_type)
        .long   0x3b    # DW_AT_type
        .byte   0       # DW_AT_lower_bound
        .byte   0x4     # DW_AT_upper_bound
        .byte   0       # end of children of DIE 0x15c

The interesting part is the DW_AT_bit_stride attribute, which tells
the size of the array elements is 6 bits, rather than the normal
element type's size.

This patch adds support for this attribute by first creating
gdbtypes.c::create_array_type_with_stride, which is an enhanced
version of create_array_type taking an extra parameter as the stride.
The old create_array_type can then be re-implemented very simply
by calling the new create_array_type_with_stride.

We can then use this new function from dwarf2read, to create
arrays with or without stride.

gdb/ChangeLog:

        * gdbtypes.h (create_array_type_with_stride): Add declaration.
        * gdbtypes.c (create_array_type_with_stride): New function,
        renaming create_array_type, but with an added parameter
        called "bit_stride".
        (create_array_type): Re-implement using
        create_array_type_with_stride.
        * dwarf2read.c (read_array_type): Add support for DW_AT_byte_stride
        and DW_AT_bit_stride attributes.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/arr-stride.c: New file.
        * gdb.dwarf2/arr-stride.exp: New file.

The test, relying purely on generating an assembly file, only
verifies the type description of our array. But I was also
able to verify manually that the debugger print values of these
types correctly as well (which was not the case prior to this
patch).

10 years agoMultiple Ada task-specific breakpoints at the same address.
Pedro Alves [Wed, 26 Feb 2014 14:22:33 +0000 (14:22 +0000)] 
Multiple Ada task-specific breakpoints at the same address.

With the test changed as in the patch, against current mainline, we get:

 (gdb) PASS: gdb.ada/tasks.exp: info tasks before inserting breakpoint
 break break_me task 1
 Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
 (gdb) PASS: gdb.ada/tasks.exp: break break_me task 1
 break break_me task 3
 Note: breakpoint 2 also set at pc 0x4030b0.
 Breakpoint 3 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
 (gdb) PASS: gdb.ada/tasks.exp: break break_me task 3
 continue
 Continuing.
 [Switching to Thread 0x7ffff7dc7700 (LWP 27133)]

 Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27
 27       null;
 (gdb) FAIL: gdb.ada/tasks.exp: continue to breakpoint
 info tasks
    ID       TID P-ID Pri State                  Name
     1    63b010       48 Waiting on RV with 3   main_task
     2    63bd80    1  48 Accept or Select Term  task_list(1)
 *   3    63f510    1  48 Accepting RV with 1    task_list(2)
     4    642ca0    1  48 Accept or Select Term  task_list(3)
 (gdb) PASS: gdb.ada/tasks.exp: info tasks after hitting breakpoint

The breakpoint that caused a stop is breakpoint 3, but GDB end up
reporting (and running breakpoint commands of) "Breakpoint 2" instead.

The issue is that the bpstat_check_breakpoint_conditions logic of
"wrong thread" is missing the "wrong task" check.  This is usually
harmless, because the thread hop code in infrun.c code that handles
wrong-task-hitting-breakpoint does check for task-specific breakpoints
(within breakpoint_thread_match):

      /* Check if a regular breakpoint has been hit before checking
         for a potential single step breakpoint.  Otherwise, GDB will
         not see this breakpoint hit when stepping onto breakpoints.  */
      if (regular_breakpoint_inserted_here_p (aspace, stop_pc))
{
  if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid))
    thread_hop_needed = 1;
}

IOW, usually, when one only has a task specific breakpoint at a given
address, things work correctly.  Put another task-specific or
non-task-specific breakpoint there, and things break.

A patch that eliminates the special thread hop code in infrun.c is
what exposed this, as after that GDB solely relies on
bpstat_check_breakpoint_conditions to know whether the right or wrong
task hit a breakpoint.  IOW, given the latent bug, Ada task-specific
breakpoints become non-task-specific, and that is caught by the
testsuite, as:

 break break_me task 3
 Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
 (gdb) PASS: gdb.ada/tasks.exp: break break_me task 3
 continue
 Continuing.
 [Switching to Thread 0x7ffff7fcb700 (LWP 17122)]

 Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27
 27       null;
 (gdb) PASS: gdb.ada/tasks.exp: continue to breakpoint
 info tasks
    ID       TID P-ID Pri State                  Name
     1    63b010       48 Waiting on RV with 2   main_task
 *   2    63bd80    1  48 Accepting RV with 1    task_list(1)
     3    63f510    1  48 Accept or Select Term  task_list(2)
     4    642ca0    1  48 Accept or Select Term  task_list(3)
 (gdb) FAIL: gdb.ada/tasks.exp: info tasks after hitting breakpoint

It was after seeing this that I thought of how to expose the bug with
current mainline.

Tested on x86_64 Fedora 17.

gdb/
2014-02-26  Pedro Alves  <palves@redhat.com>

* breakpoint.c (bpstat_check_breakpoint_conditions): Handle
task-specific breakpoints.

gdb/testsuite/
2014-02-26  Pedro Alves  <palves@redhat.com>

* gdb.ada/tasks.exp: Set a task-specific breakpoint at break_me
that won't ever trigger.  Make sure that GDB reports the correct
breakpoint that caused the stop.

10 years agoResolve PR ld/16569 by emitting (and comparing) unmangled names, unless
Dan Mick [Wed, 26 Feb 2014 12:05:02 +0000 (12:05 +0000)] 
Resolve PR ld/16569 by emitting (and comparing) unmangled names, unless
demangling has specifically been requested.

10 years agoRe-implement ia64-linux-nat.c::ia64_linux_xfer_partial
Pedro Alves [Wed, 26 Feb 2014 01:45:50 +0000 (20:45 -0500)] 
Re-implement ia64-linux-nat.c::ia64_linux_xfer_partial

[description of this patch and ChangeLog entry by Joel Brobecker]
The recent implementation was questionable, and if it worked, it was
only by chance because the requested length is large enough that only
one read was sufficient.  Note that the implementation before that
also made that assumption, in the form of only handling
TARGET_OBJECT_UNWIND_TABLE xfer requests when offset was zero.

gdb/ChangeLog:

        * ia64-linux-nat.c (ia64_linux_xfer_partial): Reimplement
        handling of object == TARGET_OBJECT_UNWIND_TABLE.

10 years agoAnnotate comments for Doxygen.
Stan Shebs [Tue, 25 Feb 2014 23:47:58 +0000 (15:47 -0800)] 
Annotate comments for Doxygen.

10 years agodaily update
Alan Modra [Tue, 25 Feb 2014 23:00:38 +0000 (09:30 +1030)] 
daily update

10 years agoPR gdb/16626
Jan Kratochvil [Tue, 25 Feb 2014 19:47:09 +0000 (20:47 +0100)] 
PR gdb/16626

gdb/testsuite/
2014-02-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/16626
* gdb.base/auto-load.exp: Fix out-of-srctree run.

Message-ID: <87k3cjt3jl.fsf@fleche.redhat.com>

10 years agoremove target_ignore
Tom Tromey [Mon, 24 Feb 2014 21:57:14 +0000 (14:57 -0700)] 
remove target_ignore

This removes target_ignore, which isn't used any more.

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

* target.h (target_ignore): Don't declare.
* target.c (target_ignore): Remove.