当未在proc映射中显示映射的文件时,如何查找? [英] How can I find the mapped file when it's not shown in proc maps?

查看:96
本文介绍了当未在proc映射中显示映射的文件时,如何查找?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I was trying to gdb a function, with it's callstack, the calling one falls into address a4734000-a4e93000, so I check the /proc//maps file and found there are:

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

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

This doesn't make sense to me, because normally it would show the target binary file that is mapped for the executable addresses. Does anyone know is this some sort of trick? Thanks a lot.

推荐答案

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

Permission field r-xp contains p, so these mappings are private. Path field is empty, so these mappings are anonymous.

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

Thus, these are private anonymous mappings, created with MAP_ANON and MAP_PRIVATE flags. They probably were created by malloc(3):

当分配大于MMAP_THRESHOLD字节的内存块时,glibc malloc()实现使用mmap(2)将内存分配为私有匿名映射.

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).

另请参见问题和 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆