external/binutils.git
10 years agogdb.base/memattr.exp regexp improvements.
Andrew Burgess [Wed, 16 Apr 2014 16:42:29 +0000 (17:42 +0100)]
gdb.base/memattr.exp regexp improvements.

  https://sourceware.org/ml/gdb-patches/2014-04/msg00210.html

Improve the regexp used in the memattr.exp test so allow for different
memory regions (.data / .bss) being laid out in different orders.

gdb/testsuite/ChangeLog:

* gdb.base/memattr.exp: Improve regexps to handle memory regions
appearing in any order.

10 years agoFix more fallout from TC_CONS_FIX_NEW change
Alan Modra [Wed, 16 Apr 2014 13:28:15 +0000 (22:58 +0930)]
Fix more fallout from TC_CONS_FIX_NEW change

* config/tc-tilegx.h (TC_CONS_FIX_NEW): Add RELOC arg.
* config/tc-tilepro.h (TC_CONS_FIX_NEW): Likewise.

10 years agoMach-O: Add objdump -P dyld_info to dump dyld data.
Tristan Gingold [Fri, 11 Apr 2014 15:10:03 +0000 (17:10 +0200)]
Mach-O: Add objdump -P dyld_info to dump dyld data.

include/mach-o/
* loader.h: Add macros for rebase, bind and export constants.

binutils/
* od-macho.c (OPT_DYLD_INFO): New macro.
(options): Add entry for dyld_info.
(mach_o_help): Likewise.
(load_and_dump, dump_dyld_info_rebase, dump_dyld_info_bind)
(dump_dyld_info_export_1, dump_dyld_info_export): New functions.
(bfd_mach_o_dyld_rebase_type_name): New array.
(export_info_data): New struct.
(dump_dyld_info): Add verbose argument.  Dump rebase, bind and
exports data.
(dump_load_command): Adjust dump_dyld_info call.
(mach_o_dump): Handle dyld_info.

10 years agoMach-O: improve objdump -P load output.
Tristan Gingold [Fri, 11 Apr 2014 13:27:10 +0000 (15:27 +0200)]
Mach-O: improve objdump -P load output.

binutils/
* od-macho.c (dump_header): Display sizeofcmds in decimal too.
(dump_segment): Reformat output.
(dump_dyld_info): Also display end offsets.
(dump_load_command): Add IDX argument, display commands size
and offset, reformat display.
(dump_load_commands): Adjust for added argument.

10 years agoMach-O: add cpu and cpusubtype caps.
Tristan Gingold [Wed, 9 Apr 2014 08:12:45 +0000 (10:12 +0200)]
Mach-O: add cpu and cpusubtype caps.

include/mach-o/
2014-04-16  Tristan Gingold  <gingold@adacore.com>

* loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64)
(BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define.

bfd/
2014-04-16  Tristan Gingold  <gingold@adacore.com>

* mach-o-x86-64.c (bfd_mach_o_x86_64_mkobject): Adjust cpusubtype
flag.

10 years agofill ppc476 fixup area
Alan Modra [Wed, 16 Apr 2014 02:17:13 +0000 (11:47 +0930)]
fill ppc476 fixup area

Stops false positive warnings from scanner.

* elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area
with "ba 0" rather than zeros.

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

10 years ago * gdb.gdb/selftest.exp (do_steps_and_nexts): Don't reference
Doug Evans [Tue, 15 Apr 2014 23:11:32 +0000 (16:11 -0700)]
* gdb.gdb/selftest.exp (do_steps_and_nexts): Don't reference
uninitialized value of "description".

10 years ago2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
Cary Coutant [Tue, 15 Apr 2014 19:06:29 +0000 (12:06 -0700)]
2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

elfcpp/
* mips.h (R _MIPS16_TLS_GD, R_MIPS16_TLS_LDM, R_MIPS16_TLS_DTPREL_HI16,
R_MIPS16_TLS_DTPREL_LO16, R_MIPS16_TLS_GOTTPREL,
R_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_LO16, R_MICROMIPS_26_S1,
R_MICROMIPS_HI16, R_MICROMIPS_LO16, R_MICROMIPS_GPREL16,
R_MICROMIPS_LITERAL, R_MICROMIPS_GOT16, R_MICROMIPS_PC7_S1,
R_MICROMIPS_PC10_S1, R_MICROMIPS_PC16_S1, R_MICROMIPS_CALL16,
R_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_OFST,
R_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_LO16, R_MICROMIPS_SUB,
R_MICROMIPS_HIGHER, R_MICROMIPS_HIGHEST, R_MICROMIPS_CALL_HI16,
R_MICROMIPS_CALL_LO16, R_MICROMIPS_SCN_DISP, R_MICROMIPS_JALR,
R_MICROMIPS_HI0_LO16, R_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_LDM,
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_GOTTPREL, R_MICROMIPS_TLS_TPREL_HI16,
R_MICROMIPS_TLS_TPREL_LO16, R_MICROMIPS_GPREL7_S2,
R_MICROMIPS_PC23_S20, R_MIPS_EH): New enums for relocations (mips16 and
micromips).
(STO_MIPS_FLAGS): New enum constant.
(elf_st_is_mips16): New function.
(elf_st_is_micromips): New function.
(is_micromips): New function.
(abi_n32): New function.
(abi_n64): New function.
(ODK_NULL, ODK_REGINFO, ODK_EXCEPTIONS, ODK_PAD, ODK_HWPATCH, ODK_FILL,
ODK_TAGS, ODK_HWAND, ODK_HWOR, ODK_GP_GROUP, ODK_IDENT): New enum
constants.
* elfcpp.h (SHT_MIPS_OPTIONS): New enum constant.

10 years agoRemove unused globals in mi-simplerun.exp.
Keith Seitz [Tue, 15 Apr 2014 19:07:33 +0000 (12:07 -0700)]
Remove unused globals in mi-simplerun.exp.

2014-04-15  Keith Seitz  <keiths@redhat.com>

* gdb.mi/mi-simplerun.exp (test_breakpoints_creation_and_listing):
Remove unused globals.
(test_running_the_program): Likewise.
(test_controlled_execution): Likewise.
(test_controlling_breakpoints): Likewise.
(test_program_termination): Likewise.

10 years agoAllow target to decide whether to include a section.
Cary Coutant [Tue, 15 Apr 2014 18:24:30 +0000 (11:24 -0700)]
Allow target to decide whether to include a section.

2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* layout.cc (Layout::include_section): Allow a target to decide
whether to include a section.
* target.h (Target::should_include_section): New function.
(Target::do_should_include_section): New function.

10 years agoAllow target to derive from Copy_relocs class.
Cary Coutant [Tue, 15 Apr 2014 18:19:18 +0000 (11:19 -0700)]
Allow target to derive from Copy_relocs class.

2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
inline into ...
(Copy_relocs::emit): ... here.
* copy-relocs.h (Copy_reloc_entry): Change from class to struct.
(Copy_reloc_entry::make_copy_reloc): Change from private to protected.
(Copy_reloc_entry::entries_): Change from private to protected.

10 years agoTest suite cleanup.
Keith Seitz [Tue, 15 Apr 2014 18:47:57 +0000 (11:47 -0700)]
Test suite cleanup.

2014-04-15  Keith Seitz  <keiths@redhat.com>

* gdb.mi/mi-break.exp (test_tbreak_creation_and_listing): Remove
unused globals.
(test_rbreak_creation_and_listing): Likewise.
(test_ignore_count): Likewise.
(test_error): Likewise.

10 years ago[AArch64] Fix off by one error in instruction relaxation mask.
Marcus Shawcroft [Tue, 15 Apr 2014 16:46:07 +0000 (17:46 +0100)]
[AArch64] Fix off by one error in instruction relaxation mask.

The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to
ensure that destination register in a relaxed ldr instruction is
always X0.  The mask has an off by one error resulting in the most
significant bit of the destination register being retained in the
relaxed instruction.  The issue generally appears when the compiler
emits TLS accesses code under high register pressure resulting in a
broken code sequence.

10 years agogdb.base/sym-file.exp, hide guts of the custom loader.
Pedro Alves [Tue, 15 Apr 2014 13:02:34 +0000 (14:02 +0100)]
gdb.base/sym-file.exp, hide guts of the custom loader.

This test uses a simple custom elf loader, implemented in
gdb.base/sym-file-loader.h|c.  This loader doesn't have a dlclose-like
function today, but I'll need one.  But, I found that the guts of the
loader are exposed too much to the client, making the interface more
complicated than necessary.  It's simpler if the loader just exports a
few dlopen/dlsym -style functions.  That's what this patch does.

Tested on x86_86 Fedora 17, native and gdbserver.

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

* gdb.base/sym-file-loader.h: Move inclusion of <inttypes.h>,
<ansidecl.h>, <elf/common.h> and <elf/external.h> to
sym-file-loader.c.
(Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr)
(Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move
to sym-file-loader.c.
(struct library): Forward declare.
(load_shlib, lookup_function): Change prototypes.
(find_shstrtab, find_strtab, find_shdr, find_symtab)
(translate_offset): Remove declarations.
(get_text_addr): New declaration.
* gdb.base/sym-file-loader.c: Move inclusion of <inttypes.h>,
<ansidecl.h>, <elf/common.h> and <elf/external.h> here from
sym-file-loader.h.
(Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr)
(Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move
here from sym-file-loader.h.
(struct library): New structure.
(load_shlib, lookup_function): Change prototypes and adjust to
work with a struct library.
(find_shstrtab, find_strtab, find_shdr, find_symtab)
(translate_offset): Make static.
(get_text_addr): New function.
* gdb.base/sym-file-main.c (main): Adjust to new loader interface.

10 years agogdb.base/sym-file-loader.c: Fix typo.
Pedro Alves [Tue, 15 Apr 2014 13:13:08 +0000 (14:13 +0100)]
gdb.base/sym-file-loader.c: Fix typo.

SELF_LINK, not SELK_LINK...

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

* gdb.base/sym-file-loader.c: Fix typo.  SELF_LINK, not SELK_LINK.

10 years agoMake sym-file.exp work with remote targets and hosts.
Pedro Alves [Mon, 14 Apr 2014 16:23:55 +0000 (17:23 +0100)]
Make sym-file.exp work with remote targets and hosts.

The main issue here is that this test passes the host's absolute path
to the library to load to the "dlopen"-like routine, which doesn't
work when either the target or the host are remote, unless a shared
filesystem has been set up.

Tests that dynamically load a library solve this by dlopen'ing by
basename, and setting rpath to $ORIGIN.  See gdb_compile.

This test doesn't use dlopen, but instead uses its own simple elf
loader.  The fix is to pass this loader the library basename, and
teach it to look up the library by basename in the executable's
directory as well, i.e., assuming/emulating RPATH=$ORIGIN.

Tested on x86_64 Fedora 17, native and gdbserver.

I looked around in the web to figure out Linux's /proc/self/exe
equivalents in other ELF OSs.  I think I covered all relevant, but if
not, I think it'll be simple enough to add more.  (Note the test is
skipped on non-ELF targets.)

Tested on x86_64 Fedora 17, native and gdbserver.

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

* gdb.base/sym-file-loader.c: Include <limits.h>.
(SELF_LINK): New define.
(get_origin): New function.
(load_shlib): Use it.
* gdb.base/sym-file.exp: Don't early return if the target is
remote.  Use runto_main, and issue fail is that fails.  Use
gdb_load_shlibs.
(shlib_name): Delete.
(lib_so, lib_syms, lib_dlopen): New globals.  Use them throughout.

10 years agogdb.base/sym-file.exp: clean up test messages a bit.
Pedro Alves [Tue, 15 Apr 2014 11:49:51 +0000 (12:49 +0100)]
gdb.base/sym-file.exp: clean up test messages a bit.

Remove regex characters from test message, and don't refer to
breakpoint numbers in test messages (subsequent patches will add more
breakpoints, changing these numbers).  Result:

 -PASS: gdb.base/sym-file.exp: add-symbol-file .*sym-file-lib\.so addr
 +PASS: gdb.base/sym-file.exp: add-symbol-file sym-file-lib.so addr

 -PASS: gdb.base/sym-file.exp: check if Breakpoint 2 is pending.
 -PASS: gdb.base/sym-file.exp: check if Breakpoint 3 is pending.
 +PASS: gdb.base/sym-file.exp: breakpoint at foo is pending
 +PASS: gdb.base/sym-file.exp: breakpoint at bar is pending

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

* gdb.base/sym-file.exp: Remove regex characters from test
message.  Don't refer to breakpoint numbers in test messages.

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

10 years agoRemove symbol_matches_domain. This fixes
Keith Seitz [Mon, 14 Apr 2014 22:47:15 +0000 (15:47 -0700)]
Remove symbol_matches_domain. This fixes
PR c++/16253.

symbol_matches_domain was permitting searches for a VAR_DOMAIN
symbol to also match STRUCT_DOMAIN symbols for languages like C++
where STRUCT_DOMAIN symbols also define a typedef of the same name,
e.g., "struct foo {}" introduces a typedef of the name "foo".

Problems occur if there exists both a VAR_DOMAIN and STRUCT_DOMAIN
symbol of the same name. Then it is essentially a race between which
symbol is found first. The other symbol is obscurred.
[This is a relatively common idiom: enum e { ... } e;]

This patchset moves this "language defines a typedef" logic to
lookup_symbol[_in_language], looking first for a symbol in the given
domain and falling back to searching STRUCT_DOMAIN when/if appropriate.

2014-04-14  Keith Seitz  <keiths@redhat.com>

PR c++/16253
* ada-lang.c (ada_symbol_matches_domain): Moved here and renamed
from symbol_matches_domain in symtab.c. All local callers
of symbol_matches_domain updated.
(standard_lookup): If DOMAIN is VAR_DOMAIN and no symbol is found,
search STRUCT_DOMAIN.
(ada_find_any_type_symbol): Do not search STRUCT_DOMAIN
independently.  standard_lookup will do that automatically.
* cp-namespace.c (cp_lookup_symbol_nonlocal): Explain when/why
VAR_DOMAIN searches may return a STRUCT_DOMAIN match.
(cp_lookup_symbol_in_namespace): Likewise.
If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN.
(cp_lookup_symbol_exports): Explain when/why VAR_DOMAIN searches
may return a STRUCT_DOMAIN match.
(lookup_symbol_file): Search for the class name in STRUCT_DOMAIN.
* cp-support.c: Include language.h.
(inspect_type): Explicitly search STRUCT_DOMAIN before searching
VAR_DOMAIN.
* psymtab.c (match_partial_symbol): Compare the requested
domain with the symbol's domain directly.
(lookup_partial_symbol): Likewise.
* symtab.c (lookup_symbol_in_language): Explain when/why
VAR_DOMAIN searches may return a STRUCT_DOMAIN match.
If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN for
appropriate languages.
(symbol_matches_domain): Renamed `ada_symbol_matches_domain'
and moved to ada-lang.c
(lookup_block_symbol): Explain that this function only returns
symbol matching the requested DOMAIN.
Compare the requested domain with the symbol's domain directly.
(iterate_over_symbols): Compare the requested domain with the
symbol's domain directly.
* symtab.h (symbol_matches_domain): Remove.

2014-04-14  Keith Seitz  <keiths@redhat.com>

PR c++/16253
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.
* gdb.dwarf2/dw2-ada-ffffffff.exp: Set the language to C++.
* gdb.dwarf2/dw2-anon-mptr.exp: Likewise.
* gdb.dwarf2/dw2-double-set-die-type.exp: Likewise.
* gdb.dwarf2/dw2-inheritance.exp: Likewise.

10 years agoimplement support for "enum class"
Tom Tromey [Thu, 27 Mar 2014 18:24:27 +0000 (12:24 -0600)]
implement support for "enum class"

This adds support for the C++11 "enum class" feature.  This is
PR c++/15246.

I chose to use the existing TYPE_DECLARED_CLASS rather than introduce
a new type code.  This seemed both simple and clear to me.

I made overloading support for the new enum types strict.  This is how
it works in C++; and it didn't seem like an undue burden to keep this,
particularly because enum constants are printed symbolically by gdb.

Built and regtested on x86-64 Fedora 20.

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

PR c++/15246:
* c-exp.y (type_aggregate_p): New function.
(qualified_name, classify_inner_name): Use it.
* c-typeprint.c (c_type_print_base): Handle TYPE_DECLARED_CLASS
and TYPE_TARGET_TYPE of an enum type.
* dwarf2read.c (read_enumeration_type): Set TYPE_DECLARED_CLASS on
an enum type.
(determine_prefix) <case DW_TAG_enumeration_type>: New case;
handle TYPE_DECLARED_CLASS.
* gdbtypes.c (rank_one_type): Handle TYPE_DECLARED_CLASS on enum
types.
* gdbtypes.h (TYPE_DECLARED_CLASS): Update comment.
* valops.c (enum_constant_from_type): New function.
(value_aggregate_elt): Use it.
* cp-namespace.c (cp_lookup_nested_symbol): Handle
TYPE_CODE_ENUM.

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

* gdb.cp/classes.exp (test_enums): Handle underlying type.
* gdb.dwarf2/enum-type.exp: Add test for enum with underlying
type.
* gdb.cp/enum-class.exp: New file.
* gdb.cp/enum-class.cc: New file.

10 years agoconstify value_aggregate_elt
Tom Tromey [Thu, 27 Mar 2014 18:16:38 +0000 (12:16 -0600)]
constify value_aggregate_elt

While working on another patch I realized that value_aggregate_elt's
"name" parameter ought to be const.  This patch implements this.

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

* valops.c (value_aggregate_elt, value_struct_elt_for_reference)
(value_namespace_elt, value_maybe_namespace_elt): Make "name"
const.
* value.h (value_aggregate_elt): Update.

10 years agohandle DW_AT_type on an enumeration
Tom Tromey [Wed, 26 Mar 2014 14:54:56 +0000 (08:54 -0600)]
handle DW_AT_type on an enumeration

DWARF allows an enumeration type to have a DW_AT_type.  GDB doesn't
recognize this, but there is a patch to change GCC to emit it, and a
DWARF proposal to further allow an enum type with a DW_AT_type to omit
the DW_AT_byte_size.  This patch changes gdb to implement this.

Built and regtested on x86-64 Fedora 20.

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

* dwarf2read.c (read_enumeration_type): Handle DW_AT_type.

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

* gdb.dwarf2/enum-type.exp: New file.

10 years agotest: add mi vla test
Sanimir Agovic [Fri, 15 Nov 2013 12:48:00 +0000 (12:48 +0000)]
test: add mi vla test

testsuite/ChangeLog:

* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.

10 years agotest: basic c99 vla tests for C primitives
Sanimir Agovic [Fri, 15 Nov 2013 12:47:47 +0000 (12:47 +0000)]
test: basic c99 vla tests for C primitives

gdb/testsuite/ChangeLog:

* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.

10 years agotest: evaluate pointers to C99 vla correctly.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:44 +0000 (12:47 +0000)]
test: evaluate pointers to C99 vla correctly.

gdb/testsuite/ChangeLog:

* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.

10 years agotest: cover subranges with present DW_AT_count attribute
Sanimir Agovic [Tue, 26 Nov 2013 14:47:16 +0000 (14:47 +0000)]
test: cover subranges with present DW_AT_count attribute

The dwarf attribute DW_AT_count specifies the elements of a subrange.
This test covers subranges with present count but absent upper bound
attribute, both with static and dynamic attribute values.

testsuite/ChangeLog:

* gdb.dwarf2/count.exp: New file.

10 years agovla: evaluate operand of sizeof if its type is a vla
Sanimir Agovic [Wed, 5 Feb 2014 16:22:08 +0000 (16:22 +0000)]
vla: evaluate operand of sizeof if its type is a vla

The c99 standard in "6.5.3.4 The sizeof operator" states:

 If the type of the operand is a variable length array type, the operand
 is evaluated;[...]

This patch mirrors the following c99 semantic in gdb:

 1| int vla[n][m];
 2| int i = 1;
 3| sizeof(vla[i++][0]); // No sideffect
 4| assert (i == 1);
 5| sizeof(vla[i++]);    // With sideffect
 6| assert (i == 2);

Note: ptype/whatis still do not allow any sideeffects.

This patch was motivated by:

  https://sourceware.org/ml/gdb-patches/2014-01/msg00732.html

gdb/ChangeLog:

* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.

testsuite/ChangeLog:

* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.

10 years agovla: resolve dynamic bounds if value contents is a constant byte-sequence
Sanimir Agovic [Tue, 26 Nov 2013 14:35:43 +0000 (14:35 +0000)]
vla: resolve dynamic bounds if value contents is a constant byte-sequence

A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.

gdb/ChangeLog:

* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.

10 years agovla: support for DW_AT_count
Sanimir Agovic [Tue, 19 Nov 2013 12:54:24 +0000 (12:54 +0000)]
vla: support for DW_AT_count

This patch adds support for DW_AT_count as requested in the code review:

  https://sourceware.org/ml/gdb-patches/2013-11/msg00200.html

gdb/ChangeLog:

* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.

10 years agovla: print "variable length" for unresolved dynamic bounds
Sanimir Agovic [Thu, 14 Nov 2013 09:55:52 +0000 (09:55 +0000)]
vla: print "variable length" for unresolved dynamic bounds

1| void foo (size_t n) {
2|   int vla[n];
3| }

Given the following expression

  (gdb) ptype &vla

Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:

  type = int (*)[1289346]

this patch deals with this case and prints:

  type = int (*)[variable length]

instead.

gdb/ChangeLog:

* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.

10 years agovla: update type from newly created value
Sanimir Agovic [Mon, 14 Oct 2013 07:36:13 +0000 (08:36 +0100)]
vla: update type from newly created value

Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.

gdb/ChangeLog

* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.

10 years agovla: enable sizeof operator for indirection
Sanimir Agovic [Sat, 12 Oct 2013 11:36:16 +0000 (12:36 +0100)]
vla: enable sizeof operator for indirection

This patch enables the sizeof operator for indirections:

1| void foo (size_t n) {
2|   int vla[n];
3|   int *vla_ptr = &vla;
4| }

(gdb) p sizeof(*vla_ptr)

yields sizeof (size_t) * n.

gdb/ChangeLog:

* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.

10 years agovla: enable sizeof operator to work with variable length arrays
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
vla: enable sizeof operator to work with variable length arrays

In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.

We now are able to get the size of a vla:

1| void foo (size_t n) {
2|   int vla[n];
3| }

(gdb) p sizeof(vla)

yields N * sizeof(int).

gdb/ChangeLog:

* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.

10 years agotype: add c99 variable length array support
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
type: add c99 variable length array support

The dwarf standard allow certain attributes to be expressed as dwarf
expressions rather than constants. For instance upper-/lowerbound attributes.
In case of a c99 variable length array the upperbound is a dynamic attribute.

With this change c99 vla behave the same as with static arrays.

1| void foo (size_t n) {
2|   int ary[n];
3|   memset(ary, 0, sizeof(ary));
4| }

(gdb) print ary
$1 = {0 <repeats 42 times>}

gdb/ChangeLog:

* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.

10 years agoAdd return value for non-void function return statements to fix error in clang build.
David Blaikie [Sat, 12 Apr 2014 00:20:49 +0000 (17:20 -0700)]
Add return value for non-void function return statements to fix error in clang build.

Clang defaults this warning to an error, breaking the build & causing
these tests not to run.

gdb/testsuite/

* gdb.mi/non-stop.c: Add return value for non-void function return
statement.
* gdb.threads/staticthreads.c: Ditto.

10 years agoFix typo in _initialize_alpha_linux_nat prototype
Richard Henderson [Mon, 14 Apr 2014 15:30:56 +0000 (08:30 -0700)]
Fix typo in _initialize_alpha_linux_nat prototype

* alpha-linux-nat.c (_initialize_alpha_linux_nat): Fix prototype.

10 years agoppc476 plt call stubs
Alan Modra [Mon, 14 Apr 2014 02:18:06 +0000 (11:48 +0930)]
ppc476 plt call stubs

Fuss over bctr in call stubs.

* elf32-ppc.c (BA): Define
(ppc_elf_link_hash_table_create): Correct default_params.
(write_glink_stub): Pad small plt call stub with "ba 0" rather
than "nop" for ppc476_workaround.
(ppc_elf_finish_dynamic_sections): Likewise for branch table
and __glink_PLTresolve.  Ensure plt call stub at end of page
doesn't allow fall-thru prefetch.

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

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

10 years agoCopy over fix for fetching dynamic type of a reference from python side.
Doug Evans [Sat, 12 Apr 2014 16:09:41 +0000 (09:09 -0700)]
Copy over fix for fetching dynamic type of a reference from python side.

* guile/scm-value.c (gdbscm_value_dynamic_type): Use coerce_ref to
dereference TYPE_CODE_REF values.

testsuite/
* gdb.guile/scm-value.c: Improve test case.
* gdb.guile/scm-value.exp: Add new test.

10 years agoCompile inline test with -std=gnu89 explicitly to override Clang's default (-std...
David Blaikie [Fri, 11 Apr 2014 19:45:37 +0000 (12:45 -0700)]
Compile inline test with -std=gnu89 explicitly to override Clang's default (-std=c99)

gdb/testsuite/
* gdb.opt/inline-break.exp: Explicitly specify -std=gnu89 to
override Clang's default.

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

10 years agogdb/testsuite/ChangeLog: Fix path to a few files in previous entries.
Joel Brobecker [Fri, 11 Apr 2014 22:28:08 +0000 (15:28 -0700)]
gdb/testsuite/ChangeLog: Fix path to a few files in previous entries.

10 years agoRevert the entire VLA series.
Joel Brobecker [Fri, 11 Apr 2014 21:47:15 +0000 (14:47 -0700)]
Revert the entire VLA series.

This reverts the following patch series, as they cause some regresssions.

commit 37c1ab67a35025d37d42c449deab5f254f9f59da
type: add c99 variable length array support

gdb/
* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.

commit 26cb189f8b46dbe7b2d485525329a8919005ca8a
vla: enable sizeof operator to work with variable length arrays

gdb/
* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.

commit 04b19544ef6a97b62b2cc4a3170b900e046ab185
vla: enable sizeof operator for indirection

gdb/
* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.

commit bcd629a44fff61527430f353cf77e20fe3afc395
vla: update type from newly created value

gdb/
* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* eval.c (evaluate_subexp_with_coercion): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.

commit b86138fb0484f42db6cb83abed1e3d0ad2ec4eac
vla: print "variable length" for unresolved dynamic bounds

gdb/
* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.

commit e1969afbd454c09c3aad1990305715f70bc47c3c
vla: support for DW_AT_count

gdb/
* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.

commit 92b09522dc5a93ba4bda3c1c0b3c58264e357c8a
vla: resolve dynamic bounds if value contents is a constant byte-sequence

gdb/
* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.

commit 3bce82377f683870cc89925ff43aefb7dcce4a77
vla: evaluate operand of sizeof if its type is a vla

gdb/
* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.

gdb/testsuite

* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.

commit 504f34326e5ae7c78ebfcdd6ed03c7403b42048b
test: cover subranges with present DW_AT_count attribute

gdb/testsuite/
* gdb.dwarf2/count.exp: New file.

commit 1a237e0ee53bbdee97d72d794b5b42e774cc81c0
test: multi-dimensional c99 vla.

gdb/testsuite/
* gdb.base/vla-multi.c: New file.
* gdb.base/vla-multi.exp: New file.

commit 024e13b46f9c33d151ae82fd9d64c53092fd9313
test: evaluate pointers to C99 vla correctly.

gdb/testsuite/
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.

commit c8655f75e2f0fada311be193e3090087a77ec802
test: basic c99 vla tests for C primitives

gdb/testsuite/
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.

commit 58a84dcf29b735ee776536b4c51ba90b51612b71
test: add mi vla test

gdb/testsuite/
* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.

10 years agoFix c++/16675 -- sizeof reference type should give the size of
Keith Seitz [Fri, 11 Apr 2014 21:17:17 +0000 (14:17 -0700)]
Fix c++/16675 -- sizeof reference type should give the size of
the referent, not the size of the actual reference variable.

10 years agoPE32+ binaries that use addresses > 1^32 have a problem in that the linker
Nick Clifton [Fri, 11 Apr 2014 15:02:52 +0000 (16:02 +0100)]
PE32+ binaries that use addresses > 1^32 have a problem in that the linker
converts some address expressions into absolute values, but the PE format
only stores absolutes as 32-bits.  This is a partial solution which attempts
to convert such absolute values back to section relative ones instead.  It
fails for symbols like __image_base and ImageBase__, but it is unclear as to
whether these values are ever actually used by applications.

PR ld/16821
* peXXigen.c (abs_finder): New function.
(_bfd_XXi_swap_sym_out): For absolute symbols with values larger
than 1^32 try to convert them into section relative values
instead.

10 years agotest: add mi vla test
Sanimir Agovic [Fri, 15 Nov 2013 12:48:00 +0000 (12:48 +0000)]
test: add mi vla test

testsuite/gdb.mi/

* mi-vla-c99.exp: New file.
* vla.c: New file.

10 years agotest: basic c99 vla tests for C primitives
Sanimir Agovic [Fri, 15 Nov 2013 12:47:47 +0000 (12:47 +0000)]
test: basic c99 vla tests for C primitives

gdb/testsuite:
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.

10 years agotest: evaluate pointers to C99 vla correctly.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:44 +0000 (12:47 +0000)]
test: evaluate pointers to C99 vla correctly.

gdb/testsuite:
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.

10 years agotest: multi-dimensional c99 vla.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:32 +0000 (12:47 +0000)]
test: multi-dimensional c99 vla.

gdb/testsuite:
* gdb.base/vla-multi.c: New file.
* gdb.base/vla-multi.exp: New file.

10 years agotest: cover subranges with present DW_AT_count attribute
Sanimir Agovic [Tue, 26 Nov 2013 14:47:16 +0000 (14:47 +0000)]
test: cover subranges with present DW_AT_count attribute

The dwarf attribute DW_AT_count specifies the elements of a subrange.
This test covers subranges with present count but absent upper bound
attribute, both with static and dynamic attribute values.

testsuite:
* gdb.dwarf2/count.exp: New file.

10 years agovla: evaluate operand of sizeof if its type is a vla
Sanimir Agovic [Wed, 5 Feb 2014 16:22:08 +0000 (16:22 +0000)]
vla: evaluate operand of sizeof if its type is a vla

The c99 standard in "6.5.3.4 The sizeof operator" states:

 If the type of the operand is a variable length array type, the operand
 is evaluated;[...]

This patch mirrors the following c99 semantic in gdb:

 1| int vla[n][m];
 2| int i = 1;
 3| sizeof(vla[i++][0]); // No sideffect
 4| assert (i == 1);
 5| sizeof(vla[i++]);    // With sideffect
 6| assert (i == 2);

Note: ptype/whatsis still do not allow any sideeffects.

This patch was motivated by:

  https://sourceware.org/ml/gdb-patches/2014-01/msg00732.html

* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.

testsuite/gdb.base/

* vla-sideeffect.c: New file.
* vla-sideeffect.exp: New file.

10 years agovla: resolve dynamic bounds if value contents is a constant byte-sequence
Sanimir Agovic [Tue, 26 Nov 2013 14:35:43 +0000 (14:35 +0000)]
vla: resolve dynamic bounds if value contents is a constant byte-sequence

A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.

* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.

10 years agovla: support for DW_AT_count
Sanimir Agovic [Tue, 19 Nov 2013 12:54:24 +0000 (12:54 +0000)]
vla: support for DW_AT_count

This patch adds support for DW_AT_count as requested in the code review:

  https://sourceware.org/ml/gdb-patches/2013-11/msg00200.html

* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.

10 years agovla: print "variable length" for unresolved dynamic bounds
Sanimir Agovic [Thu, 14 Nov 2013 09:55:52 +0000 (09:55 +0000)]
vla: print "variable length" for unresolved dynamic bounds

1| void foo (size_t n) {
2|   int vla[n];
3| }

Given the following expression

  (gdb) ptype &vla

Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:

  type = int (*)[1289346]

this patch deals with this case and prints:

  type = int (*)[variable length]

instead.

* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.

10 years agovla: update type from newly created value
Sanimir Agovic [Mon, 14 Oct 2013 07:36:13 +0000 (08:36 +0100)]
vla: update type from newly created value

Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.

* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* eval.c (evaluate_subexp_with_coercion): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.

10 years agovla: enable sizeof operator for indirection
Sanimir Agovic [Sat, 12 Oct 2013 11:36:16 +0000 (12:36 +0100)]
vla: enable sizeof operator for indirection

This patch enables the sizeof operator for indirections:

1| void foo (size_t n) {
2|   int vla[n];
3|   int *vla_ptr = &vla;
4| }

(gdb) p sizeof(*vla_ptr)

yields sizeof (size_t) * n.

* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.

10 years agovla: enable sizeof operator to work with variable length arrays
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
vla: enable sizeof operator to work with variable length arrays

In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.

We now are able to get the size of a vla:

1| void foo (size_t n) {
2|   int vla[n];
3| }

(gdb) p sizeof(vla)

yields N * sizeof(int).

* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.

10 years agotype: add c99 variable length array support
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
type: add c99 variable length array support

The dwarf standard allow certain attributes to be expressed as dwarf
expressions rather than constants. For instance upper-/lowerbound attributes.
In case of a c99 variable length array the upperbound is a dynamic attribute.

With this change c99 vla behave the same as with static arrays.

1| void foo (size_t n) {
2|   int ary[n];
3|   memset(ary, 0, sizeof(ary));
4| }

(gdb) print ary
$1 = {0 <repeats 42 times>}

* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.

10 years agovla: introduce new bound type abstraction adapt uses
Sanimir Agovic [Tue, 8 Oct 2013 14:04:49 +0000 (15:04 +0100)]
vla: introduce new bound type abstraction adapt uses

The rational behind this patch is to get started to implement the feature
described in dwarf4 standard (2.19) Static and Dynamic Values of Attributes.
It adds new BOUND_PROP to store either a constant, exprloc, or reference to
describe an upper-/lower bound of a subrange. Other than that no new features
are introduced.

* dwarf2read.c (read_subrange_type): Use struct bound_prop for
declaring high/low bounds and change uses accordingly. Call
create_range_type instead of create_static_range_type.
* gdbtypes.c (create_range_type): New function.
(create_range_type): Convert bounds into struct bound_prop and pass
them to create_range_type.
* gdbtypes.h (struct bound_prop): New struct.
(create_range_type): New function prototype.
(struct range_bounds): Use struct bound_prop instead of LONGEST for
high/low bounds. Remove low_undefined/high_undefined and adapt all uses.
(TYPE_LOW_BOUND,TYPE_HIGH_BOUND): Adapt macros to refer to the static
part of the bound.
* parse.c (follow_types): Set high bound kind to BOUND_UNDEFINED.

10 years agorefactoring: rename create_range_type to create_static_range_type
Sanimir Agovic [Thu, 19 Dec 2013 08:31:17 +0000 (08:31 +0000)]
refactoring: rename create_range_type to create_static_range_type

* gdbtypes.c (create_static_range_type): Renamed from create_range_type.
* gdbtypes.h (create_static_range_type): Renamed from create_range_type.
* ada-lang.c: All uses of create_range_type updated.
* coffread.c: All uses of create_range_type updated.
* dwarf2read.c: All uses of create_range_type updated.
* f-exp.y: All uses of create_range_type updated.
* m2-valprint.c: All uses of create_range_type updated.
* mdebugread.c: All uses of create_range_type updated.
* stabsread.c: All uses of create_range_type updated.
* valops.c: All uses of create_range_type updated.
* valprint.c: All uses of create_range_type updated.

10 years agoRegenerate header files after this commit:
Nick Clifton [Fri, 11 Apr 2014 11:39:03 +0000 (12:39 +0100)]
Regenerate header files after this commit:

  2014-04-10  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations

10 years agoCheck file exists before completion tests
Yao Qi [Wed, 2 Apr 2014 04:44:22 +0000 (12:44 +0800)]
Check file exists before completion tests

Doug told me that there are some regressions in gdb.base/completion.exp.
They are caused by my recent change, and can be reproduced via:

$ make check-parallel TESTS=gdb.base/completion.exp
FAIL: gdb.base/completion.exp: complete target core ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target tfile ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target exec ./gdb.base/completion

Current tests assume that gdb.base/completion exists but that is wrong
in a parallel run, because binary file and object files are placed
in outputs/gdb.base/completion/.

This patch is to check file exists on two candidate directories,
"gdb.base" and "outputs/gdb.base/completion/", and run tests with files
existed in either of them.

gdb/testsuite:

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

* gdb.base/completion.exp: Check file exists before running tests
on file completion.

10 years agoIgnore non-stub sections for nios2 stub_bfd processing.
Sandra Loosemore [Fri, 11 Apr 2014 00:14:18 +0000 (17:14 -0700)]
Ignore non-stub sections for nios2 stub_bfd processing.

2014-04-10  Cesar Philippidis  <cesar@codesourcery.com>

bfd/
* elf32-nios2.c (nios2_elf32_build_stubs): Ignore dynobjs
when building function stubs.

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

10 years agoConditional Z1 breakpoint hangs GDBserver.
Pedro Alves [Thu, 10 Apr 2014 18:22:23 +0000 (19:22 +0100)]
Conditional Z1 breakpoint hangs GDBserver.

While trying to fix hbreak2.exp against GDBserver I noticed this...

 (gdb) hbreak main if 1
 Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000
 Sending packet: $m40058f,1#31...Packet received: c7
 Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46.
 Sending packet: $Z1,40058f,1;X3,220127#9b...
 *hangs forever*

The issue is that nothing advances the packet pointer if
add_breakpoint_condition either fails to parse the agent expression,
or fails to find the breakpoint, resulting in an infinite loop in
process_point_options.  The latter case should really be fixed by
GDBserver tracking GDB Z1 breakpoints in its breakpoint structures
like Z0 breakpoints are, but the latter case still needs handling.
add_breakpoint_commands has the same issue, though at present I don't
know any way to trigger it other than sending a manually cooked
packet.

Unbelievably, it doesn't look like we have any test that tries setting
a conditional hardware breakpoint.  Looking at cond-eval-mode.exp, it
looks like the file was meant to actually test something, but it's
mostly empty today.  This patch adds tests that tries all sorts of
conditional breakpoints and watchpoints.  The test hangs/fails without
the GDBserver fix.

Tested on x86_64 Fedora 17.

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

* mem-break.c (add_breakpoint_condition, add_breakpoint_commands):
Check if the condition or command is NULL before checking if the
breakpoint is known.  On success, return true.
* mem-break.h (add_breakpoint_condition): Document return.
(add_breakpoint_commands): Add describing comment.
* server.c (skip_to_semicolon): New function.
(process_point_options): Use it.

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

* gdb.base/cond-eval-mode.c: New file.
* gdb.base/cond-eval-mode.exp: Use standard_testfile.  Adjust
prepare_for_testing to build the new file.  Check result of
runto_main.
(test_break, test_watch): New procedures.
(top level): Use them.

10 years agobfd/ChangeLog
Denis Chertykov [Thu, 10 Apr 2014 15:50:33 +0000 (19:50 +0400)]
bfd/ChangeLog

* elf32-avr.c: Add DIFF relocations for AVR.
(avr_final_link_relocate): Handle the DIFF relocs.
(bfd_elf_avr_diff_reloc): New.
(elf32_avr_is_diff_reloc): New.
(elf32_avr_adjust_diff_reloc_value): Reduce difference value.
(elf32_avr_relax_delete_bytes): Recompute difference after deleting
bytes.

* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations

gas/ChangeLog

* config/tc-avr.c: Add new flag mlink-relax.
(md_show_usage): Add flag and help text.
(md_parse_option): Record whether link relax is turned on.
(relaxable_section): New.
(avr_validate_fix_sub): New.
(avr_force_relocation): New.
(md_apply_fix): Generate DIFF reloc.
(avr_allow_local_subtract): New.

* config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0.
(TC_FORCE_RELOCATION): Define.
(TC_FORCE_RELOCATION_SUB_SAME): Define.
(TC_VALIDATE_FIX_SUB): Define.
(avr_force_relocation): Declare.
(avr_validate_fix_sub): Declare.
(md_allow_local_subtract): Define.
(avr_allow_local_subtract): Declare.

gas/testsuite/ChangeLog

* gas/avr/diffreloc_withrelax.d: New testcase.
* gas/avr/noreloc_withoutrelax.d: Likewise.
* gas/avr/relax.s: Likewise.

include/ChangeLog

* elf/avr.h: Add new DIFF relocs.

ld/testsuite/ChangeLog

* ld-avr/norelax_diff.d: New testcase.
* ld-avr/relax_diff.d: Likewise.
* ld-avr/relax.s: Likewise.

10 years agobreakpoint shadowing, take single-step breakpoints into account.
Pedro Alves [Thu, 10 Apr 2014 13:19:52 +0000 (14:19 +0100)]
breakpoint shadowing, take single-step breakpoints into account.

Breakpoints are supposed to be transparent to memory accesses.  For
all kinds of breakpoints breakpoint_xfer_memory hides the breakpoint
instructions.  However, sss breakpoints aren't tracked like all other
breakpoints, and nothing is taking care of hiding them from memory
reads.

Say, as is, a background step + disassemble will see breakpoints
instructions on software step targets.  E.g., stepping over this line:

  while (1);

with s&

and then "disassemble" would show sss breakpoints.

Actually, that's still not be possible to see today, because:

 - in native Linux, you can't read memory while the program
   is running.
 - with Linux gdbserver, you can, but in the all-stop RSP you
   can't talk to the server while the program is running...
 - and with non-stop, on software step targets, we presently
   force the use of displaced-stepping for all single-steps,
   so no single-step breakpoints are used...

I've been working towards making non-stop not force displaced stepping
on sss targets, and I noticed the issue then.  With that, I indeed see
this:

(gdb) set remote Z-packet off
(gdb) s&
(gdb) disassemble main
Dump of assembler code for function main:
   0x000000000040049c <+0>:     push   %rbp
   0x000000000040049d <+1>:     mov    %rsp,%rbp
   0x00000000004004a0 <+4>:     int3
   0x00000000004004a1 <+5>:     (bad)
End of assembler dump.

Instead of the correct:

(gdb) disassemble main
Dump of assembler code for function main:
   0x000000000040049c <+0>:     push   %rbp
   0x000000000040049d <+1>:     mov    %rsp,%rbp
   0x00000000004004a0 <+4>:     jmp    0x4004a0 <main+4>

This is actually one thing that my v1 of the recent "fix a bunch of
run control bugs" series was fixing, because it made sss breakpoints
be regular breakpoints in the breakpoint chain.  But dropped it in the
version that landed in the tree, due to some problems.

So instead of making sss breakpoints regular breakpoints, go with a
simpler fix (at least for now) -- make breakpoint_xfer_memory take
software single-step breakpoints into account.  After the patch, I get
the correct disassemble output.

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

Also fixes the issue pointed out by Yao at
https://sourceware.org/ml/gdb-patches/2014-04/msg00045.html, where the
prologue analysis/frame sniffing manages to see software step
breakpoint instructions.

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

* breakpoint.c (single_step_breakpoints)
(single_step_gdbarch): Move up in the file.
(one_breakpoint_xfer_memory): New function, factored out from ...
(breakpoint_xfer_memory): ... here.  Also process single-step
breakpoints.

10 years agoAdd support for the MIPS P5600 family of CPUs.
Andrew Bennett [Tue, 8 Apr 2014 13:50:42 +0000 (14:50 +0100)]
Add support for the MIPS P5600 family of CPUs.

ChangeLog:

2014-04-10  Andrew Bennett  <andrew.bennett@imgtec.com>

* config/tc-mips.c (mips_cpu_info_table): Add P5600
configuation.
* doc/c-mips.texi: Document p5600.

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

10 years agoRemove remaining default manifest support.
Nick Clifton [Wed, 9 Apr 2014 16:12:30 +0000 (17:12 +0100)]
Remove remaining default manifest support.

* Makefile.am (default-manifest.o): Remove rule.
(EMUL_EXTRA_BINARIES): Delete.
(ALL_EMUL_EXTRA_BINARIES): Delete.
(ld_new_DEPENDENCIES): Remove EMUL_EXTRA_BINARIES.
(install-data-local): Remove EMUL_EXTRA_BINARIES.
* Makefile.in: Regenerate.
* configure.in (all_emul_extra_binaries): Delete.
(EMUL_EXTRA_BINARIES): Remove.
* configure: Regenerate.
* configure.tgt (target_extra_binaries): Delete.
* emultempl/default-manifest.rc: Delete.
* ld.texinfo: Remove discussion of default manifest.
* emulparams/i386pe.sh (DEFAULT_MANIFEST): Delete.
* emulparams/i386pep.sh (DEFAULT_MANIFEST): Delete.

10 years ago[GDBserver] Fix SH/Linux build.
Pedro Alves [Wed, 9 Apr 2014 14:01:33 +0000 (15:01 +0100)]
[GDBserver] Fix SH/Linux build.

 sh-linux-gnu-gcc (...) src/gdb/gdbserver/linux-low.c
 .../src/gdb/gdbserver/linux-low.c: In function 'linux_read_loadmap':
 .../src/gdb/gdbserver/linux-low.c:5284:13: error: 'struct lwp_info' has no member named 'entry'
 make[1]: *** [linux-low.o] Error 1

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

* linux-low.c (linux_read_loadmap): Pass current_inferior directly
to lwpid_of.

10 years agoFix a few more targets affected by the change to the TC_CONS_FIX_NEW macro.
Nick Clifton [Wed, 9 Apr 2014 13:05:58 +0000 (14:05 +0100)]
Fix a few more targets affected by the change to the TC_CONS_FIX_NEW macro.

* config/tc-rl78.h (TC_CONS_FIX_NEW): Add RELOC parameter.
* config/tc-z80.h (TC_CONS_FIX_NEW): Discard RELOC parameter.
* config/tc-aarch64.h (TC_CONS_FIX_NEW): Discard RELOC parameter.
* read.c (emit_expr_fix): Mark the r parameter as potentially
unused.

10 years agodarwin: fix thinko (free thread port after threads are discovered).
Tristan Gingold [Wed, 9 Apr 2014 08:23:19 +0000 (10:23 +0200)]
darwin: fix thinko (free thread port after threads are discovered).

Due to a thinko, a message could be not understood and ignored.  The result
was a dead-lock (gdb is waiting for an event that never happen).  The port
of the thread was deallocated before new threads are discovered.  As a
consequence, the origin of the message was unknown (instead of being
linked to the newly created thread).

gdb/
* darwin-nat.c (darwin_check_new_threads): Fix port leak, add
comments.
(darwin_decode_exception_message): Free port only after use.

10 years agoAdd a time-stamp for chew
Alan Modra [Wed, 9 Apr 2014 03:53:41 +0000 (13:23 +0930)]
Add a time-stamp for chew

One last time-stamp.  Now none of the doc rules using move-if-change
will run unnecessarily.

* Makefile.am ($(MKDOC)): New rule, depend on chew.stamp.  Move
old rule to..
(chew.stamp): ..here.
(DISTCLEANFILES): Move *.stamp..
(MOSTLYCLEANFILES): ..to here.
* Makefile.in: Regenerate.

10 years agoppc476 gas warn on data in code sections
Alan Modra [Tue, 8 Apr 2014 21:33:53 +0000 (07:03 +0930)]
ppc476 gas warn on data in code sections

* config/tc-ppc.c (warn_476, last_insn, last_seg, last_subseg):
New static vars.
(md_longopts, md_parse_option, md_show_usage): Add --ppc476-workaround.
(ppc_elf_cons_fix_check): New function.
(md_assemble): Set last_insn, last_seg, last_subseg.
(ppc_byte, md_apply_fix): Handle warn_476.
* config/tc-ppc.h (TC_CONS_FIX_CHECK): Define.
(ppc_elf_cons_fix_check): Declare.
* read.c (cons_worker): Invoke TC_CONS_FIX_CHECK.

10 years agogas TC_PARSE_CONS_EXPRESSION communication with TC_CONS_FIX_NEW
Alan Modra [Tue, 8 Apr 2014 05:08:22 +0000 (14:38 +0930)]
gas TC_PARSE_CONS_EXPRESSION communication with TC_CONS_FIX_NEW

A number of targets pass extra information from TC_PARSE_CONS_EXPRESSION
to TC_CONS_FIX_NEW via static variables.  That's OK, but not best
practice.  tc-ppc.c goes further in implementing its own replacement
for cons(), because the generic one doesn't allow relocation modifiers
on constants.  This patch fixes both of these warts.

* gas/config/tc-alpha.h (TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arc.c (arc_cons_fix_new): Add reloc parameter.
* gas/config/tc-arc.h (arc_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arm.c (cons_fix_new_arm): Similarly
* gas/config/tc-arm.h (cons_fix_new_arm, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-cr16.c (cr16_cons_fix_new): Similarly.
* gas/config/tc-cr16.h (cr16_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-crx.h (TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-m32c.c (m32c_cons_fix_new): Similarly.
* gas/config/tc-m32c.h (m32c_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-mn10300.c (mn10300_cons_fix_new): Similarly.
* gas/config/tc-mn10300.h (mn10300_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-ns32k.c (cons_fix_new_ns32k): Similarly.
* gas/config/tc-ns32k.h (cons_fix_new_ns32k): Similarly.
* gas/config/tc-pj.c (pj_cons_fix_new_pj): Similarly.
* gas/config/tc-pj.h (pj_cons_fix_new_pj, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-rx.c (rx_cons_fix_new): Similarly.
* gas/config/tc-rx.h (rx_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-sh.c (sh_cons_fix_new): Similarly.
* gas/config/tc-sh.h (sh_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-tic54x.c (tic54x_cons_fix_new): Similarly.
* gas/config/tc-tic54x.h (tic54x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-tic6x.c (tic6x_cons_fix_new): Similarly.
* gas/config/tc-tic6x.h (tic6x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-arc.c (arc_parse_cons_expression): Return reloc.
* gas/config/tc-arc.h (arc_parse_cons_expression): Update proto.
* gas/config/tc-avr.c (exp_mod_data): Make global.
(pexp_mod_data): Delete.
(avr_parse_cons_expression): Return exp_mod_data pointer.
(avr_cons_fix_new): Add exp_mod_data_t pointer param.
(exp_mod_data_t): Move typedef..
* gas/config/tc-avr.h: ..to here.
(exp_mod_data): Declare.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
(avr_parse_cons_expression, avr_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Update.
* gas/config/tc-hppa.c (hppa_field_selector): Delete static var.
(cons_fix_new_hppa): Add hppa_field_selector param.
(fix_new_hppa): Adjust.
(parse_cons_expression_hppa): Return field selector.
* gas/config/tc-hppa.h (parse_cons_expression_hppa): Update proto.
(cons_fix_new_hppa): Likewise.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
* gas/config/tc-i386.c (got_reloc): Delete static var.
(x86_cons_fix_new): Add reloc param.
(x86_cons): Return got reloc.
* gas/config/tc-i386.h (x86_cons, x86_cons_fix_new): Update proto.
(TC_CONS_FIX_NEW): Add RELOC param.
* gas/config/tc-ia64.c (ia64_cons_fix_new): Add reloc param.  Adjust
calls.
* gas/config/tc-ia64.h (ia64_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add reloc param.
* gas/config/tc-microblaze.c (parse_cons_expression_microblaze):
Return reloc.
(cons_fix_new_microblaze): Add reloc param.
* gas/config/tc-microblaze.h: Formatting.
(parse_cons_expression_microblaze): Update proto.
(cons_fix_new_microblaze): Likewise.
* gas/config/tc-nios2.c (nios2_tls_ldo_reloc): Delete static var.
(nios2_cons): Return ldo reloc.
(nios2_cons_fix_new): Delete.
* gas/config/tc-nios2.h (nios2_cons): Update prototype.
(nios2_cons_fix_new, TC_CONS_FIX_NEW): Delete.
* gas/config/tc-ppc.c (md_pseudo_table): Remove quad, long, word,
short.  Make llong use cons.
(ppc_elf_suffix): Return BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(ppc_elf_cons): Delete.
(ppc_elf_parse_cons): New function.
(ppc_elf_validate_fix): Don't check for BFD_RELOC_UNUSED.
(md_assemble): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
* gas/config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): Define
(ppc_elf_parse_cons): Declare.
* gas/config/tc-sparc.c (sparc_cons_special_reloc): Delete static var.
(sparc_cons): Return reloc specifier.
(cons_fix_new_sparc): Add reloc specifier param.
(sparc_cfi_emit_pcrel_expr): Use emit_expr_with_reloc.
* gas/config/tc-sparc.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(sparc_cons, cons_fix_new_sparc): Update prototype.
* gas/config/tc-v850.c (hold_cons_reloc): Delete static var.
(v850_reloc_prefix): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(md_assemble): Likewise.
(parse_cons_expression_v850): Return reloc.
(cons_fix_new_v850): Add reloc parameter.
* gas/config/tc-v850.h (parse_cons_expression_v850): Update proto.
(cons_fix_new_v850): Likewise.
* gas/config/tc-vax.c (vax_cons_special_reloc): Delete static var.
(vax_cons): Return reloc.
(vax_cons_fix_new): Add reloc parameter.
* gas/config/tc-vax.h (vax_cons, vax_cons_fix_new): Update proto.
* gas/config/tc-xstormy16.c (xstormy16_cons_fix_new): Add reloc param.
* gas/config/tc-xstormy16.h (xstormy16_cons_fix_new): Update proto.
* gas/dwarf2dbg.c (TC_PARSE_CONS_RETURN_NONE): Provide default.
(emit_fixed_inc_line_addr): Adjust exmit_expr_fix calls.
* gas/read.c (TC_PARSE_CONS_EXPRESSION): Return value.
(do_parse_cons_expression): Adjust.
(cons_worker): Pass return value from TC_PARSE_CONS_EXPRESSION
to emit_expr_with_reloc.
(emit_expr_with_reloc): New function handling reloc, mostly
extracted from..
(emit_expr): ..here.
(emit_expr_fix): Add reloc param.  Adjust TC_CONS_FIX_NEW invocation.
Handle reloc.
(parse_mri_cons): Convert to ISO.
* gas/read.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(emit_expr_with_reloc): Declare.
(emit_expr_fix): Update prototype.
* gas/write.c (write_object_file): Update TC_CONS_FIX_NEW invocation.

10 years agoFix fallout from splitting ldbuildid.[ch] off elf32.em.
Alan Modra [Wed, 9 Apr 2014 03:55:04 +0000 (13:25 +0930)]
Fix fallout from splitting ldbuildid.[ch] off elf32.em.

bfd/
* libcoff.h: Regenerate.
ld/
* emultempl/spuelf.em: Include safe-ctype.h, remove duplicate errno.h.
* emultempl/nds32elf.em: Include bfd_stdint.h.
* po/POTFILES.in: Regenerate.

10 years agobfd doc chew
Alan Modra [Tue, 8 Apr 2014 00:34:18 +0000 (10:04 +0930)]
bfd doc chew

I got tired of watching chew.c being compiled a dozen or more times
each time I do a binutils build.

* Makefile.am (MKDOC): Use $@ in command.
(aoutx.texi): New rule, depend on aoutx.stamp.  Move old rule..
(aoutx.stamp): .. to here.  Don't depend on chew.c, depend on MKDOC
and omit recursive MAKE.  Use $< in command.
(archive.texi, archures.texi, bfdt.texi, cache.texi, coffcode.texi,
core.texi, elf.texi, elfcode.texi, mmo.texi, format.texi, libbfd.texi,
bfdio.texi, bfdwin.texi, opncls.texi, reloc.texi, section.texi,
syms.texi, targets.texi, init.texi, hash.texi, linker.texi): Similarly.
(DISTCLEANFILES): Remove *.stamp.
* Makefile.in: Regenerate.

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

10 years agoppc476 icache workaround fix for bctr
Alan Modra [Sat, 5 Apr 2014 07:25:13 +0000 (17:55 +1030)]
ppc476 icache workaround fix for bctr

I got the ppc476 workaround wrong.  bctr (and bctrl) as the last
instruction in a page can hit the icache bug if the preceding mtctr
insn is close by, and the destination is in the first few instructions
on the next page.  This scenario can occur with code generated by gcc
to implement switch statements, or in code generated to call by
function pointer.

To prevent the bctr problem it is also necessary to remove other
instructions that otherwise would be safe.

bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Remove bctr from list
of safe ppc476 insns at end of page.  Also remove non-branch insns.
Expand comments.
ld/
* emultempl/ppc32elf.em (no_zero_padding, ppc_finish): New functions.
(LDEMUL_FINISH): Define.

10 years agoFix erroneous backtrace on avrxmega architectures.
Pierre Langlois [Fri, 4 Apr 2014 17:31:36 +0000 (18:31 +0100)]
Fix erroneous backtrace on avrxmega architectures.

* avr-tdep.c (struct gdbarch_tdep): Mention avrxmega in the comment.
(avr_gdbarch_init): Add xmega architectures given by bfd_architecture
when setting the size of call_length.

10 years agoThis patch removes the inclusion of the default manifest in final links for
Nick Clifton [Tue, 8 Apr 2014 16:45:33 +0000 (17:45 +0100)]
This patch removes the inclusion of the default manifest in final links for
the Cygwin and MinGW targets.  The manifest is now going to be handled by gcc.

* scripttempl/pe.sc (R_RSRC): Remove default manifest.
* scripttempl/pep.sc (R_RSRC): Remove default manifest.

10 years agoAdd support for generating and inserting build IDs into COFF binaries.
Jon TURNEY [Tue, 8 Apr 2014 09:59:43 +0000 (10:59 +0100)]
Add support for generating and inserting build IDs into COFF binaries.

* peXXigen.c (pe_print_debugdata): New function: Displays the
contents of the debug directory and decodes codeview entries.
(_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
Add functions for reading and writing debugdir and codeview
records.
* libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
(_bfd_XXi_write_codeview_record): Add prototypes and macros.
* libcoff-in.h (pe_tdata): Add build-id data.
* libcoff.h: Regenerate.
* coffcode.h (coff_write_object_contents): Run build_id
after_write_object_contents hook.

* pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70)
(_CV_INFO_PDB20): Add structures and constants for debug directory
and codeview records.
* internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO):
Add structures and constants for internal representation of debug
directory and codeview records.

* emultempl/elf32.em (id_note_section_size, read_hex, write_build_id):
Move code for parsing build-id option and calculating the build-id to...
* ldbuildid.c: New file.
* ldbuildid.h: New file.
* Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new
files.
* Makefile.in: Regenerate.
* ld.texinfo: Update --build-id description to mention COFF
support.
* NEWS: Mention support for COFF build ids.
* emultempl/pe.em (gld${EMULATION_NAME}_handle_option):
(pecoff_checksum_contents, write_build_id, setup_build_id)
(gld_${EMULATION_NAME}_after_open):  Handle and implement
build-id option.
* emultempl/pep.em: Likewise.

10 years ago[testsuite] Disable Ctrl-V use for mingw hosts.
Pierre Muller [Tue, 25 Mar 2014 00:37:36 +0000 (08:37 +0800)]
[testsuite] Disable Ctrl-V use for mingw hosts.

On mingw host, we have seen two fails as below,

p int1dim[0]^V@2
Invalid character '^V' in expression.
(gdb) FAIL: gdb.base/printcmds.exp: p int1dim[0]@2
p int1dim[0]^V@2^V@3
Invalid character '^V' in expression.
(gdb) FAIL: gdb.base/printcmds.exp: p int1dim[0]@2@3

In the test, the comment says "# Send \026@ instead of just @ in case
the kill character is @".  Historically, kill character was @, and
Ctrl-V (\026) is to escape the next character.  However, we don't have
to do so on mingw.  This patch is to disable ctrl-v usage on mingw
hots.  With this patch applied, it becomes:

p int1dim[0]@2
$607 = {0, 1}
(gdb) PASS: gdb.base/printcmds.exp: p int1dim[0]@2
p int1dim[0]@2@3
$608 = {{0, 1}, {2, 3}, {4, 5}}

Note that this patch is picked from Pierre's submission,

  [RFC 6/6] Fix remaining failures in gdb.base/printcmds.exp for mingw hosts.
  https://www.sourceware.org/ml/gdb-patches/2013-09/msg00943.html

gdb/testsuite:

2014-04-08  Pierre Muller  <muller@sourceware.org>

* gdb.base/printcmds.exp (test_artificial_arrays): Disable
Ctrl-V use for mingw hosts.

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

10 years ago[python] Fix gdb.Value.dynamic_type for reference values.
Siva Chandra [Fri, 21 Mar 2014 13:42:50 +0000 (06:42 -0700)]
[python] Fix gdb.Value.dynamic_type for reference values.

gdb.Value.dynamic_type is supposed to work for reference and pointer
values.  However, the value object in the function 'valpy_get_dynamic_type'
was being dereferenced using 'value_ind' irrespective of the value type
being TYPE_CODE_PTR or TYPE_CODE_REF.  This patch fixes that to use
'coerce_ref' for TYPE_CODE_REF values.

ChangeLog:

* python/py-value.c (valpy_get_dynamic_type): Use coerce_ref to
dereference TYPE_CODE_REF values.

testsuite/
* gdb.python/py-value.c: Improve test case.
* gdb.python/py-value.exp: Add new test.

10 years agoAdd support to recognize clang.
Doug Evans [Mon, 7 Apr 2014 21:14:03 +0000 (14:14 -0700)]
Add support to recognize clang.

* lib/compiler.c: Identify the clang compiler.
* lib/compiler.cc: Ditto.

10 years agoFix spurious failures in ld-plugin/lto.exp
Andreas Schwab [Sat, 5 Apr 2014 20:03:44 +0000 (22:03 +0200)]
Fix spurious failures in ld-plugin/lto.exp

* ld-plugin/lto.exp: Make "-Wp," prefix optional when filtering
out _FORTIFY_SOURCE.
("Build libdummy.a 9", "PR ld/12696"): Mark as c++.

10 years agoFix ARI warning in darwin-nat.c::darwin_decode_message
Joel Brobecker [Mon, 7 Apr 2014 16:43:23 +0000 (09:43 -0700)]
Fix ARI warning in darwin-nat.c::darwin_decode_message

gdb/ChangeLog:

        * darwin-nat.c (darwin_decode_message): Remove trailing '\n' at
        end of warning message.

10 years agoReport an error on objcopy/strip of sectionless binaries
Alan Modra [Mon, 7 Apr 2014 04:14:50 +0000 (13:44 +0930)]
Report an error on objcopy/strip of sectionless binaries

All strip operations require section headers to be present, as do most
objcopy operations.  BFD is seriously confused by objects without
section info.  The error message added here is similar to the error
on attempting to strip/objcopy a zero length object.

PR binutils/16811
* objcopy.c (copy_object): Error if no sections.

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

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

10 years agoFix map file reference
Alan Modra [Sat, 5 Apr 2014 02:08:47 +0000 (12:38 +1030)]
Fix map file reference

The testcase in pr16417 comment #6 produces a map file showing
libpthread.so.0               (write@@GLIBC_2.2.5)
ie. missing the file referencing the symbol.

* elflink.c (_bfd_elf_add_default_symbol): Pass poldbfd when
merging non-default sym.

10 years agodaily update
Alan Modra [Fri, 4 Apr 2014 23:00:58 +0000 (09:30 +1030)]
daily update

10 years agoThis fixes PR bootstrap/60620:
Eric Botcazou [Fri, 4 Apr 2014 20:54:42 +0000 (22:54 +0200)]
This fixes PR bootstrap/60620:

* Makefile.def (dependencies): Make gnattools depend on libstdc++-v3.
* Makefile.in: Regenerate.

10 years agoDocument optional comma in linker script.
Cary Coutant [Fri, 4 Apr 2014 16:28:23 +0000 (09:28 -0700)]
Document optional comma in linker script.

The linker script documentation does not mention the optional comma
that may follow an output section command or an overlay command.
In some cases, where a fill expression is used, and the next
output section command begins with an operator (e.g., "/DISCARD/"),
the comma may be required to separate the two commands.

Currently, GNU ld doesn't require the comma, but gold does.

ld/
PR gold/16804
* ld.texinfo: Document optional comma following output section
command and overlay command.

10 years agoAdd support for Intel SGX instructions
Ilya Tocar [Thu, 3 Apr 2014 12:40:04 +0000 (16:40 +0400)]
Add support for Intel SGX instructions

Add Intel SGX instructions support to assembler and disassembler.

gas/

* config/tc-i386.c (cpu_arch): Add .se1.
* doc/c-i386.texi: Document .se1/se1.

gas/testsuite/

* gas/i386/i386.exp: Run SE1 tests.
* gas/i386/se1.d: New file.
* gas/i386/se1.s: Ditto.
* gas/i386/x86-64-se1.d: Ditto.
* gas/i386/x86-64-se1.s: Ditto.

opcodes/

* i386-dis.c (rm_table): Add encls, enclu.
* i386-gen.c (cpu_flag_init): Add CPU_SE1_FLAGS,
(cpu_flags): Add CpuSE1.
* i386-opc.h (enum): Add CpuSE1.
(i386_cpu_flags): Add cpuse1.
* i386-opc.tbl: Add encls, enclu.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

10 years agomach-o: reject 64 bit targets when not configured for.
Tristan Gingold [Thu, 3 Apr 2014 10:50:31 +0000 (12:50 +0200)]
mach-o: reject 64 bit targets when not configured for.

bfd/
* mach-o.c (bfd_mach_o_header_p): Reject 64 bit target when not
configured for.