如果映射文件未显示在过程映射中,我如何找到它?

How can I find the mapped file when it's not shown in proc maps?

我试图 gdb 一个函数,它的调用堆栈,调用函数落在地址 a4734000-a4e93000,所以我检查 /proc//maps 文件,发现有:

a4734000-a4e93000 r-xp 00000000 00:00 0 
a4ee0000-a527c000 r-xp 00000000 00:00 0

这对我来说没有意义,因为通常它会显示为可执行地址映射的目标二进制文件。有谁知道这是某种把戏吗?非常感谢。

权限字段 r-xp 包含 p,因此这些映射是私有的。路径字段为空,因此这些映射是匿名的。

因此,这些是私有匿名映射,使用 MAP_ANONMAP_PRIVATE 标志创建。它们可能是由 malloc(3):

创建的

When allocating blocks of memory larger than MMAP_THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2).

另见 this question and documentation