如何设置gdb的默认选项? [英] How to set default options for gdb?

查看:837
本文介绍了如何设置gdb的默认选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每次打开GDB都有几个选项,例如:

  set print thread-events off 

有没有办法在默认情况下设置这些选项,可能类似于.gdb_rc文件?

解决方案

初始化文件 gdb 被称为 .gdbinit 。你可以把你想要的选项放在这个文件中。它们将在gdb启动时自动执行。

c>#将命令行参数设置为2
set args 2

.gdbinit 文件放入您的$ HOME或当前目录中。后者覆盖全局 $ HOME / .gdbinit 文件中的设置。


I have several options that I set every time I open GDB, for instance:

set print thread-events off

Is there a way to set these options by default, perhaps something like a .gdb_rc file?

解决方案

The initialization file for gdb is called .gdbinit. You can put your desired options in this file. They'll be automatically executed during gdb's startup.

Example content:

# set command line argument to "2"
set args 2

You may put the .gdbinit file into your $HOME or current directory. The latter overrides the settings in the global $HOME/.gdbinit file.

这篇关于如何设置gdb的默认选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆