2

Every time I start gdb, I immediately do:

set print thread-events off

It would be nice if I could do this from the command-line arguments, so that I could just set up an alias instead of re-typing it every time.

Is there a faster way to do this?

Matthew
  • 28,056
  • 26
  • 104
  • 170

2 Answers2

5

How about a gdb startup script? Create ~/.gdbinit with the commands to be executed when it starts.

A .gdbinit can also be in the directory you are in when executing the program.

Community
  • 1
  • 1
wallyk
  • 56,922
  • 16
  • 83
  • 148
4

Yes:

gdb -ex "set print thread-events off" ...other-args...
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • This is the most direct answer to my question, and I up-voted it, but wallyk's answer is the best solution to my problem. – Matthew Jun 21 '12 at 21:44
  • This did not work for me. – Zane Hitchcox Apr 13 '22 at 16:09
  • Nevermind, turned out my command was being interpolated incorrectly. Just changed `cmd='gdb -q -batch -ex "set print thread-events off" -ex run...'; $cmd` to `cmd=(gdb -q -batch -ex "set print thread-events off" -ex run...); "$cmd[@]"` – Zane Hitchcox Apr 13 '22 at 16:19