-
Notifications
You must be signed in to change notification settings - Fork 277
Fix/redirect exception handler output 2 #3951
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
martin-cs
wants to merge
5
commits into
diffblue:develop
from
martin-cs:fix/redirect-exception-handler-output-2
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8dcf94c
Add a messaget parameter to parse_option_baset to format errors
a8d64c3
Reformatting that clang-format wants.
f79bc90
Correct the expected strings for the JSON-UI tests
a0645f3
Enable the JSON UI tests for CBMC
6663119
Remove the patchy exception handling in Java tools and use default
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,8 +58,8 @@ Author: Daniel Kroening, [email protected] | |
#include <goto-analyzer/unreachable_instructions.h> | ||
|
||
janalyzer_parse_optionst::janalyzer_parse_optionst(int argc, const char **argv) | ||
: parse_options_baset(JANALYZER_OPTIONS, argc, argv), | ||
messaget(ui_message_handler), | ||
: messaget(ui_message_handler), | ||
parse_options_baset(JANALYZER_OPTIONS, argc, argv, *this), | ||
ui_message_handler(cmdline, std::string("JANALYZER ") + CBMC_VERSION) | ||
{ | ||
} | ||
|
@@ -355,29 +355,8 @@ int janalyzer_parse_optionst::doit() | |
|
||
register_languages(); | ||
|
||
try | ||
{ | ||
goto_model = | ||
initialize_goto_model(cmdline.args, get_message_handler(), options); | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
return CPROVER_EXIT_EXCEPTION; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
return CPROVER_EXIT_EXCEPTION; | ||
} | ||
|
||
catch(int e) | ||
{ | ||
error() << "Numeric exception: " << e << eom; | ||
return CPROVER_EXIT_EXCEPTION; | ||
} | ||
goto_model = | ||
initialize_goto_model(cmdline.args, get_message_handler(), options); | ||
|
||
if(process_goto_program(options)) | ||
return CPROVER_EXIT_INTERNAL_ERROR; | ||
|
@@ -402,34 +381,7 @@ int janalyzer_parse_optionst::doit() | |
return CPROVER_EXIT_SUCCESS; | ||
} | ||
|
||
try | ||
{ | ||
return perform_analysis(options); | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
return CPROVER_EXIT_EXCEPTION; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
return CPROVER_EXIT_EXCEPTION; | ||
} | ||
|
||
catch(int e) | ||
{ | ||
error() << "Numeric exception: " << e << eom; | ||
return CPROVER_EXIT_EXCEPTION; | ||
} | ||
|
||
catch(const std::bad_alloc &) | ||
{ | ||
error() << "Out of memory" << eom; | ||
return CPROVER_EXIT_INTERNAL_OUT_OF_MEMORY; | ||
} | ||
return perform_analysis(options); | ||
} | ||
|
||
/// Depending on the command line mode, run one of the analysis tasks | ||
|
@@ -554,8 +506,8 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options) | |
return CPROVER_EXIT_SUCCESS; | ||
} | ||
|
||
if(set_properties()) | ||
return CPROVER_EXIT_SET_PROPERTIES_FAILED; | ||
if(cmdline.isset("property")) | ||
::set_properties(goto_model, cmdline.get_values("property")); | ||
|
||
if(options.get_bool_option("general-analysis")) | ||
{ | ||
|
@@ -637,34 +589,6 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options) | |
return CPROVER_EXIT_USAGE_ERROR; | ||
} | ||
|
||
bool janalyzer_parse_optionst::set_properties() | ||
{ | ||
try | ||
{ | ||
if(cmdline.isset("property")) | ||
::set_properties(goto_model, cmdline.get_values("property")); | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
return true; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
return true; | ||
} | ||
|
||
catch(int) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool janalyzer_parse_optionst::process_goto_program(const optionst &options) | ||
{ | ||
try | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,8 +70,8 @@ Author: Daniel Kroening, [email protected] | |
#include <java_bytecode/simple_method_stubbing.h> | ||
|
||
jbmc_parse_optionst::jbmc_parse_optionst(int argc, const char **argv) | ||
: parse_options_baset(JBMC_OPTIONS, argc, argv), | ||
messaget(ui_message_handler), | ||
: messaget(ui_message_handler), | ||
parse_options_baset(JBMC_OPTIONS, argc, argv, *this), | ||
ui_message_handler(cmdline, std::string("JBMC ") + CBMC_VERSION) | ||
{ | ||
} | ||
|
@@ -80,8 +80,8 @@ ::jbmc_parse_optionst::jbmc_parse_optionst( | |
int argc, | ||
const char **argv, | ||
const std::string &extra_options) | ||
: parse_options_baset(JBMC_OPTIONS + extra_options, argc, argv), | ||
messaget(ui_message_handler), | ||
: messaget(ui_message_handler), | ||
parse_options_baset(JBMC_OPTIONS + extra_options, argc, argv, *this), | ||
ui_message_handler(cmdline, std::string("JBMC ") + CBMC_VERSION) | ||
{ | ||
} | ||
|
@@ -425,22 +425,7 @@ int jbmc_parse_optionst::doit() | |
// | ||
|
||
optionst options; | ||
try | ||
{ | ||
get_command_line_options(options); | ||
} | ||
|
||
catch(const char *error_msg) | ||
{ | ||
error() << error_msg << eom; | ||
return 6; // should contemplate EX_SOFTWARE from sysexits.h | ||
} | ||
|
||
catch(const std::string &error_msg) | ||
{ | ||
error() << error_msg << eom; | ||
return 6; // should contemplate EX_SOFTWARE from sysexits.h | ||
} | ||
get_command_line_options(options); | ||
|
||
// | ||
// Print a banner | ||
|
@@ -636,28 +621,8 @@ int jbmc_parse_optionst::doit() | |
|
||
bool jbmc_parse_optionst::set_properties(goto_modelt &goto_model) | ||
{ | ||
try | ||
{ | ||
if(cmdline.isset("property")) | ||
::set_properties(goto_model, cmdline.get_values("property")); | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
return true; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
return true; | ||
} | ||
|
||
catch(int) | ||
{ | ||
return true; | ||
} | ||
if(cmdline.isset("property")) | ||
::set_properties(goto_model, cmdline.get_values("property")); | ||
|
||
return false; | ||
} | ||
|
@@ -672,7 +637,6 @@ int jbmc_parse_optionst::get_goto_program( | |
return 6; | ||
} | ||
|
||
try | ||
{ | ||
lazy_goto_modelt lazy_goto_model=lazy_goto_modelt::from_handler_object( | ||
*this, options, get_message_handler()); | ||
|
@@ -738,29 +702,6 @@ int jbmc_parse_optionst::get_goto_program( | |
status() << config.object_bits_info() << eom; | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
return 6; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
return 6; | ||
} | ||
|
||
catch(int) | ||
{ | ||
return 6; | ||
} | ||
|
||
catch(const std::bad_alloc &) | ||
{ | ||
error() << "Out of memory" << eom; | ||
return 6; | ||
} | ||
|
||
return -1; // no error, continue | ||
} | ||
|
||
|
@@ -776,7 +717,6 @@ void jbmc_parse_optionst::process_goto_function( | |
bool using_symex_driven_loading = | ||
options.get_bool_option("symex-driven-lazy-loading"); | ||
|
||
try | ||
{ | ||
// Removal of RTTI inspection: | ||
remove_instanceof( | ||
|
@@ -861,24 +801,6 @@ void jbmc_parse_optionst::process_goto_function( | |
// update the function member in each instruction | ||
function.update_instructions_function(); | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
throw; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
throw; | ||
} | ||
|
||
catch(const std::bad_alloc &) | ||
{ | ||
error() << "Out of memory" << eom; | ||
throw; | ||
} | ||
} | ||
|
||
bool jbmc_parse_optionst::show_loaded_functions( | ||
|
@@ -933,7 +855,6 @@ bool jbmc_parse_optionst::process_goto_functions( | |
goto_modelt &goto_model, | ||
const optionst &options) | ||
{ | ||
try | ||
{ | ||
status() << "Running GOTO functions transformation passes" << eom; | ||
|
||
|
@@ -1021,29 +942,6 @@ bool jbmc_parse_optionst::process_goto_functions( | |
remove_skip(goto_model); | ||
} | ||
|
||
catch(const char *e) | ||
{ | ||
error() << e << eom; | ||
return true; | ||
} | ||
|
||
catch(const std::string &e) | ||
{ | ||
error() << e << eom; | ||
return true; | ||
} | ||
|
||
catch(int) | ||
{ | ||
return true; | ||
} | ||
|
||
catch(const std::bad_alloc &) | ||
{ | ||
error() << "Out of memory" << eom; | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Here and everywhere else: what about only passing the message handler, not the full
messaget
? I think that would reduce the amount of churn in this commit, and would still achieve the same effect.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.
Can do...