Skip to content

Separate collecting function pointer targets [alternative-to: #4536] #4650

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

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b97f158
Extract do_function_call loop into separate method
Apr 12, 2019
bdc086d
Refactor do_function_calls
Apr 12, 2019
2efa707
Split do_function_call into two for stub/non-stub
Apr 12, 2019
17191e0
Set up the interface for fp_target map
Apr 15, 2019
98d6dbd
Add do_function_call for function pointers
petr-bauch Apr 17, 2019
2ad5ee4
Extract the collection of candidate functions
petr-bauch Apr 17, 2019
f2f489a
Re-implement remove_function_pointers
petr-bauch Apr 17, 2019
b34bf4b
Refactor remove_function_pointers
petr-bauch Apr 17, 2019
2a73c00
Add tests for listing potential targets and remove/restore returns
NlightNFotis Apr 29, 2019
83a4ad2
Assume and assert existence of the right target
petr-bauch Apr 29, 2019
4ab34a4
Swap argument order for remove_returns
petr-bauch May 11, 2019
2699e22
Improve comments and fix invariant message
petr-bauch May 11, 2019
d203ddf
Add a unit test for remove function pointers
petr-bauch May 11, 2019
16de643
Helper for extracting function identifier
petr-bauch May 12, 2019
5a39535
Introduce collection-function-pointer-targets
petr-bauch May 13, 2019
6fb460a
Move taken-addresses and type_map
petr-bauch May 13, 2019
15d8873
Move refine_call_type and type comparators
petr-bauch May 13, 2019
83d03c6
Move get_callee_id
petr-bauch May 13, 2019
c46255a
Implement the collector interface
petr-bauch May 13, 2019
49f0582
Implement collection candidates from all goto-functions
petr-bauch May 13, 2019
46ab130
Implement try-remove-const
petr-bauch May 13, 2019
6d2c53b
Implement collecting over a single goto-program
petr-bauch May 13, 2019
8eae87b
Introduce new interface for remove-function-pointers
petr-bauch May 13, 2019
cb09d11
Re-implement remove_function_pointers
petr-bauch May 13, 2019
f784091
Re-implement remove-function-pointer
petr-bauch May 13, 2019
1a99dd8
Use the type definitions from collector
petr-bauch May 13, 2019
64eb0a2
Tracking the analyses state was moved
petr-bauch May 13, 2019
4fcafc9
Change interface and document remove_function_pointers
petr-bauch May 13, 2019
86ba45c
Use type definition from collector
petr-bauch May 13, 2019
d868de3
Stop using functionst
petr-bauch May 13, 2019
7177c61
Use the new interface
petr-bauch May 13, 2019
8f23786
Use the new interface
petr-bauch May 13, 2019
fbf7f63
Fix broken rebase
petr-bauch May 13, 2019
38227e7
Remove mysterious whitespaces
petr-bauch May 13, 2019
6c54d80
Remove extra body of get_function_pointer_targets
petr-bauch May 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jbmc/src/janalyzer/janalyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
goto_partial_inline(goto_model, ui_message_handler);

// remove returns, gcc vectors, complex
remove_returns(goto_model);
remove_returns(goto_model, log.get_message_handler());
remove_vector(goto_model);
remove_complex(goto_model);

Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ void jbmc_parse_optionst::process_goto_function(
!model.can_produce_function(id);
};

remove_returns(function, function_is_stub);
remove_returns(function, log.get_message_handler(), function_is_stub);

replace_java_nondet(function);

Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/jdiff/jdiff_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool jdiff_parse_optionst::process_goto_program(
instrument_preconditions(goto_model);

// remove returns, gcc vectors, complex
remove_returns(goto_model);
remove_returns(goto_model, log.get_message_handler());
remove_vector(goto_model);
remove_complex(goto_model);
rewrite_union(goto_model);
Expand Down
16 changes: 12 additions & 4 deletions jbmc/unit/java_bytecode/java_replace_nondet/replace_nondet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ void load_and_test_method(
// Then test both situations.
THEN("Replace nondet should work after remove returns has been called.")
{
remove_returns(model_function, [](const irep_idt &) { return false; });
remove_returns(model_function, null_message_handler, [](const irep_idt &) {
return false;
});

replace_java_nondet(model_function);

Expand All @@ -165,7 +167,9 @@ void load_and_test_method(
{
replace_java_nondet(model_function);

remove_returns(model_function, [](const irep_idt &) { return false; });
remove_returns(model_function, null_message_handler, [](const irep_idt &) {
return false;
});

validate_nondet_method_removed(goto_function.body.instructions);
}
Expand All @@ -176,7 +180,9 @@ void load_and_test_method(
"Replace and convert nondet should work after remove returns has been "
"called.")
{
remove_returns(model_function, [](const irep_idt &) { return false; });
remove_returns(model_function, null_message_handler, [](const irep_idt &) {
return false;
});

replace_java_nondet(model_function);

Expand All @@ -193,7 +199,9 @@ void load_and_test_method(

convert_nondet(model_function, null_message_handler, params, ID_java);

remove_returns(model_function, [](const irep_idt &) { return false; });
remove_returns(model_function, null_message_handler, [](const irep_idt &) {
return false;
});

validate_nondets_converted(goto_function.body.instructions);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cbmc/cbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ bool cbmc_parse_optionst::process_goto_program(
instrument_preconditions(goto_model);

// remove returns, gcc vectors, complex
remove_returns(goto_model);
remove_returns(goto_model, log.get_message_handler());
remove_vector(goto_model);
remove_complex(goto_model);
rewrite_union(goto_model);
Expand Down
2 changes: 1 addition & 1 deletion src/goto-analyzer/goto_analyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ bool goto_analyzer_parse_optionst::process_goto_program(
goto_partial_inline(goto_model, ui_message_handler);

// remove returns, gcc vectors, complex
remove_returns(goto_model);
remove_returns(goto_model, log.get_message_handler());
remove_vector(goto_model);
remove_complex(goto_model);

Expand Down
2 changes: 1 addition & 1 deletion src/goto-analyzer/static_simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ bool static_simplifier(
}

// restore return types before writing the binary
restore_returns(goto_model);
restore_returns(goto_model, m.get_message_handler());
goto_model.goto_functions.update();

m.status() << "Writing goto binary" << messaget::eom;
Expand Down
2 changes: 1 addition & 1 deletion src/goto-diff/goto_diff_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ bool goto_diff_parse_optionst::process_goto_program(
instrument_preconditions(goto_model);

// remove returns, gcc vectors, complex
remove_returns(goto_model);
remove_returns(goto_model, log.get_message_handler());
remove_vector(goto_model);
remove_complex(goto_model);
rewrite_union(goto_model);
Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ int goto_instrument_parse_optionst::doit()

// restore RETURN instructions in case remove_returns had been
// applied
restore_returns(goto_model);
restore_returns(goto_model, log.get_message_handler());

if(cmdline.args.size()==2)
{
Expand Down Expand Up @@ -899,7 +899,7 @@ void goto_instrument_parse_optionst::do_remove_returns()
remove_returns_done=true;

log.status() << "Removing returns" << messaget::eom;
remove_returns(goto_model);
remove_returns(goto_model, log.get_message_handler());
}

void goto_instrument_parse_optionst::get_goto_program()
Expand Down
1 change: 1 addition & 0 deletions src/goto-programs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SRC = adjust_float_expressions.cpp \
class_hierarchy.cpp \
class_identifier.cpp \
compute_called_functions.cpp \
collect_function_pointer_targets.cpp \
destructor.cpp \
destructor_tree.cpp \
elf_reader.cpp \
Expand Down
Loading