本文介绍了转储进程的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在读取的/ proc / $ PID /映射你映射的内存区域。是疗法转储这个区域之一办法?
When reading the /proc/$PID/maps you get the mapped memory regions. Is ther a way to dump one of this regions?
$ cat /proc/18448/maps ...[snip]... 0059e000-005b1000 r-xp 00000000 08:11 40 /usr/local/lib/libgstlightning.so.0.0.0 005b1000-005b2000 r--p 00012000 08:11 40 /usr/local/lib/libgstlightning.so.0.0.0 005b2000-005b3000 rw-p 00013000 08:11 40 /usr/local/lib/libgstlightning.so.0.0.0 ...[snip]...感谢
推荐答案罗!呼叫 ptrace的() 与 ptrace的ATTACH 。然后打开 的/ proc /< PID> / MEM ,寻求区域偏移,并读取区域的长度给出的/ proc< / PID方式> /图
Nah! Call ptrace() with PTRACE ATTACH. Then open /proc/<pid>/mem, seek to the region offset, and read the length of the region as given in /proc</pid>/maps.
下面是我写一个程序做它在C.这里有一个模块,我写了做它在Python(和ptrace的结合)。对于完成,转储过程中各地区的文件程序。
Here's a program I wrote that does it in C. Here's a module I wrote that does it in Python (and the ptrace binding). For the finish, a program that dumps all regions of a process to files.
享受!
更多推荐
转储进程的内存
发布评论