From 34d0f0ff711df0cc97d8d3ec9405dd88b253a957 Mon Sep 17 00:00:00 2001 From: ccc Date: Wed, 3 Sep 2025 11:39:20 +0800 Subject: [PATCH] fix(LLDB): Repair OC_Bridge variable display issue when load-on-demand is true When symbols.load-on-demand is enabled in LLDB, variables from OC-bridged Swift objects were not being displayed. This was due to SymbolFileOndemand not correctly overriding the GetAstData method, causing it to return an empty implementation from the base SymbolFile class. This commit fixes the issue by providing the correct implementation of GetAstData in SymbolFileOndemand, ensuring that the necessary AST data is loaded and OC-bridged variables can be correctly resolved and displayed during debugging. --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 2 ++ lldb/source/Symbol/SymbolFileOnDemand.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index 6e3c2477d1769..1a9fe670ed12e 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -178,6 +178,8 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { void PreloadSymbols() override; + std::vector GetASTData(lldb::LanguageType language) override; + uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override; lldb_private::StatsDuration::Duration GetDebugInfoParseTime() override; lldb_private::StatsDuration::Duration GetDebugInfoIndexTime() override; diff --git a/lldb/source/Symbol/SymbolFileOnDemand.cpp b/lldb/source/Symbol/SymbolFileOnDemand.cpp index 807c2124e48d9..71d07776e820f 100644 --- a/lldb/source/Symbol/SymbolFileOnDemand.cpp +++ b/lldb/source/Symbol/SymbolFileOnDemand.cpp @@ -535,6 +535,15 @@ void SymbolFileOnDemand::PreloadSymbols() { return m_sym_file_impl->PreloadSymbols(); } +std::vector SymbolFileOnDemand::GetASTData(lldb::LanguageType language) { + if (!m_debug_info_enabled) { + LLDB_LOG(GetLog(), "[{0}] {1} is skipped", GetSymbolFileName(), + __FUNCTION__); + return {}; + } + return m_sym_file_impl->GetASTData(language); +} + uint64_t SymbolFileOnDemand::GetDebugInfoSize(bool load_all_debug_info) { // Always return the real debug info size. LLDB_LOG(GetLog(), "[{0}] {1} is not skipped", GetSymbolFileName(),