[Lldb-commits] [lldb] 4f0326a - [lldb] Remove the jSignalsInfo packet (#230456)

via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 00:38:57 PDT 2026


Author: Pavel Labath
Date: 2026-10-14T09:38:52+02:00
New Revision: 4f0326ac68b31922f955ab51462c80ec248f2323

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

LOG: [lldb] Remove the jSignalsInfo packet (#230456)

The use of the UnixSignals class in lldb-server prevents the
functionality from being moved to the Platform class. This packet allows
the server to program the client with the signals present on that
target, but in practice, lldb has to know that information anyway
because of postmortem debugging (no server to provide the information).

No code changes are necessary because the client already has a fallback
path (which is now promoted to the main line) for handling the case
where the packet is not implemented.

See #229106 for context.

Added: 
    

Modified: 
    lldb/include/lldb/Utility/StringExtractorGDBRemote.h
    lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
    lldb/source/Utility/StringExtractorGDBRemote.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
index 7ad0f2f1cb7da..70fd887a6bba7 100644
--- a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
+++ b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
@@ -131,7 +131,6 @@ class StringExtractorGDBRemote : public StringExtractor {
     eServerPacketType_qWatchpointSupportInfoSupported,
     eServerPacketType_qXfer,
 
-    eServerPacketType_jSignalsInfo,
     eServerPacketType_jModulesInfo,
 
     eServerPacketType_vAttach,

diff  --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index f72ed93dbb31b..f1858deb7fec6 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -28,12 +28,10 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/UriParser.h"
-#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/FormatAdapters.h"
 
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
-#include <mutex>
 #include <optional>
 
 using namespace lldb;
@@ -43,11 +41,6 @@ using namespace lldb_private::platform_gdb_server;
 LLDB_PLUGIN_DEFINE_ADV(PlatformRemoteGDBServer, PlatformGDB)
 
 static bool g_initialized = false;
-// UnixSignals does not store the signal names or descriptions itself.
-// It holds onto StringRefs. Becaue we may get signal information dynamically
-// from the remote, these strings need persistent storage client-side.
-static std::mutex g_signal_string_mutex;
-static llvm::StringSet<> g_signal_string_storage;
 
 void PlatformRemoteGDBServer::Initialize() {
   Platform::Initialize();
@@ -711,87 +704,8 @@ const UnixSignalsSP &PlatformRemoteGDBServer::GetRemoteUnixSignals() {
   if (!IsConnected())
     return Platform::GetRemoteUnixSignals();
 
-  if (m_remote_signals_sp)
-    return m_remote_signals_sp;
-
-  // If packet not implemented or JSON failed to parse, we'll guess the signal
-  // set based on the remote architecture.
-  m_remote_signals_sp = UnixSignals::Create(GetRemoteSystemArchitecture());
-
-  StringExtractorGDBRemote response;
-  auto result =
-      m_gdb_client_up->SendPacketAndWaitForResponse("jSignalsInfo", response);
-
-  if (result != decltype(result)::Success ||
-      response.GetResponseType() != response.eResponse)
-    return m_remote_signals_sp;
-
-  auto object_sp = StructuredData::ParseJSON(response.GetStringRef());
-  if (!object_sp || !object_sp->IsValid())
-    return m_remote_signals_sp;
-
-  auto array_sp = object_sp->GetAsArray();
-  if (!array_sp || !array_sp->IsValid())
-    return m_remote_signals_sp;
-
-  auto remote_signals_sp = std::make_shared<lldb_private::GDBRemoteSignals>();
-
-  bool done = array_sp->ForEach(
-      [&remote_signals_sp](StructuredData::Object *object) -> bool {
-        if (!object || !object->IsValid())
-          return false;
-
-        auto dict = object->GetAsDictionary();
-        if (!dict || !dict->IsValid())
-          return false;
-
-        // Signal number and signal name are required.
-        uint64_t signo;
-        if (!dict->GetValueForKeyAsInteger("signo", signo))
-          return false;
-
-        llvm::StringRef name;
-        if (!dict->GetValueForKeyAsString("name", name))
-          return false;
-
-        // We can live without short_name, description, etc.
-        bool suppress{false};
-        auto object_sp = dict->GetValueForKey("suppress");
-        if (object_sp && object_sp->IsValid())
-          suppress = object_sp->GetBooleanValue();
-
-        bool stop{false};
-        object_sp = dict->GetValueForKey("stop");
-        if (object_sp && object_sp->IsValid())
-          stop = object_sp->GetBooleanValue();
-
-        bool notify{false};
-        object_sp = dict->GetValueForKey("notify");
-        if (object_sp && object_sp->IsValid())
-          notify = object_sp->GetBooleanValue();
-
-        std::string description;
-        object_sp = dict->GetValueForKey("description");
-        if (object_sp && object_sp->IsValid())
-          description = std::string(object_sp->GetStringValue());
-
-        llvm::StringRef name_backed, description_backed;
-        {
-          std::lock_guard<std::mutex> guard(g_signal_string_mutex);
-          name_backed =
-              g_signal_string_storage.insert(name).first->getKeyData();
-          if (!description.empty())
-            description_backed =
-                g_signal_string_storage.insert(description).first->getKeyData();
-        }
-
-        remote_signals_sp->AddSignal(signo, name_backed, suppress, stop, notify,
-                                     description_backed);
-        return true;
-      });
-
-  if (done)
-    m_remote_signals_sp = std::move(remote_signals_sp);
+  if (!m_remote_signals_sp)
+    m_remote_signals_sp = UnixSignals::Create(GetRemoteSystemArchitecture());
 
   return m_remote_signals_sp;
 }

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index f29e83ebb097f..4f740dbd38da4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -29,7 +29,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Target/Platform.h"
-#include "lldb/Target/UnixSignals.h"
 #include "lldb/Utility/GDBRemote.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
@@ -75,9 +74,6 @@ GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform(
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_QSetWorkingDir,
       &GDBRemoteCommunicationServerPlatform::Handle_QSetWorkingDir);
-  RegisterMemberFunctionHandler(
-      StringExtractorGDBRemote::eServerPacketType_jSignalsInfo,
-      &GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo);
 
   RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_interrupt,
                         [](StringExtractorGDBRemote packet, Status &error,
@@ -393,34 +389,6 @@ GDBRemoteCommunicationServerPlatform::Handle_qC(
   return SendPacketNoLock(response.GetString());
 }
 
-GDBRemoteCommunication::PacketResult
-GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo(
-    StringExtractorGDBRemote &packet) {
-  StructuredData::Array signal_array;
-
-  lldb::UnixSignalsSP signals = UnixSignals::CreateForHost();
-  for (auto signo = signals->GetFirstSignalNumber();
-       signo != LLDB_INVALID_SIGNAL_NUMBER;
-       signo = signals->GetNextSignalNumber(signo)) {
-    auto dictionary = std::make_shared<StructuredData::Dictionary>();
-
-    dictionary->AddIntegerItem("signo", signo);
-    dictionary->AddStringItem("name", signals->GetSignalAsStringRef(signo));
-
-    bool suppress, stop, notify;
-    signals->GetSignalInfo(signo, suppress, stop, notify);
-    dictionary->AddBooleanItem("suppress", suppress);
-    dictionary->AddBooleanItem("stop", stop);
-    dictionary->AddBooleanItem("notify", notify);
-
-    signal_array.Push(dictionary);
-  }
-
-  StreamString response;
-  signal_array.Dump(response);
-  return SendPacketNoLock(response.GetString());
-}
-
 void GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped(
     lldb::pid_t pid) {
   std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
index bcfb6d3f3ed02..76333bd451455 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
@@ -65,8 +65,6 @@ class GDBRemoteCommunicationServerPlatform
 
   PacketResult Handle_qC(StringExtractorGDBRemote &packet);
 
-  PacketResult Handle_jSignalsInfo(StringExtractorGDBRemote &packet);
-
 private:
   bool KillSpawnedProcess(lldb::pid_t pid);
   bool SpawnedProcessIsRunning(lldb::pid_t pid);

diff  --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp
index 63c74ccca52ed..c24f230376248 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -317,8 +317,6 @@ StringExtractorGDBRemote::GetServerPacketType() const {
   case 'j':
     if (PACKET_STARTS_WITH("jModulesInfo:"))
       return eServerPacketType_jModulesInfo;
-    if (PACKET_MATCHES("jSignalsInfo"))
-      return eServerPacketType_jSignalsInfo;
     if (PACKET_MATCHES("jThreadsInfo"))
       return eServerPacketType_jThreadsInfo;
     if (PACKET_MATCHES("jAddressSpacesInfo"))


        


More information about the lldb-commits mailing list