platform/upstream/binutils.git
10 years agoAdd rdynamic-1 test
H.J. Lu [Wed, 29 Jan 2014 22:30:41 +0000 (14:30 -0800)]
Add rdynamic-1 test

It is added for

commit 409ff343a402799563f71f938138b29f8baf7a1c
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Nov 8 13:49:11 2011 +0000

      * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in
      executables when export_dynamic.

* ld-elf/rdynamic-1.c: New file.
* ld-elf/rdynamic-1.rd: Likewise.

* ld-elf/shared.exp (build_tests): Add rdynamic-1.

10 years agoThis changeset makes sparc64_linux_step_trap to return 0 when a
Jose E. Marchesi [Wed, 29 Jan 2014 15:15:05 +0000 (07:15 -0800)]
This changeset makes sparc64_linux_step_trap to return 0 when a
breakpoint is set in a `ta 0x6d´ which is not a sigreturn syscall.  In
these cases no rt_frame exists in the stack and thus the read PC is
wrong.

ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from
          the sigreturn register save area only if the syscall is
          sigreturn.

testsuite/ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

* gdb.arch/sparc-sysstep.exp: New file.
* gdb.arch/sparc-sysstep.c: Likewise.

* gdb.arch/Makefile.in (EXECUTABLES): Add sparc-sysstep.

10 years agoMy patch to the binutils strip-10.d test was wrong. The osabi field should always...
Nick Clifton [Wed, 29 Jan 2014 14:01:54 +0000 (14:01 +0000)]
My patch to the binutils strip-10.d test was wrong.  The osabi field should always be set to
ELFOSABI_GNU for binaries containing unique symbols.  So I am reverting that patch and
instead applying the patch below to fix up the targets that were triggering the test failure.

bfd/ChangeLog
2014-01-29  Nick Clifton  <nickc@redhat.com>

* elf32-metag.c (elf_metag_post_process_headers): Call
_bfd_elf_post_process_headers.
* elf32-sh64.c (sh64_elf_copy_private_data): Call
_bfd_elf_copy_private_data.
* elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.

binutils/testsuite/ChangeLog
2014-01-29  Nick Clifton  <nickc@redhat.com>

* binutils-all/strip-10.d: Revert previous delta.

10 years agoFollowing up on Tom's suggestion I am checking in a patch to replace the various
Nick Clifton [Wed, 29 Jan 2014 13:46:39 +0000 (13:46 +0000)]
Following up on Tom's suggestion I am checking in a patch to replace the various
bfd_xxx_set macros with static inline functions, so that we can avoid compile time
warnings about comma expressions with unused values.

* bfd-in.h (bfd_set_section_vma): Delete.
(bfd_set_section_alignment): Delete.
(bfd_set_section_userdata): Delete.
(bfd_set_cacheable): Delete.
* bfd.c (bfd_set_cacheable): New static inline function.
* section.c (bfd_set_section_userdata): Likewise.
(bfd_set_section_vma): Likewise.
(bfd_set_section_alignment): Likewise.
* bfd-in2.h: Regenerate.

10 years agoMinor reformatting in valops.c::value_slice
Joel Brobecker [Wed, 29 Jan 2014 10:25:18 +0000 (14:25 +0400)]
Minor reformatting in valops.c::value_slice

I noticed that a small lexical block was over indented by 2 characters.
So this patch starts by reducing the indentation.

While looking at this area of the code, I also noticed a couple of lines
that had trailing spaces, so this patch also removes them.

And finally, it fixes one tiny to put the assignment operator at
the start of the next line, rather than at the end of the first line.

gdb/ChangeLog:

        * valops.c (value_slice): Minor reformatting.

10 years agoAdd .gdb_index version 7 support.
Cary Coutant [Tue, 28 Jan 2014 23:35:47 +0000 (15:35 -0800)]
Add .gdb_index version 7 support.

This patch adds support for .gdb_index version 7, which adds several
flag bits to the symbol index.  It also fixes a problem where it did
not handle compressed debug sections correctly.

Tested with a google/gcc-4_8 branch compiler, which supports
the -ggnu-pubnames option to generate .debug_gnu_pubnames/pubtypes
tables. (We will submit that patch to GCC when stage 1 reopens.)

2014-01-28  Cary Coutant  <ccoutant@google.com>

* gold/dwarf_reader.cc: include <utility> (for make_pair).
(Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
debug sections.
(Dwarf_ranges_table::read_ranges_table): Likewise.
(Dwarf_pubnames_table::read_section): Check for GNU-style
sections, and for compressed debug sections.
(Dwarf_pubnames_table::read_header): Compute end address of table.
(Dwarf_pubnames_table::next_name): Return flag_byte.  Check
for end of list by offset, not by offset == 0.
(Dwarf_info_reader::do_read_string_table): Check for compressed
debug sections.
* gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
Initialize new data members.
(Dwarf_pubnames_table::next_name): return flag_byte.
(Dwarf_pubnames_table::end_of_table_): New data member.
(Dwarf_pubnames_table::is_gnu_style_): New data member.
* gold/gdb-index.cc (gdb_index_version): Update to version 7.
(Gdb_index_info_reader::read_pubtable): Read flag_byte.
(Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
read skeleton type unit DIEs.
(Gdb_index::add_symbol): Add flag_byte; adjust all callers.
(Gdb_index::do_write): Write flag_byte.
* gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
(Gdb_index::Cu_vector): Store flags along with cu indexes.
* gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
* gold/testsuite/gdb_index_test_comm.sh: Likewise.

10 years agoFix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.
Edjunior Barbosa Machado [Tue, 28 Jan 2014 17:31:23 +0000 (15:31 -0200)]
Fix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.

gdb/testsuite/
2014-01-28  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.

10 years agoFix typo in ppc64_standard_linkage7
Ulrich Weigand [Tue, 28 Jan 2014 16:49:13 +0000 (17:49 +0100)]
Fix typo in ppc64_standard_linkage7

The ppc64_standard_linkage7 pattern added by Alan's recent patch:
https://sourceware.org/ml/gdb-patches/2013-11/msg00274.html
contains a typo: the ELFv2 TOC slot offset is 24, not 40.
This was correct in the comment, but not the actual code.

ChangeLog:

* ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.

10 years agoWhen parsing a DW_FORM_ref_addr attribute the CU containing the
Nick Clifton [Tue, 28 Jan 2014 13:43:35 +0000 (13:43 +0000)]
When parsing a DW_FORM_ref_addr attribute the CU containing the
abbreviation may not be the current CU.  Thus we need to make sure
that when we read the abbreviation we use the correct CU.

* dwarf2.c (find_abstract_instance_name): For DW_FORM_ref_addr
attributes select the CU containing the abbreviation, which may not
be the current CU.

10 years agoA recent change to the BFD library has meant that the osabi field in
Nick Clifton [Tue, 28 Jan 2014 13:33:29 +0000 (13:33 +0000)]
A recent change to the BFD library has meant that the osabi field in
ELF headers will be copied from input files.  This in turn has broken
the strip-10 test in the binutils testsuite, so this patch updates the
expected output.

PR binutils/16318
* binutils-all/strip-10.d: Allow "System V" in the osabi field.

10 years agoThe MSP430 linker contains emulations for old and obsolete MCU types.
Nick Clifton [Tue, 28 Jan 2014 12:25:48 +0000 (12:25 +0000)]
The MSP430 linker contains emulations for old and obsolete MCU types.
Since all MCUs now have their own specific linker script (courtesy of
TI) there is no need for these emulations and so this patch removes
them.

* Makefile.am: Remove obsolete MSP430 emulations.
* configure.tgt: Likewise.
* emulparams/msp430all.sh: Likewise.
* Makefile.in: Regenerate.

10 years agoA recent update to the binutils means that RELA sections now have the
Nick Clifton [Tue, 28 Jan 2014 12:18:01 +0000 (12:18 +0000)]
A recent update to the binutils means that RELA sections now have the
SHF_INFO_LINK bit set, which shows up in readelf section dumps.  This
has broken a couple of IA64 testcases in the gas testsuite, which are
fixed by this patch.

PR binutils/16317
* gas/ia64/group-2.d: Expect I attribute with RELA sections.
* gas/ia64/xdata.d: Likewise.

10 years agoUpdate the tic6x linker tests to match the current behaviour of the linker and readelf.
Nick Clifton [Tue, 28 Jan 2014 11:56:13 +0000 (11:56 +0000)]
Update the tic6x linker tests to match the current behaviour of the linker and readelf.

PR binutils/16317
* ld-tic6x/shlib-1.rd: Expect I attribute with RELA sections.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
* ld-tic6x/static-app-1.rd: Likewise.
* ld-tic6x/static-app-1b.rd: Likewise.
* ld-tic6x/static-app-1r.rd: Likewise.
* ld-tic6x/static-app-1rb.rd: Likewise.

PR binutils/16318
* ld-tic6x/tic6x.exp: Expect C6000 osabi value in relocatable
objects.

10 years agoNew Ada maintenance command to ignore descriptive types (DWARF).
Joel Brobecker [Thu, 16 Jan 2014 11:08:16 +0000 (15:08 +0400)]
New Ada maintenance command to ignore descriptive types (DWARF).

Currently, Ada debugging requires the use of certain GNAT-specific
encodings, which are generated by the compiler. These encodings
were created a long time ago to work around the fairly limited
capabilities of the stabs debugging format. With DWARF, the vast
majority of the encodings could be abandoned in favor of a pure
DWARF approach.

In order to make it easier to evaluate the quality of the DWARF
debugging information generated by the compiler, and how the debugger
handles it, we are introducing a small Ada-specific maintenance
setting which changes the debugger's behavior to ignore descriptive
types. Descriptive types are artificial types generated by the
compiler purely to give the debugger hints as to how to properly
decode certain properties of a type.  For instance, for array
types, it generates a parallel type whose name is the name of
the array suffixed with ___XA, whose contents tells us what
the array's index type is, and possibly its bounds. See GCC's
gcc/ada/exp_dbug.ads for the full description of all encodings.

This is only a first step, as this setting does not deactivate
all encodings; More settings dedicated to each type of encoding
will likely be implemented in the future, as we make progress.

gdb/ChangeLog:

        * ada-lang.c (maint_set_ada_cmdlist, maint_show_ada_cmdlist):
        New static globals.
        (maint_set_ada_cmd, maint_show_ada_cmd): New functions.
        (ada_ignore_descriptive_types_p): New static global.
        (find_parallel_type_by_descriptive_type): Return immediately
        if ada_ignore_descriptive_types_p is set.
        (_initialize_ada_language): Register new commands "maintenance
        set ada", "maintenance show ada", "maintenance set ada
        ignore-descriptive-types" and "maintenance show ada
        ignore-descriptive-types".
        * NEWS: Add entry for new "maint ada set/show
        ignore-descriptive-types" commands.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada Glitches): Document the new "maint ada set/show
        ignore-descriptive-types". commands.

10 years agodaily update
Alan Modra [Mon, 27 Jan 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years agobtrace: initiate teardown when closing record btrace target
Markus Metzger [Tue, 3 Dec 2013 09:20:47 +0000 (10:20 +0100)]
btrace: initiate teardown when closing record btrace target

The to_teardown_btrace target method is used to free btrace resources
during shutdown when target record has already been unpushed and we
can't reliably talk to a remote target to disable branch tracing.

Tracing resources are freed for each thread when the thread is removed;
both on the GDB side and on the gdbserver side.

In the remote case, the remote target that provides to_teardown_btrace
to free the GDB side resources has already been unpushed when threads
are destroyed.  This results in a complaint "You can't do this ..." and
in a few bytes of memory leaked for each thread.

Initiate btrace teardown in record_btrace_close, so the remote target is
still in place.

2014-01-27  Markus Metzger  <markus.t.metzger@intel.com>

* record-btrace.c (record_btrace_close): Call btrace_teardown
for all threads.

10 years agoada-lang.c: Really include "ui-out.h".
Joel Brobecker [Wed, 22 Jan 2014 07:42:27 +0000 (11:42 +0400)]
ada-lang.c: Really include "ui-out.h".

Currently, ada-lang.c pretends to include "ui-out.h" as follow:

    #ifdef UI_OUT
    #include "ui-out.h"
    #endif

However, UI_OUT is never defined as far as I can tell. This is confirmed
by rebuilding with a #error pragma inside the #ifdef UI_OUT block,
which never triggers.

Since this unit makes references to declarations from ui-out.h,
this patch simply removes the #ifdef/#endif condition.  This has not
been an error so far because "ui-out.h" indirectly gets included,
via one of the other .h files being included.

gdb/ChangeLog:

        * ada-lang.c: Remove "#ifdef UI_OUT" condition for including
        "ui-out.h".

10 years agoTry printing array range using the name of its index type
Joel Brobecker [Wed, 15 Jan 2014 16:00:05 +0000 (20:00 +0400)]
Try printing array range using the name of its index type

   type Char_Table is array (Character range Character'First .. Character'Last)
     of Natural;

Trying to print the type description of this type currently yields:

   (gdb) ptype char_table
   type = array ('["00"]' .. '["ff"]') of natural

Although technically correct, it seemed more useful to print the array
range as:

   (gdb) ptype char_table
   type = array (character) of natural

This patch implements this suggestion.

gdb/ChangeLog:

        * ada-typeprint (type_is_full_subrange_of_target_type):
        New function.
        (print_range): Add parameter bounds_prefered_p.  If not set,
        try printing range types using the name of their base type.
        (print_range_type): Add parameter bounds_prefered_p.
        Use it in call to print_range.
        (print_array_type, ada_print_type): Update calls to print_range
        and print_range_type.

gdb/testsuite/ChangeLog:

        * gdb.ada/array_char_idx: New testcase.

10 years agoRemove unncessary function declarations in ada-typeprint.c.
Joel Brobecker [Wed, 15 Jan 2014 15:14:15 +0000 (19:14 +0400)]
Remove unncessary function declarations in ada-typeprint.c.

These declarations are unncessary, and make it extra work when trying
to change the profile of one of these functions. This patch just
removes them.

Note that one of them (print_dynamic_range_bound), was improperly
indented.

gdb/ChangeLog:

        * ada-typeprint.c (print_array_type, print_choices, print_range)
        (print_range_bound, print_dynamic_range_bound, print_range_type):
        Remove declaration.

10 years agoAdd missing empty line after declaration in ada-typeprint.c:print_range.
Joel Brobecker [Wed, 15 Jan 2014 14:27:09 +0000 (18:27 +0400)]
Add missing empty line after declaration in ada-typeprint.c:print_range.

gdb/ChangeLog:

        * ada-typeprint.c (print_range): Add missing empty line
        after local declaration.

10 years ago[Ada] Array bound incorrectly printed for array indexed by enum subrange
Joel Brobecker [Thu, 9 Jan 2014 13:30:39 +0000 (17:30 +0400)]
[Ada] Array bound incorrectly printed for array indexed by enum subrange

Consider the following declarations:

   type Range_Type is (One, Two, Three);
   type Array_Type is array (Range_Type range One .. Two) of Integer;
   A : Array_Type := (1, 2);

Trying to print A can yield:

   (gdb) print a
   $1 = (one => 1, 2)

The bound of the first element should not have been printed, since
"one" is the first enumerate of type Range_Type. Similarly, with
the following declarations:

   type Array2_Type is array (Range_Type range Two .. Three) of Integer;
   A2 : Array2_Type := (2, 3);

GDB is failing to print the bound of the first element of "A2":

   (gdb) print a2
   $2 = (2, 3)

This is because the index type for both types Array_Type and Array2_Type
are subranges (by DWARF definition for arrays), of an anonymous subrange
type. When deciding whether to print the bound of the first element,
we handle subranges, but only up to one level. This patch enhanced
the code to handle any number of subrange levels.

gdb/ChangeLog:

        * ada-valprint.c (print_optional_low_bound): Get index_type's
        target type for as long as it is a TYPE_CODE_RANGE.

No testcase with this patch, but this will be tested via the testcase
of another patch, which uses the DWARF assembler to generate debugging
info for an array indexed by an enum.

10 years agoRemove assert in procfs.c::procfs_make_note_section (x86-solaris)
Joel Brobecker [Mon, 20 Jan 2014 15:18:58 +0000 (16:18 +0100)]
Remove assert in procfs.c::procfs_make_note_section (x86-solaris)

On x86-solaris, the gcore command sometimes triggers the following
internal error:

    (gdb) gcore
    /[...]/procfs.c:5523: internal-error: procfs_make_note_section: Assertion `thread_args.note_data != note_data' failed.

The problem is extremely elusive, for reasons that will become clearer
as I explain what is going on.

The program used to produce this issue was really simple:

    | void break_me (void) { }
    |
    | int
    | main (void)
    | {
    |   break_me ();
    |   return 0;
    | }

The procfs_make_note_section builds a buffer incrementally with
the contents of the core's notes section.  The interesting bits are:

  char *note_data = NULL;
  [...]
  note_data = (char *) elfcore_write_prpsinfo (obfd,
                                               note_data,
                                               note_size,
                                               fname,
                                               psargs);

This is the first call to bfd's elfcore which initializes note_data.
After that, we have a few more calls, which keep updating notes_data
and note_size, but our interest lies in the following part of
the function:

  thread_args.note_data = note_data;
  [...]
  proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
                             &thread_args);
  /* There should be always at least one thread.  */
  gdb_assert (thread_args.note_data != note_data);

The comment implies that the assert is to verify that our loop
iterated over at least one thread. The check is relying on the
fact that the notes_data returned by the elfcore module changes
at each iteration, via (in procfs_corefile_thread_callback):

      args->note_data = procfs_do_thread_registers (args->obfd, ptid,
                                                    args->note_data,
                                                    args->note_size,
                                                    args->stop_signal);

(which calls elfcore_write_lwpstatus).

But, while it happens most of the time, thanks to a call to realloc
in elfcore_write_note (the function that actually appends the data
at the end of the notes buffer),...

       buf = (char *) realloc (buf, *bufsiz + newspace);

... this is by no means guarantied. In fact, under the right
circumstances, the buffer was grown twice without changing
addresses. Unfortunately, the circumstances are very sensitive,
thus making this bug very elusive.

This patch fixes the problem by simply removing the assert.
This means we're losing the assertion that there is at least one
thread, but I think that's OK. If we still want to keep the
assertion, we have the option of either checking the buffer
size, or else adding a boolean flag in the context structure
that we'd set to true as soon as we have a thread.

gdb/ChangeLog:

        * procfs.c (procfs_make_note_section): Remove assertion and
        associated comment.

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

10 years agodaily update
Alan Modra [Sat, 25 Jan 2014 23:01:04 +0000 (09:31 +1030)]
daily update

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

10 years agoAdd .data and .bss refsym symbols
DJ Delorie [Fri, 24 Jan 2014 19:43:58 +0000 (14:43 -0500)]
Add .data and .bss refsym symbols

For each object, if it has a nonempty .data or .bss section,
emit a symbol that could cause the startup code to selectively
link in the code to initialize those sections.

* config/tc-msp430.c (msp430_section): Always flag data sections,
regardless of -md.
(msp430_frob_section): New.  Make sure all sections are noticed if
they have content.
(msp430_lcomm): New.  Flag bss if .lcomm is seen.
(msp430_comm): New.  Likewise.
(md_pseudo_table): Add them.
* config/tc-msp430.h (msp430_frob_section): Declare.
(tc_frob_section): Define.

10 years agoReplace .align with .p2align
H.J. Lu [Fri, 24 Jan 2014 18:01:56 +0000 (10:01 -0800)]
Replace .align with .p2align

* ld-elf/pr16498a.s: Replace .align with .p2align.

10 years agoAdd another testcase for PR ld/16498
H.J. Lu [Fri, 24 Jan 2014 17:03:21 +0000 (09:03 -0800)]
Add another testcase for PR ld/16498

PR ld/16498
* ld-elf/pr16498b.d: New file.
* ld-elf/pr16498b.t: Likewise.

10 years agoImprove orphaned TLS section handling
H.J. Lu [Wed, 22 Jan 2014 19:24:12 +0000 (11:24 -0800)]
Improve orphaned TLS section handling

ld/

PR ld/16498
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Improve
orphaned TLS section handling.

ld/testsuite/

PR ld/16498
* ld-elf/pr16498a.d: New file.
* ld-elf/pr16498a.s: Likewise.
* ld-elf/pr16498a.t: Likewise.

10 years agoChange len's type to ULONGEST: remote_read_bytes and get_core_siginfo
Yao Qi [Fri, 10 Jan 2014 06:11:59 +0000 (14:11 +0800)]
Change len's type to ULONGEST: remote_read_bytes and get_core_siginfo

Functions remote_read_bytes and get_core_siginfo are the callees of
target to_xfer_partial interface, so argument 'len' should be changed
to type ULONGEST.

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

* remote.c (remote_read_bytes): Change type of len to ULONGEST.
* corelow.c (get_core_siginfo): Likewise.

10 years agoChange len's type to ULONGEST: remote_write_bytes_aux
Yao Qi [Fri, 10 Jan 2014 05:59:26 +0000 (13:59 +0800)]
Change len's type to ULONGEST: remote_write_bytes_aux

Hi,
This patch changes the type of 'len' from ssize_t to ULONGEST.

At the beginning Siddhesh Poyarekar proposed this patch

  [PATCH] Memory reads and writes should have size_t length
  https://sourceware.org/ml/gdb-patches/2012-05/msg01073.html

to change type of 'len' to size_t.  However, after Jan's review, we
decide to change it to ssize_t, because callers of these functions
may pass signed type to them.

AFAICS, the target layer is a boundary.  In one side, we pass size_t
or ssize_t to target related APIs, and in the other side, the
implementation side, we used LONGEST (ULONGEST in latest code) because
of to_xfer_partial.

Since remote_write_bytes_aux and remote_write_bytes belong to the
implementation of remote target, we should use ULONGEST for len, IMO.

Regression tested on x86_64-linux.  Is it OK?

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

* remote.c (remote_write_bytes_aux): Change type of 'len' to
ULONGEST.  Don't check 'len' is negative.
(remote_write_bytes):  Change type of 'len' to ULONGEST.

10 years agoTLS orphan section placement
Alan Modra [Fri, 24 Jan 2014 12:47:28 +0000 (23:17 +1030)]
TLS orphan section placement

Ensures TLS orphans are placed adjacent to existing TLS sections,
and fixes places where the output_section_statement flags (which might
not be set) were tested when bfd_section flags were available.

* ldlang.c (lang_output_section_find_by_flags): Be careful to
test look->bfd_section->flags if available rather than
look->flags.  Separate SEC_THREAD_LOCAL handling from
SEC_READONLY loop, and rewrite.

10 years agoFixes powerpc64le ld segfaults when --emit-relocs is used.
Alan Modra [Fri, 24 Jan 2014 03:52:10 +0000 (14:22 +1030)]
Fixes powerpc64le ld segfaults when --emit-relocs is used.

ELFv2 needs fewer relocs to annotate plt call stubs.  I correctly
allocated a smaller buffer and wrote the proper relocs, but stupidly
bumped the reloc count as for ELFv1.

* elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed
to get_relocs for ELFv2.

10 years agodaily update
Alan Modra [Thu, 23 Jan 2014 23:00:59 +0000 (09:30 +1030)]
daily update

10 years agoRemove the display of known MCU names from the MSP430 port of GAS.
Nick Clifton [Thu, 23 Jan 2014 17:08:24 +0000 (17:08 +0000)]
Remove the display of known MCU names from the MSP430 port of GAS.

New MSP430 MCU parts are being created by TI all the time and the
list is basically always out of date.  Instead any name will be
accepted by the -mmcu= command line option.  ISA selection is now
based upon the -mcpu= command line option, just as is done for GCC.

gas/ChangeLog
* config/tc-msp430.c (show_mcu_list): Delete.
(md_parse_option): Accept any MCU name.  Accept several more
variants for the -mcpu option.
(md_show_usage): Do not call show_mcu_list.

10 years agoIssue a linker error if TLS sections are not adjacent
H.J. Lu [Thu, 23 Jan 2014 16:15:17 +0000 (08:15 -0800)]
Issue a linker error if TLS sections are not adjacent

Bad linker script may lead to TLS sections separated by non-TLS sections
in output.  This patch changes linker assert to a linker error to
provide better linker diagnosis.

PR ld/16498
* elf.c (_bfd_elf_map_sections_to_segments): Issue a linker error
if TLS sections are not adjacent.

10 years agoavoid python exception in FrameDecorator.py
Tom Tromey [Wed, 22 Jan 2014 15:52:15 +0000 (08:52 -0700)]
avoid python exception in FrameDecorator.py

This fixes a bug in FrameDecorator.py.

FrameVars seems to assume that Frame.block can return None if there is
no block.  However, it actually throws an exception.

I saw this bug while developing a frame filter, but unfortunately I
don't know how to reproduce it.  It seems to me that the SAL tests in
_is_limited_frame should exclude the bad cases; and in my attempts to
write a test they do.

Nevertheless I think the fix is reasonably obvious and ought to go in.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16485:
* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
Handle exception from frame.block.
(FrameVars.fetch_frame_locals): Likewise.

10 years agofix erroneous error-handling in frame filter code
Tom Tromey [Wed, 22 Jan 2014 15:44:41 +0000 (08:44 -0700)]
fix erroneous error-handling in frame filter code

This fixes PR python/16487.

The bug here is that the function-name-handling code in py_print_frame
had a small logic error (really a misplaced closing brace).  This
error could lead to a Py_DECREF(NULL), which crashes.

This patch fixes the bug in the obvious way.

Built and regtested on x86-64 Fedora 18.  New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16487:
* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
on a NULL pointer.  Move "goto error" to correct place.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16487:
* gdb.python/py-framefilter.exp: Add test using "Error" filter.
* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
classes.

10 years agofix crash in frame filters
Tom Tromey [Wed, 22 Jan 2014 15:10:01 +0000 (08:10 -0700)]
fix crash in frame filters

apply_frame_filter calls ensure_python_env before computing the
gdbarch to use.  This means that python_gdbarch can be NULL while in
Python code, and if a frame filter depends on this somehow (easy to
do), gdb will crash.

The fix is to compute the gdbarch first.

Built and regtested on x86-64 Fedora 18.
New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16491:
* python/py-framefilter.c (apply_frame_filter): Call
ensure_python_env after computing gdbarch.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16491:
* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
string from an inferior frame.
* gdb.python/py-framefilter-mi.exp: Update.

10 years agoUse gdb_byte * instead of void *
Yao Qi [Mon, 16 Dec 2013 06:39:12 +0000 (14:39 +0800)]
Use gdb_byte * instead of void *

This patch changes the argument type to gdb_byte * in order to align
with the to_xfer_partial interface.

gdb:

2014-01-23  Yao Qi  <yao@codesourcery.com>

* target.c (raw_memory_xfer_partial): Change argument type
from void * to gdb_byte *.
(memory_xfer_partial_1, memory_xfer_partial): Likewise.

10 years ago * gdbthread.h (gdb_id_to_thread): Delete, unused.
Doug Evans [Thu, 23 Jan 2014 00:39:29 +0000 (16:39 -0800)]
* gdbthread.h (gdb_id_to_thread): Delete, unused.

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

10 years ago New gdbserver option --debug-format=timestamp.
Doug Evans [Wed, 22 Jan 2014 22:17:39 +0000 (14:17 -0800)]
New gdbserver option --debug-format=timestamp.
* NEWS: Mention it.

gdbserver/
* configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in (SFILES): Add debug.c.
(OBS): Add debug.o.
* debug.c: New file.
* debug.h: New file.
* linux-aarch64-low.c (*): Update all debugging printfs to use
debug_printf instead of fprintf.
* linux-arm-low.c (*): Ditto.
* linux-cris-low.c (*): Ditto.
* linux-crisv32-low.c (*): Ditto.
* linux-m32r-low.c (*): Ditto.
* linux-sparc-low.c (*): Ditto.
* linux-x86.c (*): Ditto.
* linux-low.c (*): Ditto.
(linux_wait_1): Add calls to debug_enter, debug_exit.
(linux_wait): Remove redundant debugging printf.
(stop_all_lwps): Add calls to debug_enter, debug_exit.
(linux_resume, unstop_all_lwps): Ditto.
* mem-break.c (*): Update all debugging printfs to use
debug_printf instead of fprintf.
* remote-utils.c (*): Ditto.
* thread-db.c (*): Ditto.
* server.c #include <ctype.h>, "gdb_vecs.h".
(debug_threads): Moved to debug.c.
(*): Update all debugging printfs to use debug_printf instead of
fprintf.
(start_inferior): Replace call to fflush with call to debug_flush.
(monitor_show_help): Mention set debug-format.
(parse_debug_format_options): New function.
(handle_monitor_command): Handle "monitor set debug-format".
(gdbserver_usage): Mention --debug-format.
(main): Parse --debug-format.
* server.h (debug_threads): Declaration moved to debug.h.
#include "debug.h".
* tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of
trace_debug_1 that uses debug_printf.
(tracepoint_look_up_symbols): Update all debugging printfs to use
debug_printf instead of fprintf.

doc/
* gdb.texinfo (Server): Mention --debug-format=all|none|timestamp.
(gdbserver man): Ditto.

testsuite/
* gdb.server/server-mon.exp: Add tests for "set debug-format".

10 years agoAdd .refsym to msp430 backend
DJ Delorie [Wed, 22 Jan 2014 21:41:13 +0000 (16:41 -0500)]
Add .refsym to msp430 backend

* config/tc-msp430.c (msp430_refsym): New: ".refsym <symbol>"
* doc/c-msp430.texi (MSP430 Directives): Document it.

The purpose of this patch is to provide a way for one object file
to require the inclusion of another object, without having to
allocate space for a .word address reference.

10 years agoRemove regzmm from AVX2 gather assert
Michael Zolotukhin [Wed, 22 Jan 2014 19:39:02 +0000 (11:39 -0800)]
Remove regzmm from AVX2 gather assert

Since regzmm can't be used in AVX2 gather instructions, there is no need
to check regzmm in AVX2 gather assert.

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

* config/tc-i386.c (check_VecOperands): Remove regzmm from AVX2
gather assert.

10 years agoAdd check for invalid register in AVX512 gathers
Michael Zolotukhin [Wed, 22 Jan 2014 17:57:31 +0000 (09:57 -0800)]
Add check for invalid register in AVX512 gathers

AVX512 gather instructions shouldn't accept the same register for both
destination and index.

gas/

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

PR gas/16489
* config/tc-i386.c (check_VecOperands): Add check for invalid
register set in AVX512 gathers.

gas/testsuite/

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

PR gas/16489
* gas/i386/vgather-check.s: Add tests for AVX512 gathers.
* gas/i386/x86-64-vgather-check.s: Likewise.
* gas/i386/vgather-check-error.l: Update correspondingly.
* gas/i386/vgather-check-none.d: Likewise.
* gas/i386/vgather-check-warn.d: Likewise.
* gas/i386/vgather-check-warn.e: Likewise.
* gas/i386/vgather-check.d: Likewise.
* gas/i386/x86-64-vgather-check-error.l: Likewise.
* gas/i386/x86-64-vgather-check-none.d: Likewise.
* gas/i386/x86-64-vgather-check-warn.d: Likewise.
* gas/i386/x86-64-vgather-check-warn.e: Likewise.
* gas/i386/x86-64-vgather-check.d: Likewise.

10 years agogdb/ChangeLog:
Andreas Arnez [Wed, 22 Jan 2014 17:54:43 +0000 (18:54 +0100)]
gdb/ChangeLog:
* syscalls/s390x-linux.xml: New file.
* syscalls/s390-linux.xml: New file.
* s390-linux-tdep.c (XML_SYSCALL_FILENAME_S390): New macro.
(XML_SYSCALL_FILENAME_S390X): Likewise.
(op_svc): New enum value for SVC opcode.
(s390_sigtramp_frame_sniffer): Replace literal by 'op_svc'.
(s390_linux_get_syscall_number): New function.
(s390_gdbarch_init): Register '*get_syscall_number' and the
syscall xml file name.
* data-directory/Makefile.in (SYSCALLS_FILES): Add
"s390-linux.xml" and "s390x-linux.xml".
* NEWS: Announce new feature.

gdb/testsuite/ChangeLog:
* gdb.base/catch-syscall.exp: Activate test on s390*-linux.

10 years agoFix regression on s390x with entry-values.exp.
Andreas Arnez [Wed, 22 Jan 2014 15:37:41 +0000 (15:37 +0000)]
Fix regression on s390x with entry-values.exp.

The trace-specific test case 'entry-values' concludes fairly late in
the process that this platform doesn't support trace.  Before that,
there are some platform specifics that don't work on s390x.  The fix
addresses two aspects:

(1) Removal of an excess space character in the regex for the
    disassembly.  This is needed when there is a function alignment
    gap, because then the hex address is immediately followed by a
    colon, like in the first 'nopr' line below:

    (gdb) disassemble foo+50,+10
    Dump of assembler code from 0x32 to 0x3c:
       0x0000000000000032 <foo+50>: br      %r4
       0x0000000000000034:  nopr    %r7
       0x0000000000000036:  nopr    %r7
       0x0000000000000038 <bar+0>:  stmg    %r11,%r15,88(%r15)
    End of assembler dump.

(2) Handling for the s390-specific call instruction.

gdb/testsuite/ChangeLog:
* gdb.trace/entry-values.exp: Remove excess space character from
regex patterns.  Handle s390 call instruction.

10 years agoRe-introduce '_start' labels and add alignment in dw2-dir-file-name test case.
Andreas Arnez [Wed, 22 Jan 2014 15:33:00 +0000 (15:33 +0000)]
Re-introduce '_start' labels and add alignment in dw2-dir-file-name test case.

On ppc64-linux a function symbol does not point to code, but to the
function descriptor.  Thus the previous change for this test case
broke it:

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

This patch reverts to the original method, re-introducing '_start'
symbols.  In addition, it adds sufficient alignment before the label,
such that the label never points into an alignment gap.

gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
define "*_start" label.  Make "name" static.
* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
${name} by references to ${name}_start.

10 years agoPrevent appending "-g" after "-g3" to compile options in info-macros.exp.
Andreas Arnez [Wed, 22 Jan 2014 15:31:10 +0000 (15:31 +0000)]
Prevent appending "-g" after "-g3" to compile options in info-macros.exp.

When upstream gcc is given a command line with the "-g" option after
"-g3", it doesn't generate a ".debug_macro" section.  This is because
the last option wins, thus downgrading the debug level again.  Without
any macro debug information in the executable, info-macros.exp
obviously produces many failures.

Since the "-g" option is appended by DejaGnu's target_compile whenever
the "debug" option is set, the fix just removes that option.

gdb/testsuite/ChangeLog:
* gdb.base/info-macros.exp: Remove "debug" from the compile
options.

10 years agogdb: xtensa: fix on 64-bit hosts
Baruch Siach [Wed, 22 Jan 2014 13:02:29 +0000 (15:02 +0200)]
gdb: xtensa: fix on 64-bit hosts

On 64-bit hosts unsigned long is 64 bit.  Use uint32_t instead.

gdb/
2014-01-22  Baruch Siach  <baruch@tkos.co.il>

* xtensa-tdep.h (xtensa_elf_greg_t): Change type to uint32_t.

10 years agoxtensa-config.c: missing defs.h include.
Pedro Alves [Wed, 22 Jan 2014 12:01:53 +0000 (12:01 +0000)]
xtensa-config.c: missing defs.h include.

All .c files must start by including defs.h.

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

* xtensa-config.c: Include defs.h.

10 years agoDisplay the reference causing a shared library to be needed
Alan Modra [Wed, 22 Jan 2014 05:35:12 +0000 (16:05 +1030)]
Display the reference causing a shared library to be needed

Adds a section for --as-needed libraries to a linker map file, similar
to what we do for archive libraries.

bfd/
* elflink.c (elf_link_add_object_symbols): Call minfo for --as-needed.
ld/
* ldlang.c (asneeded_list_head, asneeded_list_tail): New vars.
(lang_init): Initialise them.
(lang_print_asneeded): New function.
(lang_process): Call lang_print_asneeded.
* ldlang.h (struct asneeded_minfo): New.
(asneeded_list_tail): Declare.
* ldmain.c (add_archive_element): Improve archive map heading.
* ldmisc.c (minfo): Stash --as-needed info.

10 years agoFix gas build breakage
Alan Modra [Wed, 22 Jan 2014 05:06:27 +0000 (15:36 +1030)]
Fix gas build breakage

* config/tc-tic4x.c (md_shortopts): s/CONST/const/.

10 years agoComment typo
Alan Modra [Wed, 22 Jan 2014 05:04:30 +0000 (15:34 +1030)]
Comment typo

* elf64-ppc.c (STK_LINKER): Comment typo fix.

10 years agoAdd ARI (ok) marker for __func__ reference in common-utils.h
Joel Brobecker [Tue, 21 Jan 2014 10:16:57 +0000 (14:16 +0400)]
Add ARI (ok) marker for __func__ reference in common-utils.h

The ARI script flagged the use of the __func__ variable, which
is normally not allowed (not defined in C90). However, this particular
use is OK, as the reference is only made when __STDC_VERSION__ >=
199901L.  So, add an "ARI:" comment to explicitly OK this use.

gdb/ChangeLog:

        * common/common-utils.h: Add "ARI:" comment beside __func__
        reference.

10 years agoExpand documentation of common-utils.h::FUNCTION_NAME
Joel Brobecker [Tue, 21 Jan 2014 10:20:50 +0000 (14:20 +0400)]
Expand documentation of common-utils.h::FUNCTION_NAME

While looking at this macro, I noticed that it wasn't always necessarily
defined. That prompted me to search the current sources to make sure
that all uses were adequately protected, which they were. But to help
prevent future uses to be made unprotected, this patch expands the
current macro documentation a bit.

gdb/ChangeLog:

        * common/common-utils.h (FUNCTION_NAME): Expand the macro's
        documentation a bit.

10 years agoMiscellaneous ld tidies
Alan Modra [Wed, 22 Jan 2014 02:21:19 +0000 (12:51 +1030)]
Miscellaneous ld tidies

Localise a struct, prevent an unneeded symbol lookup, and fix a
testcase.

ld/
* ld.h (struct map_symbol_def): Move to..
* ldlang.h: ..here.
* ldlang.c (print_assignment): Don't set expld.assign_name to dot.
ld/testsuite/
* ld-scripts/pr14962-2.d: Correct target triple.

10 years agoMake assignments to dot keep an empty output section.
Alan Modra [Wed, 22 Jan 2014 01:13:03 +0000 (11:43 +1030)]
Make assignments to dot keep an empty output section.

An assignment to dot in an output section that allocates space of
course keeps the output section.  Here, I'm changing the behaviour for
assignments that don't allocate space.  The idea is not so much to
allow people to force output of an empty section with ". = .", but
to fix cases where an otherwise empty section has padding added by an
alignment expression that changes with relaxation or .eh_frame
editing.  Such a section might have zero size before relaxation and so
be stripped incorrectly.

ld/
* ld.texinfo (Output Section Discarding): Mention assigning to dot
as a way of keeping otherwise empty sections.
* ldexp.c (is_dot, is_value, is_sym_value, is_dot_ne_0,
is_dot_plus_0, is_align_conditional): New predicates.
(exp_fold_tree_1): Set SEC_KEEP when assigning to dot inside an
output section, except for some special cases.
* scripttempl/elfmicroblaze.sc: Use canonical form to align at
end of .heap and .stack.
ld/testsuite/
* ld-shared/elf-offset.ld: Align end of .bss with canonical form
of ALIGN that allows an empty .bss to be removed.
* ld-arm/arm-dyn.ld: Likewise.
* ld-arm/arm-lib.ld: Likewise.
* ld-elfvsb/elf-offset.ld: Likewise.
* ld-mips-elf/mips-dyn.ld: Likewise.
* ld-mips-elf/mips-lib.ld: Likewise.
* ld-arm/arm-no-rel-plt.ld: Remove duplicate ALIGN.
* ld-powerpc/vle-multiseg-1.ld: Remove ALIGN at start of section.
ALIGN address of section instead.
* ld-powerpc/vle-multiseg-2.ld: Likewise.
* ld-powerpc/vle-multiseg-3.ld: Likewise.
* ld-powerpc/vle-multiseg-4.ld: Likewise.
* ld-powerpc/vle-multiseg-6.ld: Likewise.
* ld-scripts/empty-aligned.d: Check section headers not program
headers.  Remove xfail and notarget.
* ld-scripts/empty-aligned.t: Use canonical ALIGN for end of .text2.

10 years agoCheck incompatible existing default symbol definition
H.J. Lu [Tue, 21 Jan 2014 23:42:43 +0000 (15:42 -0800)]
Check incompatible existing default symbol definition

After resolving a versioned reference, foo@VER1, to a default versioned
definition, foo@@VER1, from a shared object, we also merge it with
the existing regular default symbol definition, foo.  When foo is IFUNC
and foo@@VER1 aren't, we will merge 2 incompatible definitions.  This
patch avoids merging foo@@VER1 definition with foo definition if
one is IFUNC and the other isn't.

10 years agodaily update
Alan Modra [Tue, 21 Jan 2014 23:01:03 +0000 (09:31 +1030)]
daily update

10 years agoEnsure that %func() expressions are outermost terms
DJ Delorie [Tue, 21 Jan 2014 20:12:19 +0000 (15:12 -0500)]
Ensure that %func() expressions are outermost terms

This is to avoid expressions like:  %hi(foo) + 1, which will
not do what you expect.  The complex relocations can handle it,
but the internal fixups can't.

10 years agogdb: Support install-strip target
Roland McGrath [Tue, 21 Jan 2014 19:01:04 +0000 (11:01 -0800)]
gdb: Support install-strip target

gdb/
* configure.ac: Call AM_PROG_INSTALL_STRIP.
* configure: Regenerate.
* aclocal.m4: Regenerate.
* Makefile.in (install_sh, INSTALL_STRIP_PROGRAM, STRIP):
New substituted variables.
(install-strip): New target.
(INSTALL_SCRIPT): New substituted variable.
(FLAGS_TO_PASS): Add it.
(install-only): Use $(INSTALL_SCRIPT) rather than
$(INSTALL_PROGRAM) for gcore.

10 years ago[PATCH] include * ansidecl.h (ANSI_PROTOTYPES, PTRCONST, LONG_DOUBLE, PARAMS) ...
tromey [Tue, 21 Jan 2014 15:09:10 +0000 (15:09 +0000)]
[PATCH] include  * ansidecl.h (ANSI_PROTOTYPES, PTRCONST, LONG_DOUBLE, PARAMS)  (VPARAMS, VA_START, VA_OPEN, VA_CLOSE, VA_FIXEDARG, CONST)  (VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, AND, DOTS)  (NOARGS): Don't define.  * libiberty.h (expandargv, writeargv): Don't use PARAMS. libiberty  * _doprint.c (checkit): Use stdarg, not VA_* macros.  * asprintf.c (asprintf): Use stdarg, not VA_* macros.  * concat.c (concat_length, concat_copy, concat_copy2, concat)  (reconcat): Use stdarg, not VA_* macros.  * snprintf.c (snprintf): Use stdarg, not VA_* macros.  * vasprintf.c (checkit): Use stdarg, not VA_* macros.  * vsnprintf.c (checkit): Use stdarg, not VA_* macros.

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

10 years agoUpdate comments for the last commit
H.J. Lu [Tue, 21 Jan 2014 13:37:45 +0000 (05:37 -0800)]
Update comments for the last commit

10 years agoDon't check shared/export_dynamic/ref_dynamic for type mismatch
H.J. Lu [Tue, 21 Jan 2014 13:33:48 +0000 (05:33 -0800)]
Don't check shared/export_dynamic/ref_dynamic for type mismatch

There is nothing linker can do when a type mismatched default definition
are made dynamic by info->shared, info->export_dynamic or h->ref_dynamic.
But we do want to avoid exporting it when building PIE.  Let's remove
those checks.

bfd/

PR ld/2404
* elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
info->export_dynamic, nor !h->ref_dynamic for type mismatch when
adding the default version.

ld/testsuite/

PR ld/2404
* ld-elf/shared.exp: Add a PIE test for PR ld/2404.

10 years agodaily update
Alan Modra [Mon, 20 Jan 2014 23:01:08 +0000 (09:31 +1030)]
daily update

10 years ago[AArch64] Define LP64 BE linker name.
Marcus Shawcroft [Mon, 20 Jan 2014 18:20:04 +0000 (18:20 +0000)]
[AArch64] Define LP64 BE linker name.

10 years ago[AArch64] Define LP64 LE loader name.
Marcus Shawcroft [Mon, 20 Jan 2014 18:18:52 +0000 (18:18 +0000)]
[AArch64] Define LP64 LE loader name.

10 years agobetter packing for command struct
Tom Tromey [Fri, 27 Dec 2013 05:06:27 +0000 (22:06 -0700)]
better packing for command struct

This moves all the bitfields in struct cmd_list_element to be closer
together.  This packs the structure somewhat better.  On a 64 bit
machine, this simple rearrangement saves around 50k at startup.

2014-01-20  Tom Tromey  <tromey@redhat.com>

* cli/cli-decode.h (struct cmd_list_element): Move all bitfields
together.

10 years agoconvert flags to bitfields
Tom Tromey [Fri, 27 Dec 2013 05:04:40 +0000 (22:04 -0700)]
convert flags to bitfields

This changes various flags struct cmd_list_element into bitfields.  In
general I think bitfields are cleaner than flag words, at least in a
case like this where there is no need to pass the flags around
independently of the enclosing struct.

2014-01-20  Tom Tromey  <tromey@redhat.com>

* cli/cli-decode.c (add_cmd, deprecate_cmd, add_alias_cmd)
(add_setshow_cmd_full, delete_cmd, lookup_cmd_1)
(deprecated_cmd_warning, complete_on_cmdlist): Update.
* cli/cli-decode.h (CMD_DEPRECATED, DEPRECATED_WARN_USER)
(MALLOCED_REPLACEMENT, DOC_ALLOCATED): Remove.
(struct cmd_list_element) <flags>: Remove.
<cmd_deprecated, deprecated_warn_user, malloced_replacement,
doc_allocated>: New fields.
<hook_in, allow_unknown, abbrev_flag, type, var_type>: Now
bitfields.
* maint.c (maintenance_do_deprecate): Update.
* top.c (execute_command): Update.

10 years agoAdd a testcase for PR ld/2404
H.J. Lu [Mon, 20 Jan 2014 12:50:47 +0000 (04:50 -0800)]
Add a testcase for PR ld/2404

PR ld/2404 was fixed without a testcase.  This patch to add one.

PR ld/2404
* ld-elf/pr2404.out: New file.
* ld-elf/pr2404a.c: Likewise.
* ld-elf/pr2404b.c: Likewise.

* ld-elf/shared.exp (build_tests): Build libpr2404a.so and
libpr2404b.a.
(run_tests): Run pr2404.

10 years agogdb: xtensa: fix linux ptrace includes
Baruch Siach [Mon, 20 Jan 2014 07:53:12 +0000 (09:53 +0200)]
gdb: xtensa: fix linux ptrace includes

Currently, xtensa code using the Linux ptrace interface only include
sys/ptrace.h.  This file comes from the C library (glibc and uClibc,
at least), and includes a declaration of the ptrace() functions, along
with some cross architecture constants that are mostly copied from the
file located at include/uapi/linux/ptrace.h in recent Linux kernels.

For xtensa specific constants like PTRACE_GETXTREGS and
PTRACE_SETXTREGS the asm/ptrace.h include from the Linux kernel UAPI
is needed.  The code in gdbserver xtensa specific part doesn't call
ptrace() directly, so we can remove the unneeded sys/ptrace.h include.
The gdb xtensa specific code needs both headers, since it calls
ptrace().

gdb/
* xtensa-linux-nat.c: Include asm/ptrace.h.

gdb/gdbserver/
* linux-xtensa-low.c: Include asm/ptrace.h instead of
sys/ptrace.h.

10 years agoAllow self-assignment for absolute symbols defined in a linker script
Alan Modra [Mon, 20 Jan 2014 10:58:42 +0000 (21:28 +1030)]
Allow self-assignment for absolute symbols defined in a linker script

Modifies ld machinery tracking linker script assignments to notice all
assignments, not just those symbols mentioned in DEFINED().

ld/
PR ld/14962
* ldlang.h (struct lang_definedness_hash_entry): Add by_object and
by_script.  Make iteration a single bit field.
(lang_track_definedness, lang_symbol_definition_iteration): Delete.
(lang_symbol_defined): Declare.
* ldlang.c (lang_statement_iteration): Expand comment a little.
(lang_init <lang_definedness_table>): Make it bigger.
(lang_track_definedness, lang_symbol_definition): Delete.
(lang_definedness_newfunc): Update.
(lang_symbol_defined): New function.
(lang_update_definedness): Create entries here.  Do track whether
script definition of symbol is valid, even when also defined in
an object file.
* ldexp.c (fold_name <DEFINED>): Update.
(fold_name <NAME>): Allow self-assignment for absolute symbols
defined in a linker script.
ld/testsuite/
* ld-scripts/pr14962-2.d,
* ld-scripts/pr14962-2.t: New test.
* ld-scripts/expr.exp: Run it.

10 years agoFix duplicate output section statement lookup
Guy Martin [Mon, 20 Jan 2014 03:46:16 +0000 (14:16 +1030)]
Fix duplicate output section statement lookup

Tie output section statements to their associated output section via
output section userdata.  This allows us to avoid hash lookups which
are slower and fail when multiple output sections have the same name.

* ldlang.h (lang_output_section_get): Define.
* ldlang.c (lang_output_section_get): Likewise.
(init_os): Set the output_section userdata to the output
section statement.
* emultempl/hppaelf.em: Use lang_output_section_get instead of
lang_output_section_find where applicable.
* emultempl/aarch64elf.em: Likewise.
* emultempl/aix.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/spuelf.em: Likewise.

10 years agodaily update
Alan Modra [Sun, 19 Jan 2014 23:01:05 +0000 (09:31 +1030)]
daily update

10 years agoMove D demangling routines out of d-lang.c and into d-support.c, which
Iain Buclaw [Sat, 18 Jan 2014 17:27:28 +0000 (17:27 +0000)]
Move D demangling routines out of d-lang.c and into d-support.c, which
is intended to house other D language support functions.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * Makefile.in (SFILES): Add d-support.c.
    (COMMON_OBS): Add d-support.o.
    * d-lang.h (d_parse_symbol): Add comment, now defined in
    d-support.c.
    * d-lang.c (parse_call_convention)
    (parse_attributes, parse_function_types)
    (parse_function_args, parse_type, parse_identifier)
    (call_convention_p, d_parse_symbol): Move functions to ...
    * d-support.c: ... New file.

10 years agoFix and update D demangling support in gdb to the current mangling ABI.
Iain Buclaw [Sat, 18 Jan 2014 17:22:00 +0000 (17:22 +0000)]
Fix and update D demangling support in gdb to the current mangling ABI.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.h (d_parse_symbol): Add declaration.
    * d-lang.c (extract_identifiers)
    (extract_type_info): Remove functions.
    (parse_call_convention, parse_attributes)
    (parse_function_types, parse_function_args)
    (parse_type, parse_identifier, call_convention_p)
    (d_parse_symbol): New functions.
    (d_demangle): Use d_parse_symbol to demangle D symbols.

gdb/testsuite/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

* gdb.dlang/demangle.exp: New file.

10 years agoDefine all basic data types of D and add them to the primitive type
Iain Buclaw [Sat, 18 Jan 2014 17:18:23 +0000 (17:18 +0000)]
Define all basic data types of D and add them to the primitive type
language vector.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.h (struct builtin_d_type): New data type.
    (builtin_d_type): Add declaration.
    * d-lang.c (d_language_arch_info, build_d_types)
    (builtin_d_type): New functions.
    (enum d_primitive_types): New data type.
    (d_language_defn): Change c_language_arch_info to
    d_language_arch_info.
    (d_type_data): New static variable.
    (_initialize_d_language): Initialize d_type_data.

gdb/testsuite/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * gdb.dlang/primitive-types.exp: New file.

10 years agoAdd d_main_name to set the logical entry point for D programs.
Iain Buclaw [Sat, 18 Jan 2014 17:09:43 +0000 (17:09 +0000)]
Add d_main_name to set the logical entry point for D programs.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.h (d_main_name): Add declaration.
    * d-lang.c (d_main_name): New function.
    * symtab.c (find_main_name): Add call to d_main_name.

10 years agoUpdate d_language_defn to reflect that D does not have any style of
Iain Buclaw [Sat, 18 Jan 2014 18:04:08 +0000 (18:04 +0000)]
Update d_language_defn to reflect that D does not have any style of
macro expansion in its language.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.c (d_language_defn): Change macro_expansion_c to
    macro_expansion_no.

10 years agoAdd gdb.dlang to the gdb testsuite for the purpose of creating D
Iain Buclaw [Sat, 18 Jan 2014 16:04:36 +0000 (16:04 +0000)]
Add gdb.dlang to the gdb testsuite for the purpose of creating D
specific tests.

gdb/testsuite/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * configure.ac: Create gdb.dlang/Makefile.
    * configure: Regenerate.
    * Makefile.in (ALL_SUBDIRS): Add gdb.dlang.
    * gdb.dlang/Makefile.in: New file.
    * lib/d-support.exp: New file.
    * lib/gdb.exp (skip_d_tests): New proc.

10 years agoAdd myself as a write-after-approval gdb maintainer.
Iain Buclaw [Sat, 18 Jan 2014 18:02:41 +0000 (18:02 +0000)]
Add myself as a write-after-approval gdb maintainer.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * MAINTAINERS: Add myself as a write-after-approval maintainer.

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

10 years agoAdd "volatile" keyword to "struct gdb_exception" declaration
Sergio Durigan Junior [Fri, 17 Jan 2014 21:39:57 +0000 (19:39 -0200)]
Add "volatile" keyword to "struct gdb_exception" declaration

While doing something else, I found that those 2 places were incorrectly
declaring a "struct gdb_exception" without using the "volatile" keyword.
This commit fixes that.

2014-01-17  Sergio Durigan Junior  <sergiodj@redhat.com>

* breakpoint.c (insert_bp_location): Add "volatile" keyword to "struct
gdb_exception" declaration.
* remote.c (getpkt_or_notif_sane): Likewise.

10 years agoAdd delim_string_to_char_ptr_vec.
Doug Evans [Fri, 17 Jan 2014 18:23:29 +0000 (10:23 -0800)]
Add delim_string_to_char_ptr_vec.

* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): New
function, contents of dirnames_to_char_ptr_vec_append moved here.
(delim_string_to_char_ptr_vec): New function.
(dirnames_to_char_ptr_vec_append): Rewrite.
* common/gdb_vecs.h (delim_string_to_char_ptr_vec): Declare.

10 years agoMove ASSERT_FUNCTION to FUNCTION_NAME.
Doug Evans [Fri, 17 Jan 2014 18:00:07 +0000 (10:00 -0800)]
Move ASSERT_FUNCTION to FUNCTION_NAME.

* common/common-utils.h (FUNCTION_NAME): Renamed from ASSERT_FUNCTION,
and moved here ...
* common/gdb_assert.h (ASSERT_FUNCTION): ... from here.
#include "common-utils.h".
(gdb_assert, gdb_assert_fail, gdb_assert_not_reached): Update.
* common/vec.h (VEC_ASSERT_PASS): Update.
* darwin-nat.h: Replace #include of gdb_assert.h with common-utils.h.
(MACH_CHECK_ERROR): Update.

10 years agoFix PR mention in gdb/gdbserver/ChangeLog's previous change.
Pedro Alves [Fri, 17 Jan 2014 16:28:38 +0000 (16:28 +0000)]
Fix PR mention in gdb/gdbserver/ChangeLog's previous change.

10 years agogas: ARM: Fix encoding of VCVTr.s32.f64 instructions
Will Newton [Thu, 16 Jan 2014 10:08:45 +0000 (10:08 +0000)]
gas: ARM: Fix encoding of VCVTr.s32.f64 instructions

The direct rounding floating-point VCVT instructions introduced in
ARMv8 encode the s32.f64 variant incorrectly. The op bit should be
set to 1 for all signed conversions.

gas/ChangeLog:

2014-01-17  Will Newton  <will.newton@linaro.org>

* config/tc-arm.c (do_vfp_nsyn_cvt_fpv8): Set OP to 1
for the s32.f64 flavours of VCVT.

gas/testsuite/ChangeLog:

2014-01-17  Will Newton  <will.newton@linaro.org>

* gas/arm/armv8-a+fp.d: Correct encoding of vcvta.s32.f64.

10 years agoFix silly ChangeLog entry in previous change.
Pedro Alves [Fri, 17 Jan 2014 15:27:42 +0000 (15:27 +0000)]
Fix silly ChangeLog entry in previous change.

10 years agoFix PR PR16445 - gdbserver build failure on x86.
Pedro Alves [Fri, 17 Jan 2014 13:33:30 +0000 (13:33 +0000)]
Fix PR PR16445 - gdbserver build failure on x86.

If gdb_proc_service.h ends up including linux/elf.h, we'll trip on
duplicate definitions:

 In file included from ../../../gdb/gdbserver/linux-x86-low.c:29:0:
 ../../../gdb/gdbserver/../../include/elf/common.h:36:0: error: "ELFMAG0"
                 redefined [-Werror]
 ... etc ...

Handle this the same way linux-low.c and linux-arm-low.c handle this.

gdb/gdbserver/
2014-01-17  Pedro Alves  <palves@redhat.com>

PR PR16445
* linux-x86-low.c (linux-x86-low.c): Don't include elf/common.h if
ELFMAG0 is defined after including gdb_proc_service.h.

10 years agoAdd comments to gdbarch_address_class_name_to_type_flags.
Simon Marchi [Fri, 17 Jan 2014 09:54:56 +0000 (09:54 +0000)]
Add comments to gdbarch_address_class_name_to_type_flags.

gdb/ChangeLog
2014-01-17  Simon Marchi  <simon.marchi@ericsson.com>

* gdbarch.sh (gdbarch_address_class_name_to_type_flags): Add
comments.
* gdbarch.h: Regenerate.

10 years agoAllow ld target customiser script to force on disk scripts.
Alan Modra [Fri, 17 Jan 2014 00:09:50 +0000 (10:39 +1030)]
Allow ld target customiser script to force on disk scripts.

Mucking with EMULATION_LIBPATH has unwanted side effects.  Allow nds32
emulparams scripts to disable compiled-in scripts naturally, by
setting COMPILE_IN=no.

* genscripts.sh (COMPILE_IN): Don't set if already set.
* emulparams/nds32elf.sh: Don't clear EMULATION_LIBPATH, set
COMPILE_IN=no.
* emulparams/nds32elf16m.sh: Likewise.
* emulparams/nds32elf_linux.sh: Likewise.
* emultempl/aix.em: Test COMPILE_IN value is "yes".
* emultempl/armcoff.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/generic.em: Likewise.
* emultempl/gld960.em: Likewise.
* emultempl/gld960c.em: Likewise.
* emultempl/linux.em: Likewise.
* emultempl/lnk960.em: Likewise.
* emultempl/m68kcoff.em: Likewise.
* emultempl/sunos.em: Likewise.
* emultempl/ticoff.em: Likewise.

10 years ago * dll.c (UNSPECIFIED_CORE_ADDR): New macro.
Doug Evans [Thu, 16 Jan 2014 23:47:43 +0000 (15:47 -0800)]
* dll.c (UNSPECIFIED_CORE_ADDR): New macro.
(match_dll): Use it.

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

10 years agorearrange struct value to save memory
Tom Tromey [Sat, 28 Dec 2013 05:22:07 +0000 (22:22 -0700)]
rearrange struct value to save memory

This patch rearranges struct value a tiny bit, moving the "regnum"
field into a hole.  This saves 8 bytes per value on a 64-bit machine,
and 4 bytes per value on a 32 bit machine.  I think it does not
negatively affect readability or performance.

Built and regtested on x86-64 Fedora 18.

2014-01-16  Tom Tromey  <tromey@redhat.com>

* value.c (struct value) <regnum>: Move earlier.

10 years agoremove extended_remote_create_inferior_1
Tom Tromey [Wed, 18 Dec 2013 15:27:54 +0000 (08:27 -0700)]
remove extended_remote_create_inferior_1

I noticed that extended_remote_create_inferior_1 is called from a
single spot.  This patch unifies the callee and caller.  It's just a
simple cleanup that made the coming refactoring simpler.

2014-01-16  Tom Tromey  <tromey@redhat.com>

* remote.c (extended_remote_create_inferior): Rename from
extended_remote_create_inferior_1.  Add "ops" argument.  Remove
old implementation.

10 years agoFix gdb.trace/mi-traceframe-changed.exp on s390.
Pedro Alves [Thu, 16 Jan 2014 17:43:26 +0000 (17:43 +0000)]
Fix gdb.trace/mi-traceframe-changed.exp on s390.

The test fails on s390 with:

  -trace-find frame-number 0^M
  &"PC not available\n"^M
  ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="<unavailable>",func="??",args=[]}^M
  (gdb) ^M
  FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: -trace-find frame-number 0

tfile knows to infer the PC from the tracepoint's address if the PC
wasn't collected (tfile_fetch_registers) but, that only works on
targets whose PC register is a raw register, and on s390, the PC
register is a pseudo register.

But even if GDB doesn't know how to infer the value of PC, saying the
current frame is level -1 is a bug:

  ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="<unavailable>",func="??",args=[]}^M
                                                       ^^^^^^^^^

'-1' is the level of the sentinel frame, which should never be visible.

This is caused by the s390's heuristic unwinder accepting the frame
(the fallback heuristic unwinders _always_ accept the frame), but then
the unwind->this_id method throws that "PC not available\n" error.

IOW, the s390's heuristic unwinder was never adjusted to handle
unavailable register values gracefully, which can happen with e.g., a
trimmed core file too.

This is just the minimal necessary for
<unavailable> frames, which at least gets us:

  (gdb) tfind
  Found trace frame 0, tracepoint 1
  #0  <unavailable> in ?? ()

That is, frame #0 instead of -1.

We could get better info out of "info frame" (this patch makes us show
"outermost"), but this change would still be necessary.

gdb/
2014-01-16  Pedro Alves  <palves@redhat.com>

* s390-linux-tdep.c (s390_frame_unwind_cache): Swallow
NOT_AVAILABLE_ERROR errors while parsing the prologue or reading
the backchain.

10 years agodwarf2read.c (open_and_init_dwp_file): Fix typo in comment.
Doug Evans [Thu, 16 Jan 2014 17:29:10 +0000 (09:29 -0800)]
dwarf2read.c (open_and_init_dwp_file): Fix typo in comment.

10 years agorecord-btrace: add (reverse-)stepping support
Markus Metzger [Mon, 6 May 2013 14:04:46 +0000 (16:04 +0200)]
record-btrace: add (reverse-)stepping support

Provide to_resume and to_wait target methods for the btrace record target
to allow reverse stepping and replay support.

Replay is limited in the sense that only stepping and source correlation
are supported.  We do not record data and thus can not show variables.

Non-stop mode is not working.  Do not allow record-btrace in non-stop mode.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

* btrace.h (btrace_thread_flag): New.
(struct btrace_thread_info) <flags>: New.
* record-btrace.c (record_btrace_resume_thread)
(record_btrace_find_thread_to_move, btrace_step_no_history)
(btrace_step_stopped, record_btrace_start_replaying)
(record_btrace_step_thread, record_btrace_decr_pc_after_break)
(record_btrace_find_resume_thread): New.
(record_btrace_resume, record_btrace_wait): Extend.
(record_btrace_can_execute_reverse): New.
(record_btrace_open): Fail in non-stop mode.
(record_btrace_set_replay): Split into this, ...
(record_btrace_stop_replaying): ... this, ...
(record_btrace_clear_histories): ... and this.
(init_record_btrace_ops): Init to_can_execute_reverse.
* NEWS: Announce it.

testsuite/
* gdb.btrace/delta.exp: Check reverse stepi.
* gdb.btrace/tailcall.exp: Update.  Add stepping tests.
* gdb.btrace/finish.exp: New.
* gdb.btrace/next.exp: New.
* gdb.btrace/nexti.exp: New.
* gdb.btrace/record_goto.c: Add comments.
* gdb.btrace/step.exp: New.
* gdb.btrace/stepi.exp: New.
* gdb.btrace/multi-thread-step.c: New.
* gdb.btrace/multi-thread-step.exp: New.
* gdb.btrace/rn-dl-bind.c: New.
* gdb.btrace/rn-dl-bind.exp: New.
* gdb.btrace/data.c: New.
* gdb.btrace/data.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.

doc/
* gdb.texinfo: Document limited reverse/replay support
for target record-btrace.