[Lldb-commits] [lldb] [lldb] [ObjectFileELF] Detect QNX Neutrino RTOS targets (PR #97439)
https://github.com/ayushsahay1837 created https://github.com/llvm/llvm-project/pull/97439 This change detects _QNX Neutrino Real-Time Operating System_ targets, and is the second in a series of changes that look to facilitate remote debug of _AArch64_ targets on _QNX_. _QNX Neutrino Real-Time Operating System_ is a commercial Unix-like real-time operating system primarily targeting the embedded systems market including automotive, medical devices, robotics, transportation, and industrial embedded systems. The series of changes in question looks to provision support for – - Launching a debuggee - Attaching to a debuggee - Having the debuggee come up stopped at the entry point - Setting breakpoints - Stopping at breakpoints - Reading/writing contents of/to the debuggee's memory - Reading/writing contents of/to the debuggee's registers - Reading/writing contents of/to the debuggee's variables - Resuming the debuggee's execution - Single-stepping the debuggee's execution - Interrupting the debuggee's execution - Dumping information pertaining to the debuggee's stack trace Kindly note that _ptrace_ isn't available on _QNX_. Instead, _devctl_ can be leveraged to observe and control the execution of a process under debug on _QNX_. Any additional support (including the facilitation of execution of tests) will be the subject of future work. >From f28581bb6897395adf4b2202db4a3e772ecacff9 Mon Sep 17 00:00:00 2001 From: Ted Woodward Date: Fri, 18 Aug 2023 17:56:00 -0500 Subject: [PATCH] [lldb] [ObjectFileELF] Detect QNX Neutrino RTOS targets Detect QNX Neutrino Real-Time Operating System targets and duly set the operating system component of the triple. --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 5c6b475044be5..c9918cfc0f57e 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -66,6 +66,7 @@ static const char *const LLDB_NT_OWNER_OPENBSD = "OpenBSD"; static const char *const LLDB_NT_OWNER_ANDROID = "Android"; static const char *const LLDB_NT_OWNER_CORE = "CORE"; static const char *const LLDB_NT_OWNER_LINUX = "LINUX"; +static const char *const LLDB_NT_OWNER_QNX = "QNX"; // ELF note type definitions static const elf_word LLDB_NT_FREEBSD_ABI_TAG = 0x01; @@ -1284,6 +1285,8 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data, // cases (e.g. compile with -nostdlib) Hence set OS to Linux arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux); } +} else if (note.n_name == LLDB_NT_OWNER_QNX) { + arch_spec.GetTriple().setOS(llvm::Triple::OSType::QNX); } // Calculate the offset of the next note just in case "offset" has been ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [Platform] Introduce PlatformQNX (PR #97487)
https://github.com/ayushsahay1837 created https://github.com/llvm/llvm-project/pull/97487 This change provisions the _QNX_ platform plugin, and is the third in a series of changes that look to facilitate remote debug of _AArch64_ targets on _QNX_. _QNX Neutrino Real-Time Operating System_ is a commercial Unix-like real-time operating system primarily targeting the embedded systems market including automotive, medical devices, robotics, transportation, and industrial embedded systems. The series of changes in question looks to provision support for – - Launching a debuggee - Attaching to a debuggee - Having the debuggee come up stopped at the entry point - Setting breakpoints - Stopping at breakpoints - Reading/writing contents of/to the debuggee's memory - Reading/writing contents of/to the debuggee's registers - Reading/writing contents of/to the debuggee's variables - Resuming the debuggee's execution - Single-stepping the debuggee's execution - Interrupting the debuggee's execution - Dumping information pertaining to the debuggee's stack trace Kindly note that _ptrace_ isn't available on _QNX_. Instead, _devctl_ can be leveraged to observe and control the execution of a process under debug on _QNX_. Any additional support (including the facilitation of execution of tests) will be the subject of future work. >From 30b13cd6d0f13ba41a3f40a602c6c066dceda9d6 Mon Sep 17 00:00:00 2001 From: Ted Woodward Date: Thu, 24 Aug 2023 11:36:32 -0500 Subject: [PATCH] [lldb] [Platform] Introduce PlatformQNX Provision the QNX platform plugin. --- lldb/source/Plugins/Platform/CMakeLists.txt | 1 + .../Plugins/Platform/QNX/CMakeLists.txt | 11 + .../Plugins/Platform/QNX/PlatformQNX.cpp | 313 ++ .../source/Plugins/Platform/QNX/PlatformQNX.h | 72 4 files changed, 397 insertions(+) create mode 100644 lldb/source/Plugins/Platform/QNX/CMakeLists.txt create mode 100644 lldb/source/Plugins/Platform/QNX/PlatformQNX.cpp create mode 100644 lldb/source/Plugins/Platform/QNX/PlatformQNX.h diff --git a/lldb/source/Plugins/Platform/CMakeLists.txt b/lldb/source/Plugins/Platform/CMakeLists.txt index 6869587f917eb..d4e8669ed944b 100644 --- a/lldb/source/Plugins/Platform/CMakeLists.txt +++ b/lldb/source/Plugins/Platform/CMakeLists.txt @@ -7,4 +7,5 @@ add_subdirectory(NetBSD) add_subdirectory(OpenBSD) add_subdirectory(POSIX) add_subdirectory(QemuUser) +add_subdirectory(QNX) add_subdirectory(Windows) diff --git a/lldb/source/Plugins/Platform/QNX/CMakeLists.txt b/lldb/source/Plugins/Platform/QNX/CMakeLists.txt new file mode 100644 index 0..04e5b0f864d98 --- /dev/null +++ b/lldb/source/Plugins/Platform/QNX/CMakeLists.txt @@ -0,0 +1,11 @@ +add_lldb_library(lldbPluginPlatformQNX PLUGIN + PlatformQNX.cpp + + LINK_LIBS +lldbBreakpoint +lldbCore +lldbHost +lldbInterpreter +lldbTarget +lldbPluginPlatformPOSIX + ) diff --git a/lldb/source/Plugins/Platform/QNX/PlatformQNX.cpp b/lldb/source/Plugins/Platform/QNX/PlatformQNX.cpp new file mode 100644 index 0..028aaf5f412a2 --- /dev/null +++ b/lldb/source/Plugins/Platform/QNX/PlatformQNX.cpp @@ -0,0 +1,313 @@ +//===-- PlatformQNX.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "PlatformQNX.h" +#include "lldb/Host/Config.h" + +#include +#if LLDB_ENABLE_POSIX +#include +#endif + +#include "Utility/ARM64_DWARF_Registers.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Host/HostInfo.h" +#include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/State.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StreamString.h" + +// Define these constants from QNX mman.h for use when targeting remote QNX +// systems even when host has different values. +#define MAP_PRIVATE 0x0002 +#define MAP_ANON 0x0008 + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::platform_qnx; + +LLDB_PLUGIN_DEFINE(PlatformQNX) + +static uint32_t g_initialize_count = 0; + +PlatformSP PlatformQNX::CreateInstance(bool force, const ArchSpec *arch) { + Log *log = GetLog(LLDBLog::Platform); + LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, + arch ? arch->GetArchitectureName() : "", + arch ? arch->GetTriple().getTriple() : ""); + + bool create = force; + if (!create && arch && arch->IsValid()) { +const llvm::Triple &triple = arch->GetTriple(); +switch (triple.getOS()) { +case llvm::Triple::QNX: + create = true; +
[Lldb-commits] [lldb] [lldb] [DynamicLoaderPOSIXDYLD] Enable POSIX-DYLD for QNX (PR #97536)
https://github.com/ayushsahay1837 created https://github.com/llvm/llvm-project/pull/97536 This change enables the _POSIX_ dynamic loader plugin for _QNX_, and is the fourth in a series of changes that look to facilitate remote debug of _AArch64_ targets on _QNX_. _QNX Neutrino Real-Time Operating System_ is a commercial Unix-like real-time operating system primarily targeting the embedded systems market including automotive, medical devices, robotics, transportation, and industrial embedded systems. The series of changes in question looks to provision support for – - Launching a debuggee - Attaching to a debuggee - Having the debuggee come up stopped at the entry point - Setting breakpoints - Stopping at breakpoints - Reading/writing contents of/to the debuggee's memory - Reading/writing contents of/to the debuggee's registers - Reading/writing contents of/to the debuggee's variables - Resuming the debuggee's execution - Single-stepping the debuggee's execution - Interrupting the debuggee's execution - Dumping information pertaining to the debuggee's stack trace Kindly note that _ptrace_ isn't available on QNX. Instead, _devctl_ can be leveraged to observe and control the execution of a process under debug on _QNX_. Any additional support (including the facilitation of execution of tests) will be the subject of future work. >From f98902752ab60d3bdd2f38ce656c1b25ef2c972a Mon Sep 17 00:00:00 2001 From: Ted Woodward Date: Thu, 5 Oct 2023 10:31:46 -0500 Subject: [PATCH] [lldb] [DynamicLoaderPOSIXDYLD] Enable POSIX-DYLD for QNX Enable the POSIX dynamic loader plugin for QNX. --- .../DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp| 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 51e4b3e6728f2..7bff55e5cd347 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -54,7 +54,8 @@ DynamicLoader *DynamicLoaderPOSIXDYLD::CreateInstance(Process *process, if (triple_ref.getOS() == llvm::Triple::FreeBSD || triple_ref.getOS() == llvm::Triple::Linux || triple_ref.getOS() == llvm::Triple::NetBSD || -triple_ref.getOS() == llvm::Triple::OpenBSD) +triple_ref.getOS() == llvm::Triple::OpenBSD || +triple_ref.getOS() == llvm::Triple::QNX) create = true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [DynamicLoaderPOSIXDYLD] Enable POSIX-DYLD for QNX (PR #97536)
https://github.com/ayushsahay1837 edited https://github.com/llvm/llvm-project/pull/97536 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [ObjectFileELF] Detect QNX Neutrino RTOS targets (PR #97439)
https://github.com/ayushsahay1837 edited https://github.com/llvm/llvm-project/pull/97439 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [Platform] Introduce PlatformQNX (PR #97487)
https://github.com/ayushsahay1837 edited https://github.com/llvm/llvm-project/pull/97487 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [DynamicLoaderPOSIXDYLD] Enable POSIX-DYLD for QNX (PR #97536)
https://github.com/ayushsahay1837 edited https://github.com/llvm/llvm-project/pull/97536 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] [lldb-server] Introduce Host/qnx and NativeProcessQNX (PR #97630)
https://github.com/ayushsahay1837 edited https://github.com/llvm/llvm-project/pull/97630 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] [lldb-server] Introduce Host/qnx and NativeProcessQNX (PR #97630)
ayushsahay1837 wrote: > This is only a very light review. I agree with others that an RFC thread is a > better place to discuss this. After we sort that out, this patch should be > further subdivided into smaller pieces. Thanks, @labath! I'll look into these and get back to you at the earliest. https://github.com/llvm/llvm-project/pull/97630 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88279)
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 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)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88279)
https://github.com/ayushsahay1837 updated https://github.com/llvm/llvm-project/pull/88279 >From e5f994d2ccc359b90c9aaae33f08d702f2ca8d4b Mon Sep 17 00:00:00 2001 From: Ayush Sahay 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)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88279)
https://github.com/ayushsahay1837 ready_for_review https://github.com/llvm/llvm-project/pull/88279 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88279)
https://github.com/ayushsahay1837 closed https://github.com/llvm/llvm-project/pull/88279 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88279)
ayushsahay1837 wrote: Accidentally merged branch 'main' into main; hence, abandoning. https://github.com/llvm/llvm-project/pull/88279 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88301)
https://github.com/ayushsahay1837 created https://github.com/llvm/llvm-project/pull/88301 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 f4794dc0711005be1a98b2208855ba81d0fb3854 Mon Sep 17 00:00:00 2001 From: Ayush Sahay Date: Wed, 10 Apr 2024 22:50:04 +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)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88301)
https://github.com/ayushsahay1837 updated https://github.com/llvm/llvm-project/pull/88301 >From f4794dc0711005be1a98b2208855ba81d0fb3854 Mon Sep 17 00:00:00 2001 From: Ayush Sahay Date: Wed, 10 Apr 2024 22:50:04 +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)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [llgs] Fix assertion in Handle_qfThreadInfo (PR #88301)
https://github.com/ayushsahay1837 closed https://github.com/llvm/llvm-project/pull/88301 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] d506a9e - [lldb] Require native for command-thread-siginfo.test
Author: Ayush Sahay Date: 2022-03-14T21:20:21+05:30 New Revision: d506a9ef2b3216879bec182be67590eddac27685 URL: https://github.com/llvm/llvm-project/commit/d506a9ef2b3216879bec182be67590eddac27685 DIFF: https://github.com/llvm/llvm-project/commit/d506a9ef2b3216879bec182be67590eddac27685.diff LOG: [lldb] Require native for command-thread-siginfo.test command-thread-siginfo.test employs a subject with a call to wait, and thus requires system-linux. However, it's possible to target non-Linux platforms despite operating on Linux hosts. So, have it require native too. Reviewed By: mgorny, labath Differential Revision: https://reviews.llvm.org/D121487 Added: Modified: lldb/test/Shell/Commands/command-thread-siginfo.test Removed: diff --git a/lldb/test/Shell/Commands/command-thread-siginfo.test b/lldb/test/Shell/Commands/command-thread-siginfo.test index 92829f3dcb0c4..1f2beee90e440 100644 --- a/lldb/test/Shell/Commands/command-thread-siginfo.test +++ b/lldb/test/Shell/Commands/command-thread-siginfo.test @@ -1,4 +1,4 @@ -# REQUIRES: system-linux +# REQUIRES: native && system-linux # RUN: %clang_host -g %S/Inputs/sigchld.c -o %t # RUN: %lldb %t -b -s %s | FileCheck %s ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0803241 - [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation
Author: Ayush Sahay Date: 2023-02-01T23:05:28+05:30 New Revision: 08032411301e8996879c4b558b8bb3808d5dfe6f URL: https://github.com/llvm/llvm-project/commit/08032411301e8996879c4b558b8bb3808d5dfe6f DIFF: https://github.com/llvm/llvm-project/commit/08032411301e8996879c4b558b8bb3808d5dfe6f.diff LOG: [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation TestFrameFormatNameWithArgs.test is enabled only in case of native compilation but is applicable in case of cross compilation too. So, provision support for enabling it in case of both, native and cross compilation. Reviewed By: Michael137 Differential Revision: https://reviews.llvm.org/D140839 Added: Modified: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test lldb/test/Shell/helper/build.py Removed: diff --git a/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test b/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test index dc4dedadee80a..eeb46cfd6bf9d 100644 --- a/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test +++ b/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test @@ -1,5 +1,5 @@ # UNSUPPORTED: system-windows -# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out +# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out # RUN: %lldb -b -s %s %t.out | FileCheck %s settings set -f frame-format "frame ${function.name-with-args}\n" break set -n foo diff --git a/lldb/test/Shell/helper/build.py b/lldb/test/Shell/helper/build.py index 96684b7b3e669..55d871f2a0400 100755 --- a/lldb/test/Shell/helper/build.py +++ b/lldb/test/Shell/helper/build.py @@ -110,6 +110,12 @@ nargs='+', help='Source file(s) to compile / object file(s) to link') +parser.add_argument('--std', +metavar='std', +dest='std', +required=False, +help='Specify the C/C++ standard.') + args = parser.parse_args(args=sys.argv[1:]) @@ -231,6 +237,7 @@ def __init__(self, toolchain_type, args, obj_ext): self.verbose = args.verbose self.obj_ext = obj_ext self.lib_paths = args.libs_dir +self.std = args.std def _exe_file_name(self): assert self.mode != 'compile' @@ -581,6 +588,9 @@ def _get_compilation_command(self, source, obj): args.append('--') args.append(source) +if self.std: +args.append('/std:' + self.std) + return ('compiling', [source], obj, self.compile_env, args) @@ -652,6 +662,9 @@ def _get_compilation_command(self, source, obj): if sys.platform == 'darwin': args.extend(['-isysroot', self.apple_sdk]) +if self.std: +args.append('-std={0}'.format(self.std)) + return ('compiling', [source], obj, None, args) def _get_link_command(self): @@ -789,6 +802,7 @@ def fix_arguments(args): print(' Verbose: ' + str(args.verbose)) print(' Dryrun: ' + str(args.dry)) print(' Inputs: ' + format_text(args.inputs, 0, 10)) +print(' C/C++ Standard: ' + str(args.std)) print('Script Environment:') print_environment(os.environ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5ef5177 - [lldb-vscode] Synchronize calls to SendTerminatedEvent
Author: Ayush Sahay Date: 2021-06-11T21:37:19+05:30 New Revision: 5ef5177145b48e6379fe3a6434d3ff593fe7202a URL: https://github.com/llvm/llvm-project/commit/5ef5177145b48e6379fe3a6434d3ff593fe7202a DIFF: https://github.com/llvm/llvm-project/commit/5ef5177145b48e6379fe3a6434d3ff593fe7202a.diff LOG: [lldb-vscode] Synchronize calls to SendTerminatedEvent If an inferior exits prior to the processing of a disconnect request, then the threads executing EventThreadFunction and request_discontinue respectively may call SendTerminatedEvent simultaneously, in turn, testing and/or setting g_vsc.sent_terminated_event without any synchronization. In case the thread executing EventThreadFunction sets it before the thread executing request_discontinue has had a chance to test it, the latter would move ahead to issue a response to the disconnect request. Said response may be dispatched ahead of the terminated event compelling the client to terminate the debug session without consuming any console output that might've been generated by the execution of terminateCommands. Reviewed By: clayborg, wallace Differential Revision: https://reviews.llvm.org/D103609 Added: Modified: lldb/tools/lldb-vscode/lldb-vscode.cpp Removed: diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp index 29b4019379d83..9619572ef4889 100644 --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -179,6 +179,19 @@ void SendThreadExitedEvent(lldb::tid_t tid) { // Send a "terminated" event to indicate the process is done being // debugged. void SendTerminatedEvent() { + // If an inferior exits prior to the processing of a disconnect request, then + // the threads executing EventThreadFunction and request_discontinue + // respectively may call SendTerminatedEvent simultaneously. Without any + // synchronization, the thread executing EventThreadFunction may set + // g_vsc.sent_terminated_event before the thread executing + // request_discontinue has had a chance to test it, in which case the latter + // would move ahead to issue a response to the disconnect request. Said + // response may get dispatched ahead of the terminated event compelling the + // client to terminate the debug session without consuming any console output + // that might've been generated by the execution of terminateCommands. So, + // synchronize simultaneous calls to SendTerminatedEvent. + static std::mutex mutex; + std::lock_guard locker(mutex); if (!g_vsc.sent_terminated_event) { g_vsc.sent_terminated_event = true; g_vsc.RunTerminateCommands(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] Handle subsets of CSRs in RV32 core dump images (PR #142932)
ayushsahay1837 wrote: Thanks for reviewing this, David! > Our intention is to provide support in this PR for all the standard CSRs, and > in a later PR for the CSRs in the Xqci extension, and use that as an example > for others to implement their own extensions. The named CSRs in this PR are limited to those listed in _Table 4 (Currently allocated RISC-V unprivileged CSR addresses)_ of [_the RISC-V Instruction Set Manual (Volume II)_](https://drive.google.com/file/d/17GeetSnT5wW3xNuAHI95-SI1gPGd5sJ_/view). Qualcomm is in the process of upstreaming implementations of _Xqci_. We'll be looking to include named CSRs therein in the future. > These should be gated by some discovery mechanism, like ELF attributes, since > we don't want to collide if 2 extensions use, say, CSR 50. This corresponds to the third phase listed [here](https://discourse.llvm.org/t/add-risc-v-csrs-to-core-dumps/84348/6). > The existing riscv-32 is static. I think we'll need to replace that (and the > 64 bit static implementation, to add CSR support) with dynamic. Downstream we > have only dynamic in our 20.0 release. IIUC, then the existing support for the postmortem debug of 32-bit RISC-V core dump images looks to facilitate the enablement/disablement of optional register sets in their entirety; it doesn't support handling subsets of register sets. This change looks to provision support for handling subsets of register sets in addition to handling entire register sets. > Can we share the two implementations? We've tweaked the existing implementation to facilitate the coexistence of both the schemes. However, the implementation proposed in this PR switches to building register information for GPRs, FPRs, and CSRs dynamically unconditionally, rendering the existing scheme unexercised. > Also, test cases? As Ted has mentioned, we're working on devising/procuring a test that we could upstream. I just thought that it'll be good to get the community's initial thoughts on the proposed scheme in the meanwhile. > Also we need a comment somewhere, I suggest in this PR's description for now, > that describes the note's format in detail. > I agree - we should publish a comment with the note's format. I think a > comment in the sources would be a more natural place to look than the commit > message. Sure, I'll add a description of the note's format to the source, and post it here as well. https://github.com/llvm/llvm-project/pull/142932 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits