65
65
#include " sec_driver_parse_options.h"
66
66
67
67
#include < fstream>
68
+ #include < java_bytecode/java_utils.h>
68
69
69
70
sec_driver_parse_optionst::sec_driver_parse_optionst (int argc, const char **argv):
70
71
parse_options_baset(SEC_DRIVER_OPTIONS, argc, argv),
@@ -227,6 +228,26 @@ int sec_driver_parse_optionst::doit()
227
228
value_set_analysis.save_summary (gf.body );
228
229
}
229
230
else {
231
+ const std::string function_name = cmdline.get_value (" function" );
232
+ const bool print_function_summary = cmdline.isset (" show-value-sets" );
233
+ const bool print_all_summaries = cmdline.isset (" show-value-sets-all" );
234
+
235
+ std::string error_string;
236
+ const irep_idt fully_qualified_name = resolve_friendly_method_name (
237
+ function_name, goto_model.symbol_table , error_string);
238
+ if (print_function_summary)
239
+ {
240
+ if (function_name.empty ())
241
+ {
242
+ warning () << " Show value set analysis enabled but no function name passed in. "
243
+ " Please add a function name or use show-value-sets-all.\n " ;
244
+ }
245
+ else if (!error_string.empty ())
246
+ {
247
+ error () << " Error when resolving function to symbol: " << error_string << " \n " ;
248
+ }
249
+ }
250
+
230
251
call_grapht const call_graph (goto_model.goto_functions );
231
252
std::vector<irep_idt> process_order =
232
253
get_inverse_topological_order (call_graph.get_directed_graph ());
@@ -250,7 +271,8 @@ int sec_driver_parse_optionst::doit()
250
271
summarydb);
251
272
value_set_analysis.set_message_handler (get_message_handler ());
252
273
value_set_analysis (gf.body );
253
- if (cmdline.isset (" show-value-sets" ))
274
+
275
+ if ((print_function_summary && fname == fully_qualified_name) || print_all_summaries)
254
276
{
255
277
switch (get_ui ())
256
278
{
@@ -275,7 +297,7 @@ int sec_driver_parse_optionst::doit()
275
297
value_set_analysis.save_summary (gf.body );
276
298
}
277
299
278
- if (cmdline. isset ( " show-value-sets " ) &&
300
+ if ((print_function_summary || print_all_summaries ) &&
279
301
get_ui ()==ui_message_handlert::uit::JSON_UI)
280
302
{
281
303
json_objectt dump_message;
0 commit comments