@@ -1034,18 +1034,11 @@ codet java_bytecode_convert_methodt::convert_instructions(
10341034 i_it->statement ==" invokespecial" ||
10351035 i_it->statement ==" invokeinterface" )
10361036 {
1037- // find the corresponding try-catch blocks and add the handlers
1038- // to the targets
1039- for (const auto &exception_row : method.exception_table )
1040- {
1041- if (i_it->address >=exception_row.start_pc &&
1042- i_it->address <exception_row.end_pc )
1043- {
1044- a_entry.first ->second .successors .push_back (
1045- exception_row.handler_pc );
1046- targets.insert (exception_row.handler_pc );
1047- }
1048- }
1037+ const std::vector<unsigned int > handler =
1038+ try_catch_handler (i_it->address , method.exception_table );
1039+ std::list<unsigned int > &successors = a_entry.first ->second .successors ;
1040+ successors.insert (successors.end (), handler.begin (), handler.end ());
1041+ targets.insert (handler.begin (), handler.end ());
10491042 }
10501043
10511044 if (i_it->statement ==" goto" ||
@@ -2726,6 +2719,20 @@ codet java_bytecode_convert_methodt::convert_instructions(
27262719 return code;
27272720}
27282721
2722+ std::vector<unsigned > java_bytecode_convert_methodt::try_catch_handler (
2723+ const unsigned int address,
2724+ const java_bytecode_parse_treet::methodt::exception_tablet &exception_table)
2725+ const
2726+ {
2727+ std::vector<unsigned > result;
2728+ for (const auto &exception_row : exception_table)
2729+ {
2730+ if (address >= exception_row.start_pc && address < exception_row.end_pc )
2731+ result.push_back (exception_row.handler_pc );
2732+ }
2733+ return result;
2734+ }
2735+
27292736// / This uses a cut-down version of the logic in
27302737// / java_bytecode_convert_methodt::convert to initialize symbols for the
27312738// / parameters and update the parameters in the type of method_symbol with
0 commit comments