[Lldb-commits] [lldb] ef99707 - [trace][intelpt] Support system-wide tracing [15] - Make triple optional

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 16 11:23:16 PDT 2022


Author: Walter Erquinigo
Date: 2022-06-16T11:23:01-07:00
New Revision: ef9970759b5b63fed40061cd960e6d9e8edabb48

URL: https://github.com/llvm/llvm-project/commit/ef9970759b5b63fed40061cd960e6d9e8edabb48
DIFF: https://github.com/llvm/llvm-project/commit/ef9970759b5b63fed40061cd960e6d9e8edabb48.diff

LOG: [trace][intelpt] Support system-wide tracing [15] - Make triple optional

The process triple should only be needed when LLDB can't identify the correct
triple on its own. Examples could be universal mach-o binaries. But in any case,
at least for most of ELF files, LLDB should be able to do the job without having
the user specify the triple manually.

Differential Revision: https://reviews.llvm.org/D126990

Added: 
    

Modified: 
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
    lldb/test/API/commands/trace/TestTraceLoad.py
    lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
    lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
index af4c365d1c49e..9d0fd789cab58 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
@@ -36,7 +36,7 @@ struct JSONThread {
 
 struct JSONProcess {
   int64_t pid;
-  std::string triple;
+  llvm::Optional<std::string> triple;
   std::vector<JSONThread> threads;
   std::vector<JSONModule> modules;
 };

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
index 1977a674b61a8..85e04ff6ec6a8 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
@@ -88,7 +88,7 @@ Expected<TraceIntelPTSessionFileParser::ParsedProcess>
 TraceIntelPTSessionFileParser::ParseProcess(const JSONProcess &process) {
   TargetSP target_sp;
   Status error = m_debugger.GetTargetList().CreateTarget(
-      m_debugger, /*user_exe_path*/ StringRef(), process.triple,
+      m_debugger, /*user_exe_path*/ StringRef(), process.triple.getValueOr(""),
       eLoadDependentsNo,
       /*platform_options*/ nullptr, target_sp);
 
@@ -161,8 +161,8 @@ StringRef TraceIntelPTSessionFileParser::GetSchema() {
   "processes": [
     {
       "pid": integer,
-      "triple": string,
-          // clang/llvm target triple.
+      "triple"?: string,
+          // Optional clang/llvm target triple.
       "threads": [
         {
           "tid": integer,

diff  --git a/lldb/test/API/commands/trace/TestTraceLoad.py b/lldb/test/API/commands/trace/TestTraceLoad.py
index 6f6994bfaa8b1..be91a4d15a909 100644
--- a/lldb/test/API/commands/trace/TestTraceLoad.py
+++ b/lldb/test/API/commands/trace/TestTraceLoad.py
@@ -94,9 +94,9 @@ def testLoadInvalidTraces(self):
     "stepping": integer
   },'''])
 
-        # Now we test a missing field in the global session file
+        # Now we test a wrong cpu family field in the global session file
         self.expect("trace load -v " + os.path.join(src_dir, "intelpt-trace", "trace_bad2.json"), error=True,
-            substrs=['error: missing value at traceSession.processes[1].triple', "Context", "Schema"])
+            substrs=['error: expected uint64_t at traceSession.cpuInfo.family', "Context", "Schema"])
 
         # Now we test a missing field in the intel-pt settings
         self.expect("trace load -v " + os.path.join(src_dir, "intelpt-trace", "trace_bad4.json"), error=True,

diff  --git a/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json b/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
index 54397ee79b3cc..4bbb427156785 100644
--- a/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
+++ b/lldb/test/API/commands/trace/intelpt-multi-core-trace/trace.json
@@ -38,8 +38,7 @@
         {
           "tid": 3497497
         }
-      ],
-      "triple": "x86_64-unknown-linux-gnu"
+      ]
     }
   ],
   "tscPerfZeroConversion": {

diff  --git a/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json b/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
index 46fa01abf45b9..98d322fb39b58 100644
--- a/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
+++ b/lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
@@ -2,14 +2,13 @@
   "type": "intel-pt",
   "cpuInfo": {
     "vendor": "GenuineIntel",
-    "family": 6,
+    "family": "123",
     "model": 79,
     "stepping": 1
   },
   "processes": [
     {
       "pid": 1234,
-      "triple": "x86_64-*-linux",
       "threads": [
         {
           "tid": 5678,


        


More information about the lldb-commits mailing list