[lldb-dev] File::Read does not read everything

Eugene Birukov via lldb-dev lldb-dev at lists.llvm.org
Mon Oct 17 12:20:50 PDT 2016


Hello,


I am using LLDB 3.9 on Linux Ubuntu. I am loading a 5GiB core which is located on Windows file share mounted on Linux via mount.cifs. I see that we successfully allocated memory and are trying to fill it in one read. Unfortunately pread returns 2GiB and we never check for short read here.


I think we could combine this code with previous block "#if defined (MAX_READ_SIZE)" if we simply check for short read here (bytes_read too small) and loop until all the buffer is filled.


Thanks,

Eugene


#ifndef _WIN32
    int fd = GetDescriptor();
    if (fd != kInvalidDescriptor)
    {
        ssize_t bytes_read = -1;
        do
        {
            bytes_read = ::pread (fd, buf, num_bytes, offset);
        } while (bytes_read < 0 && errno == EINTR);

        if (bytes_read < 0)
        {
            num_bytes = 0;
            error.SetErrorToErrno();
        }
        else
        {
            offset += bytes_read;
            num_bytes = bytes_read;
        }
    }


Sent from Outlook<http://aka.ms/weboutlook>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20161017/60d57430/attachment.html>


More information about the lldb-dev mailing list