From ecdddd94fdad39fcb17fe256715cf4cc9bacbfb9 Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Tue, 23 Jun 2020 17:54:40 +0100 Subject: print stateID with --debug-print-instructions --- lib/Core/Executor.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/Core/Executor.cpp') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 03deeda7..af714c2c 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1292,11 +1292,12 @@ void Executor::executeGetValue(ExecutionState &state, } void Executor::printDebugInstructions(ExecutionState &state) { - // check do not print + // print nothing if option unset if (DebugPrintInstructions.getBits() == 0) - return; + return; - llvm::raw_ostream *stream = 0; + // set output stream (stderr/file) + llvm::raw_ostream *stream = nullptr; if (DebugPrintInstructions.isSet(STDERR_ALL) || DebugPrintInstructions.isSet(STDERR_SRC) || DebugPrintInstructions.isSet(STDERR_COMPACT)) @@ -1304,18 +1305,24 @@ void Executor::printDebugInstructions(ExecutionState &state) { else stream = &debugLogBuffer; + // print: + // [all] src location:asm line:state ID:instruction + // [compact] asm line:state ID + // [src] src location:asm line:state ID if (!DebugPrintInstructions.isSet(STDERR_COMPACT) && !DebugPrintInstructions.isSet(FILE_COMPACT)) { - (*stream) << " " << state.pc->getSourceLocation() << ":"; + (*stream) << " " << state.pc->getSourceLocation() << ':'; } - (*stream) << state.pc->info->assemblyLine; + (*stream) << state.pc->info->assemblyLine << ':' << state.getID(); if (DebugPrintInstructions.isSet(STDERR_ALL) || DebugPrintInstructions.isSet(FILE_ALL)) - (*stream) << ":" << *(state.pc->inst); - (*stream) << "\n"; + (*stream) << ':' << *(state.pc->inst); + + (*stream) << '\n'; + // flush to file if (DebugPrintInstructions.isSet(FILE_ALL) || DebugPrintInstructions.isSet(FILE_COMPACT) || DebugPrintInstructions.isSet(FILE_SRC)) { -- cgit 1.4.1