Skip to content

Commit 1daebf8

Browse files
authored
Merge pull request #6543 from apple/🍒/navy/568be31c9e50
[dsymutil] Initialize the debug map before loading the main binary
2 parents 9ba3d7a + 06e3020 commit 1daebf8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/tools/dsymutil/MachODebugMapParser.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class MachODebugMapParser {
113113
StringRef BinaryPath);
114114

115115
void Warning(const Twine &Msg, StringRef File = StringRef()) {
116+
assert(Result &&
117+
"The debug map must be initialized before calling this function");
116118
WithColor::warning() << "("
117119
<< MachOUtils::getArchName(
118120
Result->getTriple().getArchName())
@@ -199,10 +201,9 @@ static std::string getArchName(const object::MachOObjectFile &Obj) {
199201
std::unique_ptr<DebugMap>
200202
MachODebugMapParser::parseOneBinary(const MachOObjectFile &MainBinary,
201203
StringRef BinaryPath) {
204+
Result = std::make_unique<DebugMap>(MainBinary.getArchTriple(), BinaryPath,
205+
MainBinary.getUuid());
202206
loadMainBinarySymbols(MainBinary);
203-
ArrayRef<uint8_t> UUID = MainBinary.getUuid();
204-
Result =
205-
std::make_unique<DebugMap>(MainBinary.getArchTriple(), BinaryPath, UUID);
206207
MainBinaryStrings = MainBinary.getStringTableData();
207208
for (const SymbolRef &Symbol : MainBinary.symbols()) {
208209
const DataRefImpl &DRI = Symbol.getRawDataRefImpl();

0 commit comments

Comments
 (0)