external/binutils.git
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.

9 years agoDisable paging when run by Emacs 25.1 and later.
Eli Zaretskii [Thu, 29 Oct 2015 17:25:28 +0000 (19:25 +0200)]
Disable paging when run by Emacs 25.1 and later.

gdb/ChangeLog:

* utils.c (init_page_info): Disable paging if INSIDE_EMACS is set
in the environment.

9 years agognu-v2-abi.c: Add casts
Pedro Alves [Thu, 29 Oct 2015 17:23:34 +0000 (17:23 +0000)]
gnu-v2-abi.c: Add casts

I looked at changing these is_destructor_name/is_constructor_name
interfaces in order to detangle the boolean result from the ctor/dtor
kind return, but then realized that this design goes all the way down
to the libiberty demangler interfaces.  E.g, include/demangle.h:

 ~~~
 /* Return non-zero iff NAME is the mangled form of a constructor name
    in the G++ V3 ABI demangling style.  Specifically, return an `enum
    gnu_v3_ctor_kinds' value indicating what kind of constructor
    it is.  */
 extern enum gnu_v3_ctor_kinds
 is_gnu_v3_mangled_ctor (const char *name);

 enum gnu_v3_dtor_kinds {
   gnu_v3_deleting_dtor = 1,
   gnu_v3_complete_object_dtor,
   gnu_v3_base_object_dtor,
   /* These are not part of the V3 ABI.  Unified destructors are generated
      as a speed-for-space optimization when the -fdeclone-ctor-dtor option
      is used, and are always internal symbols.  */
   gnu_v3_unified_dtor,
   gnu_v3_object_dtor_group
 };
 ~~~

libiberty/cp-demangle.c:

 ~~~
 enum gnu_v3_ctor_kinds
 is_gnu_v3_mangled_ctor (const char *name)
 {
   enum gnu_v3_ctor_kinds ctor_kind;
   enum gnu_v3_dtor_kinds dtor_kind;

   if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind))
     return (enum gnu_v3_ctor_kinds) 0;
   return ctor_kind;
 }
 ~~~

etc.

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

* gnu-v2-abi.c (gnuv2_is_destructor_name)
(gnuv2_is_constructor_name): Add casts.

9 years agoMake GOT entry size target-dependent
H.J. Lu [Thu, 29 Oct 2015 15:47:12 +0000 (08:47 -0700)]
Make GOT entry size target-dependent

The GOT entry size is target-dependent.  This patch adds a got_entry_size
function to Sized_target class so that a target can provide a value
different from default.

PR gold/19184
* incremental.cc (Got_plt_view_info): Add got_entry_size.
(Local_got_offset_visitor::visit): Replace got_entry_size_
with info_.got_entry_size.
(Local_got_offset_visitor::got_entry_size_): Removed.
(Global_got_offset_visitor::visit): Replace got_entry_size_
with info_.got_entry_size.
(Global_got_offset_visitor::got_entry_size_): Removed.
(Output_section_incremental_inputs::write_got_plt): Initialize
view_info.got_entry_size.
* target.h (Sized_target::got_entry_size): New virtual function.
* x86_64.cc (Target_x86_64::got_entry_size): New function.

9 years agoAlso check GOTPCRELX
H.J. Lu [Thu, 29 Oct 2015 16:18:57 +0000 (09:18 -0700)]
Also check GOTPCRELX

* ld-x86-64/plt-main3.rd: Also check GOTPCRELX.

9 years ago2015-10-29 Catherine Moore <clm@codesourcery.com>
Catherine Moore [Thu, 29 Oct 2015 13:58:16 +0000 (06:58 -0700)]
2015-10-29  Catherine Moore  <clm@codesourcery.com>

     bfd/
     * elfxx-mips.c (mips_elf_check_mips16_stubs): Set a stub's output
     section to bfd_abs_section_ptr if the stub is discarded.

     ld/testsuite/
     * ld-mips-elf/mips16-fp-stub-1.s: New.
     * ld-mips-elf/mips16-fp-stub-2.s: New.
     * ld-mips-elf/mips16-fp-stub.d: New.
     * ld-mips-elf/mips-elf.exp: Run new tests.
     * ld-mips-elf/mips16-intermix.d: Update expected output.

https://sourceware.org/ml/binutils/2015-10/msg00137.html

9 years agoAdd support for AArch64 CloudABI binaries.
Ed Schouten [Thu, 29 Oct 2015 13:49:03 +0000 (13:49 +0000)]
Add support for AArch64 CloudABI binaries.

ld * Makefile.am (ALL_64_EMULATION_SOURCES): Add support for
CloudABI on aarch64. For this target we have to make sure we use
ELFOSABI_CLOUDABI instead of ELFOSABI_NONE.
* configure.tgt (targ_emul): Likewise.
* emulparams/aarch64cloudabi.sh: New file.
* emulparams/aarch64cloudabib.sh: New file.
* Makefile.in: Regenerate.

bfd * config.bfd (targ_defvec): Add support for CloudABI on aarch64.
For this target we have to make sure we use ELFOSABI_CLOUDABI
instead of ELFOSABI_NONE.
* configure.ac (tb): Likewise.
* elfnn-aarch64.c: Likewise.
* targets.c (_bfd_target_vector): Likewise.
* configure: Regenerate.

gas * config/tc-aarch64.c (elf64_aarch64_target_format): Select the
cloudabi format if the TARGET_OS is cloudabi.

9 years agobfd/libhppa.h: Make C++ compatible
Pedro Alves [Thu, 29 Oct 2015 12:55:03 +0000 (12:55 +0000)]
bfd/libhppa.h: Make C++ compatible

Fixes this when GDB is built in C++ mode:

 In file included from /home/pedro/gdb/mygit/src/gdb/../bfd/som.h:27:0,
  from /home/pedro/gdb/mygit/src/gdb/somread.c:31:
 /home/pedro/gdb/mygit/src/gdb/../bfd/libhppa.h: In function ‘int bfd_hppa_insn2fmt(bfd*, int)’:
 /home/pedro/gdb/mygit/src/gdb/../bfd/libhppa.h:380:42: error: invalid conversion from ‘int’ to ‘hppa_opcode_type’ [-fpermissive]
  #define get_opcode(insn) (((insn) >> 26) & 0x3f)
   ^
 /home/pedro/gdb/mygit/src/gdb/../bfd/libhppa.h:465:30: note: in expansion of macro ‘get_opcode’
    enum hppa_opcode_type op = get_opcode (insn);
       ^

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

* libhppa.h (bfd_hppa_insn2fmt): Add cast.

9 years agogdbserver/mem-break.c: Add cast
Pedro Alves [Thu, 29 Oct 2015 12:55:02 +0000 (12:55 +0000)]
gdbserver/mem-break.c: Add cast

... for C++.

Fixes:

 gdb/gdbserver/mem-break.c:204:28: error: invalid conversion from 'int' to 'bkpt_type' [-fpermissive]

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

* mem-break.c (Z_packet_to_bkpt_type): Add cast.

9 years agogdbserver/tracepoint: Add casts out of tpoint->handle
Pedro Alves [Thu, 29 Oct 2015 12:55:02 +0000 (12:55 +0000)]
gdbserver/tracepoint: Add casts out of tpoint->handle

... as needed for C++.

tpoint->handle is a generic 'void *' handle.

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

* tracepoint.c (clear_installed_tracepoints): Add casts.

9 years agogdbserver: enum gdb_signal casts
Pedro Alves [Thu, 29 Oct 2015 12:55:02 +0000 (12:55 +0000)]
gdbserver: enum gdb_signal casts

This is code parsing RSP signal numbers, checking whether the numbers
are indeed valid/known GDB signals, and then converting to host signal
numbers.  I considered adding temporary enum gdb_signal variables
instead, but didn't really like the result.

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

* server.c (handle_v_cont, process_serial_event): Add enum
gdb_signal casts to signal parsing code.

9 years agogdbserver: btrace enums
Pedro Alves [Thu, 29 Oct 2015 12:55:02 +0000 (12:55 +0000)]
gdbserver: btrace enums

Fixes:

 ../../../src/gdb/gdbserver/linux-low.c: In function ‘int linux_low_read_btrace(btrace_target_info*, buffer*, int)’:
 ../../../src/gdb/gdbserver/linux-low.c:6827:48: error: invalid conversion from ‘int’ to ‘btrace_read_type’ [-fpermissive]
    err = linux_read_btrace (&btrace, tinfo, type);
 ^
 In file included from ../../../src/gdb/gdbserver/linux-low.c:98:0:
 ../../../src/gdb/gdbserver/../nat/linux-btrace.h:116:26: error:   initializing argument 3 of ‘btrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)’ [-fpermissive]
  extern enum btrace_error linux_read_btrace (struct btrace_data *btrace,
   ^

The cyclic dependency the comment talks about is no longer relevant:
  https://sourceware.org/ml/gdb-patches/2015-10/msg00643.html

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

* linux-low.c (linux_low_read_btrace): Change type of 'type'
parameter.
* server.c (handle_qxfer_btrace): Change type of 'type'
local.
* target.h (struct target_ops) <read_btrace>: Change type of
'type' parameter.  Update comment.

9 years agogdbserver/Linux: Introduce NULL_REGSET
Pedro Alves [Thu, 29 Oct 2015 12:55:02 +0000 (12:55 +0000)]
gdbserver/Linux: Introduce NULL_REGSET

Fixes errors like:

 src/gdb/gdbserver/linux-x86-low.c:477:1: error: invalid conversion from 'int' to 'regset_type' [-fpermissive]

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

* linux-low.h (NULL_REGSET): Define.
* linux-aarch64-low.c (aarch64_regsets): Use NULL_REGSET.
* linux-arm-low.c (arm_regsets): Likewise.
* linux-crisv32-low.c (cris_regsets): Likewise.
* linux-m68k-low.c (m68k_regsets): Likewise.
* linux-mips-low.c (mips_regsets): Likewise.
* linux-nios2-low.c (nios2_regsets): Likewise.
* linux-ppc-low.c (ppc_regsets): Likewise.
* linux-s390-low.c (s390_regsets): Likewise.
* linux-sh-low.c (sh_regsets): Likewise.
* linux-sparc-low.c (sparc_regsets): Likewise.
* linux-tic6x-low.c (tic6x_regsets): Likewise.
* linux-tile-low.c (tile_regsets): Likewise.
* linux-x86-low.c (x86_regsets): Likewise.
* linux-xtensa-low.c (xtensa_regsets): Likewise.

9 years agoAdd cast to exception_none
Pedro Alves [Thu, 29 Oct 2015 12:55:01 +0000 (12:55 +0000)]
Add cast to exception_none

Fixes, in C++ mode:

 ../../src/gdb/common/common-exceptions.c:23:69: error: invalid conversion from ‘int’ to ‘return_reason’ [-fpermissive]
  const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
      ^

(I considered adding an enum value for '0', but the code and comments
around return_reason and its uses explain how 0 is special/internal,
so I'm leaving it be.)

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

* common/common-exceptions.c (exception_none): Add cast.

9 years agocompile: Rename struct type_map_instance::gcc_type field
Pedro Alves [Thu, 29 Oct 2015 12:55:01 +0000 (12:55 +0000)]
compile: Rename struct type_map_instance::gcc_type field

Fixes:

  src/gdb/compile/compile-c-types.c:36:12: error: declaration of ‘gcc_type type_map_instance::gcc_type’ [-fpermissive]
     gcc_type gcc_type;
      ^
  In file included from src/gdb/../include/gcc-c-interface.h:23:0,
   from src/gdb/compile/compile-internal.h:21,
   from src/gdb/compile/compile-c-types.c:23:
  src/gdb/../include/gcc-interface.h:32:28: error: changes meaning of ‘gcc_type’ from ‘typedef long long unsigned int gcc_type’ [-fpermissive]
   typedef unsigned long long gcc_type;
      ^
  src/gdb/compile/compile-c-types.c: In function ‘gcc_type convert_qualified(compile_c_instance*, type*)’:
  src/gdb/compile/compile-c-types.c:310:19: error: invalid conversion from ‘int’ to ‘gcc_qualifiers’ [-fpermissive]
quals);
     ^

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

* compile/compile-c-types.c (struct type_map_instance)
<gcc_type>: Rename to gcc_type_handle.
(insert_type, convert_type): Adjust.

9 years agoDon't assume break/continue inside a TRY block works
Pedro Alves [Thu, 29 Oct 2015 12:55:01 +0000 (12:55 +0000)]
Don't assume break/continue inside a TRY block works

In C++, this:

try
  {
    break;
  }
catch (..)
  {}

is invalid.  However, because our TRY/CATCH macros support it in C,
the C++ version of those macros support it too.  To catch such
assumptions, this adds a (disabled) hack that maps TRY/CATCH to raw
C++ try/catch.  Then it goes through all instances that building on
x86_64 GNU/Linux trips on, fixing them.

This isn't strictly necessary yet, but I think it's nicer to try to
keep the tree in a state where it's easier to eliminate the TRY/CATCH
macros.

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

* dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Don't
assume that "break" breaks out of a TRY/CATCH.
* python/py-framefilter.c (py_print_single_arg): Don't assume
"continue" breaks out of a TRY/CATCH.
* python/py-value.c (valpy_binop_throw): New function, factored
out from ...
(valpy_binop): ... this.
(valpy_richcompare_throw): New function, factored
out from ...
(valpy_richcompare): ... this.
* solib.c (solib_read_symbols): Don't assume "break" breaks out
of a TRY/CATCH.
* common/common-exceptions.h [USE_RAW_CXX_TRY]
<TRY/CATCH/END_CATCH>: Define as 1-1 wrappers around try/catch.

9 years agoFix reporting of command line options that need an argument, but which occur as the...
Nick Clifton [Thu, 29 Oct 2015 10:45:10 +0000 (10:45 +0000)]
Fix reporting of command line options that need an argument, but which occur as the last option on the command line.

PR ld/19146
* lexsup.c (parse_args): Correct error message for an option that
is missing its argument if that option is the last one on the
command line.

9 years agoRe: Orphan output section with multiple input sections
Alan Modra [Thu, 29 Oct 2015 05:46:22 +0000 (16:16 +1030)]
Re: Orphan output section with multiple input sections

The last patch missed handling the case where the ideal place to put
an orphan was after a non-existent output section statement, as can
happen when not using the builtin linker scripts.  This patch uses the
updated flags for that case too, and extends the support to mmo and pe.

PR ld/19162
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Pass
updated flags to lang_output_section_find_by_flags.
* emultempl/mmo.em (mmo_place_orphan): Merge flags for any
other input sections that might match a new output section to
decide placement.
* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
* ldlang.c (lang_output_section_find_by_flags): Add sec_flags param.
* ldlang.h (lang_output_section_find_by_flags): Update prototype.

9 years agofix typo in ld's texinfo
Matthias Klose [Thu, 29 Oct 2015 05:33:33 +0000 (16:03 +1030)]
fix typo in ld's texinfo

* ld.texinfo (Options <-rpath>): Fix typo.

9 years agoFix CPS availability.
Thomas Preud'homme [Thu, 15 Oct 2015 02:37:55 +0000 (10:37 +0800)]
Fix CPS availability.

2015-10-29  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
    * config/tc-arm.c (insns): Guard cps by arm_ext_v6_notm instead of
    arm_ext_v6_dsp.

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

9 years agoAdd __attribute__((__aligned__(1))) to unaligned symbols from scripts (for s390).
Marcin Kościelnicki [Mon, 5 Oct 2015 14:57:16 +0000 (16:57 +0200)]
Add __attribute__((__aligned__(1))) to unaligned symbols from scripts (for s390).

gold/
* testsuite/binary_test.cc: Add __attribute__((aligned(1))).
* testsuite/script_test_12a.c: Likewise.
* testsuite/script_test_1a.cc: Likewise.
* testsuite/script_test_2.cc: Likewise.

9 years agoMake debug_msg.sh more open-minded about line numbers (needed for s390).
Marcin Kościelnicki [Mon, 5 Oct 2015 14:57:15 +0000 (16:57 +0200)]
Make debug_msg.sh more open-minded about line numbers (needed for s390).

gold/
* testsuite/debug_msg.sh: Accept more fuzz in line numbers.

9 years agoFix empty string alignment in .rodata.str*
Marcin Kościelnicki [Mon, 5 Oct 2015 14:57:14 +0000 (16:57 +0200)]
Fix empty string alignment in .rodata.str*

gold/
PR gold/18959
* stringpool.cc (Stringpool_template::new_key_offset): Align all
strings, even zero-length.
(Stringpool_template::set_string_offsets):

9 years agoAdd s390 backend.
Marcin Kościelnicki [Mon, 5 Oct 2015 14:57:13 +0000 (16:57 +0200)]
Add s390 backend.

elfcpp/
* s390.h: New file.

gold/
* s390.cc: New file.
* Makefile.am (TARGETSOURCES): Add s390.cc.
(ALL_TARGETOBJS): Add s390.o.
* Makefile.in: Regenerate.
* configure.ac: Add s390 support.
* configure: Regenerate.
* configure.tgt: Add s390-*-* and s390x-*-*.
* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
support.

9 years agoAdd 64-bit archive support.
Marcin Kościelnicki [Mon, 5 Oct 2015 14:57:12 +0000 (16:57 +0200)]
Add 64-bit archive support.

gold/
* archive.cc (Archive::sym64name): New const.
(Archive::setup): Add support for SYM64 armap.
(Archive::read_armap): Likewise.
(Archive::interpret_header): Likewise.
(Archive::const_iterator::read_next_header): Likewise.
* archive.h (Archive::sym64name): New const.
(Archive::read_armap): Add mapsize template parameter.

9 years agoSupport 64-bit entry size in SHT_HASH (for s390).
Marcin Kościelnicki [Mon, 5 Oct 2015 14:57:11 +0000 (16:57 +0200)]
Support 64-bit entry size in SHT_HASH (for s390).

gold/
* dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
target-specific entry size.
(Dynobj::sized_create_elf_hash_table): Add size template parameter.
* dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
* layout.cc (Layout::create_dynamic_symtab): Set entsize to
hash_entry_size.
* target.h (Target::hash_entry_size): New method.
(Target::Target_info::hash_entry_size): New data member.

* aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
* arm.cc (Target_arm::arm_info): Likewise.
(Target_arm_nacl::arm_nacl_info): Likewise.
* i386.cc (Target_i386::i386_info): Likewise.
(Target_i386_nacl::i386_nacl_info): Likewise.
(Target_iamcu::iamcu_info): Likewise.
* mips.cc (Target_mips::mips_info): Likewise.
(Target_mips_nacl::mips_nacl_info): Likewise.
* powerpc.cc (Target_powerpc::powerpc_info): Likewise.
* sparc.cc (Target_sparc::sparc_info): Likewise.
* tilegx.cc (Target_tilegx::tilegx_info): Likewise.
* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
(Target_x86_64_nacl::x86_64_nacl_info): Likewise.
* testsuite/testfile.cc (Target_test::test_target_info): Likewise.

9 years agoMove encoded as 'or' in binutils.
Simon Dardis [Wed, 28 Oct 2015 16:52:17 +0000 (09:52 -0700)]
Move encoded as 'or' in binutils.

A patch (http://sourceware.org/ml/binutils/2015-07/msg00376.html)
submitted to binutils will be encoding move as an 'or' instruction over
[d]addu in assembly and various code stubs. This patch for gdb addresses
that change for the mips specific parts of gdb.

gdb/ChangeLog:

* mips-linux-tdep.c (mips_linux_in_dynsym_stub): Recognise 'or'
as move along with [d]addu.

9 years agoCheck R_386_GOT32/R_386_GOT32X without base register
H.J. Lu [Wed, 28 Oct 2015 16:15:17 +0000 (09:15 -0700)]
Check R_386_GOT32/R_386_GOT32X without base register

The R_386_GOT32 and R_386_GOT32X relocations may be used without base
register:

movl bar@GOT, %eax

Its calculation is G + A, instead of G + A - GOT, and it can only used
to generate non-PIC executable.  Include the .got.plt section address
for R_386_GOT32 and R_386_GOT32X relocations without base register.
Don't allow R_386_GOT32 and R_386_GOT32X relocations without base
register when making a PIC output.

PR gold/19177
* i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
and R_386_GOT32X relocations without base register.

9 years agoFix a typo in comment in elf32-i386.c
H.J. Lu [Wed, 28 Oct 2015 16:03:59 +0000 (09:03 -0700)]
Fix a typo in comment in elf32-i386.c

* elf32-i386.c (elf_i386_relocate_section): Fix a typo in
comment.

9 years agoAdd tests for 16-bit versions of ARM teq, tst, cmp and cmn instructions.
Nick Clifton [Wed, 28 Oct 2015 15:30:05 +0000 (15:30 +0000)]
Add tests for 16-bit versions of ARM teq, tst, cmp and cmn instructions.

        * gas/arm/pinsn.s: New.
        * gas/arm/pinsn.d: Likewise.

9 years agoPass noaliases_p to aarch64_decode_insn
Yao Qi [Mon, 5 Oct 2015 10:15:58 +0000 (11:15 +0100)]
Pass noaliases_p to aarch64_decode_insn

Nowadays aarch64_decode_insn is a public interface used by both
opcodes and gdb.  However, its behaviour relies on a global variable
no_aliases, which isn't a good practise.  On the other hand, In default,
no_aliases is zero, but in GDB, we do want no alias when decoding
instructions for prologue analysis (patches to be posted), so that we
can handle both instructions "add" and "mov" (an alias of "add") as
"add".  The code in GDB can be simplified.

This patch adds a new argument in aarch64_decode_insn, and pass no_aliases
to it.  In GDB side, always pass 1 to it.

include/opcode:

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

* aarch64.h (aarch64_decode_insn): Update declaration.

opcodes:

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

* aarch64-dis.c (aarch64_decode_insn): Add one argument
noaliases_p.  Update comments.  Pass noaliases_p rather than
no_aliases to aarch64_opcode_decode.
(print_insn_aarch64_word): Pass no_aliases to
aarch64_decode_insn.

gdb:

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

* aarch64-tdep.c (aarch64_software_single_step): Pass 1 to
aarch64_decode_insn.

9 years agoFix recent STM324LXX patch to compile on 32-bit hosts.
Nick Clifton [Wed, 28 Oct 2015 13:52:11 +0000 (13:52 +0000)]
Fix recent STM324LXX patch to compile on 32-bit hosts.

* elf32-arm.c (create_instruction_branch_absolute): Replace
pointer parameters with a simple integer parameter.
(stm32l4xx_create_replacing_stub_ldmia): Update calls to
create_instruction_branch_absolute.
(stm32l4xx_create_replacing_stub_ldmdb): Likewise.
(stm32l4xx_create_replacing_stub_vldm): Likewise.
(elf32_arm_write_section): Use pointer type for veneer addresses.

9 years agoFix errors in the gas testsuite for the ARC target.
Cupertino Miranda [Wed, 28 Oct 2015 13:48:00 +0000 (13:48 +0000)]
Fix errors in the gas testsuite for the ARC target.

bfd * reloc.c (BFD_RELOC_ARC_32_PCREL): New entry.
(ARC_TLS_DTPOFF): Arrange it in order.
* elf32-arc.c (arc_elf_howto_ini): Update formula.
(get_middle_endian_relocation): New function.
(PDATA): Define.
* bfd-in2.h: Regenerate.
* libbfd.h: Likewise.

elf * arc-reloc.def (ARC_32_PCREL): New definition.

gas * config/tc-arc.c (tokenize_arguments): Avoid creating unused
symbols when parsing relocation types.
(md_apply_fix): Handle TLS relocations. Fix BFD_RELOC_ARC_32_PCREL
relocation.
(arc_check_reloc): Emit BFD_RELOC_ARC_32_PCREL relocation.

9 years agoAdd a test for PR ld/19162
H.J. Lu [Wed, 28 Oct 2015 10:20:55 +0000 (03:20 -0700)]
Add a test for PR ld/19162

PR ld/19162
* ld-x86-64/x86-64.exp: Run pr19162.
* ld-x86-64/pr19162.d: New file.
* ld-x86-64/pr19162a.s: Likewise.
* ld-x86-64/pr19162b.s: Likewise.

9 years agoOrphan output section with multiple input sections
Alan Modra [Wed, 28 Oct 2015 06:48:13 +0000 (17:18 +1030)]
Orphan output section with multiple input sections

If given input sections with differing flags, we'd like to place the
section according to the final output section flags.

bfd/
PR ld/19162
* elflink.c (_bfd_elf_gc_mark_reloc): Move code iterating over
linker input bfds..
* section.c (bfd_get_next_section_by_name): ..to here.  Add ibfd param.
(bfd_get_linker_section): Adjust bfd_get_next_section_by_name call.
* tekhex.c (first_phase): Likewise.
* elflink.c (bfd_elf_gc_sections): Likewise.
* bfd-in2.h: Regenerate.
ld/
PR ld/19162
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check flags
before calling _bfd_elf_match_sections_by_type.  Merge flags for
any other input sections that might match a new output section to
decide placement.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Oct 2015 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoPatch for PR gold/19042 - unsupported reloc 311/312.
Han Shen [Tue, 27 Oct 2015 22:17:54 +0000 (15:17 -0700)]
Patch for PR gold/19042 - unsupported reloc 311/312.

gold/

* aarch64.cc (Target_aarch64::Scan::local): Add support for
reloc 311/312.

9 years agoMake host_address_to_string/gdb_print_host_address cast parameter to 'void *'
Pedro Alves [Tue, 27 Oct 2015 17:25:09 +0000 (17:25 +0000)]
Make host_address_to_string/gdb_print_host_address cast parameter to 'void *'

Fixes a set of errors like:

 ../../src/gdb/symfile-debug.c: In function ‘int debug_qf_map_symtabs_matching_filename(objfile*, const char*, const char*, int (*)(symtab*, void*), void*)’:
 ../../src/gdb/symfile-debug.c:137:39: error: invalid conversion from ‘int (*)(symtab*, void*)’ to ‘const void*’ [-fpermissive]
host_address_to_string (callback),
^

Note this has to work with data and function pointers.  In C++11 we
may perhaps do something a bit safer, but we're not there yet, and I
don't think it really matters.  For now just always do a simple
C-style cast in host_address_to_string itself.  No point in adding a
void * cast to each and every caller.

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

* common/print-utils.c (host_address_to_string): Rename to ...
(host_address_to_string_1): ... this.
* common/print-utils.h (host_address_to_string): Reimplement as
wrapper around host_address_to_string_1.
* utils.c (gdb_print_host_address): Rename to ...
(gdb_print_host_address_1): ... this.
* utils.h (gdb_print_host_address): Reimplement as wrapper macro
around host_address_to_string_1.

9 years agotarget_read_memory&co: no longer return target_xfer_status
Pedro Alves [Tue, 27 Oct 2015 17:25:09 +0000 (17:25 +0000)]
target_read_memory&co: no longer return target_xfer_status

Years ago, these functions used to return errno/EIO.  Later, through a
series of changes that intended to remove native/remote differences,
they ended up returning a target_xfer_status in disguise.

Unlike target_xfer_partial&co, the point of target_read_memory&co is
to either fully succeed or fail.  On error, they always return
TARGET_XFER_E_IO.  So there's no real point in casting the return of
target_read_memory to a target_xfer_status to pass it to memory_error.
Instead, it results in clearer code to simply decouple
target_read_memory&co's return from target_xfer_status.

This fixes build errors like this in C++ mode:

 ../../src/gdb/corefile.c: In function ‘void read_stack(CORE_ADDR, gdb_byte*, ssize_t)’:
 ../../src/gdb/corefile.c:276:34: error: invalid conversion from ‘int’ to ‘target_xfer_status’ [-fpermissive]
      memory_error (status, memaddr);
   ^
 ../../src/gdb/corefile.c:216:1: error:   initializing argument 1 of ‘void memory_error(target_xfer_status, CORE_ADDR)’ [-fpermissive]

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

* alpha-tdep.c (alpha_read_insn): Always pass TARGET_XFER_E_IO to
memory_error.  Rename local 'status' to 'res'.
* c-lang.c (c_get_string): Always pass TARGET_XFER_E_IO to
memory_error.
* corefile.c (read_stack, read_code, write_memory): Always pass
TARGET_XFER_E_IO to memory_error.
* disasm.c (dis_asm_memory_error): Always pass TARGET_XFER_E_IO to
memory_error.  Rename parameter 'status' to 'err'.
(dump_insns): Rename local 'status' to 'err'.
* mips-tdep.c (mips_fetch_instruction): Rename parameter 'statusp'
to 'errp'.  Rename local 'status' to 'err'.  Always pass
TARGET_XFER_E_IO to memory_error.
(mips_breakpoint_from_pc): Rename local 'status' to 'err'.
* target.c (target_read_memory, target_read_raw_memory)
(target_read_stack, target_read_code, target_write_memory)
(target_write_raw_memory): Return -1 on error instead of
TARGET_XFER_E_IO.
* valprint.c (val_print_string): Rename local 'errcode' to 'err'.
Always pass TARGET_XFER_E_IO to memory_error.  Update comment.

9 years agoguile: Change return value of gdbscm_with_guile for const char *
Simon Marchi [Tue, 27 Oct 2015 17:11:45 +0000 (13:11 -0400)]
guile: Change return value of gdbscm_with_guile for const char *

The documentation of gdbscm_with_guile says that it returns a statically
allocated string (IOW, a const char *).  We can reflect that in its
return value type, and get rid of C++ build errors.

Initially fixes:

/home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c: In function ‘void* gdbscm_disasm_read_memory_worker(void*)’:
/home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c:93:12: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
     return "seek error";

gdb/ChangeLog:

* guile/guile-internal.h (gdbscm_with_guile): Change return
types to const char *.
* guile/scm-safe-call.c (gdbscm_with_guile): Likewise.
(struct c_data) <func>: Likewise.
(struct c_data) <result>: Change type to const char *.
(scscm_eval_scheme_string): Change return type to
const char *.
(scscm_source_scheme_script): Likewise.
(gdbscm_safe_eval_string): Change type of result variable to
const char * and remove cast.
(gdbscm_safe_source_script): Likewise.
* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker):
Change return type to const char *.
(gdbscm_disasm_read_memory): Change type of status to
const char *.

9 years agosource.c:openp: save/restore errno
Pedro Alves [Tue, 27 Oct 2015 16:03:24 +0000 (16:03 +0000)]
source.c:openp: save/restore errno

openp's return is documented as:

~~~
   If a file is found, return the descriptor.
   Otherwise, return -1, with errno set for the last name we tried to open.  */
~~~

By inspection, I noticed that there are function calls after the ones
that first set errno, and those may clobber errno.  It's safer to save
errno when see an open fail, and restore it on exit.

Tested on x86_64 Fedora 20.

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

* source.c (openp): New local 'last_errno'.  Use it to
save/restore errno.

9 years agoFix RL78 disassembly of DE+offset addressing to always show the offset, even when...
Vinay Kumar [Tue, 27 Oct 2015 15:24:40 +0000 (15:24 +0000)]
Fix RL78 disassembly of DE+offset addressing to always show the offset, even when zero.

PR binutils/19159
opcodes * rl78-decode.opc (MOV): Added offset to DE register in index
addressing mode.
* rl78-decode.c: Regenerate.

test * gas/rl78/pr19159.s: New test source file.
* gas/rl78/pr19159.d: New test case.
* gas/rl78/rl78.exp: Run the new test.

9 years agopsymtab.c: Add casts
Pedro Alves [Tue, 27 Oct 2015 14:57:18 +0000 (14:57 +0000)]
psymtab.c: Add casts

... as needed for C++.

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

* psymtab.c (dump_psymtab_addrmap_1): Add casts.

9 years agoctf.c: Fix int/enum implicit cast
Simon Marchi [Tue, 27 Oct 2015 14:53:24 +0000 (10:53 -0400)]
ctf.c: Fix int/enum implicit cast

This patch was taken directly from Pedro's branch.

Right now, SET_INT32_FIELD is used to set enum fields.  This works in C,
but not C++.  Therefore, define the new SET_ENUM_FIELD, which casts the
value to the right enum type.

gdb/ChangeLog:

* ctf.c (SET_ENUM_FIELD): New macro.
(ctf_read_status): Use it.
(ctf_read_tp): Use it.

9 years agoDisplay system registers by their names when disassembling RL78 instructions.
Vinay Kumar [Tue, 27 Oct 2015 14:49:02 +0000 (14:49 +0000)]
Display system registers by their names when disassembling RL78 instructions.

PR binutils/19158
opcodes * rl78-decode.opc: Add 's' print operator to instructions that
access system registers.
* rl78-decode.c: Regenerate.
* rl78-dis.c (print_insn_rl78_common): Decode all system
registers.

tests * gas/rl78/pr19158.s: New test source file.
* gas/rl78/pr19158.d: New test case.
* gas/rl78/rl78.exp: Run the new test.

9 years agoFix RL78 disassembly so that SP+OFFSET addressing always shows the offset, even when...
Vinay Kumar [Tue, 27 Oct 2015 14:00:40 +0000 (14:00 +0000)]
Fix RL78 disassembly so that SP+OFFSET addressing always shows the offset, even when zero.

PR binutils/19157
opcodes * rl78-decode.opc: Add 'a' print operator to mov instructions
using stack pointer plus index addressing.
* rl78-decode.c: Regenerate.

tests * gas/rl78: New directory.
* gas/rl78/rl78.exp: New test driver.
* gas/rl78/pr19157.s: New test source file.
* gas/rl78/pr19157.d: New test case.

9 years agoAdd scm_t_dynwind_flags casts
Simon Marchi [Tue, 27 Oct 2015 13:34:30 +0000 (09:34 -0400)]
Add scm_t_dynwind_flags casts

There is a handful of calls to

  scm_dynwind_begin (0);

where the parameter is an enum, scm_t_dynwind_flags.  In C++, we have no
choice but to add an explicit cast, since there is no enum value that
represents 0 (no flags set).

gdb/ChangeLog:

* guile/scm-breakpoint.c (gdbscm_set_breakpoint_stop_x): Add
scm_t_dynwind_flags casts.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
* guile/scm-ports.c (gdbscm_open_memory): Likewise.
* guile/scm-value.c (gdbscm_value_to_string): Likewise.

9 years agoIntroduce ax_raw_byte and use it
Simon Marchi [Tue, 27 Oct 2015 13:33:29 +0000 (09:33 -0400)]
Introduce ax_raw_byte and use it

This patch was taken directly from Pedro's branch.

ax_simple is used to append an agent expression operator to an agent
expression string.  Therefore, it takes an enum agent_op as input.
There is an instance where it's called to append a raw byte, unrelated
to the enum.  It makes the build fail in C++ mode.

This patch introduces ax_raw_byte for that purpose and uses it.

gdb/ChangeLog:

* ax.h (ax_raw_byte): New declaration.
* ax-general.c (ax_raw_byte): New function.
(ax_simple): Use ax_raw_byte.
* ax-gdb.c (gen_printf): Likewise.

9 years agoada-lang.h: Add cast in GROW_VECT
Simon Marchi [Tue, 27 Oct 2015 13:27:40 +0000 (09:27 -0400)]
ada-lang.h: Add cast in GROW_VECT

The assignment requires a cast in C++.  We only use this macro for
vectors of chars, so adding (char *) diretly will do for now.

gdb/ChangeLog:

* ada-lang.h (GROW_VECT): Add cast.

9 years agoAdd --fix-stm32l4xx-629360 to the ARM linker to enable a link-time workaround for...
Laurent Alfonsi [Tue, 27 Oct 2015 13:20:33 +0000 (13:20 +0000)]
Add --fix-stm32l4xx-629360 to the ARM linker to enable a link-time workaround for a bug in the bus matrix / memory controller for some of the STM32 Cortex-M4 based products (STM32L4xx).

bfd  * bfd-in2.h: Regenerate.
     * bfd-in.h (bfd_arm_stm32l4xx_fix): New enum. Specify how
     STM32L4XX instruction scanning should be done.
     (bfd_elf32_arm_set_stm32l4xx_fix)
     (bfd_elf32_arm_stm32l4xx_erratum_scan)
     (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Add prototypes.
     (bfd_elf32_arm_set_target_relocs): Add stm32l4xx fix type argument
     to prototype.
     * elf32-arm.c (STM32L4XX_ERRATUM_VENEER_SECTION_NAME)
     (STM32L4XX_ERRATUM_VENEER_ENTRY_NAME): Define macros.
     (elf32_stm32l4xx_erratum_type): New enum.
     (elf32_stm32l4xx_erratum_list): New struct. List of veneers or
     jumps to veneers.
     (_arm_elf_section_data): Add stm32l4xx_erratumcount,
     stm32l4xx_erratumlist.
     (elf32_arm_link_hash_table): Add stm32l4xx_erratum_glue_size,
     stm32l4xx_fix and num_stm32l4xx_fixes fields.
     (ctz): New function.
     (popcount): New function.
     (elf32_arm_link_hash_table_create): Initialize stm32l4xx_fix.
     (put_thumb2_insn): New function.
     (STM32L4XX_ERRATUM_LDM_VENEER_SIZE): Define. Size of a veneer for
     LDM instructions.
     (STM32L4XX_ERRATUM_VLDM_VENEER_SIZE): Define. Size of a veneer for
     VLDM instructions.
     (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum
     glue section.
     (record_stm32l4xx_erratum_veneer) : New function. Create a single
     veneer, and its associated symbols.
     (bfd_elf32_arm_add_glue_sections_to_bfd): Add STM32L4XX erratum glue.
     (bfd_elf32_arm_set_stm32l4xx_fix): New function. Set the type of
     erratum workaround required.
     (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): New function. Find
     out where veneers and branches to veneers have been placed in
     virtual memory after layout.
     (is_thumb2_ldmia): New function.
     (is_thumb2_ldmdb): Likewise.
     (is_thumb2_vldm ): Likewise.
     (stm32l4xx_need_create_replacing_stub): New function. Decide if a
     veneer must be emitted.
     (bfd_elf32_arm_stm32l4xx_erratum_scan): Scan the sections of an
     input BFD for potential erratum-triggering insns. Record results.
     (bfd_elf32_arm_set_target_relocs): Set stm32l4xx_fix field in
     global hash table.
     (elf32_arm_size_dynamic_sections): Collect glue information.
     (create_instruction_branch_absolute): New function.
     (create_instruction_ldmia): Likewise.
     (create_instruction_ldmdb): Likewise.
     (create_instruction_mov): Likewise.
     (create_instruction_sub): Likewise.
     (create_instruction_vldmia): Likewise.
     (create_instruction_vldmdb): Likewise.
     (create_instruction_udf_w): Likewise.
     (create_instruction_udf): Likewise.
     (push_thumb2_insn32): Likewise.
     (push_thumb2_insn16): Likewise.
     (stm32l4xx_fill_stub_udf): Likewise.
     (stm32l4xx_create_replacing_stub_ldmia): New function. Expands the
     replacing stub for ldmia instructions.
     (stm32l4xx_create_replacing_stub_ldmdb): Likewise for ldmdb.
     (stm32l4xx_create_replacing_stub_vldm): Likewise for vldm.
     (stm32l4xx_create_replacing_stub): New function. Dispatches the
     stub emission to the appropriate functions.
     (elf32_arm_write_section): Output veneers, and branches to veneers.

ld   * ld.texinfo: Description of the STM32L4xx erratum workaround.
     * emultempl/armelf.em (stm32l4xx_fix): New.
     (arm_elf_before_allocation): Choose the type of fix, scan for
     erratum.
     (gld${EMULATION_NAME}_finish): Fix veneer locations.
     (arm_elf_create_output_section_statements): Propagate
     stm32l4xx_fix value.
     (PARSE_AND_LIST_PROLOGUE): Define OPTION_STM32L4XX_FIX.
     (PARSE_AND_LIST_LONGOPTS): Add entry for handling
     --fix-stm32l4xx-629360.
     (PARSE_AND_LIST_OPTION): Add entry for helping on
     --fix-stm32l4xx-629360.
     (PARSE_AND_LIST_ARGS_CASES): Treat OPTION_STM32L4XX_FIX.

tests * ld-arm/arm-elf.exp (armelftests_common): Add STM32L4XX
       tests.
     * ld-arm/stm32l4xx-cannot-fix-far-ldm.d: New.
     * ld-arm/stm32l4xx-cannot-fix-far-ldm.s: Likewise.
     * ld-arm/stm32l4xx-cannot-fix-it-block.d: Likewise.
     * ld-arm/stm32l4xx-cannot-fix-it-block.s: Likewise.
     * ld-arm/stm32l4xx-fix-all.d: Likewise.
     * ld-arm/stm32l4xx-fix-all.s: Likewise.
     * ld-arm/stm32l4xx-fix-it-block.d: Likewise.
     * ld-arm/stm32l4xx-fix-it-block.s: Likewise.
     * ld-arm/stm32l4xx-fix-ldm.d: Likewise.
     * ld-arm/stm32l4xx-fix-ldm.s: Likewise.
     * ld-arm/stm32l4xx-fix-vldm.d: Likewise.
     * ld-arm/stm32l4xx-fix-vldm.s: Likewise.

9 years agoAdd support to readelf for reading NetBSD ELF core notes.
Stephen Fisher [Tue, 27 Oct 2015 11:32:38 +0000 (11:32 +0000)]
Add support to readelf for reading NetBSD ELF core notes.

binutils * binutils.c (process_netbsd_elf_note): New function.
(process_note): Call the new function for NetBSD core notes.

include * common.h (NT_NETBSD_MARCH): Define.

9 years agoAdd support for 32-bit and 64-bit PowerPC AIX core files.
Sangamesh Mallayya [Tue, 27 Oct 2015 10:30:29 +0000 (10:30 +0000)]
Add support for 32-bit and 64-bit PowerPC AIX core files.

* configure.ac (powerpc64-*-aix[5-9].*): Match powerpc64 running
aix for core file support.
* configure: Regenerate.
* rs6000-core.c: Check for __ld_info64 if compiling 64-bit gdb.
Added BFD64 check if we are using old core file format for 32-bit gdb.
Set sizeof CORE_COMMONSZ appropriately in case of either new or
old core file format.
(read_hdr): Added BFD64 check for 64-bit support.
(rs6000coff_core_p): Likewise.
(rs6000coff_core_file_matches_executable_p): Likewise.
(rs6000coff_core_file_failing_command): Likewise.
(rs6000coff_core_file_failing_signal): Likewise.
Add support for debugging core files generated by binaries in
Large Memory model.
(rs6000coff_core_p): If Large Memory Model is used, then the .data
segment should start from BDATAORG which has been defined in the
system header files.