@@ -26,6 +26,7 @@ Author: Daniel Kroening, kroening@kroening.com
26
26
#include < ansi-c/string_constant.h>
27
27
28
28
#include < goto-programs/goto_functions.h>
29
+ #include < goto-programs/remove_exceptions.h>
29
30
30
31
#include " java_entry_point.h"
31
32
#include " java_object_factory.h"
@@ -325,6 +326,24 @@ void java_record_outputs(
325
326
init_code.move_to_operands (output);
326
327
}
327
328
}
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);
328
347
}
329
348
330
349
main_function_resultt get_main_symbol (
@@ -591,6 +610,15 @@ bool java_entry_point(
591
610
call_main.lhs ()=return_symbol.symbol_expr ();
592
611
}
593
612
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
+
594
622
exprt::operandst main_arguments=
595
623
java_build_arguments (
596
624
symbol,
0 commit comments