[Lldb-commits] [lldb] [lldb][NFC] Module, ModuleSpec, GetSectionData use DataExtractorSP (PR #178347)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 27 21:46:03 PST 2026


================
@@ -275,9 +275,9 @@ bool ObjectFileWasm::DecodeSections() {
 }
 
 size_t ObjectFileWasm::GetModuleSpecifications(
-    const FileSpec &file, DataBufferSP &data_sp, offset_t data_offset,
+    const FileSpec &file, DataExtractorSP &extractor_sp, offset_t data_offset,
     offset_t file_offset, offset_t length, ModuleSpecList &specs) {
-  if (!ValidateModuleHeader(data_sp)) {
+  if (!ValidateModuleHeader(extractor_sp->GetSharedDataBuffer())) {
----------------
JDevlieghere wrote:

Should we have an `extractor_sp || !extractor_sp->HasData()` check here? Is see that some plugins have that check and others don't, making it hard to know if this is a precondition or not. If it is, we should have an assert everywhere, and if it's not, we should have a check everywhere. 

I'm on the fence whether that belongs in this PR or a follow-up. If there's no way that `extractor_sp || !extractor_sp->HasData()` can fail when `!data_sp` didn't, then we should keep the existing behavior, even if it's potentially unsafe. But if by virtue of having an extractor we change behavior, we should include it here for this to be truly NFC.

https://github.com/llvm/llvm-project/pull/178347


More information about the lldb-commits mailing list