-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[llvm-dwp] Give more information when incompatible version found #168511
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
[llvm-dwp] Give more information when incompatible version found #168511
Conversation
|
@llvm/pr-subscribers-debuginfo Author: Jinjie Huang (Jinjie-Huang) ChangesProvide more information when detecting a DWARF version mismatch in .dwo files to help locate the issue, aligning with other similar errors. Full diff: https://github.com/llvm/llvm-project/pull/168511.diff 2 Files Affected:
diff --git a/llvm/lib/DWP/DWP.cpp b/llvm/lib/DWP/DWP.cpp
index b565edbfe96db..a6624339f704f 100644
--- a/llvm/lib/DWP/DWP.cpp
+++ b/llvm/lib/DWP/DWP.cpp
@@ -709,7 +709,9 @@ Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
Version = Header.Version;
IndexVersion = Version < 5 ? 2 : 5;
} else if (Version != Header.Version) {
- return make_error<DWPError>("incompatible DWARF compile unit versions.");
+ return make_error<DWPError>(
+ Input + ": incompatible DWARF compile unit version, found " +
+ utostr(Header.Version) + " and expecting " + utostr(Version));
}
writeStringsAndOffsets(Out, Strings, StrOffsetSection, CurStrSection,
diff --git a/llvm/test/tools/llvm-dwp/X86/incompatible_dwarf_version.test b/llvm/test/tools/llvm-dwp/X86/incompatible_dwarf_version.test
new file mode 100644
index 0000000000000..886fe834a3263
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/X86/incompatible_dwarf_version.test
@@ -0,0 +1,15 @@
+RUN: rm -rf %t && split-file %s %t && cd %t
+RUN: clang++ -g -gsplit-dwarf -gdwarf-5 -c %t/a.cpp -o %t/a.o
+RUN: clang++ -g -gsplit-dwarf -gdwarf-4 -c %t/b.cpp -o %t/b.o
+RUN: clang++ %t/a.o %t/b.o -o %t/main.exe
+RUN: not llvm-dwp -e %t/main.exe -o %t/main.exe.dwp 2>&1 | FileCheck %s
+
+# CHECK: error: {{.*}}b.dwo: incompatible DWARF compile unit version, found 4 and expecting 5
+
+;--- a.cpp
+int main() {
+ return 0;
+}
+
+;--- b.cpp
+void b() {}
|
🐧 Linux x64 Test Results
|
dwblaikie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could further improve this by printing the dwo name of a dwo with the other version (either the first, or the most recently parsed, guess it doesn't really matter) to at least give a specific example. (this can be non-obvious if the user is building a dwp from an executable (if the user's passing dwo files on the command line, that's a bit more obvious, any previous dwo on the command line would be an example))
|
Thanks for the suggestion, that looks reasonable. I've updated to also print the name and version of the first valid input DWO (whose debug_info is non-empty). |
dwblaikie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/40604 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/26667 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/23/builds/15704 Here is the relevant piece of the build log for the reference |
|
Does the added test use a large amount of disk space or something? This change caused 3 of my bots (the ones above) to run out of disk space! |
|
@dyung The test reuses a test input from the baseline where the ELF size is mocked at about 4GB. This isn't actually necessary. Should I modify the test case? |
If that isn't really necessary, that would be great as I tend to provision the bots with just enough disk space to complete the build/test and only a small amount of buffer. Also, wouldn't a smaller test case be quicker since it wouldn't need to write out around 4GB of data? |
Provide more information when detecting a DWARF version mismatch in .dwo files to help locate the issue and align with other similar errors.