clayborg added a comment.

Not sure this is the right fix. The calling code should listen to how many 
bytes were actually read from memory and avoid touching any bytes. So we should 
fix Module::GetMemoryObjectFile to resize its buffer back to only the size that 
was read. Something like:

  const size_t bytes_read =
      process_sp->ReadMemory(header_addr, data_up->GetBytes(),
                             data_up->GetByteSize(), readmem_error);
  if (bytes_read < size_to_read)
    data_sp->SetByteSize(bytes_read);
  if (data_sp->GetByteSize() > 0) {
    DataBufferSP data_sp(data_up.release());
    m_objfile_sp = ObjectFile::FindPlugin(shared_from_this(), process_sp,
                                          header_addr, data_sp);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75200/new/

https://reviews.llvm.org/D75200



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to