We may see an unversioned definition after the default version. We
should skip the unversioned definition in this case.
bfd/
PR ld/19073
* elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned
definition after the default version.
ld/testsuite/
PR ld/19073
* ld-elf/pr19073.map: New file.
* ld-elf/pr19073.rd: Likewise.
* ld-elf/pr19073.s: Likewise.
* ld-elf/shared.exp (build_tests): Add tests for PR ld/19073.
* config/tc-msp430.c (msp430_mcu_names): Rename to
msp430_mcu_data. Add fields for the ISA and hardware multiply
support. Update with information from the latest devices.csv
file.
(md_parse_option): Make use of the new array.
Likewise, this patch renames emit_load_store to
aarch64_emit_load_store.
gdb:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* arch/aarch64-insn.c (emit_load_store): Rename to ...
(aarch64_emit_load_store): ... it. All callers updated.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c: Update all callers as emit_load_store
is renamed to aarch64_emit_load_store.
As emit_insn becomes extern, the prefix "aarch64_" is needed. This
patch renames emit_insn to aarch64_emit_insn.
gdb:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* arch/aarch64-insn.c (emit_insn): Rename to ...
(aarch64_emit_insn): ... it. All callers updated.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c: Update all callers of function renaming
from emit_insn to aarch64_emit_insn.
This patch adds a new test case which uses gdb.arch/insn-reloc.c too
to test displaced stepping. Nowadays, tests are for x86, x86_64 and
aarch64.
gdb/testsuite:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* gdb.arch/disp-step-insn-reloc.exp: New test case.
This patch is to support displaced stepping in aarch64-linux. A
visitor is implemented for displaced stepping, and used to record
information to fixup pc after displaced stepping if needed. Some
emit_* functions are converted to macros, and moved to
arch/aarch64-insn.{c,h} so that they can be shared.
gdb:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c: Include arch-utils.h.
(aarch64_linux_init_abi): Call set_gdbarch_max_insn_length,
set_gdbarch_displaced_step_copy_insn,
set_gdbarch_displaced_step_fixup,
set_gdbarch_displaced_step_free_closure,
set_gdbarch_displaced_step_location,
and set_gdbarch_displaced_step_hw_singlestep.
* aarch64-tdep.c (struct displaced_step_closure): New.
(struct aarch64_displaced_step_data): New.
(aarch64_displaced_step_b): New function.
(aarch64_displaced_step_b_cond): Likewise.
(aarch64_register): Likewise.
(aarch64_displaced_step_cb): Likewise.
(aarch64_displaced_step_tb): Likewise.
(aarch64_displaced_step_adr): Likewise.
(aarch64_displaced_step_ldr_literal): Likewise.
(aarch64_displaced_step_others): Likewise.
(aarch64_displaced_step_copy_insn): Likewise.
(aarch64_displaced_step_fixup): Likewise.
(aarch64_displaced_step_hw_singlestep): Likewise.
* aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): New macro.
(aarch64_displaced_step_copy_insn): Declare.
(aarch64_displaced_step_fixup): Declare.
(aarch64_displaced_step_hw_singlestep): Declare.
* arch/aarch64-insn.c (emit_insn): Moved from
gdbserver/linux-aarch64-low.c.
(emit_load_store): Likewise.
* arch/aarch64-insn.h (enum aarch64_opcodes): Moved from
gdbserver/linux-aarch64-low.c.
(struct aarch64_register): Likewise.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(can_encode_int32): New macro.
(emit_b, emit_bcond, emit_cb, emit_ldr, emit_ldrsw): Likewise.
(emit_tb, emit_nop): Likewise.
(emit_insn): Declare.
(emit_load_store): Declare.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (enum aarch64_opcodes): Move to
arch/aarch64-insn.h.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(emit_insn): Move to arch/aarch64-insn.c.
(emit_b, emit_bcond, emit_cb, emit_tb): Remove.
(emit_load_store): Move to arch/aarch64-insn.c.
(emit_ldr, emit_ldrb, emit_ldrsw, emit_nop): Remove.
(can_encode_int32): Remove.
This patch moves aarch64_relocate_instruction and visitor class to
arch/aarch64-insn.c, so that both GDB and GDBserver can use it.
gdb:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* arch/aarch64-insn.c (aarch64_decode_ldr_literal): Moved from
gdbserver/linux-aarch64-low.c.
(aarch64_relocate_instruction): Likewise.
* arch/aarch64-insn.h (aarch64_decode_ldr_literal): Declare.
(struct aarch64_insn_data): Moved from
gdbserver/linux-aarch64-low.c.
(struct aarch64_insn_visitor): Likewise.
(aarch64_relocate_instruction): Declare.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (extract_signed_bitfield): Remove.
(aarch64_decode_ldr_literal): Move to gdb/arch/aarch64-insn.c.
(aarch64_relocate_instruction): Likewise.
(struct aarch64_insn_data): Move to gdb/arch/aarch64-insn.h.
(struct aarch64_insn_visitor): Likewise.
Nowadays, the instruction decodings and handling are mixed together
inside aarch64_relocate_instruction. The patch decouples instruction
decoding and instruction handling by using visitor pattern. That is,
aarch64_relocate_instruction decode instructions and visit each
instruction by different visitor methods. Each visitor defines the
concrete things to different instructions. Fast tracepoint instruction
relocation and displaced stepping can define their own visitors,
sub-class of struct aarch64_insn_data.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (struct aarch64_insn_data): New.
(struct aarch64_insn_visitor): New.
(struct aarch64_insn_relocation_data): New.
(aarch64_ftrace_insn_reloc_b): New function.
(aarch64_ftrace_insn_reloc_b_cond): Likewise.
(aarch64_ftrace_insn_reloc_cb): Likewise.
(aarch64_ftrace_insn_reloc_tb): Likewise.
(aarch64_ftrace_insn_reloc_adr): Likewise.
(aarch64_ftrace_insn_reloc_ldr_literal): Likewise.
(aarch64_ftrace_insn_reloc_others): Likewise.
(visitor): New.
(aarch64_relocate_instruction): Use visitor.
aarch64_relocate_instruction should only decode instructions, and other
operations should be done out side of it. This patch moves append_insns
out of aarch64_relocate_instruction, to its caller.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_relocate_instruction): Return
int. Add argument buf.
(aarch64_install_fast_tracepoint_jump_pad): Pass buf to
aarch64_relocate_instruction.
This patch is to move target_read_uint32 out of
aarch64_relocate_instruction and pass INSN to
aarch64_relocate_instruction, so that it is cleaner, only decode
instructions.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_relocate_instruction): Add
argument insn. Remove local variable insn. Don't call
target_read_uint32.
(aarch64_install_fast_tracepoint_jump_pad): Call
target_read_uint32.
This patch adds more tests in gdb.arch/insn-reloc.c to cover
instruction BL and cover B.CON when CON is false. These new added
tests can be used for displaced stepping too.
gdb/testsuite:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* gdb.arch/insn-reloc.c (can_relocate_bcond): Rename to ...
(can_relocate_bcond_true): ... it.
(can_relocate_bcond_false): New function.
(foo): Likewise.
(can_relocate_bl): Likewise.
(testcases) [__aarch64__]: Add can_relocate_bcond_false and
can_relocate_bl.
Assume foo_array is a pointer to a C structure. GDB must evaluate the
following expression properly, but it does not currently:
(gdb) print 1 && &foo_array[1].a
Attempt to take address of value not located in memory.
The problem is that in EVAL_AVOID_SIDE_EFFECTS mode,
eval.c:evaluate_subexp_standard always returns a not_lval value as the
result for a STRUCTOP_STRUCT operation. As a consequence, the rest of
the code believes that one cannot take the address of the returned
value.
This patch fixes STRUCTOP_STRUCT handling so that the VALUE_LVAL
attribute for the returned value is properly initialized. After this
change, the above session becomes:
(gdb) print 1 && &foo_array[1].a
$1 = 1
gdb/ChangeLog:
* eval.c (evaluate_subexp_standard) <STRUCTOP_STRUCT>: If
EVAL_AVOID_SIDE_EFFECTS mode, forward the VALUE_LVAL attribute
to the returned value.
gdb/testsuite/ChangeLog:
* gdb.base/nested-addr.c: New file.
* gdb.base/nested-addr.exp: New testcase.
Tested on x86_64-linux, no regression.
This commit fixes a few issues in the mechanism for passing information
about ".org" and ".align" directives from the assembler to the linker,
used by the avr target.
In the original commit fdd410ac7a, there
were some mistakes when writing out information about ".align"
directives:
- An align with fill does not write out its information correctly, the
fill data overwrites the alignment data.
- Each alignment directive is recorded at the location where the
previous alignment directive should be recorded, the first alignment
directive is discarded.
In commit 137c83d69f, the data produced by
objdump is not correct:
- It's miss-aligned due to a missing whitespace.
- The fill data for align with fill records is not displayed
correctly.
All of the above issues are addressed in this commit, and the test is
improved to cover these cases.
binutils/ChangeLog:
* od-elf32_avr.c (elf32_avr_dump_avr_prop): Fix printing of align
specific data, fix formatting for align and org data.
gas/ChangeLog:
* config/tc-avr.c (avr_output_property_record): Fix overwrite bug
for align and fill records.
(avr_handle_align): Record fill information for align frags.
(create_record_for_frag): Add next frag assertion, use correct
address for align records.
gas/testsuite/ChangeLog:
* gas/avr/avr-prop-1.s: Use fill in some cases.
* gas/avr/avr-prop-1.d: Update expected results.
bfd/ChangeLog:
2015-10-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR ld/19083
* elf32-s390.c (elf_s390_gc_sweep_hook): Do not reduce got
refcount for relocs not really requiring a got slot.
* elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
When handling left saturated ashifts with negative immediates, they
should be treated as right ashifts. This matches hardware behavior.
Reported-by: Igor Rayak <igorr@gitatechnologies.com>
This adds a guard that the size of the "unpacked" buffer is large enough
to contain at least BIT_SIZE bits. If not, report an error. This is to
guard this routine from doing buffer overflows when called incorrectly.
gdb/ChangeLog:
* ada-lang.c (ada_unpack_from_contents): Add guard that unpacked
is large enough for BIT_SIZE. Update function comment.
This patch fixes a buffer overflow in ada_unpack_from_contents
caused by one of the previous commits. This happens when trying
to print the value of an array of variant records.
The overflow happens while trying to print one element of the array.
Because the size of each element in the array is variable, the array
has a DWARF byte_stride attribute, which makes us treat the array
as if it was packed. And during the extraction of each array element,
we try to unpack an object using the array's byte stride as the size,
into an element whose size is actually less than the stride.
This patch fixes the issue by overriding the byte-stride with
the actual element's length.
gdb/ChangeLog:
* ada-lang.c (ada_value_primitive_packed_val): Move
src_len variable to local block where used. Override
BIT_SIZE if bigger than size of resolved type.
Just a small cleanup, to avoid code duplication...
gdb/ChangeLog:
* gdbtypes.h (is_scalar_type): Add extern declaration.
* gdbtypes.c (is_scalar_type): Make non-static.
* ada-lang.c (ada_value_primitive_packed_val): Use is_scalar_type
to compute IS_SCALAR instead of doing it ourselves.
There is some partial handling for dynamic types in
ada_value_primitive_packed_val, but this support was added
in a fairly ad hoc way, and actually only covered the situation
where OBJ is not NULL and its contents had not been fetched yet.
In addition, even in the cases that it does cover, it doesn't make
much sense. In particular, it was adjusting BIT_SIZE and SRC_LEN,
which are properties of the data to be extracted _from_, based
on TYPE's length once resolved, which is a property of the data
we want to extract _to_.
This patch hopefully adjust this function to handle dynamic types
correctly, and in all cases. It does so by unpacking the data into
a temporary buffer in order to use that buffer to resolve the type.
And _then_ creates the resulting value from that resolved type.
gdb/ChangeLog:
* ada-lang.c (ada_value_primitive_packed_val): Rework handling
of case where TYPE is dynamic.
This patch is just preparation work which splits the function
ada_value_primitive_packed_val into two function: one which unpacks
the data, and the other which now uses it to implement
ada_value_primitive_packed_val.
This simplifies a bit ada_value_primitive_packed_val, but will also
allow us to use the new function to unpack data without actually creating
a struct value as a result.
gdb/ChangeLog:
* ada-lang.c (ada_unpack_from_contents): New function,
extracted from ada_value_primitive_packed_val.
(ada_value_primitive_packed_val): Replace extracted out code
by call to ada_unpack_from_contents.
This patch just changes the order in which local variables are declared
so as to group the logically-related variables together. No code
change otherwise.
gdb/ChangeLog:
* ada-lang.c (ada_value_primitive_packed_val): Reorder local
variable declarations.
... instead of "unsigned char".
gdb/Changelog:
* ada-lang.c (ada_value_primitive_packed_val): Change the type
of local variables src and unpacked to "gdb_type *" instead of
"unsigned char *".
A number of local variables declared in ada_value_primitive_packed_val
have a name that could, IMO, be improved to, either: Be more explicit
about what the variable is about (Eg: "src" is an index, so rename it
to "src_idx"); or be more consistent with other variables that they
relate to: for instance, several variables refer to the source via
"src" (Eg: srcBitsLeft, nsrc), but the buffer they refer to is called
"bytes", so patch renames "bytes" to "src".
This should help read and understand a little more easily the code
inside this function. No real code change otherwise.
gdb/ChangeLog:
* ada-lang.c (ada_value_primitive_packed_val): Make the name
of various local variables more explicit and consistent.
No real code change otherwise.
There are a bunch of places where a void* is implicitely casted into a
gdb_byte*. The auto-insert-casts script added explicit casts at those
places. However, in many cases, it makes more sense to just change the
void* to a gdb_byte*.
gdb/ChangeLog:
* aarch64-tdep.c (stack_item_t): Change type of data to gdb_byte*.
* arm-tdep.c (struct stack_item): Likewise.
(push_stack_item): Add gdb_byte* cast.
* avr-tdep.c (struct stack_item): Change type of data to gdb_byte*.
(push_stack_item): Add gdb_byte* cast.
* cli/cli-dump.c (dump_memory_to_file): Change type of buf to gdb_byte*
and add cast.
* cris-tdep.c (struct stack_item): Change type of data to gdb_byte*.
(push_stack_item): Add gdb_byte* cast.
* gcore.c (gcore_copy_callback): Change type of memhunk to gdb_byte* and
add cast.
* gdbtypes.h (print_scalar_formatted): Change type of first parameter to
gdb_byte*.
* h8300-tdep.c (h8300_extract_return_value): Change type of valbuf to
gdb_byte* and remove unnecessary cast.
(h8300h_extract_return_value): Likewise.
(h8300_store_return_value): Change type of valbuf to gdb_byte*.
(h8300h_store_return_value): Likewise.
* iq2000-tdep.c (iq2000_extract_return_value): Change type of valbuf to
gdb_byte* and remove unnecessary cast.
* jit.c (jit_reader_try_read_symtab): Change type of gdb_mem to gdb_byte*
and add cast.
* m32r-tdep.c (m32r_store_return_value): Change type of valbuf to
gdb_byte* and remove unnecessary cast.
(m32r_extract_return_value): Change type of dst to gdb_byte* and remove
valbuf.
* mep-tdep.c (mep_pseudo_cr32_read): Change type of buf to gdb_byte*.
(mep_pseudo_cr64_read): Likewise.
(mep_pseudo_csr_write): Likewise.
(mep_pseudo_cr32_write): Likewise.
(mep_pseudo_cr64_write): Likewise.
* mi/mi-main.c (mi_cmd_data_write_memory): Change type of buffer to
gdb_byte* and add cast.
* moxie-tdep.c (moxie_store_return_value): Change type of valbuf to
gdb_byte* and remove unnecessary cast.
(moxie_extract_return_value): Change type of dst to gdb_byte* and remove
valbuf.
* p-valprint.c (print_scalar_formatted): Change type of valaddr to
gdb_byte*.
* printcmd.c (void): Likewise.
* python/py-inferior.c (infpy_read_memory): Change type of buffer to
gdb_byte* and add cast.
(infpy_write_memory): Likewise.
(infpy_search_memory): Likewise.
* regcache.c (regcache_raw_write_signed): Change type of buf to gdb_byte*
and add cast.
(regcache_raw_write_unsigned): Likewise.
(regcache_cooked_write_signed): Likewise.
(regcache_cooked_write_unsigned): Likewise.
* sh64-tdep.c (h64_extract_return_value): Change type of valbuf to
gdb_byte*.
The vdso.exp test checks that we can access the VDSO memory when replaying.
Depending on the line information generated by the compiler, runto_main may run
to the line marked with bp.1 or stop before that line. The test incorrectly
assumes that it will always run to the marked line and fails if it doesn't.
The test does not really care about what is traced. It does care that GDB is
replaying when capturing the second disassemble output.
Reflect that in the test by ignoring the output of the stepping and record goto
begin commands and by checking that GDB is actually replaying.
testsuite/
* gdb.btrace/vdso.c (main): Remove breakpoint markers.
* gdb.btrace/vdso.exp: Change stepping command to "next" and ignore
its output. Ignore the output of "record goto begin" and instead
check that GDB is replaying.
This patch fixes this racy failure, with the native-extended-gdbserver
board:
(gdb) run
Starting program: build/gdb/testsuite/outputs/gdb.base/a2-run/a2-run
Remote debugging from host 127.0.0.1
Process build/gdb/testsuite/outputs/gdb.base/a2-run/a2-run created; pid = 23832
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/libm.so.6 from remote target...
Reading /lib64/libc.so.6 from remote target...
[Inferior 1 (process 23832) exited with code 01]
(gdb) FAIL: gdb.base/a2-run.exp: run "a2-run" with no args
PASS: gdb.base/a2-run.exp: no spurious messages at program exit
run 5
Starting program: build/gdb/testsuite/outputs/gdb.base/a2-run/a2-run 5
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
usage: factorial <number>
Child exited with status 1
Note that the output is correct; it's just that inferior output
appeared after gdb's output, and the test doesn't handle that
correctly.
This comment isn't really correct, unfortunately:
# waiting. If we had already seen the status wrapper exit,
# gdb_test_multiple/expect has no spawn ids left, and thus
# returns.
That's true of expect in general, but I had missed / forgot that
gdb_test_multiple internally has extra matches using "-i
$gdb_spawn_id", so even if the caller clears all the indirect spawn id
lists, gdb_test_multiple will continue waiting.
So do a conditional exp_continue manually instead.
gdb/testsuite/ChangeLog:
2015-10-09 Pedro Alves <palves@redhat.com>
* gdb.base/a2-run.exp (maybe_exp_continue): New procedure.
(top level): Use it in the run with no args test.
gdb/ChangeLog:
* d-exp.y: (UnaryExpression): Support `type.sizeof' expressions.
(PostfixExpression): Support `expr.sizeof' expressions.
(PrimaryExpression): Support `typeof(expr)' expressions.
gdb/testsuite/ChangeLog:
* gdb.dlang/properties.exp: New file.
record_btrace_resume returns the void return from the to_resume method of the
target beneath. Split this into calling to_resume and return.
gdb/
* record-btrace.c (record_btrace_resume): Fix void return.
'template' is used in include/opcode/aarch64.h as below,
typedef struct
{
const char *template;
uint32_t value;
int has_xt;
} aarch64_sys_ins_reg;
and it triggers compilation errors when GDB is built in C++ mode.
In file included from git/gdb/aarch64-tdep.c:62:0:
git/gdb/../include/opcode/aarch64.h:651:15: error: expected unqualified-id before 'template'
const char *template;
This patch is to rename field template to name.
gas/
* config/tc-aarch64.c (md_begin): Access field 'name' rather
than 'template'.
include/opcode/
* aarch64.h (aarch64_sys_ins_reg) <template>: Removed.
<name>: New field.
opcodes/
* aarch64-dis.c (aarch64_ext_sysins_op): Access field
'name' rather than 'template'.
* aarch64-opc.c (aarch64_print_operand): Likewise.
This is sufficient to link an aarch64 GDB built in C++ mode. Pedro
did something similar in Feb
https://sourceware.org/ml/binutils/2015-02/msg00176.html
include/opcode/
2015-10-07 Yao Qi <yao.qi@linaro.org>
* aarch64.h [__cplusplus]: Wrap in extern "C".