From c2668465518db26b01e007224913f9ba6d8e80c1 Mon Sep 17 00:00:00 2001 From: Saswat Padhi Date: Sat, 12 Jun 2021 00:56:39 +0000 Subject: [PATCH] Pretty print havoc_object instructions --- .../goto-instrument/show-goto-functions1/main.c | 5 +++++ .../goto-instrument/show-goto-functions1/test.desc | 8 ++++++++ src/goto-programs/goto_program.cpp | 14 +++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 regression/goto-instrument/show-goto-functions1/main.c create mode 100644 regression/goto-instrument/show-goto-functions1/test.desc diff --git a/regression/goto-instrument/show-goto-functions1/main.c b/regression/goto-instrument/show-goto-functions1/main.c new file mode 100644 index 00000000000..445c2fe5805 --- /dev/null +++ b/regression/goto-instrument/show-goto-functions1/main.c @@ -0,0 +1,5 @@ +int main() +{ + int a[64]; + __CPROVER_havoc_object(a); +} diff --git a/regression/goto-instrument/show-goto-functions1/test.desc b/regression/goto-instrument/show-goto-functions1/test.desc new file mode 100644 index 00000000000..250c679543a --- /dev/null +++ b/regression/goto-instrument/show-goto-functions1/test.desc @@ -0,0 +1,8 @@ +CORE +main.c +--show-goto-functions +HAVOC_OBJECT \(void \*\)a +^SIGNAL=0$ +^EXIT=0$ +-- +irep\("\(.* \(\\"havoc_object\\"\)\)"\) diff --git a/src/goto-programs/goto_program.cpp b/src/goto-programs/goto_program.cpp index e76b45d763d..5aac7fc0b60 100644 --- a/src/goto-programs/goto_program.cpp +++ b/src/goto-programs/goto_program.cpp @@ -100,8 +100,20 @@ std::ostream &goto_programt::output_instruction( out << '\n'; break; - case RETURN: case OTHER: + if(instruction.get_other().id() == ID_code) + { + const auto &code = to_code(instruction.get_other()); + if(code.get_statement() == ID_havoc_object) + { + out << "HAVOC_OBJECT " << from_expr(ns, identifier, code.op0()) << '\n'; + break; + } + // fallthrough + } + // fallthrough + + case RETURN: case DECL: case DEAD: case FUNCTION_CALL: