rizin/test/db/cmd/cmd_ara
NOT XVilka 155ead6822
librz/reg: derive CC with more than four argument registers (#6600)
rz_reg_profile_to_cc() only emitted the first four argument registers
(A0-A3), so architectures that pass more arguments in registers -- the
C6000 EABI uses ten, and x86-64/riscv/ppc all declare more than four --
got a truncated convention. Walk the whole A0-A9 role range, stopping at
the first role the profile leaves undefined, and build the cc string with
RzStrBuf. Covered by a new test_reg unit test.

Co-authored-by agent: Claude/claude-opus-4-8

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-06 03:35:41 +08:00

106 lines
950 B
Text

NAME=ara swap
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
ara+
ar rax=33
ar rax
aras
ar rax
EOF
EXPECT=<<EOF
rax = 0x0000000000000021
rax = 0x0000000000000000
EOF
RUN
NAME=ara swap 2
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
ara+
ar rax=33
ar rax
aras
ar rax
aras
ar rax
EOF
EXPECT=<<EOF
rax = 0x0000000000000021
rax = 0x0000000000000000
rax = 0x0000000000000021
EOF
RUN
NAME=ara push
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
ara~?
ara+
ara~?
EOF
EXPECT=<<EOF
26
39
EOF
RUN
NAME=ara pop
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
ara~?
ara+
ara~?
ara-
ara~?
ara-
ara~?
ara-
ara~?
EOF
EXPECT=<<EOF
26
39
26
13
13
EOF
RUN
NAME=arcc+tcc
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
afcl
e asm.arch=arm
e asm.bits=32
arcc
e asm.arch=x86
e asm.bits=64
arcc
tcc `arcc`
afcl
EOF
EXPECT=<<EOF
amd64
amd64syscall
ms
reg
swift
r0 reg(r0, r1, r2, r3)
rdi reg(rdi, rsi, rdx, rcx, r8, r9, r10, r11)
amd64
amd64syscall
ms
reg
swift
EOF
RUN