When running GDB's reverse debugging testsuite against a few ARM
multilibs, i noticed failures in the machinestate* testcases.
Further investigation showed that push and pop instruction encodings
A1 and A2 were not being handled properly, thus we missed saving
important contents from registers and memory. When going backwards,
such contents were not restored and thus we ended up with a corrupted
state that did not correspond to the real values we had at a
particular point in time.
Attached is a patch that fixes around 36 failures for both
gdb.reverse/machinestate.exp and
gdb.reverse/machinestate-precsave.exp testcases, making them fully
pass. This is for both armv7 and armv4. I still see failures for
armv4 thumb though, so it needs a bit more investigation.
I see no regressions due to this patch for armv7, armv7 thumb, armv4
and armv4 thumb.
gdb/ChangeLog:
* arm-tdep.c (INSN_S_L_BIT_NUM): Document.
(arm_record_ld_st_imm_offset): Reimplement to cover all
load/store cases for ARM opcode 010.
(arm_record_ld_st_multiple): Reimplement to cover all
load/store cases for ARM opcode 100.
This commit modifies the code that prints attach and detach messages
related to following fork and vfork. The changes include using
target_terminal_ours_for_output instead of target_terminal_ours,
printing "vfork" instead of "fork" for all vfork-related messages,
and using _() for the format strings of all of the messages.
We also add a "detach" message for when a fork parent is detached.
Previously in this case the only message was notification of attaching
to the child. We still do not print any messages when following the
parent and detaching the child (the default). The rationale for this
is that from the user's perspective the new child was never attached.
Note that all of these messages are only printed when 'verbose' is set
or when debugging is turned on.
The tests gdb.base/foll-fork.exp and gdb.base/foll-vfork.exp were
modified to check for the new message.
Tested on x64 Ubuntu Lucid, native only.
gdb/ChangeLog:
* infrun.c (follow_fork_inferior): Update fork message printing
to use target_terminal_ours_for_output instead of
target_terminal_ours, to use _() for all format strings, to print
"vfork" instead of "fork" for vforks, and to add a detach message.
(handle_vfork_child_exec_or_exit): Update message printing to use
target_terminal_ours_for_output instead of target_terminal_ours, to
use _() for all format strings, and to fix some formatting.
gdb/testsuite/ChangeLog:
* gdb.base/foll-fork.exp (test_follow_fork,
catch_fork_child_follow): Check for updated fork messages emitted
from infrun.c.
* gdb.base/foll-vfork.exp (vfork_parent_follow_through_step,
vfork_parent_follow_to_bp, vfork_and_exec_child_follow_to_main_bp,
vfork_and_exec_child_follow_through_step): Check for updated vfork
messages emitted from infrun.c.
gdb/ChangeLog:
* gnu-v3-abi.c (gnuv3_pass_by_reference): Call TYPE_TARGET_TYPE
on the arg type of a constructor only if it is of reference type.
gdb/testsuite/ChangeLog:
* gdb.cp/non-trivial-retval.cc: Add a test case.
* gdb.cp/non-trivial-retval.exp: Add a test.
2014-10-22 Tejas Belagod <tejas.belagod@arm.com>
bfd/
* bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter.
* bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise.
* elfnn-aarch64.c (aarch64_erratum_835769_stub): New.
(elf_aarch64_stub_type): Add new type
aarch64_stub_erratum_835769_veneer.
(elf_aarch64_stub_hash_entry): New fields for erratum 835769.
(aarch64_erratum_835769_fix): New data struct to record erratum
835769.
(elf_aarch64_link_hash_table: Global flags for 835769.
(aarch64_build_one_stub): Add case for 835769.
(aarch64_size_one_stub): Likewise.
(aarch64_mem_op_p, aarch64_mlxl_p,
aarch64_erratum_sequence,erratum_835769_scan):
New. Decode and scan functions for erratum 835769.
(elf_aarch64_create_or_find_stub_sec): New.
(elfNN_aarch64_size_stubs): Look for erratum 835769 and record
them.
(bfd_elfNN_aarch64_set_options: Set global flag for 835769.
(erratum_835769_branch_to_stub_data,
make_branch_to_erratum_835769_stub):New. Connect up all the
erratum stubs to occurances by branches.
(elfNN_aarch64_write_section): New hook.
(aarch64_map_one_stub): Output erratum stub symbol.
(elfNN_aarch64_size_dynamic_sections): Init mapping symbol
information for erratum 835769.
(elf_backend_write_section): Define.
ld/
* emultempl/aarch64elf.em: Add command-line option for erratum
835769.
ld/testsuite/
* ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum
835769 tests.
* ld-aarch64/erratum835769.d: New.
* ld-aarch64/erratum835769.s: New.
elf32_arm_plt0_size and elf32_arm_plt_size read instructions
to determine what is size of PLT entry. However it does not
read instruction correctly in case of ARM big endian V7 case.
In this case instructions are still kept in little endian
order (BE8).
* elf32-arm.c (read_code32): New function to read 32 bit
arm instruction.
(read_code16): New function to read 16 bit thumb instrution.
(elf32_arm_plt0_size, elf32_arm_plt_size): Use read_code32
and read_code16 to read instructions.
bfd/
* elfxx-mips.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.
binutils/
* readelf.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.
include/
* elf/mips.h (AFL_ASE_MASK): Define.
This makes sure `HAVE_CODE_COMPRESSION' evaluates correctly when the
`.insn' directive is used at the beginning of a source file before any
instructions have been produced and that ELF file header's MIPS16 and
microMIPS ASE flags are set correctly in the case where no instructions
have been produced other than with the said directive.
gas/
* config/tc-mips.c (s_insn): Set file options.
gas/testsuite/
* gas/mips/insn-opts.d: New test.
* gas/mips/insn-opts.s: New test source.
* gas/mips/mips.exp: Run the new test.
This patch adds -mcpu=thunderx support to gas.
OK? Tested with no regressions.
ChangeLog:
* config/tc-aarch64.c (aarch64_cpus):
Add thunderx.
* doc/c-aarch64.texi: Document that thunderx
is a valid processor name.
The code in ppc64_elf_tls_optimize looking at the .toc is only
interested in .toc entries that are addresses. .toc can contain more
than just an array of addresses, so if we have items that aren't
8-byte aligned, ignore them.
* elf64-ppc.c (ppc64_elf_tls_optimize): Ignore relocs against toc
entries that aren't a multiple of 8 rather than failing assertion.
The construct being added to the cond.s test case otherwise triggered
both the "missing closing ..." and the "stray ..." (twice) warnings in
_find_end_of_line(). As that code fragments suggests, this is needed to
support (include) files that can be used for both assembler .include
and compiler #include directives.
Asserting "idx" to be non-negative when subsequent code handles this
case is bogus. In fact the assertion triggers e.g. when mistakenly
using the arm32 comment character @ following an instruction.
While doing this I also noticed that despite there being local
variables "detail" and "idx", not all places where they could be used
did actually make use of them, so this is being adjusted at once.
Finally, for the code to be slightly more robust, also change
comparisons against -1 to such checking for a (non-)negative value.
powerpc64 ld builds plt call stubs with a read barrier to provide
thread safety on lazy plt updates, necessary on multi-threaded apps
with power7 or later weakly ordered memory. gcc-4.9 libgomp
introduced more functions that could call pthread_create, which means
we have more functions that if referenced in an executable should
cause a default of --plt-thread-safe.
* elf64-ppc.c (ppc64_elf_size_stubs): Add gcc-4.9 libgomp functions
to thread_starter.
First:
"Breakpoint.delete" is missing parenthesis.
Second:
Someone on IRC asked, how come there is no disable() method in the
Breakpoint object. It turns out you have to do "bp.enabled = False".
Since every normal person would probably search for "disable" in that page
if their intent is to disable a python breakpoint, I thought it would be
useful if the description contained "disable" so it would be easy to find.
The result might seem a bit silly and redundant, so I am open to
suggestions.
gdb/doc/ChangeLog:
* python.texi (Breakpoints In Python): Add parenthesis after
Breakpoint.delete. Clarify Breakpoint.enabled description so
that it contains "disable".
Patch <https://sourceware.org/ml/gdb-patches/2011-07/msg00225.html> was
to fix the problem that py-objfile-script-gdb.py is removed after an
in-tree build and test. As a result of the previous patch (we don't
remove files copied to host any more), this patch is no longer needed.
This patch is to revert it logically.
gdb/testsuite:
2014-10-20 Yao Qi <yao@codesourcery.com>
* gdb.python/py-objfile-script-gdb.py.in: Rename it to ...
* gdb.python/py-objfile-script-gdb.py: New file.
* gdb.python/py-objfile-script.exp: Update reference to
py-objfile-script-gdb.py.in. Use gdb_remote_donwload instead
of remote_download. Remove the dest file.
Nowadays, if we do in-tree build and run tests sequentially, some source
files are removed, due to the following pattern:
set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt]
remote_exec host "rm -f $pi_txt"
If testing is run sequentially, file ${srcdir}/${subdir}/pi.txt is
copied to ${objdir}/${subdir}/pi.txt. However, ${objdir} is ${srcdir}
in the in-tree build/test, so the file is coped to itself, as a nop.
As a result, the file in source is removed at the end of test.
This patch fixes this problem by not removing files copied to host in
each test. This patch also addresses the question we've had that why
don't we keep files copied to host because they are needed to reproduce
certain fails.
gdb/testsuite:
2014-10-20 Yao Qi <yao@codesourcery.com>
* gdb.base/checkpoint.exp: Don't remove file copied on host.
* gdb.base/step-line.exp: Likewise.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
* gdb.dwarf2/dw2-basic.exp: Likewise.
* gdb.dwarf2/dw2-compressed.exp: Likewise.
* gdb.dwarf2/dw2-filename.exp: Likewise.
* gdb.dwarf2/dw2-intercu.exp: Likewise.
* gdb.dwarf2/dw2-intermix.exp: Likewise.
* gdb.dwarf2/dw2-producer.exp: Likewise.
* gdb.dwarf2/mac-fileno.exp: Likewise.
* gdb.python/py-frame-args.exp: Likewise.
* gdb.python/py-framefilter.exp: Likewise.
* gdb.python/py-mi.exp: Likewise.
* gdb.python/py-objfile-script.exp: Likewise
* gdb.python/py-pp-integral.exp: Likewise.
* gdb.python/py-pp-re-notag.exp: Likewise.
* gdb.python/py-prettyprint.exp: Likewise.
* gdb.python/py-section-script.exp: Likewise.
* gdb.python/py-typeprint.exp: Likewise.
* gdb.python/py-xmethods.exp: Likewise.
* gdb.stabs/weird.exp: Likewise.
* gdb.xml/tdesc-regs.exp: Likewise.
This patch fixes the failures that occur with the
gdb.dwarf2/dw2-dir-file-name.exp test on 64-bit MIPS and compressed
MIPS ISAs (i.e. MIPS16 and microMIPS).
The failures on 64-bit occur because the generated DWARF address
information is always 32-bit, which causes the upper 32-bits of
addresses to be truncated and causes breakpoints to be set on the
wrong address if any of the upper 32-bits are non-zero. I suspect
that other 64-bit architectures get away with it because they
place all their instructions at a VMA lower than 2^32 by default.
This patch causes 64-bit addresses to be generated if a 64-bit
target is detected.
The failures on MIPS16 and microMIPS occur because the breakpoint
address needs to have the LSB set to 1 (used to indicate that the
code is compressed). However, the function name is interpreted as
a data label, causing GDB to set breakpoints at even addresses.
This is fixed by explicitly adding a '.insn' directive (see
https://sourceware.org/binutils/docs/as/MIPS-insn.html) after the
label on MIPS only.
gdb/testsuite/
2014-10-18 Kwok Cheung Yeung <kcy@codesourcery.com>
* gdb.dwarf2/dw2-dir-file-name.exp (addr_len): New.
(out_cu): Use addr_len for the size of addresses.
(out_line): Likewise. Size DW_LNE_set_address instruction
according to addr_len.
* gdb.dwarf2/dw2-dir-file-name.c (START_INSNS): New.
(FUNC): Add START_INSNS to definition.
I see the following two fails on arm-none-eabi target, because argv[0]
isn't available.
print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept directory symbolic link name
My first thought is to check [target_info exists noargs], and skip the
test if it returns true. However, noargs is set in gdbserver board
files, so argv0-symlink.exp will be skipped on gdbserver board file.
The change is too aggressive.
When the program is running with gdbserver, argv[1] to argv[N] aren't
available, but argv[0] is. Fortunately, argv0-symlink.exp only
requires argv[0]. argv0-symlink.exp can be run with gdbserver board
file, as what we do now.
What we need to check is whether argv[0] is available, so I add a new
proc gdb_has_argv0 to do so by starting a program, and check
argc/argv[0] to see whether argv[0] is available.
Dan fixed the similar problem by checking noargs, which is too strong.
https://sourceware.org/ml/gdb-patches/2010-02/msg00398.html as a
result, the test is skipped on gdbserver. This patch fixed it too.
gdb/testsuite:
2014-10-18 Yao Qi <yao@codesourcery.com>
* gdb.base/argv0-symlink.exp: Check argv[0] value if
gdb_has_argv0 return true.
* gdb.guile/scm-value.exp (test_value_in_inferior): Don't
check [target_info exists noargs], check [gdb_has_argv0]
instead.
* gdb.python/py-value.exp (test_value_in_inferior): Likewise.
* lib/gdb.exp (gdb_has_argv0, gdb_has_argv0_1): New
procedures.
When functions are emitted in comdat groups, global symbols defined in
duplicates of the group are treated as if they were undefined. That
prevents the symbols in the discarded sections from affecting the
linker's global symbol hash table or causing duplicate symbol errors.
Annoyingly, when gcc emits a function to a comdat group, it does not
put *all* of a function's code and data in the comdat group.
Typically, constant tables, exception handling info, and debug info
are emitted to normal sections outside of the group, which is a
perennial source of linker problems due to the special handling needed
to deal with the extra-group pieces that ought to be discarded. In
the case of powerpc64-gcc, the OPD entry for a function is not put in
the group. Since the function symbol is defined on the OPD entry this
means we need to handle symbols in .opd specially.
To see how this affects LTO in particular, consider the linker
testcase PR ld/12942 (1). This testcase links an LTO object file
pr12942a.o with a normal (non-LTO) object pr12942b.o. Both objects
contain a definition for _Z4testv in a comdat group. On loading
pr12942a.o, the linker sees a comdat group (actually linkonce section)
for _Z4testv and a weak _Z4testv defined in the IR. On loading
pr12942b.o, the linker sees the same comdat group, and thus discards
it. However, _Z4testv is a weak symbol defined in .opd, not part of
the group, so this weak symbol overrides the weak IR symbol. On
(re)loading the LTO version of pr12942a.o, the linker sees another
weak _Z4testv, but this one does not override the value we have from
pr12942b.o. The result is a linker complaint about "`_Z4testv'
... defined in discarded section `.group' of tmpdir/pr12942b.o".
* elf64-ppc.c (ppc64_elf_add_symbol_hook): If function code
section for function symbols defined in .opd is discarded, let
the symbol appear to be undefined.
(opd_entry_value): Ensure the result section is that for the
function code section in the same object as the OPD entry.
The write.c change is to make gas report an error if reg_section
symbols should leak in future. The tc-i386.c change is the real fix.
Note that the error isn't the most helpful, "redefined symbol cannot
be used on reloc", but I'm not inclined to improve what is really an
internal gas error. reg_section symbols shouldn't leak..
gas/
PR 17493
* write.c (adjust_reloc_syms): Don't allow symbols in reg_section
to be reduced to reg_section section symbol.
* gas/config/tc-i386.c (i386_finalize_immediate): Reject all
reg_section immediates.
gas/testsuite/
* gas/i386/inval-equ-2.l: Adjust.
This patch annotates the following SPARC instructions as VIS3B
instructions: ldx *, %efsr, fpadd64, fpsub64, fpcmpule8, fpcmpune8,
fpcmpugt8, fpcmpueq8. It also improves the documentation of the VIS3B
capability in several headers.
Tested in sparc64-unknown-linux-gnu and sparc-unknown-linux-gnu.
No visible regressions.
opcodes/ChangeLog:
2014-10-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (sparc-opcodes): Annotate several instructions with
the HWCAP2_VIS3B hwcap.
include/opcodes/ChangeLog:
2014-10-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc.h (HWCAP2_VIS3B): Documentation improved.
include/elf/ChangeLog:
2014-10-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc.h (ELF_SPARC_HWCAP2_VIS3B): Documentation improved.
This patch fixes the hwcap entries in `sparc-opcodes' (which were
incorrectly located in the flags field) for the following
instructions:
wr r,r,%sys_tick
wr r,i,%sys_tick
wr r,r,%sys_tick_cmpr
wr r,i,%sys_tick_cmpr
edge8n edge8ln edge16n edge16ln edge32n edge32ln
bmask bshuffle siam
Tested in sparc-unknown-linux-gnu and sparc64-unknown-linux-gnu.
No visible regressions.
opcodes/ChangeLog:
2014-10-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (sparc-opcodes): Fix several misplaced hwcap
entries.