Skip to content

Commit e9f79f4

Browse files
committed
[lldb][AArch64][Linux] Add tests for SME only support
This PR is the tests for #138717. I have split it from implementation as there is a lot of code, and the two don't really overlap. The tests are checking what a user will see in LLDB, and only indirectly what happens in lldb-server. There are two types of tests, the first is register access tests. These start in a given mode, where a mode is a combination of the streaming mode on or off, ZA on or off, and a vector length. For register access tests I have used two states: * Streaming mode, ZA on, default vector length * Non-streaming mode, ZA off, default vector length (changing mode and vector length is tested in existing SVE+SME tests and the expression tests I'm adding in this same PR) The test program: * Sets up the requested mode. * Allocates a bunch of buffers for LLDB to write expected register values to. * Sets initial register values. Then LLDB looks for those expected values. Assuming they are present, it then writes a new set of values to the registers, and to the buffers within the program. The program is then stepped, which runs an in-process function to check that it now sees those register values. If that function fails, we have a bug. If it does not, LLDB then checks for the same values. This process repeats for several registers. Hence the repeated calls to check_register_values in the test program. In this way we make sure that LLDB sends the correct values to ptrace by validating them in process. Also that LLDB does not write other registers in the process of writing one register. This happened to me several times during development. The buffer writes are done with memory writes not expression evaluation becuase at this stage we cannot trust that expressions work (the expression tests will later prove that they do). The second type of tests are epxression state restoration tests. For each combination of states we check that we can restore to a given state if an expression takes us into the other state. This includes between the same state, and adds an extra vector lenth to check expanding and shrinking SVE buffers. This produces roughly 64 tests. I have written them all as one test case in a loop because these take a long time (~20 minutes on an FVP) and you almost always want it to fail fast. When tracing is enabled you'll see the current states logged. It's possible that we could skip some of these tests as being very unlikely to ever happen, but in the spirit of "There are Only Four Billion Floats–So Test Them All!" I think it is simpler to enumerate every possible state change. I have not added a test for executing an expression incompatible with the current mode because this leads to SIGILL, which I know we already handle. At this time LLDB makes no effort to make the expression compatible with the current mode either.
1 parent b6bbc4b commit e9f79f4

File tree

3 files changed

+1054
-0
lines changed

3 files changed

+1054
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
C_SOURCES := main.c
2+
# The memset provided by glibc may use instructions we cannot use in
3+
# streaming mode.
4+
CFLAGS_EXTRAS := -march=armv8-a+sve+sme+sme2 -fno-builtin-memset
5+
6+
include Makefile.rules

0 commit comments

Comments
 (0)