|
31 | 31 | #include <goto-programs/link_to_library.h>
|
32 | 32 | #include <goto-programs/class_hierarchy.h>
|
33 | 33 | #include <goto-programs/remove_exceptions.h>
|
| 34 | +#include <analyses/call_graph.h> |
34 | 35 |
|
35 | 36 | #include <analyses/goto_check.h>
|
36 | 37 | #include <analyses/local_may_alias.h>
|
@@ -253,6 +254,45 @@ int sec_driver_parse_optionst::doit()
|
253 | 254 | return 0;
|
254 | 255 | }
|
255 | 256 |
|
| 257 | + if(cmdline.isset("dump-html-program")) |
| 258 | + { |
| 259 | + status() |
| 260 | + << "Dumping GOTO program in HTML format under directory: '" |
| 261 | + << cmdline.get_value("dump-html-program") |
| 262 | + << "'..." |
| 263 | + << eom; |
| 264 | + if(fileutl_file_exists(cmdline.get_value("dump-html-program"))) |
| 265 | + { |
| 266 | + error() |
| 267 | + << "ERROR: The output path '" |
| 268 | + << cmdline.get_value("dump-html-program") |
| 269 | + << "' for the HTML dump exists." |
| 270 | + << eom; |
| 271 | + return -1; |
| 272 | + } |
| 273 | + class_hierarchyt class_hierarchy; |
| 274 | + class_hierarchy(goto_model.symbol_table); |
| 275 | + call_grapht call_graph(goto_model.goto_functions); |
| 276 | + std::vector<irep_idt> inverted_topological_order; |
| 277 | + { |
| 278 | + std::unordered_set<irep_idt, dstring_hash> processed; |
| 279 | + for(const auto &elem : goto_model.goto_functions.function_map) |
| 280 | + inverted_partial_topological_order( |
| 281 | + call_graph, |
| 282 | + elem.first, |
| 283 | + processed, |
| 284 | + inverted_topological_order); |
| 285 | + } |
| 286 | + dump_goto_program_in_html( |
| 287 | + goto_model, |
| 288 | + call_graph, |
| 289 | + class_hierarchy, |
| 290 | + goto_model.symbol_table, |
| 291 | + inverted_topological_order, |
| 292 | + cmdline.get_value("dump-html-program")); |
| 293 | + return 0; |
| 294 | + } |
| 295 | + |
256 | 296 | error() << "no analysis option given -- consider reading --help"
|
257 | 297 | << eom;
|
258 | 298 | return 6;
|
@@ -416,6 +456,10 @@ void sec_driver_parse_optionst::help()
|
416 | 456 | " --show-symbol-table show symbol table\n"
|
417 | 457 | " --show-goto-functions show goto program\n"
|
418 | 458 | " --show-properties show the properties, but don't run analysis\n"
|
| 459 | + " --dump-html-program dump goto program in HTML format into\n" |
| 460 | + " a directory. Pass a non existing directory\n" |
| 461 | + " path-name with this option. The directory\n" |
| 462 | + " will be created with the dumped program.\n" |
419 | 463 | "\n"
|
420 | 464 | "Other options:\n"
|
421 | 465 | " --version show version and exit\n"
|
|
0 commit comments