-
-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aweful RzAsm <-> RzAnalysis pointer sharing and Hexagon unify #4667
Conversation
Because static values are no longer allowed, it has to be sure that the 'user' pointer for the config value setter is always the plugin data. So the plugin can change its internal state, according to the configuration value. This was not possible before. Also it adds a seperated hash map for plugin values. So they are logically more separated.
Also resolves the problems with not knowing what is a valid instruction and which one not. Leads to way mor stability in decoding.
…() in analysis_hexagon.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes are good. I am only in doubt about those hacks. Let's see what others say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Hopefully this hack will go away with RzArch
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
cff6a87
to
6d0db7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but only as a temporary measure. We should not make a new release with this hack.
Your checklist for this pull request
Detailed description
Hacks
Attempt to share pointers between
RzAsm
andRzAnalysis
without anyRzArch
.The assumption made here is that
RzAsm
is always initialized. Also without anyRzAnalysis
. ButRzAnalysis
is never initialized without a companionRzAsm
.Hence a plugin requiring a common state, always accesses
RzAsm->plugin_data
, no matter if it was called fromRzAnalysis
orRzAsm
.RzAnalysis
holds the file buffer. So if this one is present, the plugin should initialize a buffer around it. If it is not there, it should make a byte buffer around the bytes passed to the function.This mimics future behavior of
RzArch
which will get either anIO
orBytes
buffer.Plugin configs
With this change there is also the need to refactor the plugin specific configs.
I designed them badly before. And they couldn't be used by a plugin without a static variable.
Plugin specific configs are hold now in a hash mpa in RzCore. The reason to have them separately and not in the
RzCore->config
is because plugins can be the owner of them. Meaning theconfig_set
functions will pass a pointer with the plugin state. Not the core state. This is required if plugins have specific configuration options they need to know, but have no access toRzCore
to get them.It adds luckily only a few more lines to handle them in
cmd_eval.c
and for the auto-complete.Hexagon changes
RzAsm->plugin_data
.Test plan
For plugin configs
Otherwise: all green with fuzz-dist.
Closing issues
None. Probably opens a few more.