Discussion:
Single-step debugging (was: Abouttheklee_make_symbolic)
Jonathan Neuschäfer
2013-03-23 17:25:25 UTC
Permalink
[ I'm CC'ing the mailing list, so that other people can read my answer
and don't need to ask the same question again. ]
I want to know if I can carry out a single-step debugging and
view which step the program run.If ok, what should I do.
Single-stepping through a program would require klee to have an inter-
active user interface, which it doesn't have AFAIK.

But you can tell klee to output every LLVM instruction that is executed
using the "-debug-print-instructions" command line option. This feature
has a little bug, though, which can be fixed by the following patch:

------------------------------------------------------------------------
commit 5c5214276946e72822d67e9d681703e5cf310f7a
Author: Jonathan Neuschäfer <***@gmx.net>
Date: Wed Oct 24 20:00:00 2012 +0200

klee -debug-print-instructions: add a newline character

diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 968283b..48aee24 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1174,7 +1174,7 @@ void Executor::stepInstruction(ExecutionState &state) {
if (DebugPrintInstructions) {
printFileLine(state, state.pc);
std::cerr << std::setw(10) << stats::instructions << " ";
- llvm::errs() << *(state.pc->inst);
+ llvm::errs() << *(state.pc->inst) << '\n';
}

if (statsTracker)
------------------------------------------------------------------------

It currently does not show you which of the execution states executed
the instruction.


HTH,
Jonathan Neuschäfer

Loading...