Search code examples
shellgdb

GDB: Do not print output of .gdbinit commands


I have set of a .gdbinit file to run commands each time gdb is called. These commands output a lot of stuff in the shell, and it's becoming annoying.

Can I prevent commands inside .gdbinit to print to the shell?


Solution

  • Use set logging redirect on:

    This is an example:

    host: srv2-x64rh5-02, OS: Linux 2.6.18-238.el5>more .gdbinit
    set logging redirect on
    set logging file /dev/null
    set logging on
    file a.out
    b main
    commands
    bt
    info args
    c
    end
    help
    r
    set logging off
    quit