* Close files before trying to delete them * Add `-N` to not load the rizinrc in `read from stdin` test to avoid overwriting the color setting * Make sure `.tmp` exists for `idpx` test
337 lines
7 KiB
Text
337 lines
7 KiB
Text
NAME=PDB downloader check
|
|
FILE=bins/pdb/user32.dll
|
|
CMDS=<<EOF
|
|
%RZ_CURL=1
|
|
e pdb.server=https://raw.githubusercontent.com/rizinorg/test-pdb-repository/main/
|
|
!!rz-bin -PP ${RZ_FILE} ~PDB
|
|
EOF
|
|
EXPECT=<<EOF
|
|
PDB "user32.pdb" download success
|
|
EOF
|
|
RUN
|
|
|
|
NAME=PDB downloader json
|
|
FILE==
|
|
CMDS=<<EOF
|
|
%RZ_CURL=1
|
|
e pdb.server=https://raw.githubusercontent.com/rizinorg/test-pdb-repository/main/
|
|
!rz-bin -PPj bins/pdb/user32.dll~{}>$pdb
|
|
$pdb~file,guid,download
|
|
EOF
|
|
EXPECT=<<EOF
|
|
"file": "user32.pdb",
|
|
"guid": "15F778B3671D4EFDBDCDE79905308B792",
|
|
"download": true
|
|
EOF
|
|
RUN
|
|
|
|
NAME=idpdj
|
|
FILE=bins/pdb/user32.dll
|
|
CMDS=<<EOF
|
|
%RZ_CURL=1
|
|
e pdb.server=https://raw.githubusercontent.com/rizinorg/test-pdb-repository/main/
|
|
idpdj~{}>$pdb
|
|
$pdb~file,guid,download
|
|
EOF
|
|
EXPECT=<<EOF
|
|
"file": "user32.pdb",
|
|
"guid": "15F778B3671D4EFDBDCDE79905308B792",
|
|
"download": true
|
|
EOF
|
|
RUN
|
|
|
|
NAME=idp 404
|
|
FILE==
|
|
CMDS=<<EOF
|
|
idp 404.pdb
|
|
EOF
|
|
EXPECT=
|
|
EXPECT_ERR=<<EOF
|
|
ERROR: Cannot open file '404.pdb'
|
|
EOF
|
|
RUN
|
|
|
|
NAME=idp and baddr
|
|
FILE==
|
|
CMDS=<<EOF
|
|
e bin.baddr=0
|
|
idp bins/pdb/Project1.pdb
|
|
fl~pdb:1
|
|
e bin.baddr=0x800000
|
|
idp bins/pdb/Project1.pdb
|
|
fl~pdb:1
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x00011000 0 pdb.Project1.__enc_textbss_end
|
|
0x00811000 0 pdb.Project1.__enc_textbss_end
|
|
EOF
|
|
RUN
|
|
|
|
NAME=find structure R2_TEST_STRUCT
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao R2_TEST_STRUCT
|
|
EXPECT=<<EOF
|
|
R2_TEST_STRUCT
|
|
EOF
|
|
RUN
|
|
|
|
NAME=find class CTest2 # has LF_BCLASS
|
|
FILE=bins/pdb/vs2019_cpp_override.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao "struct CTest2"
|
|
EXPECT=<<EOF
|
|
struct CTest2
|
|
EOF
|
|
BROKEN=1
|
|
RUN
|
|
|
|
NAME=find class _onexit_table_t # LF_STRUCTURE_19
|
|
FILE=bins/pdb/vs2019_cpp_override.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao _onexit_table_t
|
|
EXPECT=<<EOF
|
|
_onexit_table_t
|
|
EOF
|
|
RUN
|
|
|
|
NAME=find union R2_TEST_UNION
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao R2_TEST_UNION
|
|
EXPECT=<<EOF
|
|
R2_TEST_UNION
|
|
EOF
|
|
RUN
|
|
|
|
NAME=find enum R2_TEST_ENUM
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao R2_TEST_ENUM
|
|
EXPECT=<<EOF
|
|
R2_TEST_ENUM
|
|
EOF
|
|
RUN
|
|
|
|
NAME=find enum _RTC_ErrorNumber
|
|
FILE=bins/pdb/vs2019_cpp_override.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao _RTC_ErrorNumber
|
|
EXPECT=<<EOF
|
|
_RTC_ErrorNumber
|
|
EOF
|
|
RUN
|
|
|
|
NAME=find enum member of _RTC_ErrorNumber
|
|
FILE=bins/pdb/vs2019_cpp_override.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao _RTC_ILLEGAL
|
|
EXPECT=<<EOF
|
|
_RTC_ILLEGAL
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 name of structure R2_TEST_STRUCT
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao r2_struct_var_1
|
|
EXPECT=<<EOF
|
|
r2_struct_var_1
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 of structure _onexit_table_t # LF_STRUCTURE_19
|
|
FILE=bins/pdb/vs2019_cpp_override.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao "void\ (\*\*_first)();"
|
|
EXPECT=<<EOF
|
|
void (**_first)();
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member2 name of structure R2_TEST_STRUCT
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao r2_struct_var_2
|
|
EXPECT=<<EOF
|
|
r2_struct_var_2
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 type of structure R2_TEST_STRUCT
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep r2_struct_var_1 | grep -ao int32_t
|
|
EXPECT=<<EOF
|
|
int32_t
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member2 type of structure R2_TEST_STRUCT
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep r2_struct_var_2 | grep -ao int16_t
|
|
EXPECT=<<EOF
|
|
int16_t
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 name of union R2_TEST_UNION
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao r2_union_var_1
|
|
EXPECT=<<EOF
|
|
r2_union_var_1
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member2 name of union R2_TEST_UNION
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -ao r2_union_var_2
|
|
EXPECT=<<EOF
|
|
r2_union_var_2
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 type of union R2_TEST_UNION
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep r2_union_var_1 | grep -ao int32_t
|
|
EXPECT=<<EOF
|
|
int32_t
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member2 type of union R2_TEST_UNION
|
|
FILE=bins/pdb/Project1.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep r2_union_var_2 | grep -ao double
|
|
EXPECT=<<EOF
|
|
double
|
|
EOF
|
|
RUN
|
|
|
|
NAME=GUID CHECK
|
|
FILE=bins/pdb/user32.dll
|
|
CMDS=!rz-bin -I ${RZ_FILE} | grep -ao 15F778B3671D4EFDBDCDE79905308B792
|
|
EXPECT=<<EOF
|
|
15F778B3671D4EFDBDCDE79905308B792
|
|
EOF
|
|
RUN
|
|
|
|
NAME=PDB set flag realname
|
|
FILE==
|
|
CMDS=<<EOF
|
|
idp bins/pdb/Project1.pdb
|
|
fN @ 0x00011000
|
|
EOF
|
|
EXPECT=<<EOF
|
|
__enc$textbss$end
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 type of struct _CONSOLE_READCONSOLE_CONTROL of arm PDB
|
|
FILE=bins/pe/hello_world_arm/hello_world_arm_ZiZoO2.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -C2 _CONSOLE_READCONSOLE_CONTROL | grep nLength | grep -ao uint32_t
|
|
EXPECT=<<EOF
|
|
uint32_t
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member1 name of struct _CONSOLE_READCONSOLE_CONTROL of arm PDB
|
|
FILE=bins/pe/hello_world_arm/hello_world_arm_ZiZoO2.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep -C2 _CONSOLE_READCONSOLE_CONTROL | grep -ao nLength
|
|
EXPECT=<<EOF
|
|
nLength
|
|
EOF
|
|
RUN
|
|
|
|
NAME=member value of enum __acrt_fenv_machine_arm_control of arm PDB
|
|
FILE=bins/pe/hello_world_arm/hello_world_arm_ZiZoO2.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep all_control_bits | grep -ao 0x3c09f00
|
|
EXPECT=<<EOF
|
|
0x3c09f00
|
|
EOF
|
|
RUN
|
|
|
|
NAME=enum __acrt_fenv_abstract_status of arm PDB
|
|
FILE=bins/pe/hello_world_arm/hello_world_arm_ZiZoO2.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep "__acrt_fenv_abstract_status {"
|
|
EXPECT=<<EOF
|
|
enum __acrt_fenv_abstract_status {
|
|
EOF
|
|
RUN
|
|
|
|
NAME=symbol _towlower_internal of arm PDB
|
|
FILE=bins/pe/hello_world_arm/hello_world_arm_ZiZoO2.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep "_towlower_internal"
|
|
EXPECT=<<EOF
|
|
0x00066da4 2 .text _towlower_internal
|
|
EOF
|
|
RUN
|
|
|
|
NAME=complex symbol of arm PDB
|
|
FILE=bins/pe/hello_world_arm/hello_world_arm_ZiZoO2.pdb
|
|
CMDS=!rz-bin -P ${RZ_FILE} | grep "south africa"
|
|
EXPECT=<<EOF
|
|
0x000820c4 0 .rdata `string'::1484532236::"south africa"
|
|
EOF
|
|
RUN
|
|
|
|
NAME=LF_INDEX parsing
|
|
FILE=bins/pdb/exceptions-test.exe
|
|
CMDS=<<EOF
|
|
idp
|
|
te CV_HREG_e~?
|
|
EOF
|
|
EXPECT=<<EOF
|
|
3218
|
|
EOF
|
|
RUN
|
|
|
|
NAME=Type redefinition
|
|
FILE=bins/pdb/exceptions-test.exe
|
|
CMDS=<<EOF
|
|
tsc _NT_TIB
|
|
idp
|
|
tsc _NT_TIB
|
|
tsc _TP_CALLBACK_ENVIRON_V3
|
|
EOF
|
|
EXPECT=<<EOF
|
|
struct _NT_TIB {
|
|
struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
|
|
void *StackBase;
|
|
void *StackLimit;
|
|
void *SubSystemTib;
|
|
unsigned long Version;
|
|
void *ArbitraryUserPointer;
|
|
struct _NT_TIB *Self;
|
|
};
|
|
struct _NT_TIB {
|
|
struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
|
|
void *StackBase;
|
|
void *StackLimit;
|
|
void *SubSystemTib;
|
|
void *FiberData;
|
|
uint32_t Version;
|
|
void *ArbitraryUserPointer;
|
|
struct _NT_TIB *Self;
|
|
};
|
|
struct _TP_CALLBACK_ENVIRON_V3 {
|
|
uint32_t Version;
|
|
struct _TP_POOL *Pool;
|
|
struct _TP_CLEANUP_GROUP *CleanupGroup;
|
|
void (*CleanupGroupCancelCallback)(void *arg0, void *arg1);
|
|
void *RaceDll;
|
|
struct _ACTIVATION_CONTEXT *ActivationContext;
|
|
void (*FinalizationCallback)(struct _TP_CALLBACK_INSTANCE *arg0, void *arg1);
|
|
union type_0x1e89 u;
|
|
int32_t CallbackPriority;
|
|
uint32_t Size;
|
|
};
|
|
EOF
|
|
RUN
|
|
|
|
NAME=Extract pdb via idbx
|
|
FILE==
|
|
CMDS=<<EOF
|
|
idpi bins/pdb/basic32.pd_
|
|
e log.level=3
|
|
mkdir .tmp
|
|
idpx bins/pdb/basic32.pd_ .tmp
|
|
!rz-hash -a md5 .tmp/basic32.pdb
|
|
EOF
|
|
REGEXP_FILTER_ERR=(ERROR:.+\nINFO:.+\n)
|
|
EXPECT_ERR=<<EOF
|
|
ERROR: The pdb file bins/pdb/basic32.pd_ seems to be compressed, please use idpx command to extract the contents.
|
|
INFO: cab_extract: extracted .tmp/basic32.pdb
|
|
EOF
|
|
EXPECT=<<EOF
|
|
.tmp/basic32.pdb: 0x00000000-0x00649000 md5: a6c609e6b62cd0b9fbea5400bf370891
|
|
EOF
|
|
RUN
|