-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[dsymutil] Improve missing symbol warning message #75378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dsymutil] Improve missing symbol warning message #75378
Conversation
The current warning emitted by dsymutil when it can't find a symbol in an object file is worded rather poorly: could not find object file symbol for symbol _foo It's also lacking information that makes the warning actionable, such as the object file it's looking at. This patch rewords the warning and adds the object file path to the warning: could not find symbol '_foo' in object file 'test.o'
@llvm/pr-subscribers-debuginfo Author: Jonas Devlieghere (JDevlieghere) ChangesThe current warning emitted by dsymutil when it can't find a symbol in an object file is worded rather poorly:
It's also lacking information that makes the warning actionable, such as the object file it's looking at. This patch rewords the warning and adds the object file path to the warning:
rdar://119621065 Full diff: https://github.com/llvm/llvm-project/pull/75378.diff 8 Files Affected:
diff --git a/llvm/test/tools/dsymutil/ARM/extern-alias.test b/llvm/test/tools/dsymutil/ARM/extern-alias.test
index f8b59584d2b465..58a1c6a738257f 100644
--- a/llvm/test/tools/dsymutil/ARM/extern-alias.test
+++ b/llvm/test/tools/dsymutil/ARM/extern-alias.test
@@ -41,6 +41,6 @@ RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/ext
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/private_extern/private_extern.out -o %t.dSYM --verbose | FileCheck %s
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/extern.out -o %t.dSYM --verbose | FileCheck %s
-CHECK-NOT: could not find object file symbol for symbol _baz
+CHECK-NOT: could not find symbol '_baz'
CHECK: { sym: _baz, objAddr: 0x0, binAddr: 0x100007F58, size: 0x0 }
CHECK: { sym: _foo, objAddr: 0x0, binAddr: 0x100007F58, size: 0x20 }
diff --git a/llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test b/llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test
new file mode 100644
index 00000000000000..1de805d3219537
--- /dev/null
+++ b/llvm/test/tools/dsymutil/ARM/missing-symbol-warning.test
@@ -0,0 +1,3 @@
+RUN: dsymutil -oso-prepend-path %p/../Inputs --dump-debug-map %p/../Inputs/private/tmp/warning/test.out 2>&1 | FileCheck %s
+# CHECK: could not find symbol '_foo' in object file '{{.*}}test.o'
+# CHECK: { sym: _main, objAddr: 0x0, binAddr: 0x100003F84, size: 0x1C }
diff --git a/llvm/test/tools/dsymutil/ARM/static-archive-collision.test b/llvm/test/tools/dsymutil/ARM/static-archive-collision.test
index 7182f0917d897f..55fd5e6b621e76 100644
--- a/llvm/test/tools/dsymutil/ARM/static-archive-collision.test
+++ b/llvm/test/tools/dsymutil/ARM/static-archive-collision.test
@@ -22,5 +22,5 @@ $ clang main.o foo.a -o main.out
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/collision/main.out --dump-debug-map 2>&1 | FileCheck %s
CHECK: skipping debug map object with duplicate name and timestamp: {{.*}} /private/tmp/collision/foo.a(foo.o)
-CHECK-NOT: could not find object file symbol for symbol _g
-CHECK-NOT: could not find object file symbol for symbol _f
+CHECK-NOT: could not find symbol '_g'
+CHECK-NOT: could not find symbol '_f'
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o
new file mode 100644
index 00000000000000..53647992d70c97
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.o differ
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out
new file mode 100755
index 00000000000000..bfd5c74f4a1ddc
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/warning/test.out differ
diff --git a/llvm/test/tools/dsymutil/X86/alias.test b/llvm/test/tools/dsymutil/X86/alias.test
index 4c1e8168706098..65e9bf22640a8a 100644
--- a/llvm/test/tools/dsymutil/X86/alias.test
+++ b/llvm/test/tools/dsymutil/X86/alias.test
@@ -4,7 +4,7 @@
# RUN: dsymutil --linker llvm -f -oso-prepend-path=%p/../Inputs/alias \
# RUN: %p/../Inputs/alias/foobar -o - | llvm-dwarfdump - 2>&1 | FileCheck %s
-# CHECK-NOT: could not find object file symbol for symbol
+# CHECK-NOT: could not find symbol
# CHECK: DW_AT_name ("foo.c")
# CHECK: DW_AT_name ("bar.c")
diff --git a/llvm/test/tools/dsymutil/X86/thinlto.test b/llvm/test/tools/dsymutil/X86/thinlto.test
index 2d2195805f3aab..d76bfb17e7d527 100644
--- a/llvm/test/tools/dsymutil/X86/thinlto.test
+++ b/llvm/test/tools/dsymutil/X86/thinlto.test
@@ -23,5 +23,5 @@ RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/fo
RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/foobar.dylib -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
-CHECK-NOT: could not find object file symbol for symbol __ZZ9function2vE12magic_static
-CHECK-NOT: could not find object file symbol for symbol __ZGVZ9function2vE12magic_static
+CHECK-NOT: could not find symbol '__ZZ9function2vE12magic_static'
+CHECK-NOT: could not find symbol 'symbol __ZGVZ9function2vE12magic_static'
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index 7a32eacee14c1b..524a6795c360e9 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -729,7 +729,8 @@ void MachODebugMapParser::handleStabSymbolTableEntry(
}
if (ObjectSymIt == CurrentObjectAddresses.end()) {
- Warning("could not find object file symbol for symbol " + Twine(Name));
+ Warning("could not find symbol '" + Twine(Name) + "' in object file '" +
+ CurrentDebugMapObject->getObjectFilename() + "'");
return;
}
|
The current warning emitted by dsymutil when it can't find a symbol in an object file is worded rather poorly: ``` could not find object file symbol for symbol _foo ``` It's also lacking information that makes the warning actionable, such as the object file it's looking at. This patch rewords the warning and adds the object file path to the warning: ``` could not find symbol '_foo' in object file 'test.o' ``` rdar://119621065 (cherry picked from commit 5900014)
[dsymutil] Improve missing symbol warning message (llvm#75378)
The current warning emitted by dsymutil when it can't find a symbol in an object file is worded rather poorly:
It's also lacking information that makes the warning actionable, such as the object file it's looking at. This patch rewords the warning and adds the object file path to the warning:
rdar://119621065