gdb 與 父子程序

先上結論

set follow-fork-mode parent
set follow-fork-mode child
show follow-fork-mode

有時候會遇到debug到一半就跳出子程序,就結束了

[New process 28128]                                                                             
process 28128 is executing new program: /bin/dash            
[Inferior 2 (process 28128) exited with code 02]                                      

只要下 set follow-fork-mode parent ,就可以繼續留在 parent process

Leave a Reply

Your email address will not be published. Required fields are marked *