dump memory

Today I have a look about things how to get debug information in memory during process running.

This part is just ways to get the information, and later will investigate how to look into the info.

1. Coredump

Dump the memory info of a process. 

1.a can be collected during abnormal exit. 

ulimit command is used to relax resource limitation. ulimit -c unlimited 

ulimit -list can check all the limitation.

And the core dump is generated when a process exits with exception or receives abort signal.

kill -s abort process_id

kill -list can list all signals.

1.b can be collected during a process is running

gcore

And later use gdb can debug and analyze the  coredump.

2. Get function call stack. 

During a process is running, the function call is pushed into the stack(high address is bottom). From the stack, we can get the function call and corresponding variables.

2.a dump_stack

This function is used to print the system call stack in kernel mode.

2.b backtrace

Get function call history in user mode.

But I don't find a existed function to print the corresponding variables, although I know how to print with my own written code. 

3. strace

It is used to track which system calls are executed and the signals which are received. 


TODO:

1. Whether any tools can interpret the content of a core dump more plainly when some explanation words are added. 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值