Skip to content

Conversation

@weliveindetail
Copy link
Member

In 4 years the ELF debugger support plugin wasn't adapted to other object formats or debugging approaches. After the renaming NFC in #168343, this patch tailors the plugin to ELF and section load-address patching. It allows removal of abstractions and consolidate processing steps with the newly enabled AllocActions from #168343.

The key change is to process debug sections in one place in a post-allocation pass. Since we can handle the endianness of the ELF file the single visitSectionLoadAddresses() visitor function now, we don't need to track debug objects and sections in template classes anymore. We keep using the DebugObject class and drop DebugObjectSection, ELFDebugObjectSection<ELFT> and ELFDebugObject.

Furthermore, we now use the allocation's working memory for load-address fixups directly. We can drop the WritableMemoryBuffer from the debug object and most of the finalizeWorkingMemory() step, which saves one copy of the entire debug object buffer. Inlining finalizeAsync() into the pre-fixup pass simplifies quite some logic.

We still track RegisteredObjs here, because we want to free memory once the corresponding code is freed. There will be a follow-up patch that turns it into a dealloc action.

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 186287 tests passed
  • 4853 tests skipped

Copy link
Contributor

@lhames lhames left a comment

Choose a reason for hiding this comment

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

LGTM. This is a really nice simplification.

@weliveindetail weliveindetail merged commit db5eedd into llvm:main Nov 21, 2025
10 checks passed
rupprecht added a commit that referenced this pull request Nov 21, 2025
@weliveindetail
Copy link
Member Author

It seems that my patch broke some bots, but reports didn't come through to this PR:
https://lab.llvm.org/buildbot/#/builders/66/builds/22634
https://lab.llvm.org/buildbot/#/builders/51/builds/27428

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants