radare2/test/new/db/cmd/structures
Khairul Azhar Kasmiran 781fcccf55
Move CMDS= before EXPECT= in tests (#16417)
* Move CMDS= before EXPECT= in tests

* Revert "Move CMDS= before EXPECT= in tests"

This reverts commit 13a9085a36.

* Move CMDS= before EXPECT= in tests, take 2

* Revert "Move CMDS= before EXPECT= in tests, take 2"

This reverts commit 7c0bf6d8e3.

* Move CMDS= before EXPECT= in tests, take 3

Co-authored-by: pancake <pancake@nopcode.org>
2020-04-05 20:56:06 +08:00

71 lines
1.4 KiB
Plaintext

NAME=structure variable delete shadowed
FILE=../bins/elf/analysis/main_structure
CMDS=<<EOF
aaa
s main
afvb*
"td struct S1 { int a; int b; int c; char d[256]; short e; }"
afvn s1 var_110h
afvt s1 S1
afvb*
EOF
EXPECT=<<EOF
afvb -288 var_120h char ** @ 0x4004a6
afvb -276 var_114h int64_t @ 0x4004a6
afvb -272 var_110h int64_t @ 0x4004a6
afvb -268 var_10ch int64_t @ 0x4004a6
afvb -264 var_108h int64_t @ 0x4004a6
afvb -4 var_4h int64_t @ 0x4004a6
afvb -288 var_120h char ** @ 0x4004a6
afvb -276 var_114h int64_t @ 0x4004a6
afvb -272 s1 S1 @ 0x4004a6
EOF
RUN
NAME=structure offset in disassembly
FILE=../bins/elf/analysis/main_structure
CMDS=<<EOF
aaa
s main
"td struct S1 { int a; int b; int c; char d[256]; short e; }"
afvn s1 var_110h
pd 4 @ 0x004004be~[2-4]
afvt s1 S1
pd 4 @ 0x004004be~[2-4]
EOF
EXPECT=<<EOF
mov dword [s1]
mov dword [var_10ch]
mov dword [var_108h]
lea rax [s1]
mov dword [s1.a]
mov dword [s1.b]
mov dword [s1.c]
lea rax [s1.a]
EOF
RUN
NAME=structure field rename reflects immediately
FILE=../bins/elf/analysis/main_structure
CMDS=<<EOF
aaa
s main
"td struct S1 { int a; int b; int c; char d[256]; short e; }"
afvn s1 var_110h
afvt s1 S1
pd 4 @ 0x004004be~[2-4]
"td struct S1 { int x; int y; int c; char d[256]; short e; }"
pd 4 @ 0x004004be~[2-4]
EOF
EXPECT=<<EOF
mov dword [s1.a]
mov dword [s1.b]
mov dword [s1.c]
lea rax [s1.a]
mov dword [s1.x]
mov dword [s1.y]
mov dword [s1.c]
lea rax [s1.x]
EOF
RUN