Getting "Serious error when reading debug info" when using mmap

"Oren Eini (Ayende Rahien)" <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAF0G-ZjSLczmNpYkAnP1a-Gfe175ax12Sx8YPFaFsdr++e-w9Q@mail.gmail.com>
Hi,
I'm getting a strange error when running Valgrind.

--23266-- WARNING: Serious error when reading debug info
--23266-- When reading debug info from /tmp/db/test.txt:
--23266-- can't read file to inspect ELF header

Note that the file in question is a data file, which I'm mmaping

I can reproduce this using the following code:
https://gist.github.com/ayende/d65a7a3c06556d62c8fa0f88b04ea449

valgrind-3.16.1 & clang version 10.0.0-4ubuntu1

This seems to be related to mmaping a file, but I can't figure out exactly
why

Running Valgrind under `strace` gives:

    mmap(0x4e4d000, 65536, PROT_READ, MAP_SHARED|MAP_FIXED, 3, 0) =
0x4e4d000
    statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL,
{stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0600,
stx_size=262144, ...}) = 0
    readlink("/proc/self/fd/3", "/tmp/db/test.txt", 4096) = 16
    statx(AT_FDCWD, "/tmp/db/test.txt", AT_STATX_SYNC_AS_STAT, STATX_ALL,
{stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0600,
stx_size=262144, ...}) = 0
    pread64(3, 0x10032c68a0, 1024, 0)       = -1 EINVAL (Invalid argument)
    getpid()                                = 23260
    write(1027, "--23260-- WARNING: Serious error"..., 57--23260-- WARNING:
Serious error when reading debug info
    ) = 57
    getpid()                                = 23260
    write(1027, "--23260-- When reading debug inf"..., 57--23260-- When
reading debug info from /tmp/db/test.txt:

So it looks like the `pread64()` code is failing, but I can't figure out
why that is the case, or why it would cause Valgrind to give this error.
Any ideas?

_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.