【发布时间】:2011-04-09 04:43:03
【问题描述】:
我正在尝试调试在处理请求时分叉的进程。
我已将 follow-fork-mode 设置为 child 允许 gdb 在遇到孩子的断点时闯入。但是,当我从孩子继续时,父母会分离。
很多文档指向选项detach-on-fork,但如果我尝试设置此选项,我会得到:
(gdb) set detach-on-fork on
No symbol "detach" in current context.
选项明显链接自:http://sourceware.org/gdb/onlinedocs/gdb/Forks.html
编辑:系统信息
>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版本。谢谢!
如果有评论的人想添加答案,我会接受!
【问题讨论】:
-
您使用的是什么操作系统/内核,以及 GDB 版本是什么?
-
CentOS 4.4、2.6.9、GDB 6.3,将更多信息编辑到第一篇文章中
-
GDB 6.3 是否支持您正在使用的标志?您可能需要更新到更高版本。
-
有时您只需要一个公共论坛就可以让您开始检查显而易见的事情。切换到另一台gdb 6.5的机器,支持该命令。
-
是的,RHEL/CentOS 有一些非常旧的软件版本。这可能会让人很生气。