我正在使用 GDB 调试我的 C 程序。而且因为我正在处理SIGUSR1
我的程序。因此,一旦我使用我的程序可执行文件运行 gdb,例如 -
gdb <my_executable>
在 gdb 提示下(gdb)
我需要输入 -
handle SIGUSR1 nostop noprint pass
因为我每次都需要这样做,所以我想把这个handle
命令放在初始化脚本中。所以在谷歌搜索之后,我了解了~/.gdbrc
and ~/.gdbinit
。我试图将handle
命令放在这两个文件中,但在 gdb 从可执行文件中读取符号后,我仍然没有看到该句柄命令被执行一次。
这有什么问题?
编辑:GNU gdb (GDB) 7.2.2
编辑 2:我的 .gdbrc 文件内容看起来像 -
echo "hello from gdbrc"
handle SIGUSR1 nostop noprint pass
run 204
编辑 3:即使我尝试使用 GNU gdb (GDB) 8.1.3我仍然面临同样的问题。
编辑 4:~/.gdbrc
and~/.gdbinit
被授予完全访问权限-
-rwxrwxrwx 1 darshan grp 68 Oct 9 22:14 .gdbint
-rwxrwxrwx 1 darshan grp 67 Oct 9 22:14 .gdbrc
编辑 5:我错误地将文件命名为“ .gdbint
”而不是“ .gdbinit
”。重命名后,我发现GDB 8.1.3
它在启动时正在读取。但是,GDB 7.2.2
我仍然看到问题 -.gdbinit
启动时未读取文件。
并且~/.gdbrc
不是正确的文件名,GDB 无法识别。