Find out if GUI active in .gdbinit
Fernando Nasser
fnasser@redhat.com
Mon Jan 20 15:32:00 GMT 2003
Achim Bursian wrote:
> Hello,
> how can I find out if the GUI (Insight) is running while executing
> .gdbinit. I want to take different steps when -nw is given (especially
> issue some tk commands if Insight is active).
>
Nothing that I can remember off the top of my head. But it would be a
good idea to set a gdb convenience variable $nw so one could perform
this test. Maybe you should open a bug report (enhancement request) for
that.
Another thing, we could make insight look for a .insightinit before
going to .gdbinit (similar to what the bash shell does).
> And secondly, how can I source a gdb commandfile only if it exists?
> Something like
> if file exists $HOME/second.gdb
> source $HOME/second.gdb
> endif
>
> What is the way to do this in gdb (within .gdbinit)?
>
Alias the gdb command to a shell script that checks for the file
existence and calls gdb with the appropriate -x flag argument.
You can do it two ways:
Specify -n to skip .gdbinit processing and make -x point to one file
(including the extra commands) or another (with just the smaller set).
Or leave the .gdbinit in place (no -n) and use -x for the second.gdb file.
Mind that .gdbinit is executed before the -x specified one.
Hope that helps.
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
More information about the Gdb
mailing list