================
@@ -70,24 +70,30 @@ ObjectFile *ObjectFileBreakpad::CreateInstance(const 
ModuleSP &module_sp,
     extractor_sp = std::make_shared<DataExtractor>(data_sp);
     data_offset = 0;
   }
-  auto text = toStringRef(extractor_sp->GetSharedDataBuffer()->GetData());
+  // If this is opearting on a VirtualDataExtractor, it can have
+  // gaps between valid bytes in the DataBuffer. We extract an
+  // ArrayRef of the raw bytes, and can segfault.
+  DataExtractorSP contiguous_extractor_sp =
+      extractor_sp->GetSubsetExtractorSP(0);
----------------
JDevlieghere wrote:

Nit: I know the `0` is the offset but it's still a bit of a magic constant. I 
wonder if it would be nicer to have that be a default argument so you can call 
`GetSubsetExtractorSP()` or something. 

The other alternative is something like  `GetSubsetExtractorSP(/*offset=*/0)` 
or a class constant like `GetSubsetExtractorSP(DataExtractor::Start)`. 

https://github.com/llvm/llvm-project/pull/178347
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to