CBMC
|
Go to the source code of this file.
Classes | |
struct | main_function_resultt |
Macros | |
#define | JAVA_ENTRY_POINT_RETURN_SYMBOL "return'" |
#define | JAVA_ENTRY_POINT_EXCEPTION_SYMBOL "uncaught_exception'" |
Typedefs | |
using | build_argumentst = std::function< std::pair< code_blockt, std::vector< exprt > >(const symbolt &function, symbol_table_baset &symbol_table)> |
Functions | |
bool | java_entry_point (class symbol_table_baset &symbol_table, const irep_idt &main_class, class message_handlert &message_handler, bool assume_init_pointers_not_null, bool assert_uncaught_exceptions, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled, const build_argumentst &build_arguments) |
Given the symbol_table and the main_class to test, this function generates a new function __CPROVER__start that calls the method under tests. More... | |
irep_idt | get_java_class_literal_initializer_signature () |
Get the symbol name of java.lang.Class' initializer method. More... | |
main_function_resultt | get_main_symbol (const symbol_table_baset &symbol_table, const irep_idt &main_class, message_handlert &) |
Figures out the entry point of the code to verify. More... | |
bool | generate_java_start_function (const symbolt &symbol, class symbol_table_baset &symbol_table, class message_handlert &message_handler, bool assert_uncaught_exceptions, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, const build_argumentst &build_arguments) |
Generate a _start function for a specific function. More... | |
std::pair< code_blockt, std::vector< exprt > > | java_build_arguments (const symbolt &function, symbol_table_baset &symbol_table, bool assume_init_pointers_not_null, java_object_factory_parameterst object_factory_parameters, const select_pointer_typet &pointer_type_selector, message_handlert &message_handler) |
void | create_java_initialize (symbol_table_baset &symbol_table) |
Adds __cprover_initialize to the symbol_table but does not generate code for it yet. More... | |
void | java_static_lifetime_init (symbol_table_baset &symbol_table, const source_locationt &source_location, bool assume_init_pointers_not_null, java_object_factory_parameterst object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled, message_handlert &message_handler) |
Adds the body to __CPROVER_initialize. More... | |
#define JAVA_ENTRY_POINT_EXCEPTION_SYMBOL "uncaught_exception'" |
Definition at line 22 of file java_entry_point.h.
#define JAVA_ENTRY_POINT_RETURN_SYMBOL "return'" |
Definition at line 21 of file java_entry_point.h.
using build_argumentst = std::function<std::pair<code_blockt, std::vector<exprt> >( const symbolt &function, symbol_table_baset &symbol_table)> |
Definition at line 24 of file java_entry_point.h.
void create_java_initialize | ( | symbol_table_baset & | symbol_table | ) |
Adds __cprover_initialize
to the symbol_table
but does not generate code for it yet.
Definition at line 48 of file java_entry_point.cpp.
bool generate_java_start_function | ( | const symbolt & | symbol, |
class symbol_table_baset & | symbol_table, | ||
class message_handlert & | message_handler, | ||
bool | assert_uncaught_exceptions, | ||
const java_object_factory_parameterst & | object_factory_parameters, | ||
const select_pointer_typet & | pointer_type_selector, | ||
const build_argumentst & | build_arguments | ||
) |
Generate a _start function for a specific function.
See java_entry_point for more details.
symbol | The symbol representing the function to call |
symbol_table | Global symbol table |
message_handler | Where to write output to |
assert_uncaught_exceptions | Add an uncaught-exception check |
object_factory_parameters | Parameters for creation of arguments |
pointer_type_selector | Logic for substituting types of pointers |
build_arguments | The function which builds the codet s which initialise the arguments for a function. |
Definition at line 637 of file java_entry_point.cpp.
irep_idt get_java_class_literal_initializer_signature | ( | ) |
Get the symbol name of java.lang.Class' initializer method.
This method should initialize a Class instance with known properties of the type it represents, such as its name, whether it is abstract, or an enumeration, etc. The method may or may not exist in any particular symbol table; it is up to the caller to check. The method's Java signature is: void cproverInitializeClassLiteral( String name, boolean isAnnotation, boolean isArray, boolean isInterface, boolean isSynthetic, boolean isLocalClass, boolean isMemberClass, boolean isEnum);
Definition at line 77 of file java_entry_point.cpp.
main_function_resultt get_main_symbol | ( | const symbol_table_baset & | symbol_table, |
const irep_idt & | main_class, | ||
message_handlert & | message_handler | ||
) |
Figures out the entry point of the code to verify.
Definition at line 548 of file java_entry_point.cpp.
std::pair<code_blockt, std::vector<exprt> > java_build_arguments | ( | const symbolt & | function, |
symbol_table_baset & | symbol_table, | ||
bool | assume_init_pointers_not_null, | ||
java_object_factory_parameterst | object_factory_parameters, | ||
const select_pointer_typet & | pointer_type_selector, | ||
message_handlert & | message_handler | ||
) |
function | The function under test, for which to build the arguments. |
symbol_table | For the purposes of adding any local variables generated or any functions which are generated and called. |
assume_init_pointers_not_null | If this is true then any reference type parameters to the function under tests are assumed to be non-null. |
object_factory_parameters | Configuration of the object factory. |
pointer_type_selector | Means of selecting the type of value constructed for reference types which are initialised by the code returned. |
message_handler | log |
function
. The vector of expressions can be used as arguments for function
. The code returned allocates the objects used as test arguments for the function under test (function
) and non-deterministically initializes them. This code returned must be placed into the code block of the function call, before the function call. Typically this code block would be __CPROVER__start. Definition at line 321 of file java_entry_point.cpp.
bool java_entry_point | ( | class symbol_table_baset & | symbol_table, |
const irep_idt & | main_class, | ||
class message_handlert & | message_handler, | ||
bool | assume_init_pointers_not_null, | ||
bool | assert_uncaught_exceptions, | ||
const java_object_factory_parameterst & | object_factory_parameters, | ||
const select_pointer_typet & | pointer_type_selector, | ||
bool | string_refinement_enabled, | ||
const build_argumentst & | build_arguments | ||
) |
Given the symbol_table
and the main_class
to test, this function generates a new function __CPROVER__start that calls the method under tests.
If __CPROVER__start is already in the symbol_table
, it silently returns. Otherwise it finds the method under test using get_main_symbol
and constructs a body for __CPROVER__start which does as follows:
code_outputt
, together with other objects possibly altered by the execution of the method under test (in java_record_outputs
)When assume_init_pointers_not_null
is false, the generated parameter initialization code will non-deterministically set input parameters to either null or a stack-allocated object. Observe that the null/non-null setting only applies to the parameter itself, and is not propagated to other pointers that it might be necessary to initialize in the object tree rooted at the parameter. Parameter max_nondet_array_length
provides the maximum length for an array used as part of the input to the method under test, and max_nondet_tree_depth
defines the maximum depth of the object tree created for such inputs. This maximum depth is used in conjunction with the so-called "recursive type set" (see field recursive_set
in class java_object_factoryt) to bound the depth of the object tree for the parameter. Only when
symbol_table | Global symbol table |
main_class | Identifier of a class within which the main method to be analysed exists. This may be empty if the intention is not to analyse the main method. |
message_handler | Where to write output to. |
assume_init_pointers_not_null | If this is true then any reference type parameters to the function under tests are assumed to be non-null. |
assert_uncaught_exceptions | Add an uncaught-exception check. |
object_factory_parameters | Parameters for creation of arguments. |
pointer_type_selector | Logic for substituting types of pointers. |
string_refinement_enabled | If true, string refinement's string data structure will also be initialised and added to the symbol table. |
build_arguments | The function which builds the codet s which initialise the arguments for a function. |
Definition at line 602 of file java_entry_point.cpp.
void java_static_lifetime_init | ( | symbol_table_baset & | symbol_table, |
const source_locationt & | source_location, | ||
bool | assume_init_pointers_not_null, | ||
java_object_factory_parameterst | object_factory_parameters, | ||
const select_pointer_typet & | pointer_type_selector, | ||
bool | string_refinement_enabled, | ||
message_handlert & | message_handler | ||
) |
Adds the body to __CPROVER_initialize.
Definition at line 227 of file java_entry_point.cpp.