@@ -26,6 +26,7 @@ Author: Daniel Kroening, kroening@kroening.com
2626#include < ansi-c/string_constant.h>
2727
2828#include < goto-programs/goto_functions.h>
29+ #include < goto-programs/remove_exceptions.h>
2930
3031#include " java_entry_point.h"
3132#include " java_object_factory.h"
@@ -325,6 +326,24 @@ void java_record_outputs(
325326 init_code.move_to_operands (output);
326327 }
327328 }
329+
330+ // record exceptional return variable as output
331+ codet output (ID_output);
332+ output.operands ().resize (2 );
333+
334+ assert (symbol_table.has_symbol (id2string (function.name )+EXC_SUFFIX));
335+
336+ // retrieve the exception variable
337+ const symbolt exc_symbol=symbol_table.lookup (
338+ id2string (function.name )+EXC_SUFFIX);
339+
340+ output.op0 ()=address_of_exprt (
341+ index_exprt (string_constantt (exc_symbol.base_name ),
342+ from_integer (0 , index_type ())));
343+ output.op1 ()=exc_symbol.symbol_expr ();
344+ output.add_source_location ()=function.location ;
345+
346+ init_code.move_to_operands (output);
328347}
329348
330349main_function_resultt get_main_symbol (
@@ -591,6 +610,15 @@ bool java_entry_point(
591610 call_main.lhs ()=return_symbol.symbol_expr ();
592611 }
593612
613+ // add the exceptional return value
614+ auxiliary_symbolt exc_symbol;
615+ exc_symbol.mode =ID_C;
616+ exc_symbol.is_static_lifetime =false ;
617+ exc_symbol.name =id2string (symbol.name )+EXC_SUFFIX;
618+ exc_symbol.base_name =id2string (symbol.name )+EXC_SUFFIX;
619+ exc_symbol.type =typet (ID_pointer, empty_typet ());
620+ symbol_table.add (exc_symbol);
621+
594622 exprt::operandst main_arguments=
595623 java_build_arguments (
596624 symbol,
0 commit comments