如何在CLION中自动为GDB加载漂亮的打印机
我为用户定义的C ++类编写了一些GDB漂亮打印机,它们可以按预期工作。
我的IDE是CLION,问题是我必须在第一个调试会话中从GDB内手动运行“ source predtyprinters.py”。
如何使Clion自动加载这些文件?
我知道有一个名为.gdbinit的文件。我试图将我的python脚本放在这个文件中。我还试图将“ source prettyprinters.py”放在此文件中,但是这些尝试都没有成功。
请注意,我使用的是捆绑的GDB版本,该版本带有Clion。
I have written some GDB pretty-printers for my user-defined c++ classes, and they work as expected.
My IDE is CLion, and the problem is I have to manually run 'source PrettyPrinters.py' from within gdb at the first debugging session.
How can I make CLion load these files automatically?
I understand there is a file called .gdbinit. I have tried to put my python script in this file. I have also tried to put 'source PrettyPrinters.py' in this file, but none of these attempts have been successful.
Note, I am using the bundled version of GDB, that comes with CLion.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要回答我自己的问题:
打开文件'〜/.config/gdb/gdbinit',或创建它,如果尚不存在。将命令的“ add-auto-load-saf-path project-root/.gdbinit”添加到此文件中。
现在,GDB应该在下一次调试会话时自动加载漂亮的打印机(您无需重新启动CLION)。
To answer my own question:
Open the file '~/.config/gdb/gdbinit', or create it, if it does not already exist. Add the command 'add-auto-load-safe-path project-root/.gdbinit' to this file.
GDB should now load the pretty-printers automatically upon next debugging session (you do not need to restart clion).