tags:

views:

221

answers:

1

I develop on both mac and linux and have one network mounted home directory that is shared between them. On linux, it is useful to have the following in my .gdbinit:

set print thread-events off

Unfortunately, this errors on mac:

(gdb) set print thread-events off
Undefined set print command: "thread-events off".  Try "help set print".

Is there a way in .gdbinit to have this command only executed on linux?

+1  A: 

Create ~/.gdbinit.Linux and ~/.gdbinit.MacOS, then (bash syntax):

alias gdb="gdb -ex \"source ~/.gdbinit.$(uname)\""

Of course you could do the same thing with a gdb shell wrapper script instead of an alias.

Alternatively you can build GDB 7.x on both, and have full power of Python at your disposal.

Employed Russian