转储进程的内存 [英] Dump memory of a process

查看:116
本文介绍了转储进程的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在读取的/ 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.

享受!

这篇关于转储进程的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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