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.