Skip to content

Commit c9881c7

Browse files
committed
Support looking up absolute symbols
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 Differential Revision: https://reviews.llvm.org/D113445
1 parent 196554d commit c9881c7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lldb/source/Symbol/Symbol.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ void Symbol::Clear() {
115115
}
116116

117117
bool Symbol::ValueIsAddress() const {
118-
return m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
118+
return m_addr_range.GetBaseAddress().GetSection().get() != nullptr ||
119+
m_type == eSymbolTypeAbsolute;
119120
}
120121

121122
ConstString Symbol::GetDisplayName() const {

lldb/source/Symbol/Symtab.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
11001100
case eSymbolTypeCode:
11011101
case eSymbolTypeResolver:
11021102
case eSymbolTypeReExported:
1103+
case eSymbolTypeAbsolute:
11031104
symbol_indexes.push_back(temp_symbol_indexes[i]);
11041105
break;
11051106
default:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: %clang %s -g -c -o %t.o
2+
# RUN: %lldb -b -o 'target modules lookup -s absolute_symbol' %t.o | FileCheck %s
3+
# CHECK: 1 symbols match 'absolute_symbol'
4+
# CHECK: Address: 0x0000000012345678 (0x0000000012345678)
5+
# CHECK: Summary: 0x0000000012345678
6+
.globl absolute_symbol
7+
absolute_symbol = 0x12345678

0 commit comments

Comments
 (0)