[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88279)

Ayush Sahay via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 10 08:00:15 PDT 2024


https://github.com/ayushsahay1837 created https://github.com/llvm/llvm-project/pull/88279

Currently, GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo asserts if the number of processes under debug isn’t 1 and the multiprocess feature isn’t supported. This is so that we don't string IDs of threads belonging to different processes together without including the IDs of the processes themselves in the response when there are multiple processes under debug. However, it’s conceivable that we have no process under debug and the multiprocess feature isn’t supported. So, have GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo assert if the number of processes under debug is greater than 1 and the multiprocess feature isn’t supported.

>From e5f994d2ccc359b90c9aaae33f08d702f2ca8d4b Mon Sep 17 00:00:00 2001
From: Ayush Sahay <asahay at qti.qualcomm.com>
Date: Wed, 10 Apr 2024 13:40:15 +0530
Subject: [PATCH] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently, GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo asserts
if the number of processes under debug isn’t 1 and the multiprocess
feature isn’t supported. This is so that we don't string IDs of threads
belonging to different processes together without including the IDs of
the processes themselves in the response when there are multiple
processes under debug. However, it’s conceivable that we have no process
under debug and the multiprocess feature isn’t supported. So, have
GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo assert if the
number of processes under debug is greater than 1 and the multiprocess
feature isn’t supported.
---
 .../Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 3d37bb226a65fd..ae1a77e5be8321 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -2087,7 +2087,7 @@ void GDBRemoteCommunicationServerLLGS::AddProcessThreads(
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo(
     StringExtractorGDBRemote &packet) {
-  assert(m_debugged_processes.size() == 1 ||
+  assert(m_debugged_processes.size() <= 1 ||
          bool(m_extensions_supported &
               NativeProcessProtocol::Extension::multiprocess));
 



More information about the lldb-commits mailing list