[Lldb-commits] [lldb] walter/fix (PR #71455)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 6 15:00:04 PST 2023


https://github.com/walter-erquinigo created https://github.com/llvm/llvm-project/pull/71455

- [LLDB][easy] Fix a bug in DummySyntheticFrontEnd
- [LLDB] Don't forcefully initialize the process trace plugin


>From 57d19fdd476b293a87f1c14b743ba636350af7a1 Mon Sep 17 00:00:00 2001
From: walter erquinigo <walter at modular.com>
Date: Fri, 3 Nov 2023 00:50:36 -0400
Subject: [PATCH 1/2] [LLDB][easy] Fix a bug in DummySyntheticFrontEnd

DummySyntheticFrontEnd is implementing correctly CalculateNumChildren but not MightHaveChildren, where instead of delegating its action, it was returning true.
This fixes that simple bug.
---
 lldb/source/Core/ValueObjectSyntheticFilter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index 59ed780b654f3af..43bc532c4a0410b 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -41,7 +41,7 @@ class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
     return m_backend.GetIndexOfChildWithName(name);
   }
 
-  bool MightHaveChildren() override { return true; }
+  bool MightHaveChildren() override { return m_backend.MightHaveChildren(); }
 
   bool Update() override { return false; }
 };

>From 6655ac4547f4aea53ffa3576359abc8545d41cc7 Mon Sep 17 00:00:00 2001
From: walter erquinigo <walter at modular.com>
Date: Mon, 6 Nov 2023 17:57:45 -0500
Subject: [PATCH 2/2] [LLDB] Don't forcefully initialize the process trace
 plugin

This was causing some process to wrongfully be handled by ProcessTrace.

The only place this was being used is in the intel pt plugin, but it doesn't even build anymore, so I'm sure no one is using it.
---
 lldb/source/API/SystemInitializerFull.cpp                | 3 ---
 .../Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp  | 9 +++++----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 27319debc858288..c48466f25ede81b 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -68,9 +68,6 @@ llvm::Error SystemInitializerFull::Initialize() {
 #define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
 #include "Plugins/Plugins.def"
 
-  // Initialize plug-ins in core LLDB
-  ProcessTrace::Initialize();
-
   // Scan for any system or user LLDB plug-ins
   PluginManager::Initialize();
 
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
index 6bed78fd83f0b70..bd9cca675f2d747 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
@@ -103,10 +103,11 @@ TraceIntelPTBundleLoader::CreateEmptyProcess(lldb::pid_t pid,
   ParsedProcess parsed_process;
   parsed_process.target_sp = target_sp;
 
-  ProcessSP process_sp = target_sp->CreateProcess(
-      /*listener*/ nullptr, "trace",
-      /*crash_file*/ nullptr,
-      /*can_connect*/ false);
+  // This should instead try to directly create an instance of ProcessTrace.
+  // ProcessSP process_sp = target_sp->CreateProcess(
+  //    /*listener*/ nullptr, "trace",
+  //    /*crash_file*/ nullptr,
+  //    /*can_connect*/ false);
 
   process_sp->SetID(static_cast<lldb::pid_t>(pid));
 



More information about the lldb-commits mailing list