• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


users/hjl/got
RSS
Rev. Tiempo Autor
651dc85 users/hjl/got 2015-10-22 08:45:47 H.J. Lu

Gold: Don't fail on R_X86_64_[REX_]GOTPCRELX relocations

This patch updates gold to treat the R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX relocations proposed in

https://groups.google.com/forum/#!topic/x86-64-abi/n9AWHogmVY0

the same as R_X86_64_GOTPCREL. FIXME: Gold should perform the
transformations as suggested.

elfcpp/

* x86_64.h (R_X86_64_GOTPCRELX): New.
(R_X86_64_REX_GOTPCRELX): Likewise.

gold/

* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
as R_X86_64_GOTPCREL.
(Target_x86_64<size>::Scan::local): Likewise.
(Target_x86_64<size>::Scan::possible_function_pointer_reloc):
Likewise.
(Target_x86_64<size>::Scan::global): Likewise.
(Target_x86_64<size>::Relocate::relocate): Likewise.
(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.

a857110 2015-10-22 08:45:47 H.J. Lu

Gold: Don't fail on R_386_GOT32X relocation

This patch updates gold to treat the R_386_GOT32X relocation proposed in

https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I

the same as R_386_GOT32. FIXME: Gold should perform the transformations
as suggested.

elfcpp/

* i386.h (R_386_GOT32X): New.

gold/

* i386.cc (Target_i386::Scan::get_reference_flags(): Treat
R_386_GOT32X the same as R_386_GOT32.
(Target_i386::Scan::local): Likewise.
(Target_i386::Scan::possible_function_pointer_reloc): Likewise.
(Target_i386::Scan::global): Likewise.
(Target_i386::Relocate::relocate): Likewise.
(Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.

2d1d9ed 2015-10-22 08:45:47 H.J. Lu

Add "-z call-nop=PADDING" option to ld

The ld linker can transform indirect call to a locally defined function,
foo, via its GOT slot, to either "NOP call foo" or "call foo NOP" where
NOP is a 1-byte NOP padding. This patch adds a "-z call-nop=PADDING"
option to x86 ld to control 1-byte NOP padding for x86 call instruction.
PADDING is one of prefix-addr, prefix-nop, suffix-nop, prefix-NUMBER or
suffix-NUMBER.

bfd/

* elf32-i386.c (elf_i386_convert_load): Use call_nop_byte and
check call_nop_as_suffix for 1-byte NOP padding to pad call.
* elf64-x86-64.c (elf_x86_64_convert_load): Likewise.

include/

* bfdlink.h (bfd_link_info): Add call_nop_as_suffix and
call_nop_byte.

ld/

* ld/ld.texinfo: Document "-z call-nop=PADDING" option.
* emulparams/call_nop.sh: New file.
* emulparams/elf_i386_be.sh: Source
${srcdir}/emulparams/call_nop.sh.
* emulparams/elf_i386_chaos.sh: Likewise.
* emulparams/elf_i386_ldso.sh: Likewise.
* emulparams/elf_i386_vxworks.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_k1om.sh: Likewise.
* emulparams/elf_l1om.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
link_info.call_nop_byte if $CALL_NOP_BYTE isn't empty.

ld/testsuite/

* ld-i386/call3.s: New file.
* ld-i386/call3a.d: Likewise.
* ld-i386/call3b.d: Likewise.
* ld-i386/call3c.d: Likewise.
* ld-i386/call3d.d: Likewise.
* ld-i386/call3e.d: Likewise.
* ld-i386/call3f.d: Likewise.
* ld-i386/call3g.d: Likewise.
* ld-i386/call3h.d: Likewise.
* ld-i386/load1-nacl.d: Likewise.
* ld-x86-64/call1.s: Likewise.
* ld-x86-64/call1a.d: Likewise.
* ld-x86-64/call1b.d: Likewise.
* ld-x86-64/call1c.d: Likewise.
* ld-x86-64/call1d.d: Likewise.
* ld-x86-64/call1e.d: Likewise.
* ld-x86-64/call1f.d: Likewise.
* ld-x86-64/call1g.d: Likewise.
* ld-x86-64/call1h.d: Likewise.
* ld-x86-64/call1i.d: Likewise.
* ld-x86-64/load1a-nacl.d: Likewise.
* ld-x86-64/load1b-nacl.d: Likewise.
* ld-x86-64/load1c-nacl.d: Likewise.
* ld-x86-64/load1d-nacl.d: Likewise.

37c0370 2015-10-22 08:45:47 H.J. Lu

Add R_X86_64_[REX_]GOTPCRELX support to gas and ld

This patch adds support for the R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX relocations proposed in

https://groups.google.com/forum/#!topic/x86-64-abi/n9AWHogmVY0

to gas and ld. It updates gas to generate R_X86_64_GOTPCRELX,
R_X86_64_REX_GOTPCRELX if there is a REX prefix, relocation for memory
operand, foo@GOTPCREL(%rip). With the locally defined symbol, foo, we
convert

mov foo@GOTPCREL(%rip), %reg

to

lea foo(%rip), %reg

and convert

call/jmp *foo@GOTPCREL(%rip)
to

nop call foo/jmp foo nop

When PIC is false, convert

test %reg, foo@GOTPCREL(%rip)
to

test $foo, %reg

and convert

binop foo@GOTPCREL(%rip), %reg

to

binop $foo, %reg

where binop is one of adc, add, and, cmp, or, sbb, sub, xor instructions.

bfd/

* elf64-x86-64.c: Include opcode/i386.h.
(x86_64_elf_howto_table): Add R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX.
(R_X86_64_standard): Replace R_X86_64_PLT32_BND with
R_X86_64_REX_GOTPCRELX.
(x86_64_reloc_map): Add BFD_RELOC_X86_64_GOTPCRELX and
BFD_RELOC_X86_64_REX_GOTPCRELX.
(need_convert_mov_to_lea): Renamed to ...
(need_convert_load): This.
(elf_x86_64_check_relocs): Handle R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX. Replace need_convert_mov_to_lea with
need_convert_load.
(elf_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX.
(elf_x86_64_size_dynamic_sections): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_convert_mov_to_lea): Renamed to ...
(elf_x86_64_convert_load): This. Replace need_convert_mov_to_lea
with need_convert_load. Support R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX transformations.
* reloc.c (BFD_RELOC_X86_64_GOTPCRELX): New.
(BFD_RELOC_X86_64_REX_GOTPCRELX): Likewise.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

gas/

* config/tc-i386.c (tc_i386_fix_adjustable): Handle
BFD_RELOC_X86_64_GOTPCRELX and BFD_RELOC_X86_64_REX_GOTPCRELX.
(tc_gen_reloc): Likewise.
(i386_validate_fix): Generate BFD_RELOC_X86_64_GOTPCRELX or
BFD_RELOC_X86_64_REX_GOTPCRELX if fx_tcbit2 is set.
* config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Also return
true for BFD_RELOC_X86_64_GOTPCRELX and
BFD_RELOC_X86_64_REX_GOTPCRELX.

gas/testsuite/

* gas/i386/i386.exp: Run x86-64-gotpcrel.
* gas/i386/x86-64-gotpcrel.d: New file.
* gas/i386/x86-64-gotpcrel.s: Likewise.
* gas/i386/ilp32/x86-64-gotpcrel.d: Likewise.
* gas/i386/x86-64-localpic.d: Replace R_X86_64_GOTPCREL with
R_X86_64_REX_GOTPCRELX.
* gas/i386/ilp32/x86-64-localpic.d: Likewise.

include/elf/

* x86-64.h (R_X86_64_GOTPCRELX): New.
(R_X86_64_REX_GOTPCRELX): Likewise.

ld/testsuite/

* ld-ifunc/ifunc-5r-local-x86-64.d: Replace R_X86_64_GOTPCREL
with R_X86_64_REX_GOTPCRELX.
* ld-x86-64/plt-main1.rd: Likewise.
* ld-x86-64/plt-main3.rd: Likewise.
* ld-x86-64/plt-main4.rd: Likewise.
* ld-x86-64/gotpcrel1.dd: New file.
* ld-x86-64/gotpcrel1.out: Likewise.
* ld-x86-64/gotpcrel1a.S: Likewise.
* ld-x86-64/gotpcrel1b.c: Likewise.
* ld-x86-64/gotpcrel1c.c: Likewise.
* ld-x86-64/gotpcrel1d.S: Likewise.
* ld-x86-64/load1.s: Likewise.
* ld-x86-64/load1a.d: Likewise.
* ld-x86-64/load1b.d: Likewise.
* ld-x86-64/load1c.d: Likewise.
* ld-x86-64/load1d.d: Likewise.
* ld-x86-64/x86-64.exp: Run load1a, load1b, load1c and load1d
tests. Run gotpcrel1 test.

91d9e98 2015-10-22 08:45:47 H.J. Lu

Add R_386_GOT32X support to gas and ld

This patch adds support for the R_386_GOT32X relocation proposed in

https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I

to gas and ld. It updates gas to generate R_386_GOT32X relocation for
memory operand, foo@GOT[(%reg)]. We must encode "mov foo@GOT, %eax"
with the 0x8b opcode, instead of the 0xb8 opcode, so that it can be
transformed to "lea foo, %eax". With the locally defined symbol, foo,
we convert

mov foo@GOT[(%reg1)], %reg2
to
lea foo[@GOTOFF(%reg1)], %reg2

and convert

call/jmp *foo@GOT[(%reg)]
to

nop call foo/jmp foo nop

When PIC is false, convert

test %reg1, foo@GOT[(%reg2)]
to
test $foo, %reg1

and convert

binop foo@GOT[(%reg1)], %reg2

to

binop $foo, %reg2

where binop is one of adc, add, and, cmp, or, sbb, sub, xor instructions.

bfd/

* elf32-i386.c: Include opcode/i386.h.
(elf_howto_table): Add R_386_GOT32X.
(R_386_ext2): Replace R_386_IRELATIVE with R_386_GOT32X.
(elf_i386_reloc_type_lookup): Handle BFD_RELOC_386_GOT32X.
(need_convert_mov_to_lea): Renamed to ...
(need_convert_load): This.
(elf_i386_check_relocs): Handle R_386_GOT32X. Replace
need_convert_mov_to_lea with need_convert_load.
(elf_i386_gc_sweep_hook): Handle R_386_GOT32X.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_convert_mov_to_lea): Renamed to ...
(elf_i386_convert_load): This. Replace need_convert_mov_to_lea
with need_convert_load. Support R_386_GOT32X transformations.
* reloc.c (BFD_RELOC_386_GOT32X): New.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

gas/

* config/tc-i386.c (tc_i386_fix_adjustable): Handle
BFD_RELOC_386_GOT32X.
(tc_gen_reloc): Likewise.
(match_template): Force 0x8b encoding for "mov foo@GOT, %eax".
(output_disp): Check for "call/jmp *mem", "mov mem, %reg",
"test %reg, mem" and "binop mem, %reg" where binop is one of
adc, add, and, cmp, or, sbb, sub, xor instructions. Set
fx_tcbit if the REX prefix is generated. Set fx_tcbit2 if
BFD_RELOC_386_GOT32X should be generated.
(i386_validate_fix): Generate BFD_RELOC_386_GOT32X if fx_tcbit2
is set.

gas/testsuite/

* gas/i386/got.d: New file.
* gas/i386/got.s: Likewise.
* gas/i386/i386.exp: Run got.
* gas/i386/localpic.d: Replace R_386_GOT32 with R_386_GOT32X.
* gas/i386/mixed-mode-reloc32.d: Likewise.
* gas/i386/reloc32.d: Likewise.

include/elf/

* i386.h (R_386_GOT32X): New relocation.

ld/testsuite/

* ld-i386/branch1.d: New file.
* ld-i386/branch1.s: Likewise.
* ld-i386/call1.d: Likewise.
* ld-i386/call1.s: Likewise.
* ld-i386/call2.d: Likewise.
* ld-i386/call2.s: Likewise.
* ld-i386/got1.dd: Likewise.
* ld-i386/got1.out: Likewise.
* ld-i386/got1a.S: Likewise.
* ld-i386/got1b.c: Likewise.
* ld-i386/got1c.c: Likewise.
* ld-i386/got1d.S: Likewise.
* ld-i386/jmp1.d: Likewise.
* ld-i386/jmp1.s: Likewise.
* ld-i386/jmp2.d: Likewise.
* ld-i386/jmp2.s: Likewise.
* ld-i386/load1.d: Likewise.
* ld-i386/load1.s: Likewise.
* ld-i386/load2.d: Likewise.
* ld-i386/load2.s: Likewise.
* ld-i386/load3.d: Likewise.
* ld-i386/load3.s: Likewise.
* ld-i386/load4.s: Likewise.
* ld-i386/load4a.d: Likewise.
* ld-i386/load4b.d: Likewise.
* ld-i386/load5.s: Likewise.
* ld-i386/load5a.d: Likewise.
* ld-i386/load5b.d: Likewise.
* ld-i386/load6.d: Likewise.
* ld-i386/load6.s: Likewise.
* ld-i386/i386.exp: Run branch1, call1, call2, jmp1, jmp2,
load1, load2, load3, load4a, load4b, load5a, load5b and load6
tests. Run got1 test.

bed91f4 2015-10-22 04:57:22 Simon Marchi

Fix accessing a function's fields (parameters) from Python (PR 18073)

Since 7.4, gdb doesn't allow calling .fields() on a function type, even
though the documentation states it should return a list corresponding to
the function's parameters. This patch restores the intended behaviour
and adds a test for it.

Reg-tested on Arch Linux x86-64.

gdb/ChangeLog:

PR python/18073
* python/py-type.c (typy_get_composite): Allow returning a
function type.

gdb/testsuite/ChangeLog:

PR python/18073
* gdb.python/py-type.c (C::a_method): New.
(C::a_const_method): New.
(C::a_static_method): New.
(a_function): New.
* gdb.python/py-type.exp (test_fields): Test getting fields
from function and method.

3f2f83d 2015-10-22 04:37:46 Keven Boell

fort_dyn_array: add basic fortran dyn array support

Fortran provide types whose values may be dynamically allocated
or associated with a variable under explicit program control.
The purpose of this commit is:

* to read allocated/associated DWARF tags and store them in
the dynamic property list of main_type.

* enable GDB to print the value of a dynamic array in Fortran
in case the type is allocated or associated (pointer to
dynamic array).

Examples:
(gdb) p vla_not_allocated
$1 = <not allocated>

(gdb) p vla_allocated
$1 = (1, 2, 3)

(gdb) p vla_ptr_not_associated
$1 = <not associated>

(gdb) p vla_ptr_associated
$1 = (1, 2, 3)

Add basic test coverage for most dynamic array use-cases in Fortran.
The commit contains the following tests:
* Ensure that values of Fortran dynamic arrays
can be evaluated correctly in various ways and states.
* Ensure that Fortran primitives can be evaluated
correctly when used as a dynamic array.
* Dynamic arrays passed to subroutines and handled
in different ways inside the routine.
* Ensure that the ptype of dynamic arrays in
Fortran can be printed in GDB correctly.
* Ensure that dynamic arrays in different states
(allocated/associated) can be evaluated.
* Dynamic arrays passed to functions and returned from
functions.
* History values of dynamic arrays can be accessed and
printed again with the correct values.
* Dynamic array evaluations using MI protocol.
* Sizeof output of dynamic arrays in various states.

The patch was tested using the test suite on Ubuntu 12.04 64bit.

gdb/ChangeLog:

* dwarf2read.c (set_die_type): Add read of
DW_AT_allocated and DW_AT_associated.
* f-typeprint.c: New include of typeprint.h
(f_print_type): Add check for allocated/associated
status of type.
(f_type_print_varspec_suffix): Add check for
allocated/associated status of type.
* gdbtypes.c (create_array_type_with_stride):
Add check for valid data location of type in
case allocated or associated attributes are set.
Length of an array should be only calculated if
allocated or associated is resolved as true.
(is_dynamic_type_internal): Add check for allocated/
associated.
(resolve_dynamic_array): Evaluate allocated/associated
properties.
* gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED>
<DYN_PROP_ASSOCIATED>: New enums.
(TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros.
(type_not_allocated): New function.
(type_not_associated): New function.
* valarith.c (value_subscripted_rvalue): Add check for
allocated/associated.
* valprint.c: New include of typeprint.h.
(valprint_check_validity): Add check for allocated/associated.
(value_check_printable): Add check for allocated/
associated.
* typeprint.h (val_print_not_allocated): New function.
(val_print_not_associated): New function.
* typeprint.c (val_print_not_allocated): New function.
(val_print_not_associated): New function.

gdb/testsuite/ChangeLog:

* gdb.fortran/vla-alloc-assoc.exp: New file.
* gdb.fortran/vla-datatypes.exp: New file.
* gdb.fortran/vla-datatypes.f90: New file.
* gdb.fortran/vla-history.exp: New file.
* gdb.fortran/vla-ptype-sub.exp: New file.
* gdb.fortran/vla-ptype.exp: New file.
* gdb.fortran/vla-sizeof.exp: New file.
* gdb.fortran/vla-sub.f90: New file.
* gdb.fortran/vla-value-sub-arbitrary.exp: New file.
* gdb.fortran/vla-value-sub-finish.exp: New file.
* gdb.fortran/vla-value-sub.exp: New file.
* gdb.fortran/vla-value.exp: New file.
* gdb.fortran/vla-ptr-info.exp: New file.
* gdb.mi/mi-vla-fortran.exp: New file.
* gdb.mi/vla.f90: New file.

27145d5 2015-10-22 01:54:49 Sandra Loosemore

Adjust timeout in gdb.base/freebpcmd.exp.

2015-10-21 Sandra Loosemore <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/freebpcmd.exp: Use with_timeout_factor instead
of hardwired timeout value.

a846e9c 2015-10-22 01:25:28 Nick Clifton

Fix tests for PR 18500 so that they will pass for big-endian ARM toolchains.

PR gas/18500
* gas/arm/vfpv3xd-ldr_immediate.d: Update test for big-endian ARM
toolchains.
* gas/arm/vfpv3-ldr_immediate.d: Likewise.
* gas/arm/vfpv2-ldr_immediate.d: Likewise.

abeead0 2015-10-22 00:26:05 Antoine Tremblay

Support software breakpoints for ARM linux in GDBServer.

This patch enables software breakpoints via GDB's Z0 packets on ARM.

No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:

* linux-arm-low.c (arm_supports_z_point_type): Add software
breakpoint support.

b0b4b50 2015-10-22 00:26:05 Antoine Tremblay

Refactor the breakpoint definitions in linux-arm-low.c.

Before arm_sw_breakpoint_from_kind would use an #ifdef to return the right
arm_breakpoint from the abi or eabi breakpoint type.

arm_breakpoint_at would also check for the arm_breakpoint ||
arm_eabi_breakpoint.

Thus the selected arm_breakpoint would be what arm_sw_breakpoint_from_kind
returned and arm_breakpoint was arm_abi_breakpoint.

This patch makes it more clear by naming those for what they are : 2 separate
entities: arm_abi_breakpoint and arm_eabi_breakpoint and set the current used
one as arm_breakpoint.

This allows a cleaner arm_sw_breakpoint_from_kind as it just returns
arm_breakpoint rather than having the #ifdef in that function.

Any other reference to the arm_breakpoint can now also be clear of #ifdefs...

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:

* linux-arm-low.c: Refactor breakpoint definitions.
(arm_breakpoint_at): Adjust for arm_abi_breakpoint.
(arm_sw_breakpoint_from_kind): Adjust for arm_breakpoint.

8689682 2015-10-22 00:26:05 Antoine Tremblay

Implement breakpoint_kind_from_pc and sw_breakpoint_from_kind for ARM in GDBServer.

ARM can have multiple breakpoint types based on the instruction set
it's currently in: arm, thumb or thumb2.

GDBServer needs to know what breakpoint is to be inserted at location
when inserting a breakpoint.

This is handled by the breakpoint_kind_from_pc and sw_breakpoint_from_kind
target ops introduced in a previous patch, this patch adds the
arm_breakpoint_kind_from_pc and arm_sw_breakpoint_from_kind implementation so
that the proper breakpoint type is returned based on the pc.

Also in order to share some code with GDB a new file called arm.c have been
introduced in arch/.

While this file does not contain much yet future patches will add more
to it thus the inclusion at this stage.

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/ChangeLog:

* Makefile.in: Add arm.c/o.
* arch/arm.c: New file.
* arch/arm.h: (IS_THUMB_ADDR): Move macro from arm-tdep.c.
(MAKE_THUMB_ADDR): Likewise.
(UNMAKE_THUMB_ADDR): Likewise.
* arm-tdep.c (int thumb_insn_size): Move to arm.c.
(IS_THUMB_ADDR): Move to arm.h.
(MAKE_THUMB_ADDR): Likewise.
(UNMAKE_THUMB_ADDR): Likewise.
* configure.tgt: Add arm.o to all ARM configs.

gdb/gdbserver/ChangeLog:

* Makefile.in: Add arm.c/o.
* configure.srv: Likewise.
* linux-arm-low.c (arm_breakpoint_kinds): New enum.
(arm_breakpoint_kind_from_pc): New function.
(arm_sw_breakpoint_from_kind): Return proper kind.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.

2716529 2015-10-22 00:24:55 Antoine Tremblay

Support breakpoint kinds for software breakpoints in GDBServer.

There's two ways to set breakpoints in GDBServer.

- GDBServer setting its own breakpoints, through API set_breakpoint_at.

- GDBServer setting breakpoints according to the information in Z
packets, through API set_gdb_breakpoint.

Before this patch the breakpoint kinds were a concept unique to GDB and Z
packets, as GDBServer never had to set different kinds of breakpoint on its
own.

This patch teaches GDBServer to handle breakpoint kinds for its own
breakpoints. It generalizes the breakpoint kind as per Z packets to
represent different kinds of breakpoints directly set by GDBServer also.

GDBServer now querys breakpoint_kind_from_pc to know what breakpoint kind to
set on its own.

As the kind is now a differentiating factor equivalent to size for the
breakpoint struct and that it's size can be queried using
sw_breakpoint_from_kind, the size field has been replaced with the kind field.
All references to size are now replaced by kind or a call to bp_size that wraps
sw_breakpoing_from_kind and returns the size of the breakpoint in memory.

To fetch the software breakpoint data bp_opcode is called and wraps the
sw_breakpoint_from_kind call.

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:

* linux-low.c (initialize_low): Ajdust for breakpoint global variables
removal.
* mem-break.c : Remove breakpoint_data/breakpoint_len global variables.
(struct raw_breakpoint) <size>: Remove.
(struct raw_breakpoint) <kind>: Add.
(bp_size): New function.
(bp_opcode): Likewise.
(find_raw_breakpoint_at): Adjust for kind.
(insert_memory_breakpoint): Adjust for kind call bp_size,bp_opcode.
(remove_memory_breakpoint): Adjust for kind call bp_size.
(set_raw_breakpoint_at): Adjust for kind.
(set_breakpoint): Likewise.
(set_breakpoint_at): Call breakpoint_kind_from_pc.
(delete_raw_breakpoint): Adjust for kind.
(delete_breakpoint): Likewise.
(find_gdb_breakpoint): Likewise.
(set_gdb_breakpoint_1): Likewise.
(set_gdb_breakpoint): Likewise.
(delete_gdb_breakpoint_1): Likewise.
(delete_gdb_breakpoint): Likewise.
(uninsert_raw_breakpoint): Likewise.
(reinsert_raw_breakpoint): Likewise.
(set_breakpoint_data): Remove.
(validate_inserted_breakpoint): Adjust for kind call bp_size,bp_opcode.
(check_mem_read): Adjust for kind call bp_size.
(check_mem_write): Adjust for kind call bp_size,bp_opcode.
(clone_one_breakpoint): Adjust for kind.
* mem-break.h (set_gdb_breakpoint): Likewise.
(delete_gdb_breakpoint): Likewise.
* server.c (process_serial_event): Likewise.

dd37334 2015-10-22 00:24:55 Antoine Tremblay

Add the target_ops needed for software breakpoints in GDBServer.

This patch is in preparation for software breakpoints on ARM linux. It
refactors breakpoint and breakpoint_len into breakpoint_kind_from_pc and
sw_breakpoint_from kind to prepare the case where we have multiple types of
breakpoints.

Kind is the type of breakpoint (hardware or software) to be inserted, usually it
is the lenght of the software breakpoint but can be something else depending on
the target.

This patch introduces the linux_target_ops breakpoint_kind_from_pc and
sw_breakpoint_from_kind.

breakpoint_kind_from_pc returns the breakpoint kind and adjusts the PC to the
real memory location in case a flag was present in the PC. E.g the instruction
mode on ARM.

sw_breakpoint_from_kind returns the software breakpoint for this kind as a
string of bytes, the length of the breakpoint is adjusted for the breakpoint's
size in memory.

For targets that have only one kind of breakpoint, the default value 0 is
returned by linux_breakpoint_kind_from_pc so that not all targets need to
implement the breakpoint_kind_from_pc operation.

No regressions, tested on Ubuntu 14.04 on ARMv7 and x86
With gdbserver-{native,extended} / { -marm -mthumb }

Also since the target_ops have been changed compilation was tested on
affected archs namely : aarch64, arm, bfin, cris, crisv32, m32r,
m68k, mips, nios2, ppc, s390, sparc, tic6x, tile, x86, steins.

Not tested : sh

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-arm-low.c (arm_breakpoint_kind_from_pc): New function.
(arm_sw_breakpoint_from_kind): New function.
* linux-bfin-low.c (bfin_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-cris-low.c (cris_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-crisv32-low.c (cris_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-low.c (linux_wait_1): Call breakpoint_kind_from_pc
and sw_breakpoint_from_kind to increment the pc.
(linux_breakpoint_kind_from_pc): New function.
(linux_sw_breakpoint_from_kind): New function.
(struct target_ops) <sw_breakpoint_from_kind>: Initialize field.
(initialize_low): Call breakpoint_kind_from_pc and
sw_breakpoint_from_kind to replace breakpoint_data/len.
* linux-low.h (struct linux_target_ops) <breakpoint_kind_from_pc>:
New field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Likewise.
* linux-m32r-low.c (m32r_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-m68k-low.c (m68k_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-mips-low.c (mips_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-nios2-low.c (nios2_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-ppc-low.c (ppc_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-s390-low.c (s390_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-sh-low.c (sh_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-sparc-low.c (sparc_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-tic6x-low.c (tic6x_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-tile-low.c (tile_sw_breakpoint_from_kind): New function.
* linux-x86-low.c (x86_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-xtensa-low.c (xtensa_sw_breakpoint_from_kind) New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.

397dd9a 2015-10-22 00:20:02 Ronald Hoogenboom

Fix typo in spelling of author's name.

80f0110 2015-10-22 00:16:25 Yao Qi

Remove checking vCont;s in exec_cmd_expect_vCont_count

Nowadays, in the range-stepping tests, we check not only the number of
vCont;r packets but also the number of vCont;s packets, because we think
the remote target which can do range stepping must support single step.

However, if we turn displaced stepping on, the remote target (GDBserver)
can do range stepping, and support single step, but GDB may decide to
resume instructions in the scratchpad rather than single step them one
by one for displaced stepping. For example, when aarch64 GDB debugs
arm linux program with aarch64 GDBserver, GDBserver supports both range
stepping and single step, but GDB (with the gdbarch for arm-linux)
decides resume instructions in the scratchpad, so in the RSP traffic,
there is no vCont;s packet at all, and some range-stepping.exp tests
fail,

FAIL: gdb.base/range-stepping.exp: multi insns: next: vCont;s=1 vCont;r=1

This patch is to get rid of the checking to the number of vCont;s in
exec_cmd_expect_vCont_count.

gdb/testsuite:

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

* lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
Remove argument exp_vCont_s.
* gdb.base/range-stepping.exp: Callers updated.
* gdb.trace/range-stepping.exp: Likewise.

d7161de 2015-10-21 23:37:33 Aleksandar Ristovski

[nto] Improve ABI sniffing.

Use qnx specific notes to figure out the OS.

gdb/ChangeLog:
* gdb/nto-tdep.c (QNX_NOTE_NAME, QNX_INFO_SECT_NAME): New defines.
(nto_sniff_abi_note_section): New function.
(nto_elf_osabi_sniffer): Use new function to recognize nto specific
binary.

a988916 2015-10-21 23:37:33 Aleksandar Ristovski

[nto] Fix nto target stopped by watchpoint.

Fix 'stopped by watchpoint' detection: add inferior data, use inferior data
for storing last stopped flags needed for detection.

gdb/ChangeLog:

* nto-procfs.c (procfs_wait): Set stopped_flags nad stopped_pc.
(procfs_stopped_by_watchpoint): Use flags stored in inferior data.
* nto-tdep.c (nto_new_inferior_data_reg): New definition.
(nto_new_inferior_data, nto_inferior_data_cleanup, nto_inferior_data):
New functions.
(_initialize_nto_tdep): New forward declaration, new function.
* nto-tdep.h (struct nto_inferior_data): New struct.
(nto_inferior_data): New function declaration.

2b35fb2 2015-10-21 23:16:35 Ronald Hoogenbllon

Add ability for objcopy to insert new symbols into a binary.

PR binutils/19104
binutils * objcopy.c (command_line_switch): Add OPTION_ADD_SYMBOL.
(copy_options): Add add-symbol.
(copy_usage): Likewise.
(parse_symflags): New function.
(need_sym_before): New function.
(create_new_symbol): New function.
(filter_symbols): Add code to insert new symbols.
(copy_main): Process OPTION_ADD_SYMBOL.
* doc/binutils.texi: Document new feature.
* NEWS: Add note about the new feature.

tests * binutils-all/add-symbol.d: New test.
* binutils-all/objcopy.exp: Run the new test.

1283d92 2015-10-21 22:57:28 Nick Clifton

Extend description of the --enable-compressed-debug-sections configure option in gas and ld.

6c3bc0f 2015-10-21 21:15:39 Nick Clifton

Reset x86 Linux targets to not compressing debug sections by default. Enable compression of debug sections by default in the linker, if so configured.

PR gas/19109
. * configure.ac: Note the 'none' is an acceptable argument to
--enable-compressed-debug-sections.
* configure: Regenerate.

gas * configure.ac: Restore --enable-compressed-debug-sections.
Do not enable compressed debug sections by default for x86 Linux
targets.
* configure: Regenerate.

ld * configure.ac: Add --enable-compressed-debug-sections.
* configure: Regenerate.
* config.in: Regenerate.
* ld.texinfo: Document how to determine the default action for
debug sections.
* ldmain.c (main): If DEFAULT_FLAG_COMPRESS_DEBUG is defined then
set the compress_debug field of the link_info structure to
zlib-gabi.
* lexsup.c (elf_static_list_options): Output the default setting
for the --compress-debug-sections option.
* NEWS: Mention the new configure option.

4cd98a1 2015-10-21 20:45:56 Antoine Tremblay

Fix --host cris-*-linux build of GDBServer.

Compiling GDBServer with --host cris-*-linux yields a compilation error :

linux-cris-low.c:65:21: error: ‘void’ must be the only parameter

This patch fixes the issue by removing the void parameter in cris_get_pc.

gdb/gdbserver/ChangeLog:
* linux-cris-low.c (cris_get_pc): Remove void arg.

2c3853e 2015-10-21 09:00:08 GDB Administrator

Automatic date update in version.in

5f3ff4f 2015-10-21 03:40:38 Jan Kratochvil

Fix internal error on DW_OP_bregx(-1)

https://bugzilla.redhat.com/show_bug.cgi?id=1270564#c15
https://bugzilla.redhat.com/attachment.cgi?id=1081772

clang-3.5.0-9.fc22.x86_64
<3><22b2>: Abbrev Number: 69 (DW_TAG_variable)
<22b3> DW_AT_location : 7 byte block: 92 ff ff ff ff f 0 (DW_OP_bregx: 4294967295 (r-1) 0)
<22bb> DW_AT_name : (indirect string, offset: 0x2a36): texture_data
<22c1> DW_AT_type : <0x1d3>

(gdb) p variable
warning: Unmapped DWARF Register #-1 encountered.
regcache.c:177: internal-error: register_size: Assertion `regnum >= 0 && regnum < (gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs
(gdbarch))' failed.
[...]
Quit this debugging session? (y or n) FAIL: gdb.dwarf2/dw2-regno-invalid.exp: p variable (GDB internal error)

-> (x86_64)
(gdb) p variable
warning: Unmapped DWARF Register #-1 encountered.
Invalid register #-1, expecting 0 <= # < 220
(gdb) PASS: gdb.dwarf2/dw2-regno-invalid.exp: p variable
-> (i386)
(gdb) p variable
Invalid register #104, expecting 0 <= # < 104
(gdb) PASS: gdb.dwarf2/dw2-regno-invalid.exp: p variable

GDB calls gdbarch_dwarf2_reg_to_regnum() first which returns -1 in the x86_64
case
if (regnum == -1)
warning (_("Unmapped DWARF Register #%d encountered."), reg);
but in i386 case it does:
/* This will hopefully provoke a warning. */
return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
and the default implementation is a nop, leaving whatever register number
the DWARF specified.

gdb/ChangeLog
2015-10-20 Jan Kratochvil <jan.kratochvil@redhat.com>

* findvar.c (address_from_register): Check REGNUM validity.

gdb/testsuite/ChangeLog
2015-10-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com>

* gdb.dwarf2/dw2-regno-invalid.exp: New file.
* lib/dwarf.exp (Dwarf): Add DW_OP_bregx.

0fd1534 2015-10-21 02:46:47 H.J. Lu

Feed right input object to x86_64_mov_to_lea1[12]

x86_64_mov_to_lea1.o is a 64-bit x86-64 object and x86_64_mov_to_lea2.o
is a 32-bit x86-64 object. x86_64_mov_to_lea11 should use
x86_64_mov_to_lea2.o and x86_64_mov_to_lea12 should use
x86_64_mov_to_lea1.o.

* testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
(x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
x86_64_mov_to_lea1.o.
* testsuite/Makefile.in: Regenerated.

e5343fd 2015-10-21 02:11:53 Aleksandar Ristovski

[nto] Implement procfs_pid_to_exec_file.

gdb/ChangeLog:

* gdb/nto-procfs.c (procfs_pid_to_exec_file): New function.
(init_procfs_targets): Wire new function.

8a6c0cc 2015-10-21 02:02:33 Aleksandar Ristovski

[nto] Implement TARGET_OBJECT_AUXV.

Fix 'info auxv' for nto.

gdb/ChangeLog:

* nto-procfs.c (sys/auxv.h): Include.
(procfs_xfer_partial): Implement TARGET_OBJECT_AUXV.
* nto-tdep.c (nto_read_auxv_from_initial_stack): New function.
* nto-tdep.h (nto_read_auxv_from_initial_stack): New declaration.

609c304 2015-10-21 02:02:09 Aleksandar Ristovski

[nto] Fixes for nto procfs.

Fix errnoeus construction of procfs path. The issue is, after the first
info pidlist or first run, the path for local node (the most common node)
will be reset to empty which makes subsequent queries and runs impossible.

gdb/ChangeLog:

* nto-procfs.c (nto_procfs_path): Rename to...
(nodestr): ... this, and change type.
(nto_node): Use new variable and logic accordingly.
(procfs_open_1): Use new variable name. Use local buffer to construct
procfrs path.
(procfs_pidlist): Use NODESTR to construct procfs path.
(procfs_files_info): Use NODESTR to output meaningful text.
(do_attach): Construct procfs using NODESTR.
(procfs_create_inferior): Compare pointer to NULL.

edeefb6 2015-10-21 00:58:25 H.J. Lu

Add --enable-compressed-debug-sections={all,gas,gold,ld}

This patch removes the gas configure option:

--enable-compressed-debug-sections

and adds a toplevel configure option:

--enable-compressed-debug-sections={all,gas,gold,ld}

to enable compressed debug sections for gas, gold or ld by default. At
the moment, this configure option is ignored by gold and ld. For x86
Linux targets, default to compressing debug sections in gas.

PR gas/19109
* configure.ac: Add
--enable-compressed-debug-sections={all,gas,gold,ld}.
* configure: Regenerated.

gas/

PR gas/19109
* NEWS: Update --enable-compressed-debug-sections=.
* configure.ac: Remove --enable-compressed-debug-sections.
(DEFAULT_FLAG_COMPRESS_DEBUG): Check
--enable-compressed-debug-sections={all,gas} instead of
--enable-compressed-debug-sections. For x86 Linux targets,
default to compressing debug sections.
* configure: Regenerated.

f9c6230 2015-10-20 13:56:33 Hans-Peter Nilsson

Correct printed value of Main in mmo.c consistency error message.