如何在 gdb 中保存设置?

2022-01-20 00:00:00 debugging c gdb c++

有谁知道如何保存 gdb 设置(例如set print pretty on"或set print elements 0",都来自 这里)?我不想每次使用 gdb 时都设置我的配置:/

Does anyone know how to save gdb settings (like "set print pretty on" or "set print elements 0", both from here)? I don't want to set my configuration every time that I will use gdb :/

我在 google 和 SO 中搜索过,但一无所获.

I searched in google and SO, but I found nothing.

推荐答案

在您的主目录的 .gdbinit 文件中添加您想要自动运行的任何命令.

Add any commands you want to auto run in the .gdbinit file in your home directory.

相关文章