Skip to content

Commit

Permalink
[dsymutil] Fix spurious warnings in MachODebugMapParser (#78794)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JDevlieghere committed Jan 19, 2024
1 parent 9396891 commit 593395f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions llvm/test/tools/dsymutil/ARM/missing-object-warning.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RUN: dsymutil -oso-prepend-path %p/../Inputs --dump-debug-map %p/../Inputs/private/tmp/missing/foobar.out 2>&1 | FileCheck %s

CHECK: bar.o unable to open object file
CHECK-NOT: could not find object file symbol for symbol _bar
CHECK-NOT: could not find object file symbol for symbol _main
Binary file not shown.
Binary file not shown.
5 changes: 2 additions & 3 deletions llvm/tools/dsymutil/MachODebugMapParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ void MachODebugMapParser::addCommonSymbols() {
/// everything up to add symbols to the new one.
void MachODebugMapParser::switchToNewDebugMapObject(
StringRef Filename, sys::TimePoint<std::chrono::seconds> Timestamp) {
addCommonSymbols();
resetParserState();

SmallString<80> Path(PathPrefix);
sys::path::append(Path, Filename);
Expand All @@ -206,9 +208,6 @@ void MachODebugMapParser::switchToNewDebugMapObject(
return;
}

addCommonSymbols();
resetParserState();

CurrentDebugMapObject =
&Result->addDebugMapObject(Path, Timestamp, MachO::N_OSO);

Expand Down

0 comments on commit 593395f

Please sign in to comment.