-
Notifications
You must be signed in to change notification settings - Fork 604
samples: expand REP string instructions in instrace tools #7789
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
base: master
Are you sure you want to change the base?
samples: expand REP string instructions in instrace tools #7789
Conversation
|
I can help review this if it is ready. Also note that there's also drx_expand_scatter_gather which performs a similar function as drutil_expand_rep_string; you may want to add that too in a separate PR perhaps. |
|
Thanks! Yes, this PR is ready for review. Good point about drx_expand_scatter_gather — I agree that would be a useful addition. Could you please share a bit more detail on what change you had in mind for |
| event_bb(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, bool translating) | ||
| { | ||
| instr_t *first_app = instrlist_first_app(bb); | ||
| if (first_app == NULL || !drmgr_is_first_instr(drcontext, first_app)) |
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.
Why is this condition required?
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.
This check ensures REP expansion runs only once per application basic block, avoiding duplicate expansion during re-instrumentation or trace construction.
|
Thanks for the detailed review! I’ve updated both instrace_simple.c and instrace_x86.c to:
The samples build and run correctly locally, and REP string instructions are now expanded and logged as expected. Please let me know if anything else should be adjusted. |
Adds drutil_expand_rep_string() to the instrace_simple and instrace_x86
sample clients so that REP-prefixed string instructions are expanded
consistently, matching the behavior of memtrace samples.
The expansion is performed in drmgr's app2app phase with proper drutil
initialization and teardown.
This avoids confusion for users comparing instrace and memtrace behavior.
Fixes #4138.