rizin/test/db/cmd/structures
NOT XVilka ba8c170852
Migrate from Capstone to Zydis (x86 architecture) (#5164)
* Added build files [Capstone to Zydis]

* x86 Analysis [Capstone to Zydis]

* Changed x86 RzIL [Capstone to Zydis]

* Changed asm and arch files [Capstone to Zydis]

* Compilation, build error and test fixes [Capstone to Zydis]

* Test changes [Capstone to Zydis]

* Remaining changes [Capstone to Zydis]

* Added BE support [Capstone to Zydis]

---------

Co-authored-by: tushar3q34 <tushar3q34@gmail.com>
2025-05-23 13:03:46 +00:00

77 lines
1.6 KiB
Text

NAME=structure variable delete shadowed
FILE=bins/elf/analysis/main_structure
CMDS=<<EOF
aaa
s main
afvs*
echo ---
td "struct S1 { int a; int b; int c; char d[256]; short e; }"
afvn s1 var_118h
afvt s1 "struct S1"
afvs*
EOF
EXPECT=<<EOF
afvs -296 var_128h char ** @ 0x4004a6
afvs -284 var_11ch int @ 0x4004a6
afvs -280 var_118h int64_t @ 0x4004a6
afvs -276 var_114h int64_t @ 0x4004a6
afvs -272 var_110h int64_t @ 0x4004a6
afvs -12 var_ch int64_t @ 0x4004a6
---
afvs -296 var_128h char ** @ 0x4004a6
afvs -284 var_11ch int @ 0x4004a6
afvs -280 s1 struct S1 @ 0x4004a6
EOF
RUN
NAME=structure offset in disassembly
FILE=bins/elf/analysis/main_structure
CMDS=<<EOF
e asm.bytes=false
aaa
s main
td "struct S1 { int a; int b; int c; char d[256]; short e; }"
afvn s1 var_118h
pi 4 @ 0x004004be
echo ---
afvt s1 "struct S1"
pi 4 @ 0x004004be
EOF
EXPECT=<<EOF
mov dword [s1], 0x01
mov dword [var_114h], 0x02
mov dword [var_110h], 0x03
lea rax, qword [s1]
---
mov dword [s1.a], 0x01
mov dword [s1.b], 0x02
mov dword [s1.c], 0x03
lea rax, qword [s1.a]
EOF
RUN
NAME=structure field rename reflects immediately
FILE=bins/elf/analysis/main_structure
CMDS=<<EOF
e asm.bytes=true
aaa
s main
td "struct S1 { int a; int b; int c; char d[256]; short e; }"
afvn s1 var_118h
afvt s1 "struct S1"
pi 4 @ 0x004004be
t- S1
td "struct S1 { int x; int y; int c; char d[256]; short e; }"
pi 4 @ 0x004004be
EOF
EXPECT=<<EOF
mov dword [s1.a], 0x01
mov dword [s1.b], 0x02
mov dword [s1.c], 0x03
lea rax, qword [s1.a]
mov dword [s1.x], 0x01
mov dword [s1.y], 0x02
mov dword [s1.c], 0x03
lea rax, qword [s1.x]
EOF
RUN