[Lldb-commits] [PATCH] D113445: Support looking up absolute symbols

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 8 17:32:11 PST 2021


aprantl created this revision.
aprantl added reviewers: jasonmolenda, jingham, JDevlieghere.
aprantl requested review of this revision.

The Swift stdlib uses absolute symbols in the dylib to communicate feature flags to the process. LLDB's expression evaluator needs to be able to find them. This wires up absolute symbols so they show up in the symtab lookup command, which is also all that's needed for them to be visible to the expression evaluator JIT.

rdar://85093828


https://reviews.llvm.org/D113445

Files:
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/test/Shell/SymbolFile/absolute-symbol.s


Index: lldb/test/Shell/SymbolFile/absolute-symbol.s
===================================================================
--- /dev/null
+++ lldb/test/Shell/SymbolFile/absolute-symbol.s
@@ -0,0 +1,7 @@
+# RUN: %clang %s -g -c -o %t.o
+# RUN: %lldb -b -o 'target modules lookup -s absolute_symbol' %t.o | FileCheck %s
+# CHECK: 1 symbols match 'absolute_symbol'
+# CHECK:   Address: 0x0000000012345678 (0x0000000012345678)
+# CHECK:   Summary: 0x0000000012345678
+.globl absolute_symbol
+absolute_symbol = 0x12345678
Index: lldb/source/Symbol/Symtab.cpp
===================================================================
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -1100,6 +1100,7 @@
           case eSymbolTypeCode:
           case eSymbolTypeResolver:
           case eSymbolTypeReExported:
+          case eSymbolTypeAbsolute:
             symbol_indexes.push_back(temp_symbol_indexes[i]);
             break;
           default:
Index: lldb/source/Symbol/Symbol.cpp
===================================================================
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -115,7 +115,8 @@
 }
 
 bool Symbol::ValueIsAddress() const {
-  return m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
+  return m_addr_range.GetBaseAddress().GetSection().get() != nullptr ||
+         m_type == eSymbolTypeAbsolute;
 }
 
 ConstString Symbol::GetDisplayName() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113445.385663.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211109/f525d9da/attachment.bin>


More information about the lldb-commits mailing list