Skip to content

Conversation

@Jinjie-Huang
Copy link
Contributor

@Jinjie-Huang Jinjie-Huang commented Nov 18, 2025

Provide more information when detecting a DWARF version mismatch in .dwo files to help locate the issue and align with other similar errors.

@llvmbot
Copy link
Member

llvmbot commented Nov 18, 2025

@llvm/pr-subscribers-debuginfo

Author: Jinjie Huang (Jinjie-Huang)

Changes

Provide 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:

  • (modified) llvm/lib/DWP/DWP.cpp (+3-1)
  • (added) llvm/test/tools/llvm-dwp/X86/incompatible_dwarf_version.test (+15)
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() {}

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

🐧 Linux x64 Test Results

  • 186353 tests passed
  • 4859 tests skipped

Copy link
Collaborator

@dwblaikie dwblaikie left a 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))

@Jinjie-Huang
Copy link
Contributor Author

Jinjie-Huang commented Nov 19, 2025

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).

Copy link
Collaborator

@dwblaikie dwblaikie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@Jinjie-Huang Jinjie-Huang merged commit 79fffed into llvm:main Nov 20, 2025
10 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 20, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm at step 6 "test-build-unified-tree-check-all".

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
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-dwp/X86/incompatible_dwarf_version.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp && mkdir -p /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp && cd /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# executed command: rm -rf /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# note: command had no output on stdout or stderr
# executed command: mkdir -p /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# note: command had no output on stdout or stderr
# executed command: cd /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.dwo -dwarf-version=5 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llvm-dwp/X86/../Inputs/overflow/main_v5.s -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.o
# executed command: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.dwo -dwarf-version=5 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llvm-dwp/X86/../Inputs/overflow/main_v5.s -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.o
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/debug_info_v4.dwo -dwarf-version=4 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llvm-dwp/X86/../Inputs/overflow/debug_info_v4.s -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/debug_info_v4.o
# executed command: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/debug_info_v4.dwo -dwarf-version=4 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llvm-dwp/X86/../Inputs/overflow/debug_info_v4.s -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/debug_info_v4.o
# .---command stderr------------
# | LLVM ERROR: IO failure on output stream: No space left on device
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 20, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-win running on sie-win-worker while building llvm at step 7 "test-build-unified-tree-check-all".

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
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-reduce/reduce-operands-int.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-one --test z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll --test-arg --input-file Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll -o Z:\b\llvm-clang-x86_64-sie-win\build\test\tools\llvm-reduce\Output\reduce-operands-int.ll.tmp
# executed command: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-one --test 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll' --test-arg --input-file 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll' -o 'Z:\b\llvm-clang-x86_64-sie-win\build\test\tools\llvm-reduce\Output\reduce-operands-int.ll.tmp'
# .---command stderr------------
# | *** Reducing Operands to one (operands-one)...
# | �[1mZ:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll:12:26: �[0m�[0;1;31merror: �[0m�[1mCHECK-INTERESTINGNESS: expected string not found in input
�[0m# | �[1m�[0m; CHECK-INTERESTINGNESS: = add i32 %
# | �[0;1;32m                         ^
�[0m# | �[0;1;32m�[0m�[1mC:\Users\buildbot\AppData\Local\Temp\lit-tmp-3hp0xjzi\llvm-reduce-04b557.ll:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m# | �[1m�[0m; ModuleID = 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll'
# | �[0;1;32m^
�[0m# | �[0;1;32m�[0m�[1mC:\Users\buildbot\AppData\Local\Temp\lit-tmp-3hp0xjzi\llvm-reduce-04b557.ll:6:8: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m# | �[1m�[0m %add0 = add i32 1, 1
# | �[0;1;32m       ^
�[0m# | �[0;1;32m�[0m
# | Input file: C:\Users\buildbot\AppData\Local\Temp\lit-tmp-3hp0xjzi\llvm-reduce-04b557.ll
# | Check file: Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# | �[1m�[0m�[0;1;30m            1: �[0m�[1m�[0;1;46m; ModuleID = 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llvm-reduce\reduce-operands-int.ll' �[0m
# | �[0;1;31mcheck:12'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
�[0m# | �[0;1;31m�[0m�[0;1;30m            2: �[0m�[1m�[0;1;46msource_filename = "Z:\\b\\llvm-clang-x86_64-sie-win\\llvm-project\\llvm\\test\\tools\\llvm-reduce\\reduce-operands-int.ll" �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m            3: �[0m�[1m�[0;1;46m �[0m
# | �[0;1;31mcheck:12'0     ~
�[0m# | �[0;1;31m�[0m�[0;1;30m            4: �[0m�[1m�[0;1;46mdefine void @foo(i32 %arg0, i32 %arg1, <2 x i32> %arg2, <2 x i32> %arg3) { �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m            5: �[0m�[1m�[0;1;46mbb0: �[0m
# | �[0;1;31mcheck:12'0     ~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m            6: �[0m�[1m�[0;1;46m %add0 = add i32 1, 1 �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;35mcheck:12'1            ?               possible intended match
�[0m# | �[0;1;35m�[0m�[0;1;30m            7: �[0m�[1m�[0;1;46m %add1 = add i32 1, 1 �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m            8: �[0m�[1m�[0;1;46m %add2 = add i32 1, 0 �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m            9: �[0m�[1m�[0;1;46m %add3 = add i32 1, 1 �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m           10: �[0m�[1m�[0;1;46m %add4 = add i32 1, 1 �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~
�[0m# | �[0;1;31m�[0m�[0;1;30m           11: �[0m�[1m�[0;1;46m %add5 = add <2 x i32> splat (i32 1), splat (i32 1) �[0m
# | �[0;1;31mcheck:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 20, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-darwin running on doug-worker-3 while building llvm at step 6 "test-build-unified-tree-check-all".

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
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-dwp/X86/incompatible_dwarf_version.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp && mkdir -p /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp && cd /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# executed command: rm -rf /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# note: command had no output on stdout or stderr
# executed command: mkdir -p /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# note: command had no output on stdout or stderr
# executed command: cd /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.dwo -dwarf-version=5 /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/tools/llvm-dwp/X86/../Inputs/overflow/main_v5.s -o /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.o
# executed command: /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.dwo -dwarf-version=5 /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/tools/llvm-dwp/X86/../Inputs/overflow/main_v5.s -o /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llvm-dwp/X86/Output/incompatible_dwarf_version.test.tmp/main_v5.o
# .---command stderr------------
# | LLVM ERROR: IO failure on output stream: No space left on device
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@dyung
Copy link
Collaborator

dyung commented Nov 20, 2025

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!

@Jinjie-Huang
Copy link
Contributor Author

Jinjie-Huang commented Nov 20, 2025

@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?

@dyung
Copy link
Collaborator

dyung commented Nov 20, 2025

@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?

@Jinjie-Huang
Copy link
Contributor Author

@dyung Thanks for pointing this out, I've submitted a fix pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants