Function haybale::get_possible_return_values_of_func
source · pub fn get_possible_return_values_of_func<'p>(
funcname: &str,
project: &'p Project,
config: Config<'p, DefaultBackend>,
params: Option<Vec<ParameterVal>>,
thrown_size: Option<u32>,
n: usize
) -> PossibleSolutions<ReturnValue<u64>>
Expand description
Get a description of the possible return values of a function, for given argument values. Considers all possible paths through the function given these arguments.
funcname
: Name of the function to analyze.
For Project
s containing C++ or Rust code, you can pass either the mangled
or demangled function name (fully qualified with namespaces/modules).
project
: The Project
(set of LLVM modules) in which symbolic execution
should take place. In the absence of function hooks (see
Config
), we will try to enter calls to any functions
defined in the Project
.
params
: a ParameterVal
for each parameter to the function, indicating
what the initial value of that parameter should be, or if the parameter
should be unconstrained (so that the analysis considers all possible values
for the parameter).
None
here is equivalent to supplying a Vec
with all
ParameterVal::Unconstrained
entries.
thrown_size
:
If this is None
, then no attempt will be made to distinguish
between different values being thrown. A maximum of one ReturnValue::Throw
will be returned, and it will contain one possible pointer value.
If this is not None
, then it indicates the size in bits
of the value or object expected to be thrown. Many different
ReturnValue::Throw
s may be returned, each containing a distinct possible
value or object (not pointer) which may be thrown.
n
: Maximum number of distinct solutions to check for.
If there are more than n
possible solutions, this returns a
PossibleSolutions::AtLeast
containing at least n+1
solutions.
Note: get_possible_return_values_of_func()
may be of some use itself, but
also serves as an example of how you can use the other public functions in
the crate.