[Lldb-commits] [lldb] [LLDB] Serve unknown type symbols through `qSymbol` (PR #200134)
Aurore Poirier via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 22 03:15:30 PDT 2026
https://github.com/aurore-poirier updated https://github.com/llvm/llvm-project/pull/200134
>From 26e1dba73f21459fa0272aa20f9a3d10bd381957 Mon Sep 17 00:00:00 2001
From: Aurore Poirier <aurore.poirier at scisemi.com>
Date: Thu, 28 May 2026 09:13:51 +0200
Subject: [PATCH] [LLDB] Serve unknown type symbols through `qSymbol`
`358cf1ea302eb` introduced a divergence between GDB and LLDB where LLDB
does not serve symbols of unknown type through GDB protocol command
`qSymbol`. Per commit description, this is an expected behavior on
MachO-based platforms, but it is not on ELF-based platforms, where LLDB
should follow GDB, which it now does.
---
.../gdb-remote/GDBRemoteCommunicationClient.cpp | 15 +++++++++++++++
.../gdb_remote_client/TestQSymbol.py | 6 ++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index a3fe6661737a4..01e7f44fab9fe 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -15,6 +15,7 @@
#include <optional>
#include <sstream>
+#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/SafeMachO.h"
@@ -42,6 +43,7 @@
#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
#include "llvm/Support/ErrorExtras.h"
#include "llvm/Support/JSON.h"
+#include "llvm/TargetParser/Triple.h"
#if HAVE_LIBCOMPRESSION
#include <compression.h>
@@ -4279,6 +4281,19 @@ void GDBRemoteCommunicationClient::ServeSymbolLookups(
case eSymbolTypeCompiler:
case eSymbolTypeInstrumentation:
case eSymbolTypeTrampoline:
+ if (sc.module_sp->GetArchitecture()
+ .GetTriple()
+ .getObjectFormat() !=
+ llvm::Triple::ObjectFormatType::MachO) {
+ // GDB does return symbols even when they are of unknown
+ // type, following this behavior on non Mach-O
+ // architectures.
+ symbol_load_addr =
+ sc.symbol->GetLoadAddress(&process->GetTarget());
+ if (symbol_load_addr == LLDB_INVALID_ADDRESS) {
+ symbol_load_addr = sc.symbol->GetRawValue();
+ }
+ }
break;
case eSymbolTypeCode:
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestQSymbol.py b/lldb/test/API/functionalities/gdb_remote_client/TestQSymbol.py
index eac176b3809d7..96d6d83c20330 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestQSymbol.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestQSymbol.py
@@ -74,10 +74,8 @@ def test_qsymbol(self):
[
("main", 0x1000),
("local_address", 0x1004),
- # FIXME: Should return a value.
- ("global_value", None),
- # FIXME: Should return a value.
- ("local_value", None),
+ ("global_value", 0x1234),
+ ("local_value", 0xABCD),
("not_a_symbol", None),
]
)
More information about the lldb-commits
mailing list