PR 23481
* config/tc-pdp11.c (parse_op_noreg): Check for deferred register
addressing before assuming non-deferred addressing.
* testsuite/gas/pdp11/pr23481.s: New test source file.
* testsuite/gas/pdp11/pr23481.d: New test driver file.
* testsuite/gas/pdp11/pdp11.exp: Run the new test.
A recent patch introduced a few of these:
/home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security]
error (err_msg);
^
Fix them by replacing the call to error with
error ("%s", err_msg);
gdb/ChangeLog:
* remote.c (remote_target::download_tracepoint): Fix format
string errors.
gold/
* target.h (Sized_target::record_gnu_property): Change first two
parameters to unsigned int.
* x86_64.cc (Target_x86_64::record_gnu_property): Likewise.
The tracefile.c:trace_save function assumes trace_regblock_size won't
be larger than the MAX_TRACE_UPLOAD constant, used to size the buffer
which holds trace data. This can cause buffer overruns when this is
not the case. This patch changes this function so that the larger
size is used to size the buffer.
gdb/ChangeLog:
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* tracefile.c: Include common/byte-vector.h.
(trace_save): Change type of buf to gdb::byte_vector. Initialize
with trace_regblock_size if needed. Update uses of buf.
This patch changes collection_list to allow larger register masks.
The mask is changed from an array to a vector and is initialized to
hold the maximum possible remote register number. The stringify
method is updated to resize temp_buf if needed.
gdb/ChangeLog:
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* tracepoint.h (collection_list) <m_regs_mask>: Change type to
std::vector<unsigned char>.
* tracepoint.c (collection_list::collection_list): Remove
m_regs_mask initializer from initializer list. Resize
m_regs_mask using the largest remote register number.
(collection_list::add_remote_register): Remove size check on
m_regs_mask. Use at to access element.
(collection_list::stringify): Change type of temp_buf to
gdb::char_vector. Update uses of temp_buf. Resize if needed to
stringify the register mask. Use pack_hex_byte for the register
mask.
Currently, tracepoint register masks in the QTDP packets include both
internal and remote register numbers, as well as pseudo-register
numbers.
This patch changes this so that the mask only includes remote register
numbers.
Register numbers from agent expressions are already set in the mask
using remote numbers. Other tracepoint actions used internal numbers,
e.g. "collect $regs" or "collect $<pseudoreg>". To handle pseudoreg
numbers, an empty agent expression is created and ax_reg_mask is
called for this expression and the pseudoreg. This will cause the ax
to set its mask with the corresponding remote raw register
numbers (using ax_regs_mask, which calls
gdbarch_ax_pseudo_register_collect).
If ax_regs_mask and gdbarch_ax_pseudo_register_collect also generate
more ax bytecode, the ax is also appended to the collection list. It
isn't clear that this was the original intent for
gdbarch_ax_pseudo_register_collect, and none of the arches seem to do
this, but if this changes in the future, it should work.
The patch also refactors the code used by validate_action line to
validate axs into a function that is now called from every place that
generates axs. Previously, some parts of tracepoint.c that generated
axs didn't check if the ax length was greater than MAX_AGENT_EXPR_LEN.
gdb/ChangeLog:
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* tracepoint.h (class collection_list) <add_register>: Remove.
<add_remote_register, add_ax_registers, add_local_register>:
Declare.
<add_memrange>: Add scope parameter.
* tracepoint.c (encode_actions_1): Likewise.
(collection_list::add_register): Rename to ...
(collection_list::add_remote_register): ... this. Update
comment.
(collection_list::add_ax_registers, add_local_register): New
methods.
(collection_list::add_memrange): Add scope parameter. Call
add_local_register instead of add_register.
(finalize_tracepoint_aexpr): New function.
(collection_list::collect_symbol): Update calls to add_memrange.
Call add_local_register instead of add_register. Call
add_ax_registers. Call finalize_tracepoint_aexpr.
(encode_actions_1): Get remote regnos for $reg action. Call
add_remote_register, add_ax_registers, and add_local_register.
Update call to add_memrange. Call finalize_tracepoint_aexpr.
(validate_actionline): Call finalize_tracepoint_aexpr.
This patch changes the remote target to use the remote packet size to
build QTDP packets, and to check if there is enough room for the
packet.
I changed the function to raise an error if the packet is too small,
instead of aborting gdb (through xsnprintf). It isn't clear if gdb
will be in a consistent state with respect to the stub after this,
since it's possible that some packets will be sent but not others, and
there could be an incomplete tracepoint on the stub.
The char array used to build the packets is changed to a
gdb::char_vector and sized with the result from
get_remote_packet_size.
When checking if the buffer is large enough to hold the tracepoint
condition agent expression, the length of the expression is multiplied
by two, since it is encoded with two hex digits per expression
byte. For simplicity, I assume that the result won't overflow, which
can happen for very long condition expressions.
gdb/ChangeLog:
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* remote.c (remote_target::download_tracepoint): Remove BUF_SIZE.
Replace array buf with gdb::char_vector buf, of size
get_remote_packet_size (). Replace references to buf and
BUF_SIZE to buf.data () and buf.size (). Replace strcpy, strcat
and xsnprintf with snprintf. Raise errors if the buffer is too
small.
The has_more predicate in remote_target::download_tracepoint always
evaluates to true, so the last action packet will be sent with a
trailing '-'. This patch changes the predicate to remove the last
trailing '-'.
gdb/ChangeLog:
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* remote.c (remote_target::download_tracepoint): Fix the has_more
predicate in the QTDP action list iteration.
gdb/ChangeLog:
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* remote.c (remote_target::download_tracepoint): Fix indentation
in for block.
When looking at the gdb.sum file produced by dg-extract-results.sh on
Solaris 11/x86, I noticed some wrong sorting, like this:
PASS: gdb.ada/addr_arith.exp: print something'address + 0
PASS: gdb.ada/addr_arith.exp: print 0 + something'address
PASS: gdb.ada/addr_arith.exp: print something'address - 0
PASS: gdb.ada/addr_arith.exp: print 0 - something'address
Looking closer, I noticed that while dg-extract-results.sh had been
copied over from contrib in the gcc repo, the corresponding
dg-extract-results.py file had not. The latter not only fixes the
sorting problem I'd observed, but is also way faster than the shell
version (like a factor of 50 faster).
Therefore I propose to update both files from the gcc repo. The changes
to the .sh version are trivial, just counting the number of DejaGnu
ERROR lines, too.
The files are moved to toplevel contrib:
* This way, they can easily be used should someone decide to parallelize
one or more of the binutils, gas, or ld testsuites.
* They are less easily overlooked for updates from the gcc repo when
they reside in the same place in both.
* The test_summary script needs to live in contrib since the toplevel
Makefile's mail-report.log target expects it there.
Tested on amd64-pc-solaris2.11 with
make -j16 check
and
make -j16 -k RACY_ITER=5 check
gdb/testsuite:
* dg-extract-results.sh: Move to toplevel contrib.
* Makefile.in (check-parallel): Reflect dg-extract-results.sh move.
* Makefile.in (check-parallel-racy): Likewise.
contrib:
* dg-extract-results.sh: Move from gdb/testsuite.
Update from gcc repo.
* dg-extract-results.py: New from gcc repo.
Check if an input asm file is rf16 compliant; if not, and the tag says
otherwise, fix the tag and emit a warning.
gas/
2017-09-20 Claudiu Zissulescu <claziss@synopsys.com>
* config/tc-arc.c (rf16_only): New static variable.
(autodetect_attributes): Check if we are rf16 compliant.
(arc_set_public_attributes): Fix and emit the warning is required.
* testsuite/gas/arc/attr-rf16.d: New file.
* testsuite/gas/arc/attr-rf16.err: Likewise.
* testsuite/gas/arc/attr-rf16.s: Likewise.
MWDT compiler doesn't use eflags and makes use of 0x0c section. For
those, silence the gnu warning system.
bfd/
Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (arc_elf_merge_private_bfd_data): Complain about
efalgs only when in/out exists.
(elf32_arc_section_from_shdr): Don't complain about 0x0c section
type. It is mwdt compiler specific.
Not all targets support scheduler-locking. Add a check to see if the
taraget supports scheduler locking, and if it doesn't, don't run the
scheduler-locking tests that will otherwise fail.
There are actually a set of tests that try to use scheduler-locking
however, in most of these cases the test will not be run on smaller
targets (those that might not support threads and scheduler-locking)
due to the targets lack of support for threads, or some other larger
feature.
In the gdb.mi/mi-cmd-param-changed.exp test though, there's no
dependence on threads, or any other larger feature, and so, for the
small target I was using the test would otherwise try to run, only to
fail due to lack of support for scheduler-locking.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (target_supports_scheduler_locking): New proc.
* gdb.mi/mi-cmd-param-changed.exp: Only run scheduler locking
tests if the target supports scheduler locking.
The MIPS target supports 127 signals, and this can create an ambiguity
in process wait statuses. A status value of 0x007f could potentially
indicate a process that has exited with signal 127, or a process that
has stopped with signal 0.
In uClibc-ng the interpretation of 0x007f is that the process has
exited with signal 127 rather than stopped with signal 0, and so,
WIFSTOPPED (W_STOPCODE (0)) will be false rather than true as it would
be on most other platforms.
Given that it's pretty easy to avoid using W_STOPCODE (0), lets do that.
gdb/ChangeLog:
* linux-nat.c (linux_nat_target::follow_fork): Avoid using
'W_STOPCODE (0)' as this could be ambiguous.
evex-no-scale.s has ELF directive:
.section .probe, "", @progbits
and non-ELF targets may pad text sections.
* testsuite/gas/i386/i386.exp: Run evex-no-scale-32 and
evex-no-scale-64 only for ELF targets.
* testsuite/gas/i386/prefix32.s: Append ".p2align 4,0".
* testsuite/gas/i386/prefix64.s: Likewise.
* testsuite/gas/i386/prefix32.l: Updated.
* testsuite/gas/i386/prefix64.l: Likewise.
R_PPC64_REL24_NOTOC is used on calls like "bl foo@notoc" to tell the
linker that linkage stubs for PLT calls or long branches can't use r2
for pic addressing. Instead, new stubs that generate pc-relative
addresses are used. One complication is that pc-relative offsets to
the PLT may need to be 64-bit in large programs, in contrast to the
toc-relative addressing used by older PLT linkage stubs where a 32-bit
offset is sufficient until the PLT itself exceeds 2G in size.
.eh_frame info to cover the _notoc stubs is yet to be implemented.
bfd/
* elf64-ppc.c (ADDI_R12_R11, ADDI_R12_R12, LIS_R12),
(ADDIS_R12_R11, ORIS_R12_R12_0, ORI_R12_R12_0),
(SLDI_R12_R12_32, LDX_R12_R11_R12, ADD_R12_R11_R12): Define.
(ppc64_elf_howto_raw): Add R_PPC64_REL24_NOTOC entry.
(ppc64_elf_reloc_type_lookup): Support R_PPC64_REL24_NOTOC.
(ppc_stub_type): Add ppc_stub_long_branch_notoc,
ppc_stub_long_branch_both, ppc_stub_plt_branch_notoc,
ppc_stub_plt_branch_both, ppc_stub_plt_call_notoc, and
ppc_stub_plt_call_both.
(is_branch_reloc): Add R_PPC64_REL24_NOTOC.
(build_offset, size_offset): New functions.
(plt_stub_size): Support plt_call_notoc and plt_call_both.
(ppc_build_one_stub, ppc_size_one_stub): Support new stubs.
(toc_adjusting_stub_needed): Handle R_PPC64_REL24_NOTOC.
(ppc64_elf_size_stubs): Likewise, and new stubs.
(ppc64_elf_build_stubs, ppc64_elf_relocate_section): Likewise.
* reloc.c: Add BFD_RELOC_PPC64_REL24_NOTOC.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Support @notoc.
(ppc_force_relocation, ppc_fix_adjustable): Handle REL24_NOTOC.
ld/
* testsuite/ld-powerpc/ext.d,
* testsuite/ld-powerpc/ext.s,
* testsuite/ld-powerpc/ext.lnk,
* testsuite/ld-powerpc/notoc.d,
* testsuite/ld-powerpc/notoc.s: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
Not a lot is conveyed by putting _r2off in a stub symbol that can't be
seen by inspecting the stub code or the toc restoring instruction
immediately after a call via such a stub. Also, we don't distinguish
plt_call stub symbols from plt_call_r2save stub symbols, so this patch
makes long branch and plt branch stub symbols consistent with that
decision.
bfd/
* elf64-ppc.c (ppc_build_one_stub): Lose "_r2off" in stub symbols.
ld/
* testsuite/ld-powerpc/elfv2exe.d: Adjust for stub symbol change.
* testsuite/ld-powerpc/tocopt6.d: Likewise.
This fails for me on openSUSE leap 15.0:
...
FAIL: gdb.python/py-rbreak.exp: check number of returned breakpoints is 11
...
The rbreak "" command expects 11 breaks, but I see two extra for
__libc_csu_fini and __libc_csu_init:
...
Breakpoint 13 at 0x4005b0: file elf-init.c, line 106.^M
Breakpoint 14 at 0x400540: file elf-init.c, line 68.^M
...
This patch fixes the failing test by excluding functions starting with an
underscore.
Tested on x86_64-linux.
2018-08-04 Tom de Vries <tdevries@suse.de>
* gdb.python/py-rbreak.exp: Fix rbreak regexp.
The .note.gnu.property section should be aligned to 4 bytes for x32.
* testsuite/ld-x86-64/property-x86-3.s: Use ".p2align 2" to
align .note.gnu.property section if __64_bit__ is undefined.
This patch fixes a thinko that happened when I was implementing the
IPv6 support on GDB/gdbserver. On certain situations, it is necessary
to disable TCP's Nagle algorithm (NODELAY). For obvious reasons, this
only applies when we are dealing with a TCP connection.
While implementing the IPv6 patch, I noticed that the net_open
function (on gdb/ser-tcp.c) kept a flag indicating whether the
connection type was UDP or TCP. I eliminated that flag, and started
using the 'struct addrinfo *' related to the successful connection
directly. However, I made a mistake:
if (success_ainfo->ai_socktype == IPPROTO_TCP)
^^^^^^^^^^^
{
/* Disable Nagle algorithm. Needed in some cases. */
int tmp = 1;
setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY,
(char *) &tmp, sizeof (tmp));
}
The 'ai_socktype' field specifies the socket type (SOCK_STREAM or
SOCK_DGRAM), and not the protocol. This test was always failing, and
the Nagle algorithm was never being disabled.
The obvious fix is to use the 'ai_protocol' field. This is what this
patch does.
Huge "thank you" to Joel Brobecker who reported the regression (he was
experiencing an unusual delay while debugging a bare-metal program
running under QEMU) and helped me set up a proper reproducer for the
bug.
gdb/ChangeLog:
2018-08-03 Sergio Durigan Junior <sergiodj@redhat.com>
* ser-tcp.c (net_open): Fix thinko when deciding whether to
disable TCP's Nagle algorithm (use "ai_protocol" instead of
"ai_socktype").
A small rework of the PRU GCC port exposed that CIE data alignment is
erroneously set to 4 for PRU in GAS. In fact PRU stack must be aligned to 1.
Set the macro to -1, to allow output from GCC to be assembled without errors.
Also, while at it, set DWARF2 HW register numbering to follow latest
* config/tc-pru.c (pru_regname_to_dw2regnum): Return the starting HW
byte-register number.
(pru_frame_initial_instructions): Use byte-numbering for FP index.
* config/tc-pru.h (DWARF2_DEFAULT_RETURN_COLUMN): Use number from
latest GCC.
(DWARF2_CIE_DATA_ALIGNMENT): Set to -1.
PR symtab/16842 shows that gdb will crash when the user tries to
invoke "info address" of a template parameter.
The bug here is that dwarf2read.c does not set the symtab on the
template parameter symbols. This is pedantically correct, given that
the template symbols do not appear in a symtab. However, gdb
primarily uses the symtab backlink to find the symbol's objfile. So,
this patch simply sets the symtab on these symbols.
Tested by the buildbot.
gdb/ChangeLog
2018-08-02 Tom Tromey <tom@tromey.com>
PR symtab/16842.
* dwarf2read.c (read_func_scope): Set symtab on template parameter
symbols.
(process_structure_scope): Likewise.
gdb/testsuite/ChangeLog
2018-08-02 Tom Tromey <tom@tromey.com>
PR symtab/16842.
* gdb.cp/temargs.exp: Test "info address" of a template
parameter.
Starting with MacOS version Sierra, the gdb kill command
seems to work but inferior remains as zombie on the host.
Notice that, as zombie process, the inferior is not killable
by the user, nor by root.
The kill signal gdb sent to the inferior is not handled
in gdb as a signal sent by gdb thus no reply is made and
the process remains (since MacOS does not "release" the
inferior because no reply have been made to the signal
message).
This patch fixes this problem.
gdb/ChangeLog
2018-08-02 Xavier Roirand <roirand@adacore.com>
PR gdb/22629:
* darwin-nat.c (darwin_kill_inferior): Fix handling of
kill inferior.
I noticed that the existing kill-detach-inferiors-cmd.exp test was
causing gdb to crash on macOS 10.13. The bug was that an inferior
that hadn't yet been started would cause get_darwin_inferior to return
NULL, and this was not checked.
I went through the places calling get_darwin_inferior and added checks
where appropriate. This makes the test get a bit further. Not all of
these spots are exercised by the test, but they seem safe enough in
any case.
gdb/ChangeLog
2018-08-02 Tom Tromey <tom@tromey.com>
* darwin-nat.c (find_inferior_task_it, darwin_find_thread)
(darwin_suspend_inferior, darwin_resume_inferior)
(darwin_decode_notify_message, darwin_resume_inferior_threads)
(darwin_check_new_threads): Check result of get_darwin_inferior.
Add a testcase to limit open files to 16 for AR with plugin. Before
commit 103da91bc0
Author: Nick Clifton <nickc@redhat.com>
Date: Wed Aug 1 14:34:41 2018 +0100
Close resource leaks in the BFD library's plugin handler.
it failed with:
../binutils/ar: tmpdir/pr23460f.o: plugin needed to handle lto object
PR binutils/23460
* testsuite/ld-plugin/lto.exp: Run the PR binutils/23460 test.
* testsuite/ld-plugin/pr23460a.c: New file.
* testsuite/ld-plugin/pr23460b.c: Likewise.
* testsuite/ld-plugin/pr23460c.c: Likewise.
* testsuite/ld-plugin/pr23460d.c: Likewise.
* testsuite/ld-plugin/pr23460e.c: Likewise.
* testsuite/ld-plugin/pr23460f.c: Likewise.