2011-04-08 60 views
3

我試圖調試處理請求時分叉的進程。gdb:不要從父母上叉分離

我已經設置了follow-fork-modechild允許gdb在打到子節點時打破。但是,當我從孩子那裏繼續時,父母離開了。

大量的文檔指向選項detach-on-fork,但如果我嘗試設置這個選項,我得到:http://sourceware.org/gdb/onlinedocs/gdb/Forks.html

編輯:系統信息

(gdb) set detach-on-fork on 
No symbol "detach" in current context. 

選項顯然與吸菸有關

>uname -a 
Linux localhost 2.6.9-78.0.22.ELsmp #1 SMP Thu Apr 30 19:14:39 EDT 2009 i686 i686 i386 GNU/Linux 

>gdb -v 
GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "i386-redhat-linux-gnu". 

編輯#2:

$ gdb -v 
GNU gdb Red Hat Linux (6.5-16.el5rh) 

(gdb) show detach-on-fork 
Whether gdb will detach the child of a fork is on. 

我想它是在6.3和6.5之間的某個時間加入的。我沒有意識到這個盒子有這樣一個老版本的gdb。謝謝!

如果有人評論想要添加答案,我會接受它!

+1

你在使用什麼操作系統/內核,以及什麼是GDB版本? – 2011-04-08 20:15:49

+0

CentOS 4.4,2.6.9,GDB 6.3,編輯更多信息到第一篇文章 – rrhartjr 2011-04-08 20:18:41

+2

GDB 6.3是否支持您使用的國旗?您可能需要更新到更高版本。 – 2011-04-08 20:21:43

回答

2

detach-on-fork選項是added in GDB 6.5。當時它只能在Linux上工作;不確定自那以後是否增加了額外的操作系統支持。