-
Notifications
You must be signed in to change notification settings - Fork 277
Feature/restrict function pointer by name [depends-on: #5168] #5174
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
Feature/restrict function pointer by name [depends-on: #5168] #5174
Conversation
This adds a new option, --restrict-function-pointer, to cbmc. This lets a user specify a list of possible pointer targets for specific function pointer call sites, rather than have remove_function_pointers guess possible values. The intended purpose behind this is to prevent excessive symex time wasted on exploring paths the user knows the program can never actually take.
#include <cstdlib> // exit() | ||
#include <fstream> |
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.
It looks like you called clang-format
on the whole file: maybe a separate commit?
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.
Nah I'll undo it.
038bdb4
to
13bf822
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.
Looks good.
This works similar to restrict-function-pointer, but for names of individual function pointer variables (globals, locals, parameters) rather than call sites. This isn't applicable to all situations (for example, calling function pointers in structs or function pointers returned from functions), but is more readily applicable to some common use scenarios (e.g. global function pointers loaded at start time like in OpenGL).
13bf822
to
bb617bb
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: ee5b42b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/135430669
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 seems like a more convenient way of using this feature than indexing the calls in a function––thanks!
inline irep_idt string2id(const std::string &id_string) | ||
{ | ||
return irep_idt{id_string}; | ||
} | ||
|
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 seems unnecessary (and unused)?
This works similar to restrict-function-pointer, but for names of individual
function pointer variables (globals, locals, parameters) rather than call sites.
This isn't applicable to all situations (for example, calling function pointers
in structs or function pointers returned from functions), but is more readily
applicable to some common use scenarios (e.g. global function pointers loaded at
start time like in OpenGL).