Closed r3bb1t closed 10 months ago
They are always wrapped in an Option enum, even though when working with my binary it was always evaluating to Some.
Ah yeah: the Option
is due to a quirk in an earlier, in-dev version of v4 where Zydis would return NULL if no flags were set at all. That has been changed since, so we can get rid of the Option
. Good catch!
Also, in many places we can see the 0x0 instead of something like UNUSED.
Yeah, we changed the representation in Zydis. It uses bitflags now. If you want to check for "unused", you just |
together all the fields (tested | modified | ...
) and &
it with the flag that you want to check. Users had complained that with the previous approach it was very inefficient to quickly check whether some flag is accessed in some way, and the new representation solves that.
All the field are private btw. I still can't track the flags state properly.
I want to implement dead store elimination in my program which involves the tracking of opaque flags writes/reads. That's why it's so important to me.
Ohh, yeah, I see. That's by mistake and certainly explains your confusion. Fixed in 8c5a7a3bcfd45942a5272fb7c67c87260ef2aff1.
Thanks, it's much better now.
I have one more question: do we really need to write flags in Option enum? I believe it always unwraps successfuly (at least from one case which i tested)
Ah yeah, I forgot that over my surprise that these actually weren't pub
. Fixed in c4ea4ae03734ca6f02deb8dc42356ed5372a2499.
I guess we can probably close this issue
Hi, i've noticed some strange stuff. When printing with
dbg!()
macro i noticed that someAccessedFlags
looks weird. They are always wrapped in anOption
enum, even though when working with my binary it was always evaluating toSome
. Also, in many places we can see the0x0
instead of something likeUNUSED
. I think thatAccessedFlags
probably should not be wrapped inside anOption
enum, but instead it's fields should be.Here is an example:
P.s. Idk honestly how to process all this flags btw. (i.e. log reads/writes to specific flags, etc)