Skip to content

Commit 8de2ecc

Browse files
[ExecutionEngine] Fix the call to DWARFContext::create
Without this patch, we pass G.getEndianness() as one of the parameters to DWARFContext::create. The problem is that G.getEndianness() is of: enum endianness {big, little, native}; whereas DWARFContext::create is expecting "bool isLittleEndian". That is, we are relying on an implicit conversion to convert big and little to false and true, respectively. When we migrate llvm::support::endianness to std::endian in future, we can no longer rely on an implicit conversion because std::endian is declared with "enum class". Even if we could, the conversion would not be guaranteed to work because, for example, libcxx defines: enum class endian { little = 0xDEAD, big = 0xFACE, : where big and little are not boolean values. This patch fixes the problem by properly converting G.getEndianness() to a boolean value.
1 parent 9580468 commit 8de2ecc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
158158

159159
std::optional<StringRef> FileName;
160160
if (!DebugLineSectionData.empty()) {
161+
assert((G.getEndianness() == support::endianness::big ||
162+
G.getEndianness() == support::endianness::little) &&
163+
"G.getEndianness() must be either big or little");
161164
auto DWARFCtx = DWARFContext::create(DebugSectionMap, G.getPointerSize(),
162-
G.getEndianness());
165+
G.getEndianness() ==
166+
support::endianness::little);
163167
DWARFDataExtractor DebugLineData(
164168
DebugLineSectionData,
165169
G.getEndianness() == support::endianness::little, G.getPointerSize());

0 commit comments

Comments
 (0)