-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[BOLT] Add binary introspection/JIT manager #81346
base: users/rafaelauler/bolt-logging-pr
Are you sure you want to change the base?
[BOLT] Add binary introspection/JIT manager #81346
Conversation
Add a class that allows a process to introspect or investigate itself by disassembling its memory contents just-in-time with BOLT. An example is shown in a new unittest binary. This leverages the new ability to use BOLT as a library instead of as a regular executable that processes input binaries, demonstrating how to use BOLT as a library.
Depends on #81082 |
/// Allows a process to instrospect itself by running BOLT to disassemble its | ||
/// its own address space. |
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.
introspect
// Analyze fib function in this binary | ||
// Disassemble 63 bytes | ||
uint64_t Address = reinterpret_cast<uint64_t>(&fib); | ||
StringRef Data = StringRef(reinterpret_cast<const char *>(&fib), 63); |
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.
Should JITRewriter expose symbol size so users use it directly?
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 rewriter object will only get knowledge about the symbol size after a call to to registerJITFunction. Not sure if I answered the question, but does it make sense to you? The user calling registerJITSection function will first make a section visible to the Rewriter, and then the user can partition this section in different functions using registerJITFunction, so the user passes the size down to the rewriter instead of the opposite.
I split out |
return Error::success(); | ||
} | ||
|
||
Error JITRewriteInstance::disassembleFunctions() { |
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.
I believe that this and other functions are common across *RewriteInstance classes. Is it worth defining a BaseRewriteInstance class and providing them there?
Add a class that allows a process to introspect or investigate itself by disassembling its memory contents just-in-time with BOLT. An example is shown in a new unittest binary.
This leverages the new ability to use BOLT as a library instead of as a regular executable that processes input binaries, demonstrating how to use BOLT as a library.