1void __attribute__((naked)) incomplete_cas(int *a, int *b) {
2 // Stop at the first instruction (an sc without a corresponding lr), then make
3 // a step instruction and ensure that execution stops at the next instruction
4 // (and).
5 asm volatile("1:\n\t"
6 "sc.w a5, a1, (a3)\n\t"
7 "and a5, a2, a4\n\t"
8 "beq a5, a1, 2f\n\t"
9 "xor a5, a2, a0\n\t"
10 "and a5, a5, a4\n\t"
11 "xor a5, a2, a5\n\t"
12 "sc.w a5, a1, (a3)\n\t"
13 "bnez a5, 1b\n\t"
14 "2:\n\t"
15 "ret\n\t");
16}
17
18int main() {
19 int a = 4;
20 int b = 2;
21 incomplete_cas(a: &a, b: &b);
22}
23

source code of lldb/test/API/riscv/step/incomplete_sequence_without_lr.c