资料出处:http://cache.baidu.com/c?m=9d78d513d99617ff4fede52d4b5084374340c72362d88a5339968449e0794611193bb6ac27551300d2d27c1050f21641afb873713c002bb48698d61788a6d36e7cce7c656d1f874211d21ea9ce4425c3229b51e9ab1ae5bdf73196a9d8d6c2&p=99759a4ed4d85ff001be9b7a7f0d&user=baidu&fm=sc&query=gdb+attach&qid=b9c518d13a95371f&p1=13
资料出处:gdb5 -- 调试正在运行的进程(zz) - 我爱美女的日志 - 网易博客
$ ./beer-process &
[1] 17399
p@satan$ 100000 bottles of beer on the wall.
99999 bottles of beer on the wall.
99998 bottles of beer on the wall.
99997 bottles of beer on the wall.
$ gdb beer-process 17399
Attaching to program: code/running_process/beer-process, process 17399
0x410c64fb in nanosleep () from /lib/tls/libc.so.6
(gdb)
attach进程号,thread apply all where 显示所有线程当前运行位置
资料出处:gdb5 -- 调试正在运行的进程(zz) - 我爱美女的日志 - 网易博客
$ ./beer-process &
[1] 17399
p@satan$ 100000 bottles of beer on the wall.
99999 bottles of beer on the wall.
99998 bottles of beer on the wall.
99997 bottles of beer on the wall.
$ gdb beer-process 17399
Attaching to program: code/running_process/beer-process, process 17399
0x410c64fb in nanosleep () from /lib/tls/libc.so.6
(gdb)
attach进程号,thread apply all where 显示所有线程当前运行位置
如果要检测挂掉的位置要使用core文件
直接gdb
再attach 进程号就可以了
gdb时不带任何参数
gdb 不加程序名?
不加, 进程号就能获取所有信息