public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: James Ingham <jingham@cygnus.com>
To: duane@franklin.com
Cc: insight@sourceware.cygnus.com
Subject: Re: Tk/Tcl problem in insight
Date: Mon, 13 Mar 2000 11:48:00 -0000	[thread overview]
Message-ID: <14541.18077.252103.105654@leda.cygnus.com> (raw)
In-Reply-To: <38CD41BD.F6FA2ED7@franklin.com>

Duane,

This is a longstanding "infelicitious design decision" that I have not 
yet fixed.  The code you type at the tk command is not being run
correctly - it is run inside a tcl proc rather than with "uplevel #0"
so when you make a variable you are making a LOCAL not a global
variable.  Similarly, if you try to do:

(gdb) tk set tcl_patchLevel

You would get a "variable not found" error.

There are two solutions to this:

1) Use :: on all the variables you want to be global, so in your case:

  tk set ::foobar "Hello World"
  tk set ::foobar

...

Actually, I have just been too busy to fix this, so I usually cheap
out and use TkCon to attach to the Tcl interpreter in Insight, and
send commands that way.  This is convenient, since TkCon understands
Tcl syntax, whereas the Console window does not (for instance the
Insight console can't continue lines of code in a way that Tcl
likes...)

2) Help fix it.  This is probably not that hard to just make sure all
the Tcl commands get evaluated in the global interpreter scope.  

What would be even better would be to put a switch in the console
window so that you can toggle it from being a gdb command line
interpreter (with the "tk" command as the out to the Tcl interpreter)
to being a tcl interpreter (with the "gdb_cmd" command to send
commands to the gdb interpreter.)  This would be REALLY useful, and if
you want to give it a whack, I will be glad to help out...

There are some other neat things that you could do as well.  Like it
would be really cool if the "source" menu item, or even the built-in
source command - would do the Unix trick of looking for a #!, and if
it saw "#!gdbtk" or some such would feed the rest of the code to the
Tcl interpreter.

Jim

 > I am trying to do something with insight & tcl/tk and cannot seem to
 > get anywhere.
 > 
 > Here's what I have done: 
 > 
 > a)  downloaded the insight-20000309 snapshot,
 > 
 > b)  unpacked, configured, unstalled etc, like this:
 >     [host: redhat linux 6.1, intel]
 > 
 > 	./configure -prefix=/home/duane/test
 > 
 > 	make
 > 
 > 	make install
 > 
 >   Builds fine.
 > 
 > d) cd to the 'bin' directory where it installed
 >    the 'gdb' executable so I can run it.
 > 
 >     cd /home/duane/test/bin
 > 
 >     ./gdb
 > 
 > e) Gdb starts up - no problem.
 > 
 >    Click on the "C:>" prompt
 > 
 > f) type the following:
 > 
 > 	tk set foobar "Hello, world"
 > 
 >    Responds with 'Hello, world'
 > 
 > g) type the following:
 > 
 > 	tk puts $foobar
 > 
 >    And it does not work, I get 
 > 
 > 	Error: can't read "foobar": no such variable
 > 
 > What am I doing wrong?
 > 
 > ... Now the [real] problem ....
 > 
 > I really have a tcl script that interacts with a custom simulator that
 > I wrote, and I cannot get it to work, I get the same basic errors and
 > problems.
 > 
 > I thought - ok - get the latest version in it's 'virgin' state - and
 > try a very simple little test with *JUST* two commands.
 > 
 > --Duane.
 > 

-- 
++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++
Jim Ingham                                              jingham@cygnus.com
Cygnus Solutions, a Red Hat Company                      

      reply	other threads:[~2000-03-13 11:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-13 11:37 Duane Ellis
2000-03-13 11:48 ` James Ingham [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14541.18077.252103.105654@leda.cygnus.com \
    --to=jingham@cygnus.com \
    --cc=duane@franklin.com \
    --cc=insight@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).