~ubuntu-support-team/binutils/+git/binutils-gdb:users/jemarch/new-bpf-atomics

Last commit made on 2023-05-10
Get this branch:
git clone -b users/jemarch/new-bpf-atomics https://git.launchpad.net/~ubuntu-support-team/binutils/+git/binutils-gdb

Branch merges

Branch information

Name:
users/jemarch/new-bpf-atomics
Repository:
lp:~ubuntu-support-team/binutils/+git/binutils-gdb

Recent commits

c074d67... by "Jose E. Marchesi" <email address hidden>

gas: document V3 BPF atomic instructions in the GAS manual

gas/ChangeLog:

2023-05-10 Jose E. Marchesi <email address hidden>

 * doc/c-bpf.texi (BPF Opcodes): Document the V3 BPF atomic
 instructions.

1f83501... by "Jose E. Marchesi" <email address hidden>

gas: add tests for BPF V3 atomic instructions

2023-05-10 Jose E. Marchesi <email address hidden>

 * testsuite/gas/bpf/atomic-v3.s: New file.
 * testsuite/gas/bpf/atomic-v3.d: Likewise.
 * testsuite/gas/bpf/atomic-v3-be.d: Likewise.
 * testsuite/gas/bpf/bpf.exp: Run atomic-v3 and atomic-v3-be.

86e8a6b... by "Jose E. Marchesi" <email address hidden>

cpu: add V3 BPF atomic instructions

This patch adds a set of new atomic instructions that were introduced
in the version 3 BPF ISA:

Atomic operations:

  xor{w,dw}
  xand{w,dw}
  xxor{w,dw}

Atomic fetch-and-operate:

  xfadd{w,dw}
  xfor{w,dw}
  xfand{w,dw}
  xfxor{w,dw}

Other:

  xchg{w,dw}
  xcmp{w,dw}

617ba55... by "Jose E. Marchesi" <email address hidden>

opcodes: use CGEN_INSN_LGUINT for base instructions

This patch changes the opcodes CGEN support code in order to support
base instructions with opcodes past the least significative 32 bits.

Note that the masks have been adapted in a previous patch.

include/ChangeLog:

2023-05-10 Jose E. Marchesi <email address hidden>

 * opcode/cgen.h (CGEN_IVALUE): Make room for 64-bit base values.

opcodes/ChangeLog:

2023-05-10 Jose E. Marchesi <email address hidden>

 * cgen-dis.in (print_insn): Use CGEN_INSN_LGUINT for instruction
 base values.
 * cgen-dis.c (cgen_dis_lookup_insn): Likewise.
 * cgen-opc.c (cgen_macro_insn_count): Likewise.
 * epiphany-dis.c: Regenerate.
 * fr30-dis.c: Likewise.
 * frv-dis.c: Likewise.
 * ip2k-dis.c: Likewise.
 * iq2000-dis.c: Likewise.
 * lm32-dis.c: Likewise.
 * m32c-dis.c: Likewise.
 * m32r-dis.c: Likewise.
 * mep-dis.c: Likewise.
 * mt-dis.c: Likewise.
 * or1k-dis.c: Likewise.
 * xstormy16-dis.c: Likewise.

2b8c776... by "Jose E. Marchesi" <email address hidden>

gas: bpf: fix tests for pseudo-c syntax

This patch fixes the GAS BPF testsuite so the tests for pseudo-c
syntax are actually executed.

2023-04-27 Jose E. Marchesi <email address hidden>

 * testsuite/gas/bpf/mem.dump: New file.
 * testsuite/gas/bpf/mem-pseudoc.d: Likewise.
 * testsuite/gas/bpf/mem.d: #dump mem.dump.
 * testsuite/gas/bpf/lddw.dump: New file.
 * testsuite/gas/bpf/lddw-pseudoc.d: Likewise.
 * testsuite/gas/bpf/lddw.d: #dump lddw.dump.
 * testsuite/gas/bpf/jump.dump: New file.
 * testsuite/gas/bpf/jump-pseudoc.d: Likewise
 * testsuite/gas/bpf/jump.d: #dump jump.dump.
 * testsuite/gas/bpf/jump32.dump: New file.
 * testsuite/gas/bpf/jump32-pseudoc.d: Likewise.
 * testsuite/gas/bpf/jump32.d: #dump jump32.dump.
 * testsuite/gas/bpf/lddw-be.dump: New file.
 * testsuite/gas/bpf/lddw-be-pseudoc.d: Likewise.
 * testsuite/gas/bpf/lddw-be.d: #dump lddw-be.dump.
 * testsuite/gas/bpf/indcall-1.dump: New file.
 * testsuite/gas/bpf/indcall-1-pseudoc.d: Likewise.
 * testsuite/gas/bpf/indcall-1.d: #dump indcall-1.dump.
 * testsuite/gas/bpf/indcall-1-pseudoc.s (main): Fix lddw
 instruction.
 * testsuite/gas/bpf/atomic.dump: New file.
 * testsuite/gas/bpf/atomic-pseudoc.d: Likewise.
 * testsuite/gas/bpf/atomic.d: #dump atomic.dump.
 * testsuite/gas/bpf/alu32.dump: New file.
 * testsuite/gas/bpf/alu32-pseudoc.d: Likewise.
 * testsuite/gas/bpf/alu32.d: #dump alu32.dump.
 * testsuite/gas/bpf/alu.dump: New file.
 * testsuite/gas/bpf/alu-pseudoc.d: Likewise.
 * testsuite/gas/bpf/alu.d: #dump alu.dump.

 * testsuite/gas/bpf/alu-be.dump: New file.
 * testsuite/gas/bpf/alu-be-pseudoc.d: Likewise.
 * testsuite/gas/bpf/alu-be.d: #dump alu-be.dump.
 * testsuite/gas/bpf/alu32-be-pseudoc.d: New file.
 * testsuite/gas/bpf/alu32-be-dump: Likewise.
 * testsuite/gas/bpf/alu32-be.d: #dump alu32-be-dump.
 * testsuite/gas/bpf/bpf.exp: Run *-pseudoc tests.

e29ff72... by Tom Tromey <email address hidden>

Avoid some compiler warnings in gdb.ada

Running gdb.ada/verylong.exp shows a warning from the Ada compiler:

prog.adb:16:11: warning: file name does not match unit name, should be "main.adb" [enabled by default]

This patch fixes the problem, and another similar one in
unchecked_union.exp.

670c91c... by Michael Matz <email address hidden>

Fix PR30358, performance with --sort-section

since af31506c we only use the binary tree when section sorting is
required. While its unbalanced and hence can degrade to a linear list
it should otherwise have been equivalent to the old code relying on
insertion sort. Unfortunately it was not. The old code directly used
lang_add_section to populate the sorted list, the new code first
populates the tree and only then does lang_add_section on the sorted
result.

In the testcase we have very many linkonce section groups, and hence
lang_add_section won't actually insert anything for most of them. That
limited the to-be-sorted list length previously. The tree-sorting code
OTOH first created a tree of all candidates sections, including those
that wouldn't be inserted by lang_add_section, hence increasing the size
of the sorting problem. In the testcase the chain length went from
about 1500 to 106000, and in the degenerated case (as in the testcase)
that goes in quadratically.

This splits out most of the early-out code from lang_add_section to its
own function and uses the latter to avoid inserting into the tree. This
refactoring slightly changes the order of early-out tests (the ones
based on section flags is now done last, and only in lang_add_section).
The new function is not a pure predicate: it can give warnings and it
might change output_section, like the old early-out code did. I have
also added a skip-warning case in the first discard case, whose
non-existence seemed to have been an oversight.

 PR 30358
 * ldlang.c (wont_add_section_p): Split out from ...
 (lang_add_section): ... here.
 (output_section_callback_sort): Use wont_add_section_p to not
 always add sections to the sort tree.

0d42948... by Andrew Burgess <email address hidden>

gdb/doc: extend the documentation of the jump command

This commit addresses PR gdb/7946. While checking for bugs relating
to the jump command I noticed a long standing bug that points out a
deficiency with GDB's documentation of the jump command.

The bug points out that 'jump 0x...' is not always the same as 'set
$pc = 0x...' and then 'continue'. Writing directly to the $pc
register does not update any auxiliary state, e.g. $npc on SPARC,
while using 'jump' does.

It felt like this would be an easy issue to address by adding a
paragraph to the docs, so I took a stab at writing something suitable.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7946

Approved-By: Eli Zaretskii <email address hidden>

08ec06d... by Andrew Burgess <email address hidden>

gdb/testsuite: special case '^' in gdb_test pattern

In this commit I propose that we add special handling for the '^' when
used at the start of a gdb_test pattern. Consider this usage:

  gdb_test "some_command" "^command output pattern"

I think the intention here is pretty clear - run 'some_command', and
the output from the command should be exactly 'command output
pattern'.

After the previous commit which tightened up how gdb_test matches the
final newline and prompt we know that the only thing after the output
pattern will be a single newline and prompt, and the leading '^'
ensures that there's no output before 'command output pattern', so
this will do what I want, right?

... except it doesn't. The command itself will also needs to be
matched, so I should really write:

  gdb_test "some_command" "^some_command\r\ncommand output pattern"

which will do what I want, right? Well, that's fine until I change
the command and include some regexp character, then I have to write:

  gdb_test "some_command" \
    "^[string_to_regexp some_command]\r\ncommand output pattern"

but this all gets a bit verbose, so in most cases I simply don't
bother anchoring the output with a '^', and a quick scan of the
testsuite would indicate that most other folk don't both either.

What I propose is this: the *only* thing that can appear immediately
after the '^' is the command converted into a regexp, so lets do that
automatically, moving the work into gdb_test. Thus, when I write:

  gdb_test "some_command" "^command output pattern"

Inside gdb_test we will spot the leading '^' in the pattern, and
inject the regexp version of the command after the '^', followed by a
'\r\n'.

My hope is that given this new ability, folk will be more inclined to
anchor their output patterns when this makes sense to do so. This
should increase our ability to catch any unexpected output from GDB
that appears as a result of running a particular command.

There is one problem case we need to consider, sometime people do
this:

  gdb_test "" "^expected output pattern"

In this case no command is sent to GDB, but we are still expecting
some output from GDB. This might be a result of some asynchronous
event for example. As there is no command sent to GDB (from the
gdb_test) there will be no command text to parse.

In this case my proposed new feature injects the command regexp, which
is the empty string (as the command itself is empty), but still
injects the '\r\n' after the command regexp, thus we end up with this
pattern:

  ^\r\nexpected output pattern

This extra '\r\n' is not what we should expected here, and so there is
a special case inside gdb_test -- if the command is empty then don't
add anything after the '^' character.

There are a bunch of tests that do already use '^' followed by the
command, and these can all be simplified in this commit.

I've tried to run all the tests that I can to check this commit, but I
am certain that there will be some tests that I manage to miss.
Apologies for any regressions this commit causes, hopefully fixing the
regressions will not be too hard.

Reviewed-By: Tom Tromey <email address hidden>

e2f6201... by Andrew Burgess <email address hidden>

gdb/testsuite: change newline patterns used in gdb_test

This commit makes two changes to how we match newline characters in
the gdb_test proc.

First, for the newline pattern between the command output and the
prompt, I propose changing from '[\r\n]+' to an explicit '\r\n'.

The old pattern would spot multiple newlines, and so there are a few
places where, as part of this commit, I've needed to add an extra
trailing '\r\n' to the pattern in the main test file, where GDB's
output actually includes a blank line.

But I think this is a good thing. If a command produces a blank line
then we should be checking for it, the current gdb_test doesn't do
that. But also, with the current gdb_test, if a blank line suddenly
appears in the output, this is going to be silently ignored, and I
think this is wrong, the test should fail in that case.

Additionally, the existing pattern will happily match a partial
newline. There are a strangely large number of tests that end with a
random '.' character. Not matching a literal period, but matching any
single character, this is then matching half of the trailing newline
sequence, while the \[\r\n\]+ in gdb_test is matching the other half
of the sequence. I can think of no reason why this would be
intentional, I suspect that the expected output at one time included a
period, which has since been remove, but I haven't bothered to check
on this. In this commit I've removed all these unneeded trailing '.'
characters.

The basic rule of gdb_test after this is that the expected pattern
needs to match everything up to, but not including the newline
sequence immediately before the GDB prompt. This is generally how the
proc is used anyway, so in almost all cases, this commit represents no
significant change.

Second, while I was cleaning up newline matching in gdb_test, I've
also removed the '[\r\n]*' that was added to the start of the pattern
passed to gdb_test_multiple.

The addition of this pattern adds no value. If the user pattern
matches at the start of a line then this would match against the
newline sequence. But, due to the '*', if the user pattern doesn't
match at the start of a line then this group doesn't care, it'll
happily match nothing.

As such, there's no value to it, it just adds more complexity for no
gain, so I'm removing it. No tests will need updating as a
consequence of this part of the patch.

Reviewed-By: Tom Tromey <email address hidden>