This patch initialize dsd.insn_count, otherwise, it triggers the assert
below on testings we did recently.
gdb:
2015-10-23 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Set
dsd.insn_count to zero.
Revert bba037e0, it breaks the gc-sections model. Instead fix the
underlying problem which is that _bfd_elf_gc_mark_hook is too late to
be setting SEC_KEEP.
PR ld/11133
PR ld/19161
* elflink.c (elf_gc_sweep): Revert last patch.
(_bfd_elf_gc_mark_hook): Don't set SEC_KEEP here.
SEC_KEEP check in elf_gc_sweep was missing in commit:
commit bde6f3eb6d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Jan 8 01:43:23 2010 +0000
Set SEC_KEEP on section XXX for undefined __start_XXX/__stop_XXX
bfd/
2010-01-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/11133
* elflink.c (_bfd_elf_gc_mark_hook): Check section XXX for
undefined __start_XXX/__stop_XXX in all input files and set
SEC_KEEP.
This patch adds SEC_KEEP check to elf_gc_sweep.
bfd/
PR ld/19161
* elflink.c (elf_gc_sweep): Always keep sections marked with
SEC_KEEP.
ld/testsuite/
PR ld/19161
* ld-gc/gc.exp: Run pr19161 test.
* ld-gc/pr19161-1.c: New file.
* ld-gc/pr19161-2.c: Likewise.
* ld-gc/pr19161.d: Likewise.
This patch fixes a regression introduced by :
https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html
Tests : gdb.trace/trace-break.exp and gdb.trace/trace-mt.exp would fail on x86
with gdbserver-{native,extended}.
Before this patch, the breakpoint kind set by GDB with a Z packet and the one
set in the case of a tracepoint would be inconsistent on targets that did not
implement breakpoint_kind_from_pc. On x86 for example a breakpoint set by GDB
would have a kind of 1 but a breakpoint set by a tracepoint would have a kind of
0.
This created a missmatch when trying to insert a tracepoint and a breakpoint at
the same location. One of the two breakpoints would be removed with debug
message : "Inconsistent breakpoint kind".
This patch fixes the issue by changing the default 0 breakpoint kind to be
the size of the breakpoint according to sw_breakpoint_from_kind.
The default breakpoint kind must be the breakpoint length to keep consistency
between breakpoints set via GDB and the ones set internally by GDBServer.
No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended}
gdb/gdbserver/ChangeLog:
* linux-low.c (default_breakpoint_kind_from_pc): New function.
(linux_breakpoint_kind_from_pc): Use default_breakpoint_kind_from_pc for
the default breakpoint kind.
Explation below based on what Joel wrote at:
https://sourceware.org/ml/gdb-patches/2015-10/msg00274.html
The merge async/sync code paths patch broke attaching on Windows.
This is what we observe, after attaching to any process. At first, it
seems like everything worked fine, since the process stops, and we get
the prompt back:
(gdb) att 3156
Attaching to program `C:\[...]\foo.exe', process 3156
[New Thread 3156.0xcd8]
[New Thread 3156.0xfe4]
0x7770000d in ntdll!DbgBreakPoint () from C:\Windows\SysWOW64\ntdll.dll
(gdb)
However, enter any commands at all, and GDB appears to be hanging.
For instance:
(gdb) set lang ada
[nothing happens]
Despite appearances, GDB is not reading from the prompt. It is
blocked waiting for an event from the inferior. And since our
inferior is stopped, there aren't going to be any events to read.
In chronological order, what happens is that windows_attach calls
do_initial_windows_stuff, which performs the inferior creation,
and repeatedly waits until we get the first SIGTRAP:
while (1)
{
stop_after_trap = 1;
wait_for_inferior ();
tp = inferior_thread ();
if (tp->suspend.stop_signal != GDB_SIGNAL_TRAP)
resume (tp->suspend.stop_signal);
else
break;
}
The call to wait_for_inferior triggers a call to do_target_wait to get
the event, followed by handle_inferior_event to process it. However,
because the first couple of events are "spurious" events, GDB resumes
the execution, and prepares the inferior to wait again:
case TARGET_WAITKIND_SPURIOUS:
[...]
resume (GDB_SIGNAL_0);
prepare_to_wait (ecs);
And prepare_to_wait just does...
ecs->wait_some_more = 1;
if (!target_is_async_p ())
mark_infrun_async_event_handler ();
... which as a result sets the infrun_async_event_handler "ready"
flag to 1.
We get a couple of spurious events before we get the initial SIGTRAP,
at which point we exit the "while (1)" loop above, after which we
reach the end of the attach_command, followed by the normal
end-of-command processing (normal_stop, bp handling, printing the GDB
prompt), back finally to the root of the event loop.
Notice that, at this point, nothing has unset the "ready" flag for the
infrun_async_event_handler. So, when another cycle of
gdb_do_one_event from the event loop, we eventually call
check_async_event_handlers, which finds that the infrun async event
handler is "ready", and therefore calls it's associated "proc"
callback, which does...
inferior_event_handler (INF_REG_EVENT, NULL);
... triggering a blocking call to target_wait, thus hanging forever.
The fix is to use windows_wait and windows_resume directly, similarly
to gdbserver. This will also allow getting rid of 'stop_after_trap'.
gdb/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
* windows-nat.c (do_initial_windows_stuff): Rewrite loop using
windows_wait and windows_resume directly instead of
wait_for_inferior and resume.
bfd:
* mmo.c (struct mmo_data_struct): New members
symbol_consistency_override_calculated and ignore_symbol_consistency.
(mmo_section_has_contents, mmo_ignore_symbol_consistency): New
functions.
(mmo_create_symbol): Check with mmo_ignore_symbol_consistency if to
report an error for unexpected value of Main.
(mmo_write_symbols_and_terminator): Similar.
XTREG is used with raw numbers, like:
...
XTREG( 78,312,32, 4, 4,0x02d7,0x0007,-2, 2,0x1000,excsave7, 0,0,0,0,0,0)
XTREG( 79,316, 8, 4, 4,0x02e0,0x0007,-2, 2,0x1000,cpenable, 0,0,0,0,0,0)
XTREG( 80,320,22, 4, 4,0x02e2,0x000b,-2, 2,0x1000,interrupt, 0,0,0,0,0,0)
XTREG( 81,324,22, 4, 4,0x02e2,0x000d,-2, 2,0x1000,intset, 0,0,0,0,0,0)
...
So just add the explicit cast to the macro.
In file included from /home/pedro/gdb/mygit/src/gdb/xtensa-config.c:25:0:
/home/pedro/gdb/mygit/src/gdb/xtensa-tdep.h:289:2: error: invalid conversion from ‘int’ to ‘call_abi_t’ [-fpermissive]
}
^
gdb/ChangeLog:
* xtensa-tdep.h (XTREG): Add casts.
(XTREG_END): Likewise.
Fixes this error:
/home/simark/src/binutils-gdb/gdb/solib-spu.c: In function ‘file_ptr spu_bfd_iovec_pread(bfd*, void*, void*, file_ptr, file_ptr)’:
/home/simark/src/binutils-gdb/gdb/solib-spu.c:299:55: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
ret = target_read_memory (addr + offset, buf, nbytes);
^
In file included from /home/simark/src/binutils-gdb/gdb/target.h:65:0,
from /home/simark/src/binutils-gdb/gdb/exec.h:23,
from /home/simark/src/binutils-gdb/gdb/gdbcore.h:29,
from /home/simark/src/binutils-gdb/gdb/solib-spu.c:23:
/home/simark/src/binutils-gdb/gdb/target/target.h:35:12: note: initializing argument 2 of ‘int target_read_memory(CORE_ADDR, gdb_byte*, ssize_t)’
extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
gdb/ChangeLog:
* solib-spu.c (spu_bfd_iovec_pread): Add (gdb_byte *) cast.
The error in mips64_linux_get_longjmp_target is fixed by changing "buf"
to be a gdb_byte*, as usual. supply_32bit_reg and mips64_fill_gregset
do some more complicated things however, so it's safer just to add the
explicit cast and avoid changing the code too much.
gdb/ChangeLog:
* mips-linux-tdep.c (mips64_linux_get_longjmp_target): Change type of
buf to gdb_byte*.
(supply_32bit_reg): Add cast.
(mips64_fill_gregset): Likewise.
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.
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.
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.
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.
bfd/ChangeLog:
* elf32-s390.c (elf_s390_check_relocs): Set the non_got_ref marker
only when linking an executable.
(elf_s390_relocate_section): Redirect PC-relative relocs to a IPLT
slot.
* elf64-s390.c (elf_s390_check_relocs): Set the non_got_ref marker
only when linking an executable.
(elf_s390_relocate_section): Redirect PC-relative relocs to a IPLT
slot.
bfd/ChangeLog:
* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Set the PLT
reference counters for local IFUNC calls.
* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
Normally a GOTOFF reloc only uses the GOT pointer to address something
relativ to it without actually requiring a GOT or PLT slot. Things
change if the target is an ifunc symbol though.
bfd/ChangeLog:
* elf32-s390.c (elf_s390_check_relocs): Fallthrough to the PLT
slot allocating code for GOTOFF relocs on ifunc symbols.
(elf_s390_gc_sweep_hook): Decrement plt refcount for GOTOFF relocs
on ifunc symbols.
(elf_s390_relocate_section): Redirect a GOTOFF reloc to an iplt
slot.
In order to get the ifunc relocs properly sorted the correct class
needs to be returned. The code mimics what has been done for x86.
bfd/ChangeLog:
PR ld/18841
* elf32-s390.c (elf_s390_reloc_type_class): Return
reloc_class_ifunc for ifunc symbols.
* elf64-s390.c (elf_s390_reloc_type_class): Likewise.
bfd/ChangeLog:
* elf32-s390.c (elf_s390_finish_dynamic_symbol): Call
elf_s390_finish_ifunc_symbol only for actually defined symbols.
* elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.