binutils-gdb.git
9 years agosim: cr16/d10v: localize translation funcs
Mike Frysinger [Tue, 10 Nov 2015 07:04:53 +0000 (23:04 -0800)]
sim: cr16/d10v: localize translation funcs

These functions are only used in the interp module, so there's no point
in exporting them and declaring them in the external sim interface.

9 years agoFix performance regression due to ld -r memmove
Alan Modra [Mon, 9 Nov 2015 04:33:29 +0000 (15:03 +1030)]
Fix performance regression due to ld -r memmove

The idea here is that instead of using memmove to shuffle the relocs
array every time one is deleted, to add a "wrel" pointer and copy from
rel[0] to wrel[0] as we go.

* elf64-ppc.c (ppc64_elf_relocate_section): Use read and write
pointers to reloc array, rather than memmove when deleting a
reloc.  Don't use RELOC_AGAINST_DISCARDED_SECTION.  Adjust
reloc counts at end of loop.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.

9 years agosim: m32c: move test code to testsuite
Mike Frysinger [Mon, 9 Nov 2015 05:13:08 +0000 (00:13 -0500)]
sim: m32c: move test code to testsuite

Various target code belongs in the testsuite/ subdir, so move the m32c
code to match all the other targets.

9 years agosim: m32c: drop redundant dependency info
Mike Frysinger [Mon, 9 Nov 2015 05:14:26 +0000 (00:14 -0500)]
sim: m32c: drop redundant dependency info

9 years agosim: h8300: drop unused littleendian variable
Mike Frysinger [Mon, 9 Nov 2015 02:41:53 +0000 (21:41 -0500)]
sim: h8300: drop unused littleendian variable

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Nov 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRecognize .pdr debug sections.
Vladimir Radosavljevic [Tue, 3 Nov 2015 16:18:09 +0000 (16:18 +0000)]
Recognize .pdr debug sections.

gold/
* layout.h (Layout::is_debug_info_section): Recognize .pdr debug
sections.

9 years agoRemove unnecessary target dependencies on relocation format.
Cary Coutant [Mon, 9 Nov 2015 16:43:46 +0000 (08:43 -0800)]
Remove unnecessary target dependencies on relocation format.

2015-11-09  Cary Coutant  <ccoutant@gmail.com>
    Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>

gold/
* copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
with type, offset, addend.
(Copy_relocs::save): Likewise.
* copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
(Copy_relocs::save): Likewise.
* aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
and r_addend to Copy_relocs::copy_reloc.
* arm.cc (Target_arm::copy_reloc): Likewise.
* i386.cc (Target_i386::copy_reloc): Likewise.
* mips.cc (Target_mips::copy_reloc): Likewise.
* powerpc.cc (Target_powerpc::copy_reloc): Likewise.
* s390.cc (Target_s390::copy_reloc): Likewise.
* sparc.cc (Target_sparc::copy_reloc): Likewise.
* tilegx.cc (Target_tilegx::copy_reloc): Likewise.
* x86_64.cc (Target_x86_64::copy_reloc): Likewise.

9 years ago[Ada] GDB crash during "finish" of function with out parameters
Joel Brobecker [Mon, 9 Nov 2015 17:58:16 +0000 (09:58 -0800)]
[Ada] GDB crash during "finish" of function with out parameters

Consider a function with the following signature...

   function F (R : out Rec_Type) return Enum_Type;

... where Rec_Type is a simple record:

   type Rec_Type is record
      Cur : Integer;
   end record;

Trying to "finish" from that function causes GDB to SEGV:

    (gdb) fin
    Run till exit from #0  bar.f (r=...) at bar.adb:5
    0x00000000004022fe in foo () at foo.adb:5
    5          I : Enum_Type := F (R);
    [1]    18949 segmentation fault (core dumped)  /[..]/gdb

This is related to the fact that funtion F has a parameter (R)
which is an "out" parameter being passed by copy. For those,
GNAT transforms the return value to be a record with multiple
fields: The first one is called "RETVAL" and contains the return
value shown in the source, and the remaining fields have the same
name as the "out" or "in out" parameters which are passed by copy.
So, in the example above, function F returns a struct that has
one field who name is "r".

Because "RETVAL" starts with "R", GDB thinks it's a wrapper field,
because it looks like the encoding used for  variant records:

   --    member_name ::= {choice} | others_choice
   --    choice ::= simple_choice | range_choice
   --    simple_choice ::= S number
   --    range_choice  ::= R number T number   <<<<<-----  here
   --    number ::= {decimal_digit} [m]
   --    others_choice ::= O (upper case letter O)

See ada_is_wrapper_field:

  return (name != NULL
          && (startswith (name, "PARENT")
              || strcmp (name, "REP") == 0
              || startswith (name, "_parent")
              || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));

As a result of this, when trying to print the RETURN value,
we think that RETVAL is a wrapper, and thus recurse into
print_field_values...

      if (ada_is_wrapper_field (type, i))
        {
          comma_needed =
            print_field_values (TYPE_FIELD_TYPE (type, i),
                                valaddr,
                                (offset
                                 + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT),
                                stream, recurse, val, options,
                                comma_needed, type, offset, language);

... which is a problem since print_field_values assumes that
the type it is given ("TYPE_FIELD_TYPE (type, i)" here), is also
a record type. However, that's not the case, since RETVAL is
an enum. That eventually leads GDB to a NULL type when trying to
extract fields out of the enum, which then leads to a SEGV when
trying to dereference it.

Ideally, we'd want to be a little more careful in identifying
wrapper fields, by enhancing ada_is_wrapper_field to be a little
more complete in its analysis of the field name before declaring
it a variant record wrapper. However, it's not super easy to do
so, considering that the choices can be combined together when
complex choices are used. Eg:

   -- [...] the choice 1 .. 4 | 7 | -10 would be represented by
   --    R1T4S7S10m

Given that we are working towards getting rid of GNAT encodings,
which means that the above will eventually disappear, we took
the more pragmatic approach is just treating  RETVAL as a special
case.

gdb/ChangeLog:

        * ada-lang.c (ada_is_wrapper_field): Add special handling
        for fields called "RETVAL".

gdb/testsuite/ChangeLog:

        * gdb.ada/fin_fun_out: New testcase.

9 years agogas: Fix left shift of negative value.
Dominik Vogt [Mon, 9 Nov 2015 16:12:57 +0000 (17:12 +0100)]
gas: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C cod
which is undefined by the C standard.

gas/ChangeLog:

        * read.c (parse_bitfield_cons): Fix left shift of negative value.
        * config/tc-xstormy16.c (md_section_align): Likewise.
        * config/tc-xgate.c (md_section_align): Likewise.
        * config/tc-visium.c (md_section_align): Likewise.
        * config/tc-v850.c (md_section_align): Likewise.
        * config/tc-tic6x.c (md_section_align): Likewise.
        * config/tc-sh.c (SH64PCREL32_M, SH64PCREL48_M, SH64PCREL32_M)
        (MOVI_32_M, MOVI_48_M, MOVI_32_M, md_section_align): Likewise.
        * config/tc-sh64.c (shmedia_md_estimate_size_before_relax): Likewise.
        * config/tc-score.c (s3_section_align): Likewise.
        * config/tc-score7.c (s7_section_align): Likewise.
        * config/tc-s390.c (md_section_align): Likewise.
        * config/tc-rx.c (md_section_align): Likewise.
        * config/tc-rl78.c (md_section_align): Likewise.
        * config/tc-ppc.c (md_section_align): Likewise.
        * config/tc-or1k.c (md_section_align): Likewise.
        * config/tc-nds32.c (md_section_align): Likewise.
        * config/tc-mt.c (md_section_align): Likewise.
        * config/tc-msp430.c (md_section_align): Likewise.
        * config/tc-mn10300.c (md_section_align): Likewise.
        * config/tc-mn10200.c (md_section_align): Likewise.
        * config/tc-mips.c (md_section_align): Likewise.
        * config/tc-microblaze.c (parse_imm): Likewise.
        * config/tc-mep.c (md_section_align): Likewise.
        * config/tc-m68k.c (md_section_align): Likewise.
        * config/tc-m68hc11.c (md_section_align): Likewise.
        * config/tc-m32r.c (md_section_align): Likewise.
        * config/tc-m32c.c (md_section_align): Likewise.
        * config/tc-lm32.c (md_section_align): Likewise.
        * config/tc-iq2000.c (md_section_align): Likewise.
        * config/tc-ip2k.c (md_section_align): Likewise.
        * config/tc-ia64.c (dot_save, dot_vframe): Likewise.
        * config/tc-i960.c (md_number_to_field, md_section_align): Likewise.
        * config/tc-i386.c (md_section_align): Likewise.
        * config/tc-i370.c (md_section_align): Likewise.
        * config/tc-frv.c (md_section_align): Likewise.
        * config/tc-fr30.c (md_section_align): Likewise.
        * config/tc-epiphany.c (md_section_align): Likewise.
        * config/tc-d30v.c (md_section_align): Likewise.
        * config/tc-d10v.c (md_section_align): Likewise.
        * config/tc-cr16.c (l_cons): Likewise.
        * config/tc-bfin.c (md_section_align): Likewise.
        * config/tc-arm.c (md_section_align): Likewise.
        * config/tc-arc.c (md_section_align): Likewise.
        * config/bfin-parse.y (expr_1): Likewise.

gas/testsuite/ChangeLog:

        * gas/all/test-gen.c (random_order_16s, random_order_24s)
        (random_order_32s): Fix left shift of negative value.

9 years agobinutils: Fix left shift of negative value.
Dominik Vogt [Mon, 9 Nov 2015 16:12:56 +0000 (17:12 +0100)]
binutils: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C code
which is undefined by the C standard.

binutils/ChangeLog:

        * dwarf.c (read_leb128): Fix left shift of negative value.

9 years agobfd: Fix left shift of negative value.
Dominik Vogt [Mon, 9 Nov 2015 16:12:56 +0000 (17:12 +0100)]
bfd: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C code
which is undefined by the C standard.

bfd/ChangeLog:

        * elf64-ppc.c (ppc64_elf_size_stubs, ppc64_elf_build_stubs): Fix left
        shift of negative value.
        * libbfd.c (safe_read_leb128): Likewise.
        * dwarf2.c (place_sections): Likewise.
        * bfd-in.h (align_power): Likewise.
        * bfd-in2.h (align_power): Likewise.

9 years agoUse ELF_STRING_ARM_unwind in arm-tdep.c
Yao Qi [Mon, 9 Nov 2015 15:56:20 +0000 (15:56 +0000)]
Use ELF_STRING_ARM_unwind in arm-tdep.c

We've already has the definition like this,

 #define ELF_STRING_ARM_unwind           ".ARM.exidx"

so it is better to use the macro rather than the string.

gdb:

2015-11-09  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (arm_exidx_new_objfile): Use
ELF_STRING_ARM_unwind.

9 years agoNew function displaced_step_in_progress_thread
Yao Qi [Mon, 9 Nov 2015 14:39:56 +0000 (14:39 +0000)]
New function displaced_step_in_progress_thread

This patch adds a new function displaced_step_in_progress_thread,
which returns whether the thread is in progress of displaced
stepping.

gdb:

2015-11-09  Yao Qi  <yao.qi@linaro.org>

* infrun.c (displaced_step_in_progress_thread): New function.
(handle_inferior_event_1): Call it.

9 years agoMove copy_u.w to MSA64 ASE, remove copy_u.d.
Robert Suchanek [Mon, 9 Nov 2015 08:43:09 +0000 (08:43 +0000)]
Move copy_u.w to MSA64 ASE, remove copy_u.d.

opcodes/ChangeLog:

* mips-opc.c (mips_builtin_opcodes): Change "copy_u.w" to MSA64 ASE,
remove "copy_u.d".

gas/testsuite/ChangeLog:

* gas/mips/micromips@msa.d: Remove "copy_u.w".
* gas/mips/msa.d: Likewise.
* gas/mips/msa.s: Likweise.
* gas/mips/mipsr6@msa.d: Likewise.  Replace addresses with regex.
* gas/mips/msa64.d: Add "copy_u.w".  Remove "copy_u.d".
* gas/mips/msa64.s: Likewise.
* gas/mips/micromips@msa64.d: Likewise.

9 years agoConfigury changes for obstack optimization
Alan Modra [Mon, 9 Nov 2015 04:47:05 +0000 (15:17 +1030)]
Configury changes for obstack optimization

Provides defines used to determine whether glibc obstacks are
compatible.  Generally speaking, 32-bit targets won't need to use
obstack.o from libiberty if glibc is used, while 64-bit targets will,
until glibc gets the new obstack code.

libiberty/
* configure.ac: Get size of size_t.
* config.in: Regenerate.
* configure: Regenerate.

9 years agoSilence obstack.c -Wc++compat warning
Alan Modra [Mon, 9 Nov 2015 04:45:51 +0000 (15:15 +1030)]
Silence obstack.c -Wc++compat warning

Fixes
warning: request for implicit conversion from ‘void *’ to ‘struct _obstack_chunk *’ not permitted in C++ [-Wc++-compat]

I moved the assignment to h->chunk to fix an overlong line, then
decided it would be better after the alloc failure check just to do
things the same way as in _obstack_newchunk.

* obstack.c (_obstack_newchunk): Silence -Wc++compat warning.
(_obstack_begin_worker): Likewise.  Move assignment to h->chunk
after alloc failure check.

9 years agoModify obstack.[hc] to avoid having to include other gnulib files
Alan Modra [Mon, 9 Nov 2015 04:43:51 +0000 (15:13 +1030)]
Modify obstack.[hc] to avoid having to include other gnulib files

Using the standard gnulib obstack source requires importing quite a
lot of other files from gnulib, and requires build changes.

include/
PR gdb/17133
* obstack.h (__attribute_pure__): Expand _GL_ATTRIBUTE_PURE.
libiberty/
PR gdb/17133
* obstack.c (__alignof__): Expand alignof_type from alignof.h.
(obstack_exit_failure): Don't use exitfail.h.
(_): Include libintl.h when HAVE_LIBINTL_H and nls enabled.
Provide default.  Don't include gettext.h.
(_Noreturn): Define.
* obstacks.texi: Adjust node references to external libc info files.

9 years agoCopy gnulib obstack files
Alan Modra [Mon, 9 Nov 2015 04:42:45 +0000 (15:12 +1030)]
Copy gnulib obstack files

This copies obstack.[ch] from gnulib, and updates the docs.  The next
patch should be applied if someone repeats the import at a later date.

include/
PR gdb/17133
* obstack.h: Import current gnulib file.
libiberty/
PR gdb/17133
* obstack.c: Import current gnulib file.
* obstacks.texi: Updated doc, from glibc's manual/memory.texi.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Nov 2015 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Nov 2015 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdb.dwarf2: Don't hardcode certain constants in Dwarf::assemble constructs
Kevin Buettner [Fri, 30 Oct 2015 04:53:51 +0000 (21:53 -0700)]
gdb.dwarf2: Don't hardcode certain constants in Dwarf::assemble constructs

Two tests in gdb.dwarf2, data-loc.exp and dynarr-ptr.exp assume that
sizeof(int) is 4.  This patch looks up the integer size and uses this
constant for DW_AT_byte_size, DW_AT_lower_bound, and DW_AT_upper_bound.

I discovered this problem while looking at test results for this
msp430 multilib:

msp430-sim/-msim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either

It fixes the following set of failures:

FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.three_ptr.all'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.three_ptr'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.three_ptr_tdef.all'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.three_ptr_tdef'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.five_ptr.all'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.five_ptr'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.five_ptr_tdef.all'first
FAIL: gdb.dwarf2/dynarr-ptr.exp: print foo.five_ptr_tdef'first
FAIL: gdb.dwarf2/data-loc.exp: print foo.three
FAIL: gdb.dwarf2/data-loc.exp: print foo.three(1)
FAIL: gdb.dwarf2/data-loc.exp: print foo.three(2)
FAIL: gdb.dwarf2/data-loc.exp: print foo.three(3)
FAIL: gdb.dwarf2/data-loc.exp: print foo.three_tdef
FAIL: gdb.dwarf2/data-loc.exp: print foo.three_tdef(1)
FAIL: gdb.dwarf2/data-loc.exp: print foo.three_tdef(2)
FAIL: gdb.dwarf2/data-loc.exp: print foo.three_tdef(3)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five
FAIL: gdb.dwarf2/data-loc.exp: print foo.five(2)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five(3)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five(4)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five(5)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five(6)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five_tdef
FAIL: gdb.dwarf2/data-loc.exp: print foo.five_tdef(2)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five_tdef(3)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five_tdef(4)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five_tdef(5)
FAIL: gdb.dwarf2/data-loc.exp: print foo.five_tdef(6)
FAIL: gdb.dwarf2/data-loc.exp: print foo__three
FAIL: gdb.dwarf2/data-loc.exp: print foo__three_tdef
FAIL: gdb.dwarf2/data-loc.exp: print foo__five
FAIL: gdb.dwarf2/data-loc.exp: print foo__five_tdef

As I recall, there are still (other) problems with msp430 multilibs
which don't use -mlarge.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/data-loc.exp (Dwarf::assemble): Don't hardcode
value associated with DW_AT_byte_size.
* gdb.dwarf2/dynarr-ptr.exp (Dwarf::assemble): Don't hardcode
constants for DW_AT_byte_size, DW_AT_lower_bound, and
DW_AT_upper_bound.

9 years agotestsuite: Define and use gdb_target_symbol_prefix_flags_asm.
Kevin Buettner [Fri, 6 Nov 2015 04:40:53 +0000 (21:40 -0700)]
testsuite: Define and use gdb_target_symbol_prefix_flags_asm.

Some of the source code for the test cases in the GDB testsuite
reside in .S files containing assembly code.  These files typically
define a symbol - such as main - which may, depending on the target,
require a prefix such as underscore.

For example, gdb.dwarf2/dw-compdir-oldgcc.S defines the symbol main:

main: .globl main

Some targets, such as rx-elf, require main to have an underscore
prefix.  (If it doesn't, a linker error results due to not being able
to find _main required by crt0.o.) So, instead, the above should look
like this for rx-elf and other targets with this same requirement:

_main: .globl _main

This patch defines a new tcl proc in lib/gdb named
gdb_target_symbol_prefix_flags_asm.  This proc returns a string
which will - assuming everything else is wired up correctly - cause
-DSYMBOL_PREFIX=_ to be passed on the command line to the compiler.

The test cases are augmented with a macro definition for SYMBOL
as follows:

    #define CONCAT1(a, b) CONCAT2(a, b)
    #define CONCAT2(a, b) a ## b

    #ifdef SYMBOL_PREFIX
    # define SYMBOL(str)     CONCAT1(SYMBOL_PREFIX, str)
    #else
    # define SYMBOL(str)     str
    #endif

Symbols, such as main shown in the example earlier are then wrapped
with SYMBOL like this:

SYMBOL(main): .globl SYMBOL(main)

The net effect will be to add a prefix for those targets which need
it and add no prefix for those targets which do not.

It should be noted that there was already a proc in lib/gdb.exp
called gdb_target_symbol_prefix_flags.  It still exists, but has
been significantly rewritten.  (There is only one small difference
between the two versions.)

That proc used to explicitly list targets which were known to
require an underscore prefix.  This is no longer done; the recently
added proc, gdb_target_symbol_prefix, is now invoked to dynamically
discover whether or not a prefix is required for that particular
target.

The difference between gdb_target_symbol_prefix_flags_asm
and gdb_target_symbol_prefix_flags is that the former returns
a bare prefix while the latter returns the prefix enclosed in
double quotes.  I.e. assuming that the discovered prefix is
underscore, gdb_target_symbol_prefix_flags_asm returns:

    additional_flags=-DSYMBOL_PREFIX=_

while gdb_target_symbol_prefix_flags returns:

    additional_flags=-DSYMBOL_PREFIX="_"

The double-quoted version is not suitable for using with .S files
containing assembly code; there is no way to strip the double quotes
using C preprocessor constructs.

It would be possible to use the bare (non double quoted) version in
C source code.  However, the supporting macros become more complicated
and therefore more difficult to maintain.

gdb/testsuite/ChangeLog:

* lib/gdb (gdb_target_symbol_prefix_flags_asm): New proc.
(gdb_target_symbol_prefix_flags): Define in terms of _asm
version.
* gdb.arch/i386-float.exp, gdb.arch/i386-permbkpt.exp,
gdb.dwarf2/dw2-canonicalize-type.exp,
gdb.dwarf2/dw2-compdir-oldgcc.exp, gdb.dwarf2/dw2-minsym-in-cu.exp,
gdb.dwarf2/dw2-op-stack-value.exp, gdb.dwarf2/dw2-unresolved.exp,
gdb.dwarf2/fission-reread.exp, gdb.dwarf2/pr13961.exp: Use flags
provided by gdb_target_symbol_prefix_flags_asm.
* gdb.dwarf2/dw2-canonicalize-type.S, gdb.dwarf2/dw2-compdir-oldgcc.S,
testsuite/gdb.dwarf2/dw2-minsym-in-cu.S,
testsuite/gdb.dwarf2/dw2-unresolved-main.c,
testsuite/gdb.dwarf2/dw2-unresolved.S, gdb.dwarf2/fission-reread.S,
gdb.dwarf2/pr13961.S: Define and use SYMBOL macro (and supporting
macros where needed).  Use this macro for symbols which require
the prefix provided by SYMBOL_PREFIX.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Nov 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDo not use libiberty's getpagesize on Android
Joel Brobecker [Fri, 6 Nov 2015 21:39:19 +0000 (13:39 -0800)]
Do not use libiberty's getpagesize on Android

Building libiberty on Android currently fails with the error message
shown below.  This was discovered by trying to build GDBserver
for Android, which stopped building after libiberty became
a GDBserver dependency.

Here is the error message:

[...]/getpagesize.c:64:1: error: redefinition of 'getpagesize'
In file included from /[...]/getpagesize.c:34:0:
/[...]/usr/include/unistd.h:171:23: note: previous definition of 'getpagesize' was here

And looking at the definition, one can see that it defined as
a static inline function...

   static __inline__ int getpagesize(void) {
     extern unsigned int __page_size;
     return __page_size;
   }

... which explains why the AC_CHECK_FUNCS test failed to detect
the function, since there is no associated symbol to be linked in.

This patch prevents getpagesize.c to be compiled in by hard-coding
the fact that getpagesize is available on android hosts.

libiberty/ChangeLog:

        * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
        Android hosts.
        * configure: Regenerate.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 Nov 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdb.dwarf2: Define and use gdb_target_symbol for symbol prefixes
Kevin Buettner [Wed, 28 Oct 2015 18:36:06 +0000 (11:36 -0700)]
gdb.dwarf2: Define and use gdb_target_symbol for symbol prefixes

Some of the tests in gdb.dwarf2 which use Dwarf::assemble refer to
(minimal/linker) symbols created in the course of building a small
test program.  Some targets use a prefix such as underscore ("_") on
these symbols.  Many of the tests in gdb.dwarf2 do not take this into
account.  As a consequence, these tests fail to build, resulting
either in failures or untested testcases.

Here is an example from gdb.dwarf2/dw2-regno-invalid.exp:

    Dwarf::assemble $asm_file {
        cu {} {
            compile_unit {
                {low_pc main DW_FORM_addr}
                {high_pc main+0x10000 DW_FORM_addr}
            } {
            ...
            }

For targets which require an underscore prefix on linker symbols,
the two occurrences of "main" would have to have a prepended underscore,
i.e. _main instead of main.

For the above case, a call to the new proc gdb_target_symbol is used
prepend the correct prefix to the symbol.  I.e. the above code is
rewritten (as shown in the patch) as follows:

    Dwarf::assemble $asm_file {
        cu {} {
            compile_unit {
                {low_pc [gdb_target_symbol main] DW_FORM_addr}
                {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
            } {
            ...
            }

I also found it necessary to make an adjustment to lib/dwarf.exp so that
expressions of more than just one list element can be used in DW_TAG_...
constructs.  Both atomic-type.exp and dw2-bad-mips-linkage-name.exp require
this new functionality.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_target_symbol_prefix, gdb_target_symbol):
New procs.
* lib/dwarf.exp (_handle_DW_TAG): Handle attribute values,
representing expressions, of more than one list element.
* gdb.dwarf2/atomic-type.exp (Dwarf::assemble): Use gdb_target_symbol
to prepend linker symbol prefix to f.
* gdb.dwarf2/data-loc.exp (Dwarf::assemble): Likewise, for
table_1 and table_2.
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp (Dwarf::assemble):
Likewise, for f and g.
* gdb.dwarf2/dw2-ifort-parameter.exp (Dwarf::assemble): Likewise,
for ptr.
* gdb.dwarf2/dw2-regno-invalid.exp (Dwarf::assemble): Likewise,
for main.
* gdb.dwarf2/dynarr-ptr.exp (Dwarf::assemble): Likewise, for
table_1_ptr and table_2_ptr.

9 years agoRevert patch for PR 19119, which led to PR 19172 and 19197.
Cary Coutant [Thu, 5 Nov 2015 20:59:02 +0000 (12:59 -0800)]
Revert patch for PR 19119, which led to PR 19172 and 19197.

Gold does not support all the emulations that Gnu ld does, and supports
only one spelling per target. The -m option is used only in the rare case
where there are no ELF input files, and we produce an empty output file.
In those cases, users are expected to supply a -m option naming one of
the supported emulations. In the many cases where a build script provides
an unnecessary -m option naming an emulation that gold does not support,
we will simply ignore the option, as we did before the reverted patch.

gold/
PR gold/19119
PR gold/19172
PR gold/19197
Revert commit 6457197210144f50a696097c0d308d81d46d5510:

2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>

* options.h (General_options): Remove "obsolete" from -m.
* parameters.cc (set_parameters_target): Check if input target
is compatible with output emulation set by "-m emulation".

9 years agoAdd aarch64-specific --no-apply-dynamic-relocs option.
Cary Coutant [Thu, 5 Nov 2015 20:24:14 +0000 (12:24 -0800)]
Add aarch64-specific --no-apply-dynamic-relocs option.

With --no-apply-dynamic-relocs on aarch64 targets, gold will not apply
link-time values for absolute relocations that become dynamic relocations.
This provides a workaround for broken Android dynamic linkers that use
the link-time value as an extra addend to the relocation.

gold/
PR gold/19163
* aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
certain relocations if --no-apply-dynamic-relocs is set.
* options.h (--apply-dynamic-relocs): New aarch64-specific option.

9 years agoUse aarch64_decode_insn in aarch64_displaced_step_copy_insn
Yao Qi [Thu, 5 Nov 2015 09:44:32 +0000 (09:44 +0000)]
Use aarch64_decode_insn in aarch64_displaced_step_copy_insn

gdb:

2015-11-05  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Call
aarch64_decode_insn and decode instruction by aarch64_inst.

9 years agoUse aarch64_decode_insn in aarch64_analyze_prologue
Yao Qi [Thu, 5 Nov 2015 09:44:32 +0000 (09:44 +0000)]
Use aarch64_decode_insn in aarch64_analyze_prologue

This patch convert aarch64_analyze_prologue to using aarch64_decode_insn
to decode instructions.  After this change, aarch64_analyze_prologue
looks much simple, and some aarch64_decode_* functions are removed
accordingly.

gdb:

2015-11-05  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (extract_signed_bitfield): Remove.
(decode_masked_match): Remove.
(aarch64_decode_add_sub_imm): Remove.
(aarch64_decode_br): Remove.
(aarch64_decode_eret): Remove.
(aarch64_decode_movz): Remove.
(aarch64_decode_orr_shifted_register_x): Remove.
(aarch64_decode_ret): Remove.
(aarch64_decode_stp_offset): Remove.
(aarch64_decode_stur): Remove.
(aarch64_analyze_prologue): Call aarch64_decode_insn
and use aarch64_inst to decode instructions.

9 years agoCombine aarch64_decode_stp_offset_wb and aarch64_decode_stp_offset
Yao Qi [Thu, 5 Nov 2015 09:44:32 +0000 (09:44 +0000)]
Combine aarch64_decode_stp_offset_wb and aarch64_decode_stp_offset

This patch combines both aarch64_decode_stp_offset_wb and
aarch64_decode_stp_offset together.

gdb:

2015-11-05  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (aarch64_decode_stp_offset): New argument
wback.
(aarch64_decode_stp_offset_wb): Removed.
(aarch64_analyze_prologue): Don't use
aarch64_decode_stp_offset_wb.

9 years agoRegenerate ld/Makefile.in
Alan Modra [Wed, 4 Nov 2015 14:14:50 +0000 (00:44 +1030)]
Regenerate ld/Makefile.in

* Makefile.in: Regenerate.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Nov 2015 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFortran: allocate()d memory is uninitialized
Jan Kratochvil [Wed, 4 Nov 2015 14:52:41 +0000 (15:52 +0100)]
Fortran: allocate()d memory is uninitialized

  allocate (vla1 (5))         ! vla1-not-allocated
  l = allocated(vla1)         ! vla1-allocated     <------------------

Expecting: ^(510-data-evaluate-expression vla1[^M
]+)?(510\^done,value="\(0, 0, 0, 0, 0\)"[^M
]+[(]gdb[)] ^M
[ ]*)
510-data-evaluate-expression vla1^M
510^done,value="(1.82987403e-09, 7.8472714e-44, 1.82987403e-09, 7.8472714e-44, 2.67929926e+20)"^M
(gdb) ^M
FAIL: gdb.mi/mi-vla-fortran.exp: evaluate allocated vla

gcc-4.9.2-6.fc21.x86_64

I think some older gfortran did initialize allocated memory but that is an
unspecified behavior.  I haven't found any initialization mentioned
in Fortran 90 standard (draft) and it is also clearly stated here:
        https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268786
        Initialization to 0 of allocated arrays (of integers) is an
        implementation issue. i.e. do not rely on it.

Joel Brobecker wrote:
I am wondering if it might be better to just relax instead the regexp to allow
any number rather than just remove the test altogether. The test allows us to
verify that, as soon as we're past the "allocate" call, we no longer say "not
allocated".

gdb/testsuite/ChangeLog
2015-11-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Joel Brobecker  <brobecker@adacore.com>

* gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Permit any data.

9 years agogdb/s390-linux: Step over MVCLE+JO (and similiar) as a unit.
Marcin Kościelnicki [Mon, 2 Nov 2015 16:17:22 +0000 (17:17 +0100)]
gdb/s390-linux: Step over MVCLE+JO (and similiar) as a unit.

This is needed to avoid O(n**2) complexity when recording MVCLE and other
partial execution instructions.

gdb/ChangeLog:

PR/18376
* gdb/s390-linux-tdep.c (s390_is_partial_instruction): New function.
(s390_software_single_step): New function.
(s390_displaced_step_hw_singlestep): New function.
(s390_gdbarch_init): Fill gdbarch slots with the above.

9 years agogdb: Add process record and replay support for s390.
Marcin Kościelnicki [Mon, 2 Nov 2015 16:16:07 +0000 (17:16 +0100)]
gdb: Add process record and replay support for s390.

gdb/ChangeLog:

PR/18376
* gdb/configure.tgt: Add linux-record.o to s390*-linux.
* gdb/s390-linux-tdep.c: #include "linux-record.h", "record-full.h"
(s390_linux_record_tdep): New static global variable.
(s390x_linux_record_tdep): New static global variable.
(s390_all_but_pc_registers_record): New function.
(s390_canonicalize_syscall): New function.
(s390_linux_syscall_record): New function.
(s390_linux_record_signal): New function.
(s390_record_calc_disp_common): New function.
(s390_record_calc_disp): New function.
(s390_record_calc_disp_vsce): New function.
(s390_record_calc_rl): New function.
(s390_record_gpr_g): New function.
(s390_record_gpr_h): New function.
(s390_record_vr): New function.
(s390_process_record): New function.
(s390_init_linux_record_tdep): New function.
(s390_gdbarch_init): Fill record function slots.

gdb/testsuite/ChangeLog:

* gdb.reverse/s390-mvcle.c: New test.
* gdb.reverse/s390-mvcle.exp: New file.
* lib/gdb.exp: Enable reverse tests on s390*-linux.

9 years agogdb/record-full: Use xmalloc instead of alloca for temporary memory storage.
Marcin Kościelnicki [Mon, 2 Nov 2015 01:12:58 +0000 (02:12 +0100)]
gdb/record-full: Use xmalloc instead of alloca for temporary memory storage.

On the newly added s390 target, it's possible for a single instruction
to write practically unbounded amount of memory (eg. MVCLE).  This caused
a stack overflow when alloca was used.

gdb/ChangeLog:

* record-full.c (record_full_exec_insn): Use xmalloc for temporary
memory storage.

9 years agoDATA_SEGMENT_ALIGN documentation is not consistent with behaviour
Alan Modra [Wed, 4 Nov 2015 14:03:55 +0000 (00:33 +1030)]
DATA_SEGMENT_ALIGN documentation is not consistent with behaviour

PR ld/19203
* ld.texinfo (DATA_SEGMENT_ALIGN): Correct second expression.

9 years agoFix non stopping breakpoint on newer compilers.
Walfred Tedeschi [Wed, 4 Nov 2015 10:09:03 +0000 (11:09 +0100)]
Fix non stopping breakpoint on newer compilers.

The breakpoint presented in the return statement was not activated while
compiling the test with gcc 4.9.2.  Added a dummy statement to allow the
breakpoint again.

2015-10-14  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite:

* i386-mpx-map.c (foo): Add dummy statement to trigger breakpoint.

Change-Id: I5293ca1c7f82a631e1e41cb650c30dd2d09ef3c2
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
9 years agoChanging compiler flags for MPX tests.
Walfred Tedeschi [Wed, 4 Nov 2015 10:09:02 +0000 (11:09 +0100)]
Changing compiler flags for MPX tests.

Adapts tests to use actual GCC flags, previous used flags were
related to an internal GCC release.

2015-06-18  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/testsuite:

* gdb.arch/i386-mpx-map.exp (comp_flags): Use released GCC flags.
* gdb.arch/i386-mpx.exp (comp_flags): Use released GCC flags.

Change-Id: Id4c4551693a8df071ed4b71bb5dfb46a526ed5db
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
9 years agoImprove error message for MPX bound table examinations.
Walfred Tedeschi [Wed, 4 Nov 2015 10:09:02 +0000 (11:09 +0100)]
Improve error message for MPX bound table examinations.

Error was introduced to fix a build issue caused by a mismatching variable
size.  The error message is changed to explicitly report what goes wrong
and how user might still investigate the issue.

2015-06-18  Walfred Tedeschi  <walfred.tedeschi@intel.com>

* i386-tdep.c (i386_mpx_get_bt_entry) Improves error message.

Change-Id: I6e9c7475eba663f49bd8e720b84ad0265bcb0e92
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
9 years agobtrace: add instruction-history /s and fix documentation
Markus Metzger [Fri, 11 Sep 2015 08:09:54 +0000 (10:09 +0200)]
btrace: add instruction-history /s and fix documentation

Add support for the /s modifier of the "record instruction-history" command.  It
behaves exactly like /m and prints disassembled instructions in the order in
which they were recorded with interleaved sources.  We accept /s in addition
to /m to align with the "disassemble" command.

The "record instruction-history" modifiers were not documented.  Document
all of them.

gdb/
* record.c (get_insn_history_modifiers): Set DISASSEMBLY_SOURCE
instead of DISASSEMBLY_SOURCE_DEPRECATED.  Also accept /s.
(_initialize_record): Document the /s modifier.
* NEWS: Announce record instruction-history's new /s modifier.

doc/
* gdb.texinfo (Process Record and Replay): Document "record
instruction-history" modifiers.

9 years agobtrace: change record instruction-history /m
Markus Metzger [Wed, 12 Aug 2015 08:38:35 +0000 (10:38 +0200)]
btrace: change record instruction-history /m

The /m modifier interleaves source lines with the disassembly of recorded
instructions.  This calls disasm.c's gdb_disassembly once for each recorded
instruction to be printed.

This doesn't really work because gdb_disassembly may choose not to print
anything in some situations.  And if it does print something, the output
interferes with btrace_insn_history's output around it.

It further results in a separate asm_insns list for each instruction in MI.
Even though there is no MI support for target record, yet, we fix this obvious
issue.

Change record instruction-history /m to use the new gdb_pretty_print_insn
function for printing a single instruction and interleave source lines as
appropriate.

We cannot reuse the new disasm.c do_mixed_source_and_assembly function without
significant changes to it.

gdb/
* record-btrace.c (struct btrace_line_range): New.
(btrace_mk_line_range, btrace_line_range_add)
(btrace_line_range_is_empty, btrace_line_range_contains_range)
(btrace_find_line_range, btrace_print_lines): New.
(btrace_insn_history): Add source interleaving algorithm.

9 years agodisasm: add struct disasm_insn to describe to-be-disassembled instruction
Markus Metzger [Fri, 11 Sep 2015 12:47:08 +0000 (14:47 +0200)]
disasm: add struct disasm_insn to describe to-be-disassembled instruction

The "record instruction-history" command prints for each instruction in
addition to the instruction's disassembly:

  - the instruction number in the recorded execution trace
  - a '?' before the instruction if it was executed speculatively

To allow the "record instruction-history" command to use GDB's disassembly
infrastructure, we extend gdb_pretty_print_insn to optionally print those
additional fields and export the function.

Add a new struct disasm_insn to add additional fields describing the
to-be-disassembled instruction.  The additional fields are:

  number            an optional instruction number, zero if omitted.
  is_speculative    a predicate saying whether the instruction was
                    executed speculatively.

If non-zero, the instruction number is printed first.  It will also appear
as a new optional field "insn-number" in MI.  The field will be present if
insn_num is non-zero.

If is_speculative is set, speculative execution will be indicated by a "?"
following the new instruction number field.  Unless the PC is omitted, it
will overwrite the first byte of the PC prefix.  It will appear as a new
optional field "is-speculative" in MI.  The field will contain "?" and will
be present if is_speculative is set.

The speculative execution indication is guarded by a new flag
DISASSEMBLY_SPECULATION.

Replace the PC parameter of gdb_pretty_print_insn with a pointer to the above
struct.  GDB's "disassemble" command does not use the new fields.

gdb/
* disasm.h (DISASSEMBLY_SPECULATION): New.
(struct disasm_insn): New.
(gdb_pretty_print_insn): New.
* disasm.c (gdb_pretty_print_insn): Replace parameter PC with INSN.
Update users.  Print instruction number and indicate speculative
execution, if requested.

9 years agodisasm: split dump_insns
Markus Metzger [Mon, 12 Oct 2015 11:43:42 +0000 (13:43 +0200)]
disasm: split dump_insns

Split disasm.c's dump_insn into two parts:

  - print a single instruction
  - loop over the specified address range

The first part will be refined in subsequent patches so it can be reused.

gdb/
* disasm.c (dump_insns):  Split into this and ...
(gdb_pretty_print_insn): ... this.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Nov 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoxtensa: Add missing statics
Simon Marchi [Tue, 3 Nov 2015 18:33:16 +0000 (13:33 -0500)]
xtensa: Add missing statics

This actually fixes the build in C:

/home/simark/src/binutils-gdb/gdb/xtensa-linux-nat.c:100:1: error: no previous prototype for ‘supply_gregset_reg’ [-Werror=missing-prototypes]
 supply_gregset_reg (struct regcache *regcache,
 ^
/home/simark/src/binutils-gdb/gdb/xtensa-linux-nat.c:257:1: error: no previous prototype for ‘xtensa_linux_fetch_inferior_registers’ [-Werror=missing-prototypes]
 xtensa_linux_fetch_inferior_registers (struct target_ops *ops,
 ^
/home/simark/src/binutils-gdb/gdb/xtensa-linux-nat.c:272:1: error: no previous prototype for ‘xtensa_linux_store_inferior_registers’ [-Werror=missing-prototypes]
 xtensa_linux_store_inferior_registers (struct target_ops *ops,
 ^
cc1: all warnings being treated as errors

These functions are local to this file, so they should be static.

gdb/ChangeLog:

* xtensa-linux-nat.c (supply_gregset_reg): Make static.
(xtensa_linux_fetch_inferior_registers): Likewise.
(xtensa_linux_store_inferior_registers): Likewise.

9 years agolinux-mips-low.c: Add casts
Simon Marchi [Tue, 3 Nov 2015 18:33:15 +0000 (13:33 -0500)]
linux-mips-low.c: Add casts

Fixes a bunch of:

/home/simark/src/binutils-gdb/gdb/gdbserver/linux-mips-low.c: In function ‘void mips_store_fpregset(regcache*, const void*)’:
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-mips-low.c:809:39: error: invalid conversion from ‘const void*’ to ‘const mips_register*’ [-fpermissive]
   const union mips_register *regset = buf;
                                       ^

gdb/gdbserver/ChangeLog:

* linux-mips-low.c (mips_fill_gregset): Add cast.
(mips_store_gregset): Likewise.
(mips_fill_fpregset): Likewise.
(mips_store_fpregset): Likewise.

9 years agolinux-mips-low.c: Change "private" variable name
Simon Marchi [Tue, 3 Nov 2015 18:33:15 +0000 (13:33 -0500)]
linux-mips-low.c: Change "private" variable name

Fixes:

/home/simark/src/binutils-gdb/gdb/gdbserver/linux-mips-low.c:359:48: error: expected ‘,’ or ‘...’ before ‘private’
 mips_add_watchpoint (struct arch_process_info *private, CORE_ADDR addr,
                                                ^

gdb/gdbserver/ChangeLog:

* linux-mips-low.c (mips_add_watchpoint): Rename private to
priv.

9 years agolinux-mips-low.c: Fix type of mips_add_watchpoint parameter
Simon Marchi [Tue, 3 Nov 2015 18:33:14 +0000 (13:33 -0500)]
linux-mips-low.c: Fix type of mips_add_watchpoint parameter

Fixes

/home/simark/src/binutils-gdb/gdb/gdbserver/linux-mips-low.c: In function ‘void mips_add_watchpoint(arch_process_info*, CORE_ADDR, int, int)’:
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-mips-low.c:368:19: error: invalid conversion from ‘int’ to ‘target_hw_bp_type’ [-fpermissive]
   new_watch->type = watch_type;
                   ^

gdb/gdbserver/ChangeLog:

* linux-mips-low.c (mips_linux_new_thread): Change type of
watch_type to enum target_hw_bp_type.

9 years agoarm-linux-nat.c: Add cast
Simon Marchi [Tue, 3 Nov 2015 18:33:14 +0000 (13:33 -0500)]
arm-linux-nat.c: Add cast

Fixes:

/home/simark/src/binutils-gdb/gdb/arm-linux-nat.c: In function ‘const target_desc* arm_linux_read_description(target_ops*)’:
/home/simark/src/binutils-gdb/gdb/../include/libiberty.h:711:38: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
 # define alloca(x) __builtin_alloca(x)
                                      ^
/home/simark/src/binutils-gdb/gdb/arm-linux-nat.c:578:13: note: in expansion of macro ‘alloca’
       buf = alloca (VFP_REGS_SIZE);
             ^

gdb/ChangeLog:

* arm-linux-nat.c (arm_linux_read_description): Add cast.

9 years agoChange return type of raw_bkpt_type_to_arm_hwbp_type
Simon Marchi [Tue, 3 Nov 2015 18:33:13 +0000 (13:33 -0500)]
Change return type of raw_bkpt_type_to_arm_hwbp_type

Fixes:

/home/simark/src/binutils-gdb/gdb/gdbserver/linux-arm-low.c: In function ‘int arm_linux_hw_point_initialize(raw_bkpt_type, CORE_ADDR, int, arm_linux_hw_breakpoint*)’:
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-arm-low.c:459:55: error: invalid conversion from ‘int’ to ‘arm_hwbp_type’ [-fpermissive]
   hwbp_type = raw_bkpt_type_to_arm_hwbp_type (raw_type);
                                                       ^

gdb/gdbserver/ChangeLog:

* linux-arm-low.c (raw_bkpt_type_to_arm_hwbp_type):
Change return type to arm_hwbp_type.

9 years agogdbserver arm: Add casts
Simon Marchi [Tue, 3 Nov 2015 18:33:13 +0000 (13:33 -0500)]
gdbserver arm: Add casts

Trivial casts for C++.

Fixes things like

In file included from /home/simark/src/binutils-gdb/gdb/gdbserver/../common/common-defs.h:39:0,
                 from /home/simark/src/binutils-gdb/gdb/gdbserver/server.h:22,
                 from /home/simark/src/binutils-gdb/gdb/gdbserver/linux-arm-low.c:19:
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-arm-low.c: In function ‘int arm_get_hwcap(long unsigned int*)’:
/home/simark/src/binutils-gdb/gdb/gdbserver/../../include/libiberty.h:711:38: error: invalid conversion from ‘void*’ to ‘unsigned char*’ [-fpermissive]
 # define alloca(x) __builtin_alloca(x)
                                      ^
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-arm-low.c:807:25: note: in expansion of macro ‘alloca’
   unsigned char *data = alloca (8);
                         ^

gdb/gdbserver/ChangeLog:

* linux-aarch32-low.c (arm_fill_gregset): Add cast.
(arm_store_gregset): Likewise.
* linux-arm-low.c (arm_get_hwcap): Likewise.
(arm_read_description): Likewise.

9 years agolinux-aarch32-low.c: Use NULL_REGSET
Simon Marchi [Tue, 3 Nov 2015 18:33:12 +0000 (13:33 -0500)]
linux-aarch32-low.c: Use NULL_REGSET

Fixes

/home/simark/src/binutils-gdb/gdb/gdbserver/linux-aarch32-low.c:124:1: error: invalid conversion from ‘int’ to ‘regset_type’ [-fpermissive]
 };
 ^

gdb/gdbserver/ChangeLog:

* linux-aarch32-low.c (aarch32_regsets): Use NULL_REGSET.

9 years agotarget_ops mask_watchpoint: change int to target_hw_bp_type
Simon Marchi [Tue, 3 Nov 2015 18:33:12 +0000 (13:33 -0500)]
target_ops mask_watchpoint: change int to target_hw_bp_type

Fixes:

/home/simark/src/binutils-gdb/gdb/ppc-linux-nat.c: In function ‘int ppc_linux_insert_mask_watchpoint(target_ops*, CORE_ADDR, CORE_ADDR, int)’:
/home/simark/src/binutils-gdb/gdb/ppc-linux-nat.c:1730:40: error: invalid conversion from ‘int’ to ‘target_hw_bp_type’ [-fpermissive]
   p.trigger_type = get_trigger_type (rw);
                                        ^

gdb/ChangeLog:

* ppc-linux-nat.c (ppc_linux_insert_mask_watchpoint): Change
type of rw to enum target_hw_bp_type.
(ppc_linux_remove_mask_watchpoint): Likewise.
* target.c (target_insert_mask_watchpoint): Likewise.
(target_remove_mask_watchpoint): Likewise.
* target.h (target_insert_mask_watchpoint): Likewise.
(target_remove_mask_watchpoint): Likewise.
(struct target_ops) <to_insert_mask_watchpoint>: Likewise.
(struct target_ops) <to_remove_mask_watchpoint>: Likewise.
* target-delegates.c: Regenerate.

9 years agoremote-sim.c: Add casts
Simon Marchi [Tue, 3 Nov 2015 18:33:11 +0000 (13:33 -0500)]
remote-sim.c: Add casts

Mostly some casts from "generic arg" void* to the actual type.

There are two (enum gdb_signal) casts.  I tried to see if it would have
been better to change the type of sigrc, but it has a double role, as an
enum and as an integer, so I left it as is.

gdb/ChangeLog:

* remote-sim.c (check_for_duplicate_sim_descriptor): Add casts.
(get_sim_inferior_data): Likewise.
(sim_inferior_data_cleanup): Likewise.
(gdbsim_close_inferior): Likewise.
(gdbsim_resume_inferior): Likewise.
(gdbsim_wait): Likewise.
(simulator_command): Likewise.
(sim_command_completer): Likewise.

9 years agolinux-ppc-low.c: Add casts
Simon Marchi [Tue, 3 Nov 2015 18:33:11 +0000 (13:33 -0500)]
linux-ppc-low.c: Add casts

Trivial casts for C++.

gdb/gdbserver/ChangeLog:

* linux-ppc-low.c (ppc_get_hwcap): Add cast.
(ppc_fill_vsxregset): Likewise.
(ppc_store_vsxregset): Likewise.
(ppc_fill_vrregset): Likewise.
(ppc_store_vrregset): Likewise.
(ppc_fill_evrregset): Likewise.
(ppc_store_evrregset): Likewise.

9 years agolinux-ppc-low.c: Remove forward declaration, move ppc_arch_setup lower
Simon Marchi [Tue, 3 Nov 2015 18:33:10 +0000 (13:33 -0500)]
linux-ppc-low.c: Remove forward declaration, move ppc_arch_setup lower

g++ doesn't like that we forward-declare a variable that is initialized
later in the file.  It's easy enough to re-order things to fix it.

Fixes

/home/simark/src/binutils-gdb/gdb/gdbserver/linux-ppc-low.c:663:28: error: redefinition of ‘usrregs_info ppc_usrregs_info’
 static struct usrregs_info ppc_usrregs_info =
                            ^
/home/simark/src/binutils-gdb/gdb/gdbserver/linux-ppc-low.c:381:28: note: ‘usrregs_info ppc_usrregs_info’ previously declared here
 static struct usrregs_info ppc_usrregs_info;
                            ^

gdb/gdbserver/ChangeLog:

* linux-ppc-low.c (ppc_usrregs_info): Remove
forward-declaration.
(ppc_arch_setup): Move lower in file.

9 years agoreadelf verdef and verneed
Alan Modra [Tue, 3 Nov 2015 09:03:27 +0000 (19:33 +1030)]
readelf verdef and verneed

readelf ought to notify when a symbol wrongly has both a version
definition and a needed version.  This patch does that, and removes
the heuristic that only defined symbols in SHT_NOBITS sections have
verneed entries.

* readelf (process_version_sections): Check DT_VERNEED and
DT_VERDEF for all symbols.  Report "*both*" should a symbol
have both a verneed and verdef.
(get_symbol_version_string): Reduce indentation by early
exits.  Don't use SHT_NOBITS heuristic to detect case where a
defined symbol has a verneed entry.

9 years ago[GOLD] Regenerate POTFILES.in to add s390.cc
Alan Modra [Tue, 3 Nov 2015 06:16:39 +0000 (16:46 +1030)]
[GOLD] Regenerate POTFILES.in to add s390.cc

* po/POTFILES.in: Regenerate.

9 years ago[LD][AARCH64]Add test cases for big-endian.
Renlin Li [Tue, 3 Nov 2015 12:00:10 +0000 (12:00 +0000)]
[LD][AARCH64]Add test cases for big-endian.

ld/testsuite

2015-11-03  Renlin Li  <renlin.li@arm.com>

* ld-aarch64/aarch64-elf.exp: Run newly added test cases.
* ld-aarch64/emit-relocs-301.d: Skip aarch64_be.
* ld-aarch64/emit-relocs-302.d: Likwise.
* ld-aarch64/emit-relocs-310.d: Likwise.
* ld-aarch64/emit-relocs-515.d: Likwise.
* ld-aarch64/emit-relocs-516.d: Likwise.
* ld-aarch64/tls-large-desc.d: Likwise.
* ld-aarch64/tls-large-ie.d: Likwise.
* ld-aarch64/tls-relax-large-desc-ie.d: Likwise.
* ld-aarch64/tls-relax-large-desc-le.d: Likwise.
* ld-aarch64/tls-relax-large-gd-ie.d: Likwise.
* ld-aarch64/tls-relax-large-gd-le.d: Likwise.
* ld-aarch64/emit-relocs-301-be.d: New for aarch64_be.
* ld-aarch64/emit-relocs-302-be.d: Likewise.
* ld-aarch64/emit-relocs-310-be.d: Likewise.
* ld-aarch64/emit-relocs-515-be.d: Likewise.
* ld-aarch64/emit-relocs-516-be.d: Likewise.
* ld-aarch64/tls-large-desc-be.d: Likewise.
* ld-aarch64/tls-large-ie-be.d: Likewise.
* ld-aarch64/tls-relax-large-desc-ie-be.d: Likewise.
* ld-aarch64/tls-relax-large-desc-le-be.d: Likewise.
* ld-aarch64/tls-relax-large-gd-ie-be.d: Likewise.
* ld-aarch64/tls-relax-large-gd-le-be.d: Likewise.

9 years agoObvious typo fix in gdb.reverse/readv-reverse.exp
Marcin Kościelnicki [Mon, 2 Nov 2015 19:29:12 +0000 (20:29 +0100)]
Obvious typo fix in gdb.reverse/readv-reverse.exp

gdb/testsuite/ChangeLog:

* gdb.reverse/readv-reverse.exp: Obvious typo fixed.

9 years agogdb/reverse: Fix continue_to_breakpoint in syscall testcases.
Marcin Kościelnicki [Mon, 2 Nov 2015 19:27:19 +0000 (20:27 +0100)]
gdb/reverse: Fix continue_to_breakpoint in syscall testcases.

continue_to_breakpoint always continues to the next breakpoint, not to the
one named in parameter.  This rendered the tests effectively useless, since
marker2 was never reached.

gdb/testsuite/ChangeLog:

* gdb.reverse/fstatat-reverse.exp: Set breakpoint on marker1 after
reaching marker2.
* gdb.reverse/getresuid-reverse.exp: Likewise.
* gdb.reverse/pipe-reverse.exp: Likewise.
* gdb.reverse/readv-reverse.exp: Likewise.
* gdb.reverse/recvmsg-reverse.exp: Likewise.
* gdb.reverse/time-reverse.exp: Likewise.
* gdb.reverse/waitpid-reverse.exp: Likewise and add KFAILs.

9 years agoAdd myself to gdb MAINTAINERS
Marcin Kościelnicki [Tue, 3 Nov 2015 10:28:19 +0000 (11:28 +0100)]
Add myself to gdb MAINTAINERS

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add Marcin Kościelnicki.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Nov 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDisassemble RX NOP instructions as such.
Nick Clifton [Mon, 2 Nov 2015 14:37:33 +0000 (14:37 +0000)]
Disassemble RX NOP instructions as such.

opcode * rx.h (enum RX_Opcode_ID): Add more NOP opcodes.

opcodes * rx-decode.opc (rx_decode_opcode): Decode extra NOP
instructions.
* rx-decode.c: Regenerate.

tests * gas/rx/max.d: Update expecetd disassembly.
* gas/rx/nod.d: Likewise.
* gas/rx/nop.sm: Add tests of more NOP instructions.

9 years agoFix disassembly of RX zero-offset register indirect instructions.
Nick Clifton [Mon, 2 Nov 2015 14:14:22 +0000 (14:14 +0000)]
Fix disassembly of RX zero-offset register indirect instructions.

opcode * rx.h (enum RX_Operand_Type): Add RX_Operand_Zero_Indirect.

opcodes * rx-decode.opc (rx_disp): If the displacement is zero, set the
type to RX_Operand_Zero_Indirect.
* rx-decode.c: Regenerate.
* rx-dis (print_insn): Handle RX_Operand_Zero_Indirect.

gas * config/rx-parse.y: Allow zero value for 5-bit displacements.

tests * gas/rx/mov.sm: Add tests for zero offset indirect moves.
* gas/rx/mov.d: Update expected output.

9 years agoFix the RX assembler's section alignment parameter to use multiples of N rather than...
Nick Clifton [Mon, 2 Nov 2015 13:46:13 +0000 (13:46 +0000)]
Fix the RX assembler's section alignment parameter to use multiples of N rather than powers of N

* config/tc-rx.c (parse_rx_section): Align parameter provides a
multiple of n argument, not a power of n argument.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Nov 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 Nov 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 31 Oct 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDon't displaced step when there's a breakpoint in the scratch pad range
Pedro Alves [Fri, 30 Oct 2015 16:00:43 +0000 (16:00 +0000)]
Don't displaced step when there's a breakpoint in the scratch pad range

Assuming displaced stepping is enabled, and a breakpoint is set in the
memory region of the scratch pad, things break.  One of two cases can
happen:

#1 - The breakpoint wasn't inserted yet (all threads were stopped), so
     after setting up the displaced stepping scratch pad with the
     adjusted copy of the instruction we're trying to single-step, we
     insert the breakpoint, which corrupts the scratch pad, and the
     inferior executes the wrong instruction.  (Example below.)
     This is clearly unacceptable.

#2 - The breakpoint was already inserted, so setting up the displaced
     stepping scratch pad overwrites the breakpoint.  This is OK in
     the sense that we already assume that no thread is going to
     executes the code in the scratch pad range (after initial
     startup) anyway.

This commit addresses both cases by simply punting on displaced
stepping if we have a breakpoint in the scratch pad range.

The #1 case above explains a few regressions exposed by the AS/NS
series on x86:

 Running ./gdb.dwarf2/callframecfa.exp ...
 FAIL: gdb.dwarf2/callframecfa.exp: set display for call-frame-cfa
 FAIL: gdb.dwarf2/callframecfa.exp: step 1 for call-frame-cfa
 FAIL: gdb.dwarf2/callframecfa.exp: step 2 for call-frame-cfa
 FAIL: gdb.dwarf2/callframecfa.exp: step 3 for call-frame-cfa
 FAIL: gdb.dwarf2/callframecfa.exp: step 4 for call-frame-cfa
 Running ./gdb.dwarf2/typeddwarf.exp ...
 FAIL: gdb.dwarf2/typeddwarf.exp: continue to breakpoint: continue to typeddwarf.c:53
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of x at typeddwarf.c:53
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of y at typeddwarf.c:53
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of z at typeddwarf.c:53
 FAIL: gdb.dwarf2/typeddwarf.exp: continue to breakpoint: continue to typeddwarf.c:73
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of w at typeddwarf.c:73
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of x at typeddwarf.c:73
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of y at typeddwarf.c:73
 FAIL: gdb.dwarf2/typeddwarf.exp: check value of z at typeddwarf.c:73

Enabling "maint set target-non-stop on" implies displaced stepping
enabled as well, and it's the latter that's to blame here.  We can see
the same failures with "maint set target-non-stop off + set displaced
on".

Diffing (good/bad) gdb.log for callframecfa.exp shows:

 @@ -99,29 +99,29 @@ Breakpoint 2 at 0x80481b0: file q.c, lin
  continue
  Continuing.

 -Breakpoint 2, func (arg=77) at q.c:2
 +Breakpoint 2, func (arg=52301) at q.c:2
  2      in q.c
  (gdb) PASS: gdb.dwarf2/callframecfa.exp: continue to breakpoint: continue to breakpoint for call-frame-cfa
  display arg
 -1: arg = 77
 -(gdb) PASS: gdb.dwarf2/callframecfa.exp: set display for call-frame-cfa
 +1: arg = 52301
 +(gdb) FAIL: gdb.dwarf2/callframecfa.exp: set display for call-frame-cfa

The problem is here, when setting up the func call:

 Breakpoint 1, main (argc=-13345, argv=0x0) at q.c:7
 7       in q.c

 (gdb) disassemble
 Dump of assembler code for function main:
    0x080481bb <+0>:     push   %ebp
    0x080481bc <+1>:     mov    %esp,%ebp
    0x080481be <+3>:     sub    $0x4,%esp
 => 0x080481c1 <+6>:     movl   $0x4d,(%esp)
    0x080481c8 <+13>:    call   0x80481b0 <func>
    0x080481cd <+18>:    leave
    0x080481ce <+19>:    ret
 End of assembler dump.
 (gdb) disassemble /r
 Dump of assembler code for function main:
    0x080481bb <+0>:     55      push   %ebp
    0x080481bc <+1>:     89 e5   mov    %esp,%ebp
    0x080481be <+3>:     83 ec 04        sub    $0x4,%esp
 => 0x080481c1 <+6>:     c7 04 24 4d 00 00 00    movl   $0x4d,(%esp)
    0x080481c8 <+13>:    e8 e3 ff ff ff  call   0x80481b0 <func>
    0x080481cd <+18>:    c9      leave
    0x080481ce <+19>:    c3      ret
 End of assembler dump.

Note the breakpoint at main is set at 0x080481c1.  Right at the
instruction that sets up func's argument.  Executing that instruction
should write 0x4d to the address pointed at by $esp.  However, if we
stepi, the program manages to write 52301/0xcc4d there instead (0xcc
is int3, the x86 breakpoint instruction), because the breakpoint
address is 4 bytes inside the scratch pad location, which is
0x080481bd:

 (gdb) p 0x080481c1 - 0x080481bd
 $1 = 4

IOW, instead of executing:

  "c7 04 24 4d 00 00 00" [ movl $0x4d,(%esp) ]

the inferior executes:

  "c7 04 24 4d cc 00 00" [ movl $0xcc4d,(%esp) ]

gdb/ChangeLog:
2015-10-30  Pedro Alves  <palves@redhat.com>

* breakpoint.c (breakpoint_in_range_p)
(breakpoint_location_address_range_overlap): New functions.
* breakpoint.h (breakpoint_in_range_p): New declaration.
* infrun.c (displaced_step_prepare_throw): If there's a breakpoint
in the scratch pad range, don't displaced step.

9 years agoSimplify gdb.threads/wp-replication.exp on counting HW watchpoints
Yao Qi [Fri, 30 Oct 2015 15:51:33 +0000 (15:51 +0000)]
Simplify gdb.threads/wp-replication.exp on counting HW watchpoints

Nowadays, test gdb.threads/wp-replication.exp uses a while loop to
repeatedly insert HW watchpoint, resume and check no error message
coming out, in order to count HW watchpoints  There are some
drawbacks in this way,

 - the loop could be endless.  I think this is use to making trouble
   to S/390, since we had such comment

      # Some targets (like S/390) behave as though supporting
      # unlimited hardware watchpoints.  In this case we just take a
      # safe exit out of the loop.

   I hit this today too because a GDB internal error is triggered
   on "continue" in the loop, and $done is 0 invariantly, so the loop
   can't end.
 - the code counting hardware watchpoint is too complicated.  We can
   use "set breakpoint always-inserted on" to get the result of inserting
   HW watchpoint without resuming the inferior.  In this way,
   watch_count_done and empty_cycle in c file is no longer needed.

In this patch, I change to use "set breakpoint always-inserted on" trick,
and only iterate $NR_THREADS times, to count the HW watchpoint.  In this
way, the loop can't be endless, and GDB doesn't need to resume the inferior.

gdb/testsuite:

2015-10-30  Yao Qi  <yao.qi@linaro.org>

* gdb.threads/wp-replication.c (watch_count_done): Remove.
(empty_cycle): Remove.
(main): Don't call empty_cycle.  Don't use watch_count_done.
* gdb.threads/wp-replication.exp: Don't set breakpoint on
empty_cycle.  Rewrite the code counting HW watchpoints.

9 years agogdb/linux-record: Fix struct sizes for x32
Marcin Kościelnicki [Fri, 30 Oct 2015 15:52:02 +0000 (15:52 +0000)]
gdb/linux-record: Fix struct sizes for x32

While x32 syscall interface is mostly shared with x86_64, some syscalls
are truly 32-bit.  Correct sizes accordingly.

gdb/ChangeLog:

* amd64-linux-tdep.c (amd64_x32_linux_init_abi): Fix size_msghdr,
size_stack_t, size_size_t, size_iovec.

9 years agogdb/linux-record: Fix size_termios for x32, amd64, aarch64
Marcin Kościelnicki [Fri, 30 Oct 2015 15:52:02 +0000 (15:52 +0000)]
gdb/linux-record: Fix size_termios for x32, amd64, aarch64

60 bytes is the size of glibc's struct termios, the one used by kernel is
36 bytes long.

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Fix size_termios.
* amd64-linux-tdep.c (amd64_linux_init_abi): Fix size_termios.
(amd64_x32_linux_init_abi): Fix size_termios.

9 years agogdb/linux-record: TASK_COMM_LEN is 16 on ppc too
Marcin Kościelnicki [Fri, 30 Oct 2015 15:52:01 +0000 (15:52 +0000)]
gdb/linux-record: TASK_COMM_LEN is 16 on ppc too

gdb/ChangeLog:

* ppc-linux-tdep.c (ppc_init_linux_record_tdep): Fix TASK_COMM_LEN.

9 years agogdb/linux-record: Fix old_select syscall handling
Marcin Kościelnicki [Fri, 30 Oct 2015 15:52:01 +0000 (15:52 +0000)]
gdb/linux-record: Fix old_select syscall handling

We have to use extract_unsigned_integer to read paramaters structure - target
pointers can have different endianness and size.

gdb/ChangeLog:

* linux-record.c (record_linux_system_call): Fix old_select.

9 years agogdb/linux-record: Fix newfstatat handling
Marcin Kościelnicki [Fri, 30 Oct 2015 15:52:00 +0000 (15:52 +0000)]
gdb/linux-record: Fix newfstatat handling

The struct stat pointer is in the third argument, not the second.

gdb/ChangeLog:

* linux-record.c (record_linux_system_call): Fix newstatat.

9 years agogdb/linux-record: Fix [gs]etgroups16 syscall
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:59 +0000 (15:51 +0000)]
gdb/linux-record: Fix [gs]etgroups16 syscall

Memory size for getgroups16 needs to be multiplied by entry count, and only
needs recording if the pointer is non-NULL.  setgroups16, on the other hand,
doesn't write to user memory and doesn't need special handling at all.

gdb/ChangeLog:

* linux-record.c (record_linux_system_call): Fix [gs]etgroups16.

9 years agogdb/linux-record: Support time, waitpid, pipe syscalls
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:59 +0000 (15:51 +0000)]
gdb/linux-record: Support time, waitpid, pipe syscalls

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Add size_time_t.
* amd64-linux-tdep.c (amd64_linux_init_abi): Add size_time_t.
(amd64_x32_linux_init_abi): Add size_time_t.
* arm-linux-tdep.c (arm_linux_init_abi): Add size_time_t.
* i386-linux-tdep.c (i386_linux_init_abi): Add size_time_t.
* linux-record.c (record_linux_system_call): Add time, waitpid, pipe
handling.
* linux-record.h (struct linux_record_tdep): Add size_time_t.
* ppc-linux-tdep.c (ppc_init_linux_record_tdep): Add size_time_t.

9 years agogdb/linux-record: Fix msghdr parsing on 64-bit targets
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:58 +0000 (15:51 +0000)]
gdb/linux-record: Fix msghdr parsing on 64-bit targets

The code failed to account for padding between the int and subsequent
pointer present on 64-bit architectures.

gdb/ChangeLog:

* linux-record.c (record_linux_msghdr): Fix msg_namelen handling.

9 years agogdb/linux-record: Fix readdir and getdents handling
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:58 +0000 (15:51 +0000)]
gdb/linux-record: Fix readdir and getdents handling

getdents buffer size is given in bytes, not dirent entries (which have
variable size anyway).  We don't need size_dirent and size_dirent64 for
this reason.

readdir, on the other hand, needs size of old_linux_dirent, which is
a somewhat different structure.  Accordingly, rename size_dirent
to size_old_dirent.

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Remove
size_dirent{,64}, add size_old_dirent.
* amd64-linux-tdep.c (amd64_linux_init_abi): Remove size_dirent{,64},
add size_old_dirent.
(amd64_x32_linux_init_abi): Remove size_dirent{,64}, add
size_old_dirent.
* arm-linux-tdep.c (arm_linux_init_abi): Remove size_dirent{,64},
add size_old_dirent.
* i386-linux-tdep.c (i386_linux_init_abi): Remove size_dirent{,64},
add size_old_dirent.
* linux-record.c (record_linux_system_call): Fix handling of readdir
and getdents{,64}.
* linux-record.h (struct linux_record_tdep): Remove size_dirent{,64},
add size_old_dirent.
* ppc-linux-tdep.c (ppc_init_linux_record_tdep): Remove
size_dirent{,64}, add size_old_dirent.

9 years agogdb/linux-record: Fix sizes of sigaction and sigset_t
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:57 +0000 (15:51 +0000)]
gdb/linux-record: Fix sizes of sigaction and sigset_t

The values were mistakenly set to size of glibc's sigset_t (128 bytes)
and sigaction (140 or 152 bytes) instead of the kernel ones.  The kernel
has 4 or 8 byte old_sigset_t, 8 byte sigset_t, 16 or 32 byte old_sigaction,
20 or 32 byte sigaction.

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Fix size_sigaction,
size_sigset_t, size_old_sigaction, size_old_sigset_t.
* amd64-linux-tdep.c (amd64_linux_init_abi): Fix size_sigaction,
size_sigset_t, size_old_sigaction, size_old_sigset_t.
(amd64_x32_linux_init_abi): Fix size_sigaction, size_sigset_t,
size_old_sigaction, size_old_sigset_t.
* arm-linux-tdep.c (arm_linux_init_abi): Fix size_sigaction,
size_old_sigaction, size_old_sigset_t.
* i386-linux-tdep.c (i386_linux_init_abi): Fix size_sigaction,
size_old_sigaction, size_old_sigset_t.
* ppc-linux-tdep.c (ppc_init_linux_record_tdep): Fix size_sigaction,
size_sigset_t, size_old_sigaction, size_old_sigset_t.

9 years agogdb/linux-record: Fix size_[ug]id values
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:56 +0000 (15:51 +0000)]
gdb/linux-record: Fix size_[ug]id values

i386 and arm wrongly set them to 2, when it should be 4.  size_[ug]id is used
by getgroups32 etc syscalls, while size_old_[ug]id is used for getgroups16
and friends.

gdb/ChangeLog:

* arm-linux-tdep.c (arm_linux_init_abi): Fix size_[ug]id.
* i386-linux-tdep.c (i386_linux_init_abi): Fix size_[ug]id.

9 years agogdb/linux-record: Remove size_siginfo
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:56 +0000 (15:51 +0000)]
gdb/linux-record: Remove size_siginfo

It's a duplicate of size_siginfo_t.

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Remove size_siginfo.
* amd64-linux-tdep.c (amd64_linux_init_abi): Remove size_siginfo.
(amd64_x32_linux_init_abi): Remove size_siginfo.
* arm-linux-tdep.c (arm_linux_init_abi): Remove size_siginfo.
* i386-linux-tdep.c (i386_linux_init_abi): Remove size_siginfo.
* linux-record.c (record_linux_system_call): Change size_siginfo
to size_siginfo_t.
* linux-record.h (struct linux_record_tdep): Remove size_siginfo.
* ppc-linux-tdep.c (ppc_init_linux_record_tdep): Remove size_siginfo.

9 years agogdb/record: Add testcases for a few syscalls.
Marcin Kościelnicki [Fri, 30 Oct 2015 15:51:55 +0000 (15:51 +0000)]
gdb/record: Add testcases for a few syscalls.

gdb/testsuite/ChangeLog:

* gdb.reverse/fstatat-reverse.c: New test.
* gdb.reverse/fstatat-reverse.exp: New file.
* gdb.reverse/getresuid-reverse.c: New test.
* gdb.reverse/getresuid-reverse.exp: New file.
* gdb.reverse/pipe-reverse.c: New test.
* gdb.reverse/pipe-reverse.exp: New file.
* gdb.reverse/readv-reverse.c: New test.
* gdb.reverse/readv-reverse.exp: New file.
* gdb.reverse/recvmsg-reverse.c: New test.
* gdb.reverse/recvmsg-reverse.exp: New file.
* gdb.reverse/time-reverse.c: New test.
* gdb.reverse/time-reverse.exp: New file.
* gdb.reverse/waitpid-reverse.c: New test.
* gdb.reverse/waitpid-reverse.exp: New file.

9 years agogdbserver/proc-service.c: Change CORE_ADDR cast to uintptr_t
Simon Marchi [Fri, 30 Oct 2015 15:50:00 +0000 (11:50 -0400)]
gdbserver/proc-service.c: Change CORE_ADDR cast to uintptr_t

Fixes on i386:

../../../binutils-gdb/gdb/gdbserver/proc-service.c: In function ps_pdread:
../../../binutils-gdb/gdb/gdbserver/proc-service.c:83:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
../../../binutils-gdb/gdb/gdbserver/proc-service.c: In function ps_pdwrite:
../../../binutils-gdb/gdb/gdbserver/proc-service.c:93:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

I could have kept both casts:

  (CORE_ADDR) (uintptr_t) addr

but it's cleaner this way.  The uintptr_t implicitely gets promoted to a
CORE_ADDR, which is at least as long as uintptr_t.

gdb/gdbserver/ChangeLog:

* proc-service.c (ps_pdread): Change CORE_ADDR cast to uintptr_t.
(ps_pdwrite): Likewise.

9 years agoUpdated (simplified) Chinese translations for ld, bfd, binutils and gold.
Nick Clifton [Fri, 30 Oct 2015 12:50:27 +0000 (12:50 +0000)]
Updated (simplified) Chinese translations for ld, bfd, binutils and gold.

* po/zh_CN.po: Updated (simplified) Chinese translation.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Oct 2015 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdbserver: Move pointer dereference to after assert checks.
Henrik Wallin [Wed, 14 Oct 2015 11:14:26 +0000 (13:14 +0200)]
gdbserver: Move pointer dereference to after assert checks.

gdb/gdbserver/ChangeLog:

* linux-arm-low.c (arm_new_thread): Move pointer dereference
to after assert checks.

Signed-off-by: Henrik Wallin <henrik.wallin@windriver.com>
9 years agoAdd/adjust casts in gdbserver's proc-service
Simon Marchi [Thu, 29 Oct 2015 18:15:08 +0000 (14:15 -0400)]
Add/adjust casts in gdbserver's proc-service

The casts are required because ps_pd{read,write} must respect a fixed
interface.

gdb/gdbserver/ChangeLog:

* proc-service.c (ps_pdread): Add/adjust casts.
(ps_pdwrite): Add/adjust casts.

9 years agomdebugread.c: Address class -> address class index
Pedro Alves [Thu, 29 Oct 2015 16:18:30 +0000 (16:18 +0000)]
mdebugread.c: Address class -> address class index

This fixes this error in C++ mode:

 /home/pedro/gdb/mygit/cxx-convertion/src/gdb/mdebugread.c:654:11: error: invalid conversion from ‘int’ to ‘address_class’ [-fpermissive]
   theclass = mdebug_register_index;
    ^

The "theclass" local is of type enum address_class, however, what it
really holds is an address class index.  Class index values by design
match the address class values up until LOC_FINAL_VALUE, but extend
beyond that, so it's not really right to store an address class index
in an enum address_class.

The fix is really the same making the 'theclass' local be of type int,
but while we're at it, we get rid of the goto, and thus the local
becomes the 'aclass_index' parameter in the new add_data_symbol
function.

gdb/ChangeLog:
2015-10-29  Pedro Alves  <palves@redhat.com>

* mdebugread.c (add_data_symbol): New function, factored out from
...
(parse_symbol): ... here.  Delete 'theclass' local.

9 years agoAdd a cast in jit_target_read_impl
Simon Marchi [Thu, 29 Oct 2015 17:41:14 +0000 (13:41 -0400)]
Add a cast in jit_target_read_impl

We could change the signature of the function.  However, it would
require changing gdb_target_read in jit-reader.h, which is an exported
interface.  It's probably better to just add a cast in our code than to
break other people's code.

gdb/ChangeLog:

* jit.c (jit_target_read_impl): Add cast.

9 years agoCast gdb_dlsym return value
Simon Marchi [Thu, 29 Oct 2015 17:41:14 +0000 (13:41 -0400)]
Cast gdb_dlsym return value

gdb/ChangeLog:

* jit.c (jit_reader_load): Add cast.

9 years agogdbserver/server.c: Cast return value of memmem
Simon Marchi [Thu, 29 Oct 2015 17:41:13 +0000 (13:41 -0400)]
gdbserver/server.c: Cast return value of memmem

gdb/gdbserver/ChangeLog:

* server.c (handle_search_memory_1): Cast return value of
memmem.

9 years agoChange type of write_qxfer_response parameter
Simon Marchi [Thu, 29 Oct 2015 17:41:13 +0000 (13:41 -0400)]
Change type of write_qxfer_response parameter

Fixes:

/home/simark/src/binutils-gdb/gdb/gdbserver/server.c: In function ‘int write_qxfer_response(char*, const void*, int, int)’:
/home/simark/src/binutils-gdb/gdb/gdbserver/server.c:398:32: error: invalid conversion from ‘const void*’ to ‘const gdb_byte* {aka const unsigned char*}’ [-fpermissive]
           &out_len, PBUFSIZ - 2) + 1;
                                ^
gdb/gdbserver/ChangeLog:

* server.c (write_qxfer_response): Change type of data to
gdb_byte *.

9 years agodwarf2read.c: Add cast
Simon Marchi [Thu, 29 Oct 2015 17:41:12 +0000 (13:41 -0400)]
dwarf2read.c: Add cast

There is no enum value representing 0.  It seems like the value of the
name field is irrelevant here.

gdb/ChangeLog:

* dwarf2read.c (partial_die_full_name): Add cast.

9 years agoAdd cast to VEC_iterate
Pedro Alves [Thu, 29 Oct 2015 15:25:08 +0000 (15:25 +0000)]
Add cast to VEC_iterate

Fixes this in C++:

 ../../src/gdb/break-catch-sig.c: In function ‘int VEC_gdb_signal_type_iterate(const VEC_gdb_signal_type*, unsigned int, gdb_signal_type*)’:
 ../../src/gdb/common/vec.h:576:12: error: invalid conversion from ‘int’ to ‘gdb_signal_type {aka gdb_signal}’ [-fpermissive]
*ptr = 0;          \
     ^
 ../../src/gdb/common/vec.h:417:1: note: in expansion of macro ‘DEF_VEC_FUNC_P’
  DEF_VEC_FUNC_P(T)         \
  ^
 ../../src/gdb/break-catch-sig.c:37:1: note: in expansion of macro ‘DEF_VEC_I’
  DEF_VEC_I (gdb_signal_type);
  ^

I actually carried a different fix in the C++ branch that removed this
assignment and then adjusted all callers that depended on it.  The
thinking was that this is for the case where we're returning false,
indicating end of iteration.  But that results in a much larger and
tricker patch; looking back it seems quite pointless.  I looked at the
history of GCC's C++ conversion and saw that they added this same cast
to their version of vec.h, FWIW.  (GCC's vec.h is completely different
nowadays, having been converted to templates meanwhile.)

gdb/ChangeLog:
2015-10-29  Pedro Alves  <palves@redhat.com>

* common/vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T.

9 years agoguile/: Add enum cast
Pedro Alves [Thu, 29 Oct 2015 15:25:00 +0000 (15:25 +0000)]
guile/: Add enum cast

gdb/ChangeLog:
2015-10-29  Pedro Alves  <palves@redhat.com>

* guile/scm-frame.c (gdbscm_unwind_stop_reason_string): Add cast.