Skip to content

Commit 7df9f15

Browse files
committed
Add LVSA summary dump-to-JSON
1 parent d0d3620 commit 7df9f15

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/analyses/static_analysis.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,30 @@ void static_analysis_baset::output(
110110
}
111111
}
112112

113+
jsont static_analysis_baset::output_json(
114+
const goto_programt &goto_program,
115+
const irep_idt &identifier) const
116+
{
117+
json_arrayt retval;
118+
119+
forall_goto_program_instructions(i_it, goto_program)
120+
{
121+
std::ostringstream out;
122+
out << "**** " << i_it->location_number << " "
123+
<< i_it->source_location << "\n";
124+
125+
get_state(i_it).output(ns, out);
126+
out << "\n";
127+
#if 1
128+
goto_program.output_instruction(ns, identifier, out, i_it);
129+
out << "\n";
130+
#endif
131+
retval.push_back(json_stringt(out.str()));
132+
}
133+
134+
return retval;
135+
}
136+
113137
void static_analysis_baset::generate_states(
114138
const goto_functionst &goto_functions)
115139
{

src/analyses/static_analysis.h

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Author: Daniel Kroening, [email protected]
2121
#include <memory>
2222
#include <unordered_set>
2323

24+
#include <util/json.h>
2425
#include <util/make_unique.h>
2526

2627
#include <goto-programs/goto_functions.h>
@@ -157,6 +158,11 @@ class static_analysis_baset
157158
output(goto_program, "", out);
158159
}
159160

161+
jsont output_json(const goto_programt &goto_program) const
162+
{
163+
return output_json(goto_program, "");
164+
}
165+
160166
virtual bool has_location(locationt l) const=0;
161167

162168
void insert(locationt l)
@@ -183,6 +189,10 @@ class static_analysis_baset
183189
const irep_idt &identifier,
184190
std::ostream &out) const;
185191

192+
virtual jsont output_json(
193+
const goto_programt &goto_program,
194+
const irep_idt &identifier) const;
195+
186196
typedef std::map<unsigned, locationt> working_sett;
187197

188198
locationt get_next(working_sett &working_set);

src/util/ui_message.h

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include "message.h"
1414

15+
#define UI_MESSAGE_OPTIONS \
16+
"(json-ui)" \
17+
"(xml-ui)" \
18+
// End of options
19+
1520
class ui_message_handlert:public message_handlert
1621
{
1722
public:

0 commit comments

Comments
 (0)