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;
}
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;
}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits