-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# NOTE: this isn't a standalone script -- meant to be run within gdb! | ||
|
||
# gdb's rust mode doesn't parse the `<` and `>` in the types correctly | ||
gdb.execute('set language c++') | ||
|
||
|
||
checked_types = [ | ||
('zydis::decoder::Decoder', 'ZydisDecoder'), | ||
('zydis::ffi::decoder::DecodedOperand', 'ZydisDecodedOperand'), | ||
('zydis::ffi::decoder::AccessedFlags<zydis::enums::CpuFlag>', 'ZydisAccessedFlags'), | ||
('zydis::ffi::decoder::AccessedFlags<zydis::enums::FpuFlag>', 'ZydisAccessedFlags'), | ||
('zydis::ffi::decoder::AvxInfo', 'ZydisDecodedInstructionAvx'), | ||
('zydis::ffi::decoder::MetaInfo', 'ZydisDecodedInstructionMeta'), | ||
('zydis::ffi::decoder::RawInfo', 'ZydisDecodedInstructionRaw'), | ||
] | ||
|
||
|
||
def sizeof(ty: str) -> int: | ||
return gdb.parse_and_eval(f'sizeof({ty})') | ||
|
||
|
||
for bind_ty, c_ty in checked_types: | ||
bind_ty_sz = sizeof(bind_ty) | ||
c_ty_sz = sizeof(c_ty) | ||
|
||
assert bind_ty_sz == c_ty_sz, \ | ||
f'binding type {bind_ty} is {bind_ty_sz} bytes, but expected {c_ty_sz}' | ||
|
||
print("ALL STRUCTS OK") |