Skip to content

fix llvm-gsymutil verification #141751

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

Merged
merged 1 commit into from
May 29, 2025
Merged

fix llvm-gsymutil verification #141751

merged 1 commit into from
May 29, 2025

Conversation

peremyach
Copy link
Contributor

@peremyach peremyach commented May 28, 2025

Verification crashed here https://github.com/llvm/llvm-project/blob/main/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp#L519
The reason being that during verification to extract inline_info we recreate compile unit dies. Assert fails because we previously cleaned up just the DIEs but some other fields remained initialized.

@llvmbot
Copy link
Member

llvmbot commented May 28, 2025

@llvm/pr-subscribers-debuginfo

Author: None (peremyach)

Changes

Verification crashed here https://github.com/llvm/llvm-project/blob/main/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp#L519
The reason being that we to extract inline_info we recreate compile unit dies. Assert fails because we previously cleaned up just the DIEs but some other fields remained initialized.


Full diff: https://github.com/llvm/llvm-project/pull/141751.diff

1 Files Affected:

  • (modified) llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp (+4)
diff --git a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
index 1f70d273a9d9d..640141463c107 100644
--- a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+++ b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
@@ -713,6 +713,10 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
                                      OutputAggregator &Out) {
   Out << "Verifying GSYM file \"" << GsymPath << "\":\n";
 
+  for (const auto &CU : DICtx.compile_units()) {
+    CU->clear();
+  }
+
   auto Gsym = GsymReader::openFile(GsymPath);
   if (!Gsym)
     return Gsym.takeError();

Comment on lines 716 to 719
for (const auto &CU : DICtx.compile_units()) {
CU->clear();
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

So if there is some state that wasn't cleared in the DWARFUnit objects (or DWARFCompileUnit objects) then we should be doing one of two things:

  • Instead of calling void DWARFUnit::clearDIEs(bool KeepCUDie, bool KeepDWODies = false);, we call DWARFUnit::clear(). This should reset all of the state correctly and avoid the assertion
  • in void clearDIEs(bool KeepCUDie, bool KeepDWODies = false); we should clear any state related to the DIEs that needs to be cleared.

@Jlalond
Copy link
Contributor

Jlalond commented May 29, 2025

@peremyach want me to merge this for you?

@peremyach
Copy link
Contributor Author

@Jlalond yes, please

@Jlalond Jlalond merged commit beb6972 into llvm:main May 29, 2025
11 checks passed
google-yfyang pushed a commit to google-yfyang/llvm-project that referenced this pull request May 29, 2025
Verification crashed here
https://github.com/llvm/llvm-project/blob/main/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp#L519
The reason being that during verification to extract inline_info we
recreate compile unit dies. Assert fails because we previously cleaned
up just the DIEs but some other fields remained initialized.

Co-authored-by: Arslan Khabutdinov <akhabutdinov@fb.com>
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Verification crashed here
https://github.com/llvm/llvm-project/blob/main/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp#L519
The reason being that during verification to extract inline_info we
recreate compile unit dies. Assert fails because we previously cleaned
up just the DIEs but some other fields remained initialized.

Co-authored-by: Arslan Khabutdinov <akhabutdinov@fb.com>
peremyach added a commit to peremyach/llvm-project that referenced this pull request Jun 4, 2025
peremyach pushed a commit to peremyach/llvm-project that referenced this pull request Jun 4, 2025
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.

4 participants