调试器gdb无法找到本地.gdbinit文件,而只能找到-cd参数指向的文件夹中的文件。
当本地文件夹中没有启动文件时,它不会显示任何警告:
/home/mydir/sources $ rm .gdbinit
/home/mydir/sources $ gdb --cd /home/mydir/apprundir
(output omited)但是,如果我们在当前文件夹中创建一个.gdbinit文件,它会检测到它在那里,但是它没有加载它,而是显示了“警告:.gdbinit:没有这样的文件或目录”。
/home/mydir/sources $ > .gdbinit
/home/mydir/sources $ gdb -cd /home/mydir/apprundir
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: .gdbinit: No such file or directory是否有其他方法来设置一个cmd文件,而不是通过gdb命令行参数?但通过任何外部方式,比如环境变量或其他方式?我不能将参数传递给gdb,因为它是由第三方脚本启动的,而且我不能在应用程序主文件夹中创建文件。
PS:我的最后一个选择是将所有命令放在$HOME/..gdbinit文件中,但我避免使用它,因为还有其他开发环境共享相同的$HOME/..dbginit文件。
发布于 2018-09-21 02:22:27
warning: .gdbinit: No such file or directory
这几乎肯定是GDB中的一个bug --我希望它能够从通过.gdbinit参数指定的目录中读取-cd DIR。文档说:
5. Processes command line options and operands.
6. Reads and executes the commands from init file (if any) in the current working directory ...从逻辑上讲,此时的当前工作目录应该是DIR。
我的最后一个选择是在
$HOME/.gdbinit文件中放置所有命令,但我避免使用它,因为还有其他开发环境共享相同的$HOME/.dbginit文件
如果您有带有嵌入式Python的非古代GDB,则可以将source ~/.gdbinit.py放入~/.gdbinit中。在~/.gdbinit.py中,您可以使用Python的全部功能。您可以检查环境、参数(包括将要调试的二进制文件),并为该特定环境适当地调整设置。
发布于 2021-05-17 16:29:02
我找到了解决我们所有问题的办法。它被称为rr调试器
首先,它是对gdb的替代,这意味着它应该使用IDE的类似于Codelite的最小设置。
其次,它是可逆性的!可逆计算是一个理论领域,但显然他们是通过存储和重播所有相关的代码指令来实现这一点的。
你知道,当你调试一些东西时,你会想,嗯,回到这个或那个断点会很好,好吧,他们终于让它成为可能了!
https://stackoverflow.com/questions/52432353
复制相似问题