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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 9 04:26:56 PDT 2026


https://github.com/labath created https://github.com/llvm/llvm-project/pull/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.

>From 9ca72051a8e08fae15b31d8162f3821a0cb76ac5 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Fri, 9 Oct 2026 13:23:13 +0200
Subject: [PATCH] [lldb] Remove the jSignalsInfo packet

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.
---
 .../lldb/Utility/StringExtractorGDBRemote.h   |  1 -
 .../gdb-server/PlatformRemoteGDBServer.cpp    | 83 +------------------
 .../GDBRemoteCommunicationServerPlatform.cpp  | 32 -------
 .../GDBRemoteCommunicationServerPlatform.h    |  2 -
 .../Utility/StringExtractorGDBRemote.cpp      |  2 -
 5 files changed, 2 insertions(+), 118 deletions(-)

diff --git a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
index b70372db4b6107..1b4796a36805fc 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 1f69ef5f3f6ca0..7ff2bd7d4abb6b 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -711,87 +711,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 f29e83ebb097f2..4f740dbd38da43 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 bcfb6d3f3ed020..76333bd4514555 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 ed15926d621bf0..d97b5ebc29e23a 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