@@ -182,55 +182,56 @@ def build_HTML_interface_to_slicing_tasks(root_dir,sub_dir,ofile):
182
182
if not os .path .exists (full_sub_dir ):
183
183
os .makedirs (full_sub_dir )
184
184
185
- build_HTML_interface_to_slicer_call_graph (
186
- os .path .abspath (os .path .join (full_sub_dir ,"call_graph.html" ))
185
+ instrumented_goto_program_fname = os .path .join (full_sub_dir , "instrumented_goto_program.json" )
186
+ if os .path .isfile (instrumented_goto_program_fname ):
187
+ build_HTML_interface_to_slicer_call_graph (
188
+ os .path .abspath (os .path .join (full_sub_dir ,"call_graph.html" ))
187
189
)
188
- build_HTML_interface_to_slicer_inverted_call_graph (
189
- os .path .abspath (os .path .join (full_sub_dir ,"inverted_call_graph.html" ))
190
+ build_HTML_interface_to_slicer_inverted_call_graph (
191
+ os .path .abspath (os .path .join (full_sub_dir ,"inverted_call_graph.html" ))
190
192
)
191
- build_HTML_interface_to_slicer_tokens_propagation_graph (
192
- os .path .abspath (os .path .join (full_sub_dir ,"tokens_propagation_graph.html" ))
193
+ build_HTML_interface_to_slicer_tokens_propagation_graph (
194
+ os .path .abspath (os .path .join (full_sub_dir ,"tokens_propagation_graph.html" ))
193
195
)
194
196
195
- instrumentation_props ,instrumentation_props_fname = load_instrumentation_props_of_slicer (full_sub_dir )
196
- fname = os .path .splitext (instrumentation_props_fname )[0 ] + ".html"
197
- build_HTML_interface_to_slicer_instrumentation_props (instrumentation_props , fname )
197
+ instrumentation_props ,instrumentation_props_fname = load_instrumentation_props_of_slicer (full_sub_dir )
198
+ fname = os .path .splitext (instrumentation_props_fname )[0 ] + ".html"
199
+ build_HTML_interface_to_slicer_instrumentation_props (instrumentation_props , fname )
198
200
199
- ofile .write ("<table>\n "
200
- "<caption>Supporting and intermediate data structures.</caption>\n "
201
- " <tr>\n "
202
- " <th>Property</th>\n "
203
- " <th>Value</th>\n "
204
- " </tr>\n " )
205
- ofile .write (" <tr>\n " )
206
- ofile .write (" <td>Call graph</td>\n " )
207
- ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir + "/call_graph.html\" >here</a></td>\n " )
208
- ofile .write (" </tr>\n " )
209
- ofile .write (" <tr>\n " )
210
- ofile .write (" <td>Inverted call graph</td>\n " )
211
- ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir + "/inverted_call_graph.html\" >here</a></td>\n " )
212
- ofile .write (" </tr>\n " )
213
- ofile .write (" <tr>\n " )
214
- ofile .write (" <td>Tokens propagation graph</td>\n " )
215
- ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir + "/tokens_propagation_graph.html\" >here</a></td>\n " )
216
- ofile .write (" </tr>\n " )
217
- ofile .write (" <tr>\n " )
218
- ofile .write (" <td>Map from rules to their application sites (in JSON format)</td>\n " )
219
- ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir +
220
- "/map_from_functions_to_rule_application_sites.json\" >here</a></td>\n " )
221
- ofile .write (" </tr>\n " )
222
- ofile .write (" <td>Instrumentation properties</td>\n " )
223
- ofile .write (" <td align=\" center\" ><a href=\" ./" +
224
- os .path .join (sub_dir ,os .path .splitext (os .path .basename (instrumentation_props_fname ))[0 ] + ".html" ) +
225
- "\" >here</a></td>\n " )
226
- ofile .write (" </tr>\n " )
227
- ofile .write ("</table>\n " )
201
+ ofile .write ("<table>\n "
202
+ "<caption>Supporting and intermediate data structures.</caption>\n "
203
+ " <tr>\n "
204
+ " <th>Property</th>\n "
205
+ " <th>Value</th>\n "
206
+ " </tr>\n " )
207
+ ofile .write (" <tr>\n " )
208
+ ofile .write (" <td>Call graph</td>\n " )
209
+ ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir + "/call_graph.html\" >here</a></td>\n " )
210
+ ofile .write (" </tr>\n " )
211
+ ofile .write (" <tr>\n " )
212
+ ofile .write (" <td>Inverted call graph</td>\n " )
213
+ ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir + "/inverted_call_graph.html\" >here</a></td>\n " )
214
+ ofile .write (" </tr>\n " )
215
+ ofile .write (" <tr>\n " )
216
+ ofile .write (" <td>Tokens propagation graph</td>\n " )
217
+ ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir + "/tokens_propagation_graph.html\" >here</a></td>\n " )
218
+ ofile .write (" </tr>\n " )
219
+ ofile .write (" <tr>\n " )
220
+ ofile .write (" <td>Map from rules to their application sites (in JSON format)</td>\n " )
221
+ ofile .write (" <td align=\" center\" ><a href=\" ./" + sub_dir +
222
+ "/map_from_functions_to_rule_application_sites.json\" >here</a></td>\n " )
223
+ ofile .write (" </tr>\n " )
224
+ ofile .write (" <td>Instrumentation properties</td>\n " )
225
+ ofile .write (" <td align=\" center\" ><a href=\" ./" +
226
+ os .path .join (sub_dir ,os .path .splitext (os .path .basename (instrumentation_props_fname ))[0 ] + ".html" ) +
227
+ "\" >here</a></td>\n " )
228
+ ofile .write (" </tr>\n " )
229
+ ofile .write ("</table>\n " )
228
230
229
- ofile .write ("<p></p>\n " )
231
+ ofile .write ("<p></p>\n " )
230
232
231
- with open (os .path .join (full_sub_dir ,"instrumented_goto_program.json" )) as json_file :
232
- instrumented_goto_program = json .load (json_file )
233
- if instrumented_goto_program is not None :
233
+ with open (instrumented_goto_program_fname ) as json_file :
234
+ instrumented_goto_program = json .load (json_file )
234
235
ofile .write ("<table>\n "
235
236
"<caption>Instrumented GOTO program</caption>\n "
236
237
" <tr>\n "
@@ -250,7 +251,9 @@ def build_HTML_interface_to_slicing_tasks(root_dir,sub_dir,ofile):
250
251
ofile .write (" </tr>\n " )
251
252
ofile .write ("</table>\n " )
252
253
return True
253
- return False
254
+ else :
255
+ ofile .write ("<p>The program is safe. No tainted data may reach any sink.</p>\n " )
256
+ return False
254
257
255
258
def build_HTML_interface_to_the_slicer (root_dir ,sub_dir ,ofile ):
256
259
full_sub_dir = os .path .join (root_dir , sub_dir )
@@ -686,12 +689,9 @@ def build_HTML_interface_to_results_and_statistics(
686
689
#######################################################################################################
687
690
688
691
689
- ofile .write ("<h3>Phase 2: Application of program slicing</h3>\n " )
690
- ofile .write ("<p>It is performed by the tool 'goto-instrument'.</p>\n " )
691
-
692
- if not has_instrumented_program :
693
- ofile .write ("<p>The instrumented GOTO binary was not generated from the previous stage.</p>\n " )
694
- else :
692
+ if has_instrumented_program :
693
+ ofile .write ("<h3>Phase 2: Application of program slicing</h3>\n " )
694
+ ofile .write ("<p>It is performed by the tool 'goto-instrument'.</p>\n " )
695
695
build_HTML_interface_to_the_slicer (
696
696
cmdline .results_dir ,
697
697
"program_slicing" ,
@@ -704,12 +704,9 @@ def build_HTML_interface_to_results_and_statistics(
704
704
#######################################################################################################
705
705
706
706
707
- ofile .write ("<h3>Phase 3: Search for error-traces in the sliced program</h3>\n " )
708
- ofile .write ("<p>It is currently performed only by the tool 'JBMC'.</p>\n " )
709
-
710
- if not has_instrumented_program :
711
- ofile .write ("<p>There are no error traces, because there is no GOTO binary available from previous stage(s).</p>\n " )
712
- else :
707
+ if has_instrumented_program :
708
+ ofile .write ("<h3>Phase 3: Search for error-traces in the sliced program</h3>\n " )
709
+ ofile .write ("<p>It is currently performed only by the tool 'JBMC'.</p>\n " )
713
710
build_HTML_interface_to_error_traces (
714
711
cmdline .results_dir ,
715
712
"search_for_error_traces" ,
0 commit comments