Commit Graph

81902 Commits

Author SHA1 Message Date
Jan-Benedict Glaw 3f9034c204 Fix date in ChangeLog entry 2014-11-19 14:18:17 +01:00
Jan-Benedict Glaw e44c58ce2f Fix signedness warning
This is the updated version using uintptr_t as Alan Modra suggested.

2014-11-18  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	* dwarf.c (process_extended_line_op): Fix signedness warning.
2014-11-19 14:13:30 +01:00
Jiong Wang 54a28c4ce5 [AArch64] Warn on load pair to same register
2014-11-19  Ryan Mansfield  <rmansfield@qnx.com>

    * config/tc-aarch64.c (md_assemble): Call warn_unpredictable_ldst.
    (warn_unpredictable_ldst): New.

  2014-11-19  Ryan Mansfield <rmansfield@qnx.com>

    * gas/aarch64/diagnostic.s: Add new warnings test patterns.
    * gas/aarch64/diagnostic.l: Update expected diagnostic output.
2014-11-19 09:35:23 +00:00
Andreas Arnez 0d7b254902 Use 2-byte instead of 4-byte NOP on S390 in 'bp-permanent' test case
The bp-permanent test case assumes that a NOP is exactly as long as a
software breakpoint.  This is not the case for the S390 "nop"
instruction, which is 4 bytes long, while a software breakpoint is
just 2 bytes long.  The "nopr" instruction has the right size and can
be used instead.

Without this patch the test case fails on S390 when trying to continue
after SIGTRAP on the permanent breakpoint:

  ...
  Continuing.

  Program received signal SIGILL, Illegal instruction.
  test () at /home/arnez/src/binutils-gdb/gdb/testsuite/gdb.base/bp-permanent.c:40
  40	  NOP; /* after permanent bp */
  (gdb)
  FAIL: gdb.base/bp-permanent.exp: always_inserted=off, sw_watchpoint=0:
    basics: stop at permanent breakpoint

With this patch the test case succeeds without any FAILs.

gdb/testsuite/ChangeLog:

	* gdb.base/bp-permanent.c (NOP): Define as 2-byte instead of
	4-byte instruction on S390.
2014-11-19 10:03:32 +01:00
Joel Brobecker 2b0f535a44 [Ada] gdb.ada/complete.exp failure on x86_64-windows
Using the example in gdb.ada/complete.exp, the following command
on x86_64-windows returns one unwanted completion choice :

    (gdb) complete p pck
    p <pck_E>>
    [all following completions entries snipped, all expected]

I tracked down this suprising entry to a minimal symbol whose name
is ".refptr.pck_E". The problem occurs while trying to see if
this symbol matches "pck" when doing wild-matching as we are doing
here:

  /* Second: Try wild matching...  */

  if (!match && wild_match_p)
    {
      /* Since we are doing wild matching, this means that TEXT
         may represent an unqualified symbol name.  We therefore must
         also compare TEXT against the unqualified name of the symbol.  */
      sym_name = ada_unqualified_name (ada_decode (sym_name));
      if (strncmp (sym_name, text, text_len) == 0)
        match = 1;
    }

What happens is that ada_decode correctly identifies the fact that
SYM_NAME (".refptr.pck_E") is not following any GNAT encoding, and
therefore returns that same name, but bracketed: "<.refptr.pck_E>".
This is the convention we use for telling GDB that the decoded name
is not a real Ada name - and therefore should not be encoded for
operations such as name matching, symbol lookups, etc. So far, so good.

Next is the call to ada_unqualified_name, which unfortunately does
not notice that the decoded name it is being given isn't a natural
symbol, and just blindly strips everything up to the last do, returning
"pck_E>". And of course, "pck_E>" matches "pck" now, and so we end
up accepting this symbol as a match.

This patch fixes the problem by making ada_unqualified_name a little
smarter by making sure that the given decoded symbol name does not
start with '<'.

gdb/ChangeLog:

        * ada-lang.c (ada_unqualified_name): Return DECODED_NAME if
        it starts with '<'.

Tested on x86_64-windows using AdaCore's testsuite as well as
on x86_64-linux.
2014-11-19 12:49:55 +04:00
Joel Brobecker 8908fca577 [Ada] Ignore __XA types when redundant.
Consider the following code which declares a variable A2 which
is an array of arrays of integers.

   type Array2_First is array (24 .. 26) of Integer;
   type Array2_Second is array (1 .. 2) of Array2_First;
   A1 : Array1_Second := ((10, 11, 12), (13, 14, 15));

Trying to print the type of that variable currently yields:

    (gdb) ptype A2
    type = array (1 .. 2, 24 .. 26) of integer

This is not correct, as this is the description of a two-dimension
array, which is different from an array of arrays. The expected
output is:

    (gdb) ptype a2
    type = array (1 .. 2) of foo_n926_029.array2_first

GDB's struct type currently handles multi-dimension arrays the same
way arrays of arrays, where each dimension is stored as a sub-array.
The ada-valprint module considers that consecutive array layers
are in fact multi-dimension arrays. For array of arrays, a typedef
layer is introduced between the two arrays, creating a break between
each array type.

In our situation, A2 is a described as a typedef of an array type...

        .uleb128 0x8    # (DIE (0x125) DW_TAG_variable)
        .ascii "a2\0"   # DW_AT_name
        .long   0xfc    # DW_AT_type

        .uleb128 0x4    # (DIE (0xfc) DW_TAG_typedef)
        .long   .LASF5  # DW_AT_name: "foo__array2_second"
        .long   0x107   # DW_AT_type

        .uleb128 0x5    # (DIE (0x107) DW_TAG_array_type)
        .long   .LASF5  # DW_AT_name: "foo__array2_second"
        .long   0xb4    # DW_AT_type
        .uleb128 0x6    # (DIE (0x114) DW_TAG_subrange_type)
        .long   0x11b   # DW_AT_type
        .byte   0x2     # DW_AT_upper_bound
        .byte   0       # end of children of DIE 0x107

... whose element type is, as expected, a typedef to the sub-array
type:

        .uleb128 0x4    # (DIE (0xb4) DW_TAG_typedef)
        .long   .LASF4  # DW_AT_name: "foo__array2_first"
        .long   0xbf    # DW_AT_type

        .uleb128 0x9    # (DIE (0xbf) DW_TAG_array_type)
        .long   .LASF4  # DW_AT_name: "foo__array2_first"
        .long   0xd8    # DW_AT_GNAT_descriptive_type
        .long   0x1c5   # DW_AT_type
        .uleb128 0xa    # (DIE (0xd0) DW_TAG_subrange_type)
        .long   0xf0    # DW_AT_type
        .byte   0x18    # DW_AT_lower_bound
        .byte   0x1a    # DW_AT_upper_bound
        .byte   0       # end of children of DIE 0xbf

The reason why things fails is that, during expression evaluation,
GDB tries to "fix" A1's type. Because the sub-array has a parallel
(descriptive) type (DIE 0xd8), GDB thinks that our array's index
type must be dynamic and therefore needs to be fixed. This in turn
causes the sub-array to be "fixed", which itself results in the
typedef layer to be stripped.

However, looking closer at the parallel type, we see...

        .uleb128 0xb    # (DIE (0xd8) DW_TAG_structure_type)
        .long   .LASF8  # DW_AT_name: "foo__array2_first___XA"
        [...]
        .uleb128 0xc    # (DIE (0xe4) DW_TAG_member)
        .long   .LASF10 # DW_AT_name: "foo__Tarray2_firstD1___XDLU_24__26"

... that all it tells us is that the array bounds are 24 and 26,
which is already correctly provided by the array's DW_TAG_subrange_type
bounds, meaning that this parallel type is just redundant.

Parallel types in general are slowly being removed in favor of
standard DWARF constructs. But in the meantime, this patch kills
two birds with one stone:

  1. It recognizes this situation where the XA type is useless,
     and saves an unnecessary range-type fixing;

  2. It fixes the issue at hand because ignoring the XA type results
     in no type fixing being required, which allows the typedef layer
     to be preserved.

gdb/ChangeLog:

        * ada-lang.c (ada_is_redundant_range_encoding): New function.
        (ada_is_redundant_index_type_desc): New function.
        (to_fixed_array_type): Ignore parallel XA type if redundant.

gdb/testsuite/ChangeLog:

        * gdb.ada/arr_arr: New testcase.

Tested on x86_64-linux.
2014-11-19 12:48:07 +04:00
Joel Brobecker 4a46959e7b varsize-limit error printing element of packed array...
... when that packed array is part of a discriminated record and
one of the bounds is a discriminant.

Consider the following code:

   type FUNNY_CHAR_T is (NUL, ' ', '"', '#', [etc]);
   type FUNNY_STR_T is array (POSITIVE range <>) of FUNNY_CHAR_T;
   pragma PACK (FUNNY_STR_T);
   type FUNNY_STRING_T (SIZE : NATURAL := 1) is
      record
         STR    : FUNNY_STR_T (1 .. SIZE) := (others => '0');
         LENGTH : NATURAL := 4;
      end record;
   TEST: FUNNY_STRING_T(100);

GDB is able to print the value of variable "test" and "test.str".
But not "test.str(1)":

    (gdb) p test
    $1 = (size => 100, str => (33 'A', nul <repeats 99 times>), length => 1)
    (gdb) p test.str
    $2 = (33 'A', nul <repeats 99 times>)
    (gdb) p test.str(1)
    object size is larger than varsize-limit

The problem occurs during the phase where we are trying to resolve
the expression subscript operation. On the one hand of the subscript
operator, we have the result of the evaluation of "test.str", which
is our packed array. We have the following code to handle packed
arrays in particular:

      if (ada_is_constrained_packed_array_type
          (desc_base_type (value_type (argvec[0]))))
        argvec[0] = ada_coerce_to_simple_array (argvec[0]);

This eventually leads to a call to constrained_packed_array_type
to return the "simple array".  This function relies on a parallel
___XA type, when available, to determine the bounds.  In our case,
we find type...

    failure__funny_string_t__T4b___XA"

... which has one field describing the bounds of our array as:

    failure__funny_string_t__T3b___XDLU_1__size

The part that interests us is after the ___XD suffix or,
in other words: "LU_1__size". What this means in GNAT encoding
parlance is that the lower bound is 1, and that the upper bound
is the value of "size". "size" is our discriminant in this case.

Normally, we would access the record's discriminant in order to
get the upper bound's value, but we do not have that information,
here. We are in a mode where we are just trying to "fix" the type
without an actual value. This is what the call to to_fixed_range_type
is doing, and because the fix'ing fails, it ends up returning
the ___XDLU type unmodified as our index type.

This shouldn't be a problem, except that the later part of
constrained_packed_array_type then uses that index_type to
determine the array size, via a call to get_discrete_bounds.
The problem is that the upper bound of the ___XDLU type is
dynamic (in the DWARF sense) while get_discrete_bounds implicitly
assumes that the bounds are static, and therefore accesses
them using macros that assume the bounds values are constants:

    case TYPE_CODE_RANGE:
      *lowp = TYPE_LOW_BOUND (type);
      *highp = TYPE_HIGH_BOUND (type);

This therefore returns a bogus value for the upper bound,
leading to an unexpectedly large size for our array, which
later triggers the varsize-limit guard we've seen above.

This patch avoids the problem by adding special handling
of dynamic range types. It also extends the documentation
of the constrained_packed_array_type function to document
what happens in this situation.

gdb/ChangeLog:

        * ada-lang.c (constrained_packed_array_type): Set the length
        of the return array as if both bounds where zero if that
        returned array's index type is dynamic.

gdb/testsuite/ChangeLog:

        * gdb.ada/pkd_arr_elem: New Testcase.

Tested on x86_64-linux.
2014-11-19 12:06:19 +04:00
Yao Qi 2acf986b74 Don't set CC in config/i386/go32.mh
I cross-compile gdb for msdosdjgpp (both target and host is
i586-pc-msdosdjgpp), so the CC should be i586-pc-msdosdjgpp-gcc.
However, CC is set incorrectly to gcc after config/i386/go32.mh is inlined
into the Makefile.

This patch is to remove the CC setting in config/i386/go32.mh.

gdb:

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

	* config/i386/go32.mh (CC): Remove.
2014-11-19 15:44:35 +08:00
GDB Administrator b10779500e Automatic date update in version.in 2014-11-19 00:00:08 +00:00
H.J. Lu ab7fede88e Check PC-relative offset overflow in PLT entry
This patch checks PC-relative offset overflow in pushq instruction in
x86-64 PLT entry.

bfd/

	PR ld/17618
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
	PC-relative offset overflow in PLT entry.

ld/testsuite/

	PR ld/17618
	* ld-x86-64/x86-64.exp: Run pr17618 for Linux target.

	* ld-x86-64/pr17618.d: New file.
	* ld-x86-64/pr17618.s: Likewise.
2014-11-18 11:04:46 -08:00
Doug Evans 439247b656 symtab.h (SYMTAB_BLOCKVECTOR): Renamed from BLOCKVECTOR. All uses updated.
gdb/ChangeLog:

	* symtab.h (SYMTAB_BLOCKVECTOR): Renamed from BLOCKVECTOR.  All uses
	updated.
2014-11-18 09:41:45 -08:00
Doug Evans 4d663531f2 buildsym API cleanup
gdb/ChangeLog:

	* buildsym.c (buildsym_objfile): New static global.
	(buildsym_comp_dir): New static global.
	(finish_block_internal): Delete arg objfile.  All callers updated.
	(finish_block): Delete arg objfile.  All callers updated.
	(start_subfile): Delete arg dirname.  All callers updated.
	(patch_subfile_names): Update buildsym_comp_dir.
	(get_macro_table): Delete arg objfile.  All callers updated.
	(start_symtab): New arg objfile.  All callers updated.
	Rename arg dirname to comp_dir.
	(reset_symtab_globals): Initialize buildsym_objfile, buildsym_comp_dir.
	(end_symtab_get_static_block): Delete arg objfile.  All callers
	updated.
	(end_symtab_without_blockvector): Ditto.
	(end_symtab_with_blockvector): Ditto.
	(end_symtab_from_static_block): Ditto.
	(end_symtab): Ditto.
	(end_expandable_symtab): Ditto.
	(augment_type_symtab): Ditto.
	* coffread.c (coff_start_symtab): New arg objfile.  All callers
	updated.
2014-11-18 09:37:50 -08:00
Nick Clifton 0593bd3ace Fixes a seg-fault when displaying the time data for a corrupt archive.
PR binutuls/17605
	* bucomm.c (print_arelt_descr): Check for ctime returning NULL.
2014-11-18 17:35:39 +00:00
Doug Evans 8435453b81 symtab.h (SYMTAB_LINETABLE): Renamed from LINETABLE. All uses updated.
gdb/ChangeLog:

	* symtab.h (SYMTAB_LINETABLE): Renamed from LINETABLE.  All uses
	updated.
2014-11-18 09:32:10 -08:00
Doug Evans ee6f8984bb SYMTAB_DIRNAME: New macro.
gdb/ChangeLog:

	* symtab.h (SYMTAB_DIRNAME): New macro.  All uses of member
	symtab.dirname updated to use it.
2014-11-18 09:28:32 -08:00
Doug Evans eb822aa6d0 SYMTAB_OBJFILE: New macro.
gdb/ChangeLog:

	* symtab.h (SYMTAB_OBJFILE): New macro.  All uses of member
	symtab.objfile updated to use it.
2014-11-18 09:19:11 -08:00
Doug Evans 98387a2917 Fix memory leak in watch_main_source_file_lossage.
gdb/ChangeLog:

	* buildsym.c (watch_main_source_file_lossage): Fix memory leak.
2014-11-18 09:00:15 -08:00
Doug Evans aff0895837 Use SYMBOL_OBJFILE more.
gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
	SYMBOL_OBJFILE.
	* findvar.c (default_read_var_value): Ditto.
	* jv-lang.c (add_class_symtab_symbol): Ditto.
	* parse.c (operator_check_standard): Ditto.
	* printcmd.c (address_info): Ditto.
	* symtab.c (fixup_symbol_section): Ditto.
	(skip_prologue_sal): Ditto.
	* tracepoint.c (scope_info): Ditto.
	* valops.c (find_function_in_inferior): Ditto.
	* guile/scm-symbol.c (syscm_eq_symbol_smob): Ditto.
	* python/py-symbol.c (set_symbol): Ditto.
2014-11-18 08:54:06 -08:00
Doug Evans 7bab9b58fd Split up end_symtab_from_static_block into two.
This patch is conceptually quite simple.
If you look at end_symtab_from_static_block you'll see
that the static_block == NULL case is completely different
than the non-NULL case.

There's a lot of complexity to handle the NULL case but it seems
entirely unnecessary.  For example, whether blockvector is NULL
is decided at the start, before this for loop:

  for (subfile = subfiles; subfile; subfile = nextsub)

Secondly, after the for loop, we test symtab for non-NULL here:

  /* Set this for the main source file.  */
  if (symtab)

but symtab will only ever be non-NULL if blockvector was non-NULL.
And if blockvector was non_NULL so will symtab.

The other case to consider is these lines of code executed before
the for loop:

  /* Read the line table if it has to be read separately.
     This is only used by xcoffread.c.  */
  if (objfile->sf->sym_read_linetable != NULL)
    objfile->sf->sym_read_linetable (objfile);

  /* Handle the case where the debug info specifies a different path
     for the main source file.  It can cause us to lose track of its
     line number information.  */
  watch_main_source_file_lossage ();

From my reading of the code, neither of these is useful
in the static_block == NULL case.

Thus we can make the code more readable by splitting these two cases up,
which is what this patch does.

gdb/ChangeLog:

	* buildsym.c (main_subfile): New static global.
	(free_subfiles_list): New function.
	(start_symtab): Set main_subfile.
	(restart_symtab): Replace init of subfiles, current_subfile with
	call to free_subfiles_list.
	(watch_main_source_file_lossage): Use main_subfile.
	(reset_symtab_globals): Replace init of current_subfile with call
	to free_subfiles_list.
	(end_symtab_without_blockvector, end_symtab_with_blockvector): New
	functions, split out from ...
	(end_symtab_from_static_block): ... here.  Rewrite to call them.
2014-11-18 08:28:04 -08:00
Doug Evans f194fefb5e The result of symtab expansion is always a primary symtab.
gdb/ChangeLog:

	* dwarf2read.c (dw2_instantiate_symtab): Add assert.
	(dw2_lookup_symbol): Remove unnecessary test for primary symbol table.
	* psymtab.c (lookup_symbol_aux_psymtabs): Ditto.
	(psymtab_to_symtab): Add comment and assert.
	(map_matching_symbols_psymtab): Remove unnecessary test for
	non-primary symtab.
2014-11-18 08:08:00 -08:00
Nick Clifton 6937bb54a9 More fixes for illegal memory accesses exposed by fuzzed binaries.
PR binutils/17512
	* peXXIgen.c (pe_print_pdata): Fail if the section's virtual size
	is larger than its real size.
	(rsrc_print_section): Fix off-by-one error checking for overflow.
	* pei-x86_64.c (pex64_bfd_print_pdata): Handle empty unwind
	sections.

	* dwarf.c (get_encoded_value): Warn and return if the encoded
	value is more than 64-bits long.
	(SAFE_BYTE_GET): Do not attempt to read more than 64-bits.
	(process_extended_line_op): Add more range checks.
	(decode_location_expression): Use the return value from
	display_block.  Add more range checks.
	(read_debug_line_header): Add range check.
	(display_debug_lines_raw): Add range checks.
	(display_debug_frames): Silently skip multiple zero terminators.
	Add range checks.
	(process_cu_tu_index): Check for non-existant or empty sections.
	Use SAFE_BYTE_GET instead of byte_get.
2014-11-18 14:40:05 +00:00
H.J. Lu de84aee38c Always run mpx3 and mpx4 tests in 64-bit
* ld-x86-64/mpx.exp: Always run mpx3 and mpx4 tests in 64-bit.
2014-11-18 05:55:32 -08:00
Igor Zamyatin d258b82828 Add -z bndplt to generate BND prefix in PLT entries
This patch adds "-z bndplt" option Linux/x86-64 linker to generate BND
prefix in PLT entries.  It also updated Linux/x86-64 assembler not to
generate R_X86_64_PLT32_BND nor R_X86_64_PC32_BND relocations.

bfd/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* elf64-x86-64.c (elf_x86_64_check_relocs): Enable MPX PLT only
	for -z bndplt.

gas/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* config/tc-i386-intel.c (i386_operator): Remove last argument
	from lex_got call.
	* config/tc-i386.c (reloc): Remove bnd_prefix from parameters'
	list.  Return always BFD_RELOC_32_PCREL.
	* (output_branch): Remove condition for BFD_RELOC_X86_64_PC32_BND.
	* (output_jump): Update call to reloc accordingly.
	* (output_interseg_jump): Likewise.
	* (output_disp): Likewise.
	* (output_imm): Likewise.
	* (x86_cons_fix_new): Likewise.
	* (lex_got): Remove bnd_prefix from parameters' list in macro and
	declarations. Don't use BFD_RELOC_X86_64_PLT32_BND.
	* (x86_cons): Update call to lex_got accordingly.
	* (i386_immediate): Likewise.
	* (i386_displacement): Likewise.
	* (md_apply_fix): Don't use BFD_RELOC_X86_64_PLT32_BND nor
	BFD_RELOC_X86_64_PC32_BND.
	* (tc_gen_reloc): Likewise.

include/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* bfdlink.h (struct bfd_link_info): Add bndplt.

ld/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* emulparams/elf_x86_64.sh (BNDPLT): Set to yes for x86_64.
	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle
	"-z bndplt" if BNDPLT is yes.
	(gld${EMULATION_NAME}_list_options): Add "-z bndplt" entry.
	* ld.texinfo: Add description for bndplt.

ld/testsuite/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* testsuite/ld-x86-64/bnd-ifunc-1.d: Add bndplt option.
	* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
	* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.  Update dissassembly
	sections.
	* testsuite/ld-x86-64/mpx.exp: Handle mpx3 and mpx4 tests.
	* testsuite/ld-x86-64/mpx1a.rd: Remove _BND from relocation name.
	* testsuite/ld-x86-64/mpx1c.rd: Likewise.
	* testsuite/ld-x86-64/mpx2a.rd: Likewise.
	* testsuite/ld-x86-64/mpx2c.rd: Likewise.
	* testsuite/ld-x86-64/mpx3.dd: New file.
	* testsuite/ld-x86-64/mpx3a.s: Likewise.
	* testsuite/ld-x86-64/mpx3b.s: Likewise.
	* testsuite/ld-x86-64/mpx4.dd: Likewise.
	* testsuite/ld-x86-64/mpx4a.s: Likewise.
	* testsuite/ld-x86-64/mpx4b.s: Likewise.
2014-11-18 05:40:17 -08:00
Luis Machado 470e2f4e30 I caught a few mingw32-specific failures for some of the gdb.reverse
tests.

FAIL: gdb.reverse/consecutive-precsave.exp: reload precord save file
FAIL: gdb.reverse/finish-precsave.exp: reload precord save file
FAIL: gdb.reverse/until-precsave.exp: reload core file
FAIL: gdb.reverse/watch-precsave.exp: reload core file
FAIL: gdb.reverse/step-precsave.exp: reload core file
FAIL: gdb.reverse/break-precsave.exp: reload precord save file
FAIL: gdb.reverse/sigall-precsave.exp: reload precord save file

They happen for two reasons.

- mingw32 does not define SIGTRAP, so upon recording a core file, the
signal information will be missing, which in turn causes GDB to not
display the stopping signal when it loads the same core file.  An
earlier message warns about this:

"warning: Signal SIGTRAP does not exist on this system."

- The testcase is crafted in a way that expects a pattern of the
stopping signal message instead of a successful core file read message.

The following patch fixes this by changing the old pattern to a more
reasonable one, while still ignoring the fact that mingw32-based GDB
does not record a SIGTRAP in a core file because it does not define
it.

gdb/testsuite/

2014-11-18  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.reverse/break-precsave: Expect completion message for
	core file reads.
	* gdb.reverse/consecutive-precsave.exp: Likewise.
	* gdb.reverse/finish-precsave.exp: Likewise.
	* gdb.reverse/i386-precsave.exp: Likewise.
	* gdb.reverse/machinestate-precsave.exp: Likewise.
	* gdb.reverse/sigall-precsave.exp: Likewise.
	* gdb.reverse/solib-precsave.exp: Likewise.
	* gdb.reverse/step-precsave.exp: Likewise.
	* gdb.reverse/until-precsave.exp: Likewise.
	* gdb.reverse/watch-precsave.exp: Likewise.
2014-11-18 11:16:37 -02:00
Jan Beulich ae527cd876 aarch64: allow adding/removing just feature flags via .arch_extension
Rather than requiring to always also set/change the base architecture,
allow just en-/disabling of architecture extensions, matching what ARM
has.
2014-11-18 14:08:28 +01:00
Philipp Tomsich 0a9ce86daf [AArch64] Add xgene2. 2014-11-18 11:24:14 +00:00
Philipp Tomsich 070cb95614 [AArch64] Add xgene1.
The name xgene1 superceeds xgene-1.  We retain support for the
original xgene-1 for compatibility but drop it from documentation.
2014-11-18 11:19:05 +00:00
Nick Clifton 0eff716535 Fix memort access problems exposed by fuzzed binaries.
PR binutils/17531
	* readelf.c (get_unwind_section_word): Skip reloc processing if
	there are no relocs associated with the section.
	(decode_tic6x_unwind_bytecode): Warn and return if the stack
	pointer adjustment falls off the end of the buffer.
2014-11-18 10:07:11 +00:00
Alan Modra 25a0334e39 daily update 2014-11-18 10:30:47 +10:30
Ilya Tocar 14f195c9a0 Add AVX512VBMI instructions
gas/

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

opcodes/

	* i386-dis-evex.c (evex_table): Add vpermi2b, vpermt2b, vpermb,
	vpmultishiftqb.
	* i386-dis.c (PREFIX enum): Add PREFIX_EVEX_0F3883, EVEX_W_0F3883_P_2.
	* i386-gen.c (cpu_flag_init): Add CPU_AVX512VBMI_FLAGS.
	(cpu_flags): Add CpuAVX512VBMI.
	* i386-opc.h (enum): Add CpuAVX512VBMI.
	(i386_cpu_flags): Add cpuavx512vbmi.
	* i386-opc.tbl: Add vpmadd52luq, vpmultishiftqb, vpermb, vpermi2b,
	vpermt2b.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.

/gas/testsuite/

	* gas/i386/i386.exp: Run new tests.
	* gas/i386/avx512vbmi-intel.d: New file.
	* gas/i386/avx512vbmi.d: Likewise.
	* gas/i386/avx512vbmi.s: Likewise.
	* gas/i386/avx512vbmi_vl-intel.d: Likewise.
	* gas/i386/avx512vbmi_vl.d: Likewise.
	* gas/i386/avx512vbmi_vl.s: Likewise.
	* gas/i386/x86-64-avx512vbmi-intel.d: Likewise.
	* gas/i386/x86-64-avx512vbmi.d: Likewise.
	* gas/i386/x86-64-avx512vbmi.s: Likewise.
	* gas/i386/x86-64-avx512vbmi_vl-intel.d: Likewise.
	* gas/i386/x86-64-avx512vbmi_vl.d: Likewise.
	* gas/i386/x86-64-avx512vbmi_vl.s: Likewise.
2014-11-17 06:03:41 -08:00
Ilya Tocar 2cc1b5aad8 Add AVX512IFMA instructions
gas/

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

opcodes/

	* i386-dis-evex.c (evex_table): Add vpmadd52luq, vpmadd52huq.
	* i386-dis.c (PREFIX enum): Add PREFIX_EVEX_0F38B4,
	PREFIX_EVEX_0F38B5.
	* i386-gen.c (cpu_flag_init): Add CPU_AVX512IFMA_FLAGS.
	(cpu_flags): Add CpuAVX512IFMA.
	* i386-opc.h (enum): Add CpuAVX512IFMA.
	(i386_cpu_flags): Add cpuavx512ifma.
	* i386-opc.tbl: Add vpmadd52huq, vpmadd52luq.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.

/gas/testsuite/

	* gas/i386/i386.exp: Run new tests.
	* gas/i386/avx512ifma-intel.d: New file.
	* gas/i386/avx512ifma.d: Likewise.
	* gas/i386/avx512ifma.s: Likewise.
	* gas/i386/avx512ifma_vl-intel.d: Likewise.
	* gas/i386/avx512ifma_vl.d: Likewise.
	* gas/i386/avx512ifma_vl.s: Likewise.
	* gas/i386/x86-64-avx512ifma-intel.d: Likewise.
	* gas/i386/x86-64-avx512ifma.d: Likewise.
	* gas/i386/x86-64-avx512ifma.s: Likewise.
	* gas/i386/x86-64-avx512ifma_vl-intel.d: Likewise.
	* gas/i386/x86-64-avx512ifma_vl.d: Likewise.
	* gas/i386/x86-64-avx512ifma_vl.s: Likewise.
2014-11-17 06:03:24 -08:00
Ilya Tocar 9d8596f079 Add pcommit instruction
gas/

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

/opcodes

	* i386-dis.c (PREFIX enum): Add PREFIX_RM_0_0FAE_REG_7.
	(prefix_table): Add pcommit.
	* i386-gen.c (cpu_flag_init): Add CPU_PCOMMIT_FLAGS.
	(cpu_flags): Add CpuPCOMMIT.
	* i386-opc.h (enum): Add CpuPCOMMIT.
	(i386_cpu_flags): Add cpupcommit.
	* i386-opc.tbl: Add pcommit.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.

/gas/testsuite/

	* gas/i386/i386.exp: Run new tests.
	* gas/i386/pcommit-intel.d: New file.
	* gas/i386/pcommit.d: Likewise.
	* gas/i386/pcommit.s: Likewise.
	* gas/i386/x86-64-pcommit-intel.d: Likewise.
	* gas/i386/x86-64-pcommit.d: Likewise.
	* gas/i386/x86-64-pcommit.s: Likewise.
2014-11-17 05:56:47 -08:00
Ilya Tocar c5e7287a1a Add clwb instruction
gas/

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

opcodes/
	* i386-dis.c (PREFIX enum): Add PREFIX_0FAE_REG_6.
	(prefix_table): Add clwb.
	* i386-gen.c (cpu_flag_init): Add CPU_CLWB_FLAGS.
	(cpu_flags): Add CpuCLWB.
	* i386-opc.h (enum): Add CpuCLWB.
	(i386_cpu_flags): Add cpuclwb.
	* i386-opc.tbl: Add clwb.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.

gas/testsuite/

	* gas/i386/i386.exp: Run new tests.
	* gas/i386/clwb-intel.d: New file.
	* gas/i386/clwb.d: Likewise.
	* gas/i386/clwb.s: Likewise.
	* gas/i386/x86-64-clwb-intel.d: Likewise.
	* gas/i386/x86-64-clwb.d: Likewise.
	* gas/i386/x86-64-clwb.s: Likewise.
2014-11-17 05:56:37 -08:00
Andreas Arnez a267f3ad3f GDB testsuite: More fixes for warnings with -std=gnu11
Fix some more C compiler warnings for missing function return types
and implicit function declarations in the GDB testsuite.

gdb/testsuite/ChangeLog:

	* gdb.base/bp-permanent.c: Include unistd.h.
	* gdb.python/py-framefilter-mi.c (main): Add return type.
	* gdb.python/py-framefilter.c (main): Likewise.
	* gdb.trace/actions-changed.c (main): Likewise.
2014-11-17 10:26:31 +01:00
Andreas Arnez 12084a9ae1 Eliminate literal line numbers in mi-until.exp
Remove literal line numbers from the regexps in mi-until.exp.  Add
appropriate eye-catchers to until.c and refer to those instead.

This change fixes the test case after having disturbed the line
numbering with the previous fix for compiler warnings with -std=gnu11.

gdb/testsuite/ChangeLog:

	* gdb.mi/until.c: Add eye-catchers.
	* gdb.mi/mi-until.exp: Refer to eye-catchers instead of literal
	line numbers.
2014-11-17 10:26:30 +01:00
Andreas Arnez dc7e1a77a4 Drop remaining references to removed source lines in break1.c and ur1.c
In some .exp files it was missed to remove the references to
eye-catchers like "set breakpoint 9 here" when the non-prototype
function header variants they belonged to were deleted.  This patch
cleans this up.

gdb/testsuite/ChangeLog:

	* gdb.base/condbreak.exp: Drop references to removed non-prototype
	function header variants in break1.c.
	* gdb.base/ena-dis-br.exp: Likewise.
	* gdb.base/hbreak2.exp: Likewise.
	* gdb.reverse/until-precsave.exp: Drop references to removed
	non-prototype function header variants in ur1.c.
	* gdb.reverse/until-reverse.exp: Likewise.
2014-11-17 10:26:30 +01:00
Joel Brobecker 43968415b0 [gdbserver/lynx] spurious failure to write in inferior memory
We noticed the following error on ppc-lynx178, using just about
any program:

        (gdb) tar remote mytarget:4444
        Remote debugging using mytarget:4444
        0x000100c8 in _start ()
        (gdb) b try
        Breakpoint 1 at 0x10844: file try.adb, line 11.
        (gdb) cont
        Continuing.
 !!!->  Cannot remove breakpoints because program is no longer writable.
 !!!->  Further execution is probably impossible.

        Breakpoint 1, try () at try.adb:11
        11          Local : Integer := 18;

And, of course, trying to continue yielded the expected outcome:

       (gdb) c
       Continuing.
       warning: Error removing breakpoint 1
       Cannot remove breakpoints because program is no longer writable.
       Further execution is probably impossible.

It turns out that the problem is caused by an intentional test
against a variable with an undefined value. After GDB receives
notification of the inferior stopping, it tries to remove the
breakpoint by sending a memory-write packet ("X10844,4:9 ").
This leads us to lynx_write_memory, where it tries to split
the memory-write into chunks of 4 bytes. And, in order to handle
writes which are not aligned on word boundaries, we have the
following code:

      if (skip > 0 || truncate > 0)
        /* We need to read the memory at this address in order to preserve
           the data that we are not overwriting.  */
        lynx_read_memory (addr, (unsigned char *) &buf, xfer_size);
        if (errno)
          return errno;

(the comment explains what the code is about).

Unfortunately, the not-so-glaring error that we've made here is
that we're checking ERRNO regardless of whether we've called
lynx_read_memory. In our case, because we are writing 4 bytes
aligned on a word boundary, we do not call lynx_read_memory and
therefore test an ERRNO with an undefined value.

gdb/gdbserver/ChangeLog:

        * lynx-low.c (lynx_write_memory): Put lynx_read_memory and
        corresponding ERRNO check in same block.
2014-11-17 07:23:27 +04:00
Jan-Benedict Glaw abdef8eb90 Sync libiberty from GCC 2014-11-17 03:30:13 +01:00
Petr Machata 41c7760520 dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field
Dwarf::tu and Dwarf::cu allow selection of units with 64-bit offsets
through an option.  When selected, unit size is encoded properly, but
offset to abbreviation unit is still encoded in a 4-byte field.  This
patch fixes the problem.

Reproducer:

Dwarf::assemble "blah.s" {
    tu {is_64 1 version 4 addr_size 8} 0x1122334455667788 the_type {
	type_unit {} { the_type: }
    }

    cu {is_64 1 version 4 addr_size 8} {
	compile_unit {{language @DW_LANG_C}} {}
    }
}

gdb/testsuite:

	* lib/dwarf.exp  (Dwarf::cu, Dwarf::tu): Emit
	${_cu_offset_size} bytes abbrev offset.
2014-11-17 08:31:47 +08:00
Alan Modra 209fed2dec daily update 2014-11-17 10:31:00 +10:30
Jan-Benedict Glaw 8969c424dc Update config.{guess,sub} from upstream config repo
2014-11-16  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	* config.guess: Update from upstream config repo.
	* config.sub: Ditto.
2014-11-16 20:15:00 +01:00
Jan-Benedict Glaw 37e77caf21 Update `move-if-change' from gnulib
2014-11-16  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	* move-if-change: Update from upstream gnulib.
2014-11-16 17:04:02 +01:00
Jan-Benedict Glaw e30465112e Update from upstream Automake
2014-11-16  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	* compile: Sync with upstream Automake.
	* depcomp: Ditto.
	* install-sh: Ditto.
	* missing: Ditto.
	* mkinstalldirs: Ditto.
	* ylwrap: Ditto.
2014-11-16 13:43:48 +01:00
Doug Evans a3f89f9768 Add copyright headers. 2014-11-15 10:20:21 -08:00
Doug Evans 34248c3af7 PR symtab/17559
Basically the problem is that "symtab" is ambiguous.
Is it the primary symtab (where we canonically think of
blockvectors as being stored) or is it for a specific file
(where each file's line table is stored) ?

gdb_disassembly wants the symtab that contains the line table
but is instead getting the primary symtab.

gdb/ChangeLog:

	PR symtab/17559
	* symtab.c (find_pc_line_symtab): New function.
	* symtab.h (find_pc_line_symtab): Declare.
	* disasm.c (gdb_disassembly): Call find_pc_line_symtab instead of
	find_pc_symtab.
	* tui/tui-disasm.c (tui_set_disassem_content): Ditto.
	* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Ditto.
	* tui/tui-source.c (tui_vertical_source_scroll): Ditto.
	* tui/tui-win.c (make_visible_with_new_height): Ditto.
	* tui/tui-winsource.c (tui_horizontal_source_scroll): Ditto.
	(tui_display_main): Call find_pc_line_symtab instead of find_pc_line.

gdb/testsuite/ChangeLog:

	PR symtab/17559
	* gdb.base/line-symtabs.exp: New file.
	* gdb.base/line-symtabs.c: New file.
	* gdb.base/line-symtabs.h: New file.
2014-11-15 10:08:34 -08:00
Doug Evans 2097ae2584 expand_symtab_containing_pc: Renamed from find_pc_sect_symtab_via_partial.
This patch just renames one function.
Its only caller is in stack.c where we're printing a backtrace
with non-zero info_verbose and we want to make sure all the needed
symtabs are expanded before printing the backtrace
so that debug symbol reading messages don't pollute the backtrace.

I think the new name of the function makes clearer to the reader
what is going on.

gdb/ChangeLog:

	* symtab.c (expand_symtab_containing_pc): Renamed from
	find_pc_sect_symtab_via_partial.  All callers updated.
2014-11-15 08:05:22 -08:00
Yao Qi 1ada499f30 Add missing parenthesis
One parenthesis is missing, and it causes a compilation error.  This
patch is to fix it.

gdb:

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

	* go32-nat.c (go32_create_inferior): Add missing parenthesis.
2014-11-15 17:04:30 +08:00
H.J. Lu e88ba8d569 Don't make PLT entry for R_X86_64_GOTPLT64
* x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
	entry for R_X86_64_GOTPLT64.
	(Target_x86_64<size>::Relocate::relocate): Update comments for
	R_X86_64_GOTPLT64.
2014-11-14 16:47:15 -08:00
Joel Brobecker 355e210214 common-defs.h: include <stdarg.h> before <stdio.h>
When trying to build gdbserver on ppc-lynx178, the compiler reports
while trying to compile gdbserver/ax.c that vsprintf is not declared.
Looking at my C99 reference manual (a draft), I see the following
synopsis:

    #include <stdarg.h>
    #include <stdio.h>
    int vsprintf(char * restrict s, [etc]);

Looking at stdio.h on LynxOS-178, if found where vsprintf gets
declared:

    #if defined(__varargs_h) || defined(__stdarg_h) \
            || defined(_VARARGS_H) || defined(_STDARG_H)
    extern int vsprintf             _AP((char *, const char *, va_list));
    #endif

Digging further, I noticed that common-defs.h, which is included
via server.h, includes stdarg.h after including stdio, explaining
why vsprintf does not get declared in this case.

This patch fixes the problem by including stdarg.h before stdio.h.

gdb/ChangeLog:

        * common/common-defs.h: Move <stdarg.h> #include ahead of
        <stdio.h> #include.

Tested on x86_64-linux.
2014-11-14 21:00:45 +04:00
H.J. Lu 1dfc6506b7 Correct x86 assembler manual
* config/tc-i386.c (cpu_arch): Re-arrange avx512* and xsave*
	items.

	* doc/c-i386.texi: Re-arrange avx512* and xsave*.  Add
	clflushopt and se1.  Remove duplicated entries.
2014-11-14 08:36:04 -08:00