[llvm] 593395f - [dsymutil] Fix spurious warnings in MachODebugMapParser (#78794)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 15:11:01 PST 2024
Author: Jonas Devlieghere
Date: 2024-01-19T15:10:57-08:00
New Revision: 593395f0da67e9c5e2e6de6fe364c313458a642a
URL: https://github.com/llvm/llvm-project/commit/593395f0da67e9c5e2e6de6fe364c313458a642a
DIFF: https://github.com/llvm/llvm-project/commit/593395f0da67e9c5e2e6de6fe364c313458a642a.diff
LOG: [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
Added:
llvm/test/tools/dsymutil/ARM/missing-object-warning.test
llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foo.o
llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foobar.out
Modified:
llvm/tools/dsymutil/MachODebugMapParser.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/dsymutil/ARM/missing-object-warning.test b/llvm/test/tools/dsymutil/ARM/missing-object-warning.test
new file mode 100644
index 000000000000000..62b3ecb31888b16
--- /dev/null
+++ b/llvm/test/tools/dsymutil/ARM/missing-object-warning.test
@@ -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
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foo.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foo.o
new file mode 100644
index 000000000000000..333b39c45b14521
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foo.o
diff er
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foobar.out b/llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foobar.out
new file mode 100755
index 000000000000000..2574c85b9929240
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/missing/foobar.out
diff er
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index 524a6795c360e96..6a9f25681cdd1ca 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -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);
@@ -206,9 +208,6 @@ void MachODebugMapParser::switchToNewDebugMapObject(
return;
}
- addCommonSymbols();
- resetParserState();
-
CurrentDebugMapObject =
&Result->addDebugMapObject(Path, Timestamp, MachO::N_OSO);
More information about the llvm-commits
mailing list