$ gdb -ex 'run arg1 arg2 ... argN' faulty_app
(...)
Program received signal SIGSEGV, Segmentation fault.
0x000055555555513d in faulty_func ()
(gdb) (... do some stuff like e.g. backtrace ...)
(gdb) p (int)getpid()
$2 = 2993764
(gdb) !bash
$ cd /proc/2993764
(... do some stuff ...)
$ exit
exit
(gdb) quit
A debugging session is active.
Inferior 1 [process 2993764] will be killed.
Quit anyway? (y or n) y
1条答案
按热度按时间oxalkeyp1#
使用
gdb
,它将在您的应用程序崩溃时停止,您将得到提示。然后您将能够:/proc/<pid>
的内容典型例子:
字符串