如何在.gdbinit或配置文件中设置GDB TUI默认regs布局?
How to Launch GDB TUI with Registers Layout by Default
Absolutely! You can set this up directly in your ~/.gdbinit configuration file—it’s totally straightforward. Here’s the step-by-step breakdown:
- Open your
~/.gdbinitfile with your preferred text editor (e.g.,vim ~/.gdbinitornano ~/.gdbinit). If the file doesn’t exist yet, just create a new one. - Add these two lines to the file:
The first line turns on TUI mode by default, while the second sets the default layout to display registers alongside your code.tui enable layout regs - Save the file and exit the editor.
Next time you launch GDB, it will automatically start in TUI mode with the registers layout active. If you ever need to switch to a different layout temporarily (like source-only or assembly view), you can still use commands such as layout src or layout asm as usual.
内容的提问来源于stack exchange,提问作者StudentsTea




