public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Find out if GUI active in .gdbinit
@ 2003-01-17 22:34 Achim Bursian
  2003-01-20 15:32 ` Fernando Nasser
  0 siblings, 1 reply; 2+ messages in thread
From: Achim Bursian @ 2003-01-17 22:34 UTC (permalink / raw)
  To: insight, gdb

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).

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)?

Thanks for help. (If possible, CC: to my mailaddress)
  Achim

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Find out if GUI active in .gdbinit
  2003-01-17 22:34 Find out if GUI active in .gdbinit Achim Bursian
@ 2003-01-20 15:32 ` Fernando Nasser
  0 siblings, 0 replies; 2+ messages in thread
From: Fernando Nasser @ 2003-01-20 15:32 UTC (permalink / raw)
  To: Achim Bursian; +Cc: insight, gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-20 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-17 22:34 Find out if GUI active in .gdbinit Achim Bursian
2003-01-20 15:32 ` Fernando Nasser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).