/proc/$PID/maps文件解读

Each row in /proc/$PID/maps describes a region of contiguous virtual memory in a process or thread. Each row has the following fields:

address           perms offset  dev   inode   pathname
08048000-08056000 r-xp 00000000 03:0c 64593   /usr/sbin/gpm
  • address - This is the starting and ending address of the region in the process‘s address space
  • permissions - This describes how pages in the region can be accessed. There are four different permissions: read, write, execute, and shared. If read/write/execute are disabled, a ‘-‘ will appear instead of the ‘r‘/‘w‘/‘x‘. If a region is not shared, it is private, so a ‘p‘ will appear instead of an ‘s‘. If the process attempts to access memory in a way that is not permitted, a segmentation fault is generated. Permissions can be changed using the mprotect system call.
  • offset - If the region was mapped from a file (using mmap), this is the offset in the file where the mapping begins. If the memory was not mapped from a file, it‘s just 0.
  • device - If the region was mapped from a file, this is the major and minor device number (in hex) where the file lives.
  • inode - If the region was mapped from a file, this is the file number.
  • pathname - If the region was mapped from a file, this is the name of the file. This field is blank for anonymous mapped regions. There are also special regions with names like [heap][stack], or [vdso][vdso] stands for virtual dynamic shared object. It‘s used by system calls to switch to kernel mode. Here‘s a good article about it.

You might notice a lot of anonymous regions. These are usually created by mmap but are not attached to any file. They are used for a lot of miscellaneous things like shared memory or buffers not allocated on the heap. For instance, I think the pthread library uses anonymous mapped regions as stacks for new threads.

原文地址:https://www.cnblogs.com/cgc0415/p/8886251.html

时间: 2024-10-30 03:09:55

/proc/$PID/maps文件解读的相关文章

/proc/$pid/maps文件中各个空间段的意义

一.从/proc/self/maps中看到的内存布局 在这个输出中,可以很容易看到一个so文件中有一个"---p"属性的区间段,它们对应哪些文件内容,数据从哪里来?在stackoverflow网站上也有一个这样的提问,只是还没有人解答.[email protected]: cat /proc/self/maps 00400000-0040b000 r-xp 00000000 fd:01 15433 /usr/bin/cat0060b000-0060c000 r--p 0000b000

Linux高级调试与优化——同时抓取coredump和maps文件

Linux内核源码 Documentation/sysctl/kernel.txt core_pattern: core_pattern: core_pattern is used to specify a core dumpfile pattern name. . max length 128 characters; default value is "core" . core_pattern is used as a pattern template for the output

linux proc maps文件分析

Proc/pid/maps显示进程映射了的内存区域和访问权限.对应内核中的操作集为proc_pid_maps_op,具体的导出函数为show_map.内核中进程的一段地址空间用一个vm_area_struct结构体表示,所有地址空间存储在task->mm->mmap链表中. 一个文件可以映射到进程的一段内存区域中,映射的文件描述符保存在vm_area_struct->vm_file域中,这种内存区域叫做有名内存区域,相反,属于匿名映射内存区域.Vm_area_struct每项对应解析如下

Oracle性能分析2:trace文件解读

下面是trace文件中的一个片段,表示一个SQL执行的过程,一个trace文件由很多这样的片段组成: PARSING IN CURSOR #4 len=135 dep=1 uid=0 oct=3 lid=0 tim=777069789359 hv=1115215392 ad='33e7e384' select /*+ index(idl_char$ i_idl_char1) +*/ piece#,length,piece from idl_char$ where obj#=:1 and part

awk 解析maps文件中的地址

maps文件一般是这个样子: [email protected]:~ $ sudo cat /proc/1/maps 54b88000-54c8d000 r-xp 00000000 b3:07 655537 /lib/systemd/systemd 54c9c000-54cac000 r--p 00104000 b3:07 655537 /lib/systemd/systemd 54cac000-54cad000 rw-p 00114000 b3:07 655537 /lib/systemd/s

浏览器插件开发-manifest文件解读

调研资料 manifest.json 官方文档 Chrome Extension API 360浏览器的插件文档中文, 虽然内核差不多但是不一定与 Chrome api 一致, 可以作为参考 Chrome 官方案例库 案例 如何实现网页和Chrome插件之间的通信 消息传递 manifest.json 配置说明 manifest.json 用于描述 Chrome 插件的源数据,配置信息等,基本内容如下 { "name": "名称", "descriptio

nginx nginx.pid无故文件丢失,日志无法正常轮转

nginx.pid文件丢失,日志无法正常轮转.解决方法:故障原因,日志被迁移后,kill-USR1 pid 没有成功,致使nginx写的文件句柄还是在旧的文件里. 模拟故障:1: 我们 mv 日志文件为.bak2: 我们清空nginx.pid文件3: 我们试图reload的时候失败,因为pid文件是空的.这时候我们使用killall nginx ,然后再启动nginx才能解决. [[email protected] nginx]# ps -ef |grep nginx root     1028

maven工程pom.xml文件解读

maven的核心是pom.xml,POM(Project Object Model,项目对象模型)定义了项目的基本信息,用于描述如何构建,声明项目依赖.以Hello World项目为例,创建一个hello-world的文件夹,里面新建一个pom.xml文件,内容如下: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0

对内核模块的Makefile文件解读

ifneq ($(KERNELRELEASE),)param-objs := file1.o file2.oobj-m := param.oelse KDIR := /lib/modules/2.6.18-53.el5/build all: make -C $(KDIR) M=$(PWD) modules clean: rm -f *.ko *.o *.mod.o *.mod.c *.symversendif KERNELRELEASE是在内核源码的顶层Makefile中定义的一个变量,在第一次