Skip to content

Fix/redirect exception handler output 3 #3952

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
88 changes: 6 additions & 82 deletions jbmc/src/janalyzer/janalyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ 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),
: parse_options_baset(JANALYZER_OPTIONS, argc, argv, ui_message_handler),
messaget(ui_message_handler),
ui_message_handler(cmdline, std::string("JANALYZER ") + CBMC_VERSION)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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"))
{
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion jbmc/src/janalyzer/janalyzer_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ class janalyzer_parse_optionst : public parse_options_baset, public messaget
virtual void get_command_line_options(optionst &options);

virtual bool process_goto_program(const optionst &options);
bool set_properties();

virtual int perform_analysis(const optionst &options);

Expand Down
116 changes: 9 additions & 107 deletions jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ 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),
: parse_options_baset(JBMC_OPTIONS, argc, argv, ui_message_handler),
messaget(ui_message_handler),
ui_message_handler(cmdline, std::string("JBMC ") + CBMC_VERSION)
{
Expand All @@ -80,7 +80,11 @@ ::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),
: parse_options_baset(
JBMC_OPTIONS + extra_options,
argc,
argv,
ui_message_handler),
messaget(ui_message_handler),
ui_message_handler(cmdline, std::string("JBMC ") + CBMC_VERSION)
{
Expand Down Expand Up @@ -425,22 +429,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
Expand Down Expand Up @@ -636,28 +625,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;
}
Expand All @@ -672,7 +641,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());
Expand Down Expand Up @@ -738,29 +706,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
}

Expand All @@ -776,7 +721,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(
Expand Down Expand Up @@ -861,24 +805,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(
Expand Down Expand Up @@ -933,7 +859,6 @@ bool jbmc_parse_optionst::process_goto_functions(
goto_modelt &goto_model,
const optionst &options)
{
try
{
status() << "Running GOTO functions transformation passes" << eom;

Expand Down Expand Up @@ -1021,29 +946,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;
}

Expand Down
34 changes: 6 additions & 28 deletions jbmc/src/jdiff/jdiff_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Author: Peter Schrammel
// TODO: do not use language_uit for this; requires a refactoring of
// initialize_goto_model to support parsing specific command line files
jdiff_parse_optionst::jdiff_parse_optionst(int argc, const char **argv)
: parse_options_baset(JDIFF_OPTIONS, argc, argv),
: parse_options_baset(JDIFF_OPTIONS, argc, argv, ui_message_handler),
jdiff_languagest(cmdline, ui_message_handler, &options),
ui_message_handler(cmdline, std::string("JDIFF ") + CBMC_VERSION),
languages2(cmdline, ui_message_handler, &options)
Expand All @@ -74,7 +74,11 @@ ::jdiff_parse_optionst::jdiff_parse_optionst(
int argc,
const char **argv,
const std::string &extra_options)
: parse_options_baset(JDIFF_OPTIONS + extra_options, argc, argv),
: parse_options_baset(
JDIFF_OPTIONS + extra_options,
argc,
argv,
ui_message_handler),
jdiff_languagest(cmdline, ui_message_handler, &options),
ui_message_handler(cmdline, std::string("JDIFF ") + CBMC_VERSION),
languages2(cmdline, ui_message_handler, &options)
Expand Down Expand Up @@ -342,7 +346,6 @@ bool jdiff_parse_optionst::process_goto_program(
const optionst &options,
goto_modelt &goto_model)
{
try
{
// remove function pointers
status() << "Removing function pointers and virtual functions" << eom;
Expand Down Expand Up @@ -407,31 +410,6 @@ bool jdiff_parse_optionst::process_goto_program(
goto_model.goto_functions.update();
}

catch(const char *e)
{
error() << e << eom;
return true;
}

catch(const std::string &e)
{
error() << e << eom;
return true;
}

catch(int e)
{
error() << "Numeric exception: " << e << eom;
return true;
}

catch(const std::bad_alloc &)
{
error() << "Out of memory" << eom;
exit(CPROVER_EXIT_INTERNAL_OUT_OF_MEMORY);
return true;
}

return false;
}

Expand Down
4 changes: 2 additions & 2 deletions regression/cbmc/json-ui/no_entry.desc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
KNOWNBUG
CORE
no_entry.c
--json-ui
activate-multi-line-match
^EXIT=6$
^SIGNAL=0$
"messageText": "the program has no entry point",[\n ]*"messageType": "ERROR",
"messageText": "the program has no entry point",[\n ]*"messageType": "ERROR"
--
^warning: ignoring
^VERIFICATION SUCCESSFUL$
Loading