[Lldb-commits] [PATCH] D135521: [lldb][trace] Add a basic function call dumpdump [1] - Add the command scaffolding

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 8 14:18:40 PDT 2022


wallace created this revision.
wallace added reviewers: jj10306, persona0220.
Herald added a project: All.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The command is thread trace dump function-calls and as minimum will
require printing to a file in json and non-json format

I added a test


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135521

Files:
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py


Index: lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
===================================================================
--- /dev/null
+++ lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
@@ -0,0 +1,17 @@
+from intelpt_testcase import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class TestTraceDumpInfo(TraceIntelPTTestCaseBase):
+    def testDumpFunctionCalls(self):
+      self.expect("trace load -v " +
+        os.path.join(self.getSourceDir(), "intelpt-trace", "trace.json"))
+
+      self.expect("thread trace dump function-calls 2",
+        error=True, substrs=['error: no thread with index: "2"'])
+
+      self.expect("thread trace dump function-calls 1 -j",
+        substrs=['json = true, pretty_json = false, file = false, thread = 3842849'])
+
+      self.expect("thread trace dump function-calls 1 -F /tmp -J",
+        substrs=['false, pretty_json = true, file = true, thread = 3842849'])
Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -2187,9 +2187,9 @@
       result.AppendError("invalid thread\n");
       return false;
     }
-    result.AppendMessageWithFormatv("json = {0}, pretty_json = {1}, file = {2}",
+    result.AppendMessageWithFormatv("json = {0}, pretty_json = {1}, file = {2}, thread = {3}",
                                     m_options.m_json, m_options.m_pretty_json,
-                                    m_options.m_output_file);
+                                    !!m_options.m_output_file, thread_sp->GetID());
     return true;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135521.466311.patch
Type: text/x-patch
Size: 1715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221008/81509038/attachment.bin>


More information about the lldb-commits mailing list