Skip to content

Commit 924be12

Browse files
authored
Merge pull request diffblue#360 from diffblue/SEC-304_Slow_Summary_Printing
SEC-304: Slow VSA summary printing
2 parents e02b1ac + 545b46b commit 924be12

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/driver/sec_driver_parse_options.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "sec_driver_parse_options.h"
6666

6767
#include <fstream>
68+
#include <java_bytecode/java_utils.h>
6869

6970
sec_driver_parse_optionst::sec_driver_parse_optionst(int argc, const char **argv):
7071
parse_options_baset(SEC_DRIVER_OPTIONS, argc, argv),
@@ -227,6 +228,26 @@ int sec_driver_parse_optionst::doit()
227228
value_set_analysis.save_summary(gf.body);
228229
}
229230
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+
230251
call_grapht const call_graph(goto_model.goto_functions);
231252
std::vector<irep_idt> process_order =
232253
get_inverse_topological_order(call_graph.get_directed_graph());
@@ -250,7 +271,8 @@ int sec_driver_parse_optionst::doit()
250271
summarydb);
251272
value_set_analysis.set_message_handler(get_message_handler());
252273
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)
254276
{
255277
switch(get_ui())
256278
{
@@ -275,7 +297,7 @@ int sec_driver_parse_optionst::doit()
275297
value_set_analysis.save_summary(gf.body);
276298
}
277299

278-
if(cmdline.isset("show-value-sets") &&
300+
if((print_function_summary || print_all_summaries) &&
279301
get_ui()==ui_message_handlert::uit::JSON_UI)
280302
{
281303
json_objectt dump_message;

src/driver/sec_driver_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class optionst;
3838
"(intervals)(show-intervals)" \
3939
"(non-null)(show-non-null)" \
4040
"(lvsa-summary-directory):" \
41-
"(local-value-set-analysis)(show-value-sets)(lvsa-function):" \
41+
"(local-value-set-analysis)(show-value-sets-all)(show-value-sets)(lvsa-function):" \
4242
"(security-scanner):" \
4343
"(do-not-use-precise-access-paths)" \
4444
"(rebuild-taint-cache)" \

0 commit comments

Comments
 (0)