Skip to content

Commit 7b45085

Browse files
authored
Merge pull request #8546 from diffblue/show-local-bitvector
goto-analyzer: `--show-local-bitvector`
2 parents 189e49b + 1e50663 commit 7b45085

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

Diff for: doc/man/goto-analyzer.1

+3
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ perform taint analysis using rules in given file
409409
\fB\-\-show\-taint\fR
410410
print taint analysis results on stdout
411411
.TP
412+
\fB\-\-show\-local\-bitvector\fR
413+
perform procedure\-local bitvector analysis
414+
.TP
412415
\fB\-\-show\-local\-may\-alias\fR
413416
perform procedure\-local may alias analysis
414417
.SS "C/C++ frontend options:"

Diff for: regression/goto-analyzer/bitvector-analysis/basic1.c

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int some_int;
2+
int *pointer_global;
3+
4+
void foobar(int *pointer_parameter)
5+
{
6+
int *pointer_local;
7+
pointer_local = &some_int;
8+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
basic1.c
3+
--show-local-bitvector
4+
^ foobar::pointer_parameter: \+unknown$
5+
^ foobar::1::pointer_local: \+static_lifetime$
6+
^EXIT=0$
7+
^SIGNAL=0$
8+
--

Diff for: src/goto-analyzer/goto_analyzer_parse_options.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Author: Daniel Kroening, [email protected]
2525
#include <goto-programs/show_symbol_table.h>
2626

2727
#include <analyses/ai.h>
28+
#include <analyses/local_bitvector_analysis.h>
2829
#include <analyses/local_may_alias.h>
2930
#include <ansi-c/cprover_library.h>
3031
#include <ansi-c/gcc_version.h>
@@ -139,6 +140,11 @@ void goto_analyzer_parse_optionst::get_command_line_options(optionst &options)
139140
options.set_option("show-local-may-alias", true);
140141
options.set_option("specific-analysis", true);
141142
}
143+
if(cmdline.isset("show-local-bitvector"))
144+
{
145+
options.set_option("show-local-bitvector", true);
146+
options.set_option("specific-analysis", true);
147+
}
142148

143149
// Output format choice
144150
if(cmdline.isset("text"))
@@ -572,6 +578,23 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
572578
return CPROVER_EXIT_SUCCESS;
573579
}
574580

581+
if(options.get_bool_option("show-local-bitvector"))
582+
{
583+
namespacet ns(goto_model.symbol_table);
584+
585+
for(const auto &gf_entry : goto_model.goto_functions.function_map)
586+
{
587+
std::cout << ">>>>\n";
588+
std::cout << ">>>> " << gf_entry.first << '\n';
589+
std::cout << ">>>>\n";
590+
local_bitvector_analysist local_bitvector_analysis(gf_entry.second, ns);
591+
local_bitvector_analysis.output(std::cout, gf_entry.second, ns);
592+
std::cout << '\n';
593+
}
594+
595+
return CPROVER_EXIT_SUCCESS;
596+
}
597+
575598
label_properties(goto_model);
576599

577600
if(cmdline.isset("show-properties"))
@@ -802,6 +825,7 @@ void goto_analyzer_parse_optionst::help()
802825
" {y--taint} {ufile_name} \t perform taint analysis using rules in given"
803826
" file\n"
804827
" {y--show-taint} \t print taint analysis results on stdout\n"
828+
" {y--show-local-bitvector} \t perform procedure-local bitvector analysis\n"
805829
" {y--show-local-may-alias} \t perform procedure-local may alias analysis\n"
806830
"\n"
807831
"C/C++ frontend options:\n"

Diff for: src/goto-analyzer/goto_analyzer_parse_options.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ class optionst;
144144

145145
#define GOTO_ANALYSER_OPTIONS_SPECIFIC_ANALYSES \
146146
"(taint):(show-taint)" \
147-
"(show-local-may-alias)"
147+
"(show-local-may-alias)" \
148+
"(show-local-bitvector)"
148149

149150
#define GOTO_ANALYSER_OPTIONS \
150151
OPT_FUNCTIONS \

0 commit comments

Comments
 (0)