Skip to content

Commit 593395f

Browse files
authored
[dsymutil] Fix spurious warnings in MachODebugMapParser (#78794)
When the MachODebugMapParser encounters an object file that cannot be found on disk, it currently leaves the parser in an incoherent state, resulting in spurious warnings that can in turn slow down dsymutil. This fixes #78411. rdar://117515153
1 parent 9396891 commit 593395f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RUN: dsymutil -oso-prepend-path %p/../Inputs --dump-debug-map %p/../Inputs/private/tmp/missing/foobar.out 2>&1 | FileCheck %s
2+
3+
CHECK: bar.o unable to open object file
4+
CHECK-NOT: could not find object file symbol for symbol _bar
5+
CHECK-NOT: could not find object file symbol for symbol _main
Binary file not shown.
Binary file not shown.

llvm/tools/dsymutil/MachODebugMapParser.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ void MachODebugMapParser::addCommonSymbols() {
186186
/// everything up to add symbols to the new one.
187187
void MachODebugMapParser::switchToNewDebugMapObject(
188188
StringRef Filename, sys::TimePoint<std::chrono::seconds> Timestamp) {
189+
addCommonSymbols();
190+
resetParserState();
189191

190192
SmallString<80> Path(PathPrefix);
191193
sys::path::append(Path, Filename);
@@ -206,9 +208,6 @@ void MachODebugMapParser::switchToNewDebugMapObject(
206208
return;
207209
}
208210

209-
addCommonSymbols();
210-
resetParserState();
211-
212211
CurrentDebugMapObject =
213212
&Result->addDebugMapObject(Path, Timestamp, MachO::N_OSO);
214213

0 commit comments

Comments
 (0)