Skip to content

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

Conversation

hannes-steffenhagen-diffblue
Copy link
Contributor

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).

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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>
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@hannes-steffenhagen-diffblue hannes-steffenhagen-diffblue force-pushed the feature/restrict-function-pointer-by-name branch from 038bdb4 to 13bf822 Compare November 6, 2019 16:38
Copy link
Contributor

@xbauch xbauch left a 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).
@hannes-steffenhagen-diffblue hannes-steffenhagen-diffblue force-pushed the feature/restrict-function-pointer-by-name branch from 13bf822 to bb617bb Compare November 6, 2019 16:47
Copy link
Contributor

@allredj allredj left a 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

@karkhaz karkhaz added the aws Bugs or features of importance to AWS CBMC users label Feb 12, 2020
@karkhaz karkhaz self-assigned this Feb 12, 2020
Copy link
Collaborator

@karkhaz karkhaz left a 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!

@danpoe danpoe mentioned this pull request Mar 7, 2020
5 tasks
Comment on lines +53 to +57
inline irep_idt string2id(const std::string &id_string)
{
return irep_idt{id_string};
}

Copy link
Collaborator

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants