Skip to content

Commit 8498335

Browse files
committed
[Runtime] Add the pointer location to the "failed to look up symbolic reference" error.
The pointer location can be computed from the symbolic reference location and offset, which we already provide, but it's not clear that you should add them together, nor is it clear why this failure would occur. Add the location of the NULL pointer itself to the error message, and also mention that it's probably caused by a missing weak symbol.
1 parent 2600aa5 commit 8498335

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ ResolveAsSymbolicReference::operator()(SymbolicReferenceKind kind,
133133
if (symInfo->getSymbolName())
134134
symbolName = symInfo->getSymbolName();
135135
}
136+
uintptr_t ptrLocation = detail::applyRelativeOffset(base, offset);
136137
swift::fatalError(
137138
0,
138139
"Failed to look up symbolic reference at %p - offset %" PRId32
139-
" - symbol %s in %s\n",
140-
base, offset, symbolName, fileName);
140+
" - symbol %s in %s - pointer at %#" PRIxPTR
141+
" is likely a reference to a missing weak symbol\n",
142+
base, offset, symbolName, fileName, ptrLocation);
141143
}
142144

143145
// Figure out this symbolic reference's grammatical role.

0 commit comments

Comments
 (0)