[CLI] Add more readable backtrace
authorAlexander Soldatov <soldatov.a@samsung.com>
Mon, 18 Oct 2021 17:50:17 +0000 (20:50 +0300)
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Tue, 19 Oct 2021 11:17:09 +0000 (14:17 +0300)
src/protocols/cliprotocol.cpp

index 812ff8c3de086d008391649be72a0a98269307b6..e333921ec0e941b296c1427bb49b40385f16ee05 100644 (file)
@@ -701,25 +701,14 @@ HRESULT CLIProtocol::PrintFrameLocation(const StackFrame &stackFrame, std::strin
 {
     std::ostringstream ss;
 
+    ss << stackFrame.name;
     if (!stackFrame.source.IsNull())
     {
-        ss << "\n    " << stackFrame.source.path << ":" << stackFrame.line << "  (col: " << stackFrame.column << " to line: " << stackFrame.endLine << " col: " << stackFrame.endColumn << ")\n";
+        ss << " at "  << stackFrame.source.path << ":" << stackFrame.line;
     }
 
-    if (stackFrame.clrAddr.methodToken != 0)
-    {
-        ss << "    clr-addr: {module-id {" << stackFrame.moduleId << "}"
-           << ", method-token: 0x" << std::setw(8) << std::setfill('0') << std::hex << stackFrame.clrAddr.methodToken 
-           << " il-offset: " << std::dec << stackFrame.clrAddr.ilOffset << ", native offset: " << stackFrame.clrAddr.nativeOffset << "}";
-    }
-
-    ss << "\n    " << stackFrame.name;
-    if (stackFrame.id != 0)
-        ss << ", addr: " << ProtocolUtils::AddrToString(stackFrame.addr);
-
     output = ss.str();
-
-    return stackFrame.source.IsNull() ? S_FALSE : S_OK;
+    return S_OK;
 }
 
 HRESULT CLIProtocol::PrintFrames(ThreadId threadId, std::string &output, FrameLevel lowFrame, FrameLevel highFrame)
@@ -734,25 +723,18 @@ HRESULT CLIProtocol::PrintFrames(ThreadId threadId, std::string &output, FrameLe
 
     int currentFrame = int(lowFrame);
 
-    ss << "stack=[";
-    const char *sep = "";
-
     for (const StackFrame &stackFrame : stackFrames)
     {
-        ss << sep;
-        sep = ",";
+        ss << "#" << currentFrame;
 
         std::string frameLocation;
         PrintFrameLocation(stackFrame, frameLocation);
-
-        ss << "\nframe={ level: " << currentFrame;
         if (!frameLocation.empty())
-            ss << "," << frameLocation;
-        ss << "\n}";
+            ss << " " << frameLocation;
+        ss << "\n";
         currentFrame++;
     }
 
-    ss << "]";
 
     output = ss.str();