permanently disable gdb startup text
Asked Answered
A

3

14

When debugging a program with gdb (gdb main), it shows a lot of credits, and links. I know that we can use the quiet argument to disable this text, but I want to disable it permanently. Does gdb have init file or anything else in order to change the behavior of gdb?

Instead of:

$ gdb main
Copyright (C) 2020 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.
...

I want:

$ gdb main
Reading symbols from main...
(No debugging symbols found in main)
(gdb) 
Addam answered 16/9, 2020 at 10:49 Comment(0)
H
13

The patch alluded to by Tom Tromey above has been merged into gdb 11, it appears.

Put set startup-quietly on into an early initialization file (this is $XDG_CONFIG_HOME/gdb/gdbearlyinit, ~/.config/gdb/gdbearlyinit or ~/.gdbearlyinit) and you will be good.

See the documentation here: https://sourceware.org/gdb/onlinedocs/gdb/Initialization-Files.html#Initialization-Files

and here: https://sourceware.org/gdb/onlinedocs/gdb/Mode-Options.html#index-set-startup_002dquietly

Hilar answered 15/3, 2022 at 3:21 Comment(0)
I
8

At present, the only way to do this is to use gdb -q (aka gdb --quiet). This will silence the startup message. A typical way to do this is to use a shell alias.

There's a pending patch to add this feature to gdb. However, it won't be available until at least GDB 11, expected sometime next year.

Induplicate answered 16/9, 2020 at 13:11 Comment(0)
V
0

Based on the answer from @tom-tromey , you can add an alias in your bashrc (or equivalent for whichever shell you use)

echo 'alias gdb="gdb -q"' >> ~/.bashrc
Vlaminck answered 30/1 at 21:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.