This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

insight & tcl linked vars


Hi

I'm working on an extension to Insight and I'm kind of stuck and need
a pointer or two. (specifically the problem deals with linking global
vars in C [inside the armulator simulator] to tcl/tk variables under
gdb)

I"m using insight 5.2.1 (I got started there - and now see that 5.3 is
out :-< but I understand it is broke under cygwin and I'll need cygwin
later so I don't want to move to that yet)

I have a couple C integer variables - 

  int sim_register_timer_rate;
  int sim_register_timer_remain;

They are used to simulate a simple timer which generates a periodic
interrupt.

I link these to tcl variables of the same name via Tcl_LinkVar()

I have a tcl script - with a command "sim_create_muse"
that creates my simulated device - including a notebook
tab with the current value of the timer_rate

I start GDB - and in the console window execute the command:

(gdb) tk sim_create_muse

this creates my simulated device, internally it uses 
uplevel \#0 real_sim_create_muse so that it is created
at a "global scope" in TCL - not in the ::Console scope.

My script creates a number of widgits - one of which is
a simple label that is used to display the timer registers.

I also have created a 'trace' on the timer variables so that when they
are written to - I Can update the labels automajically

That seems to be the problem, it can't seem to do this consistantly.

If from within the bowels of the armulator - I determine
it is time to update the variables on the screen - I call
the "Tcl_UpdateLinkedVar()"

I also call Tcl_UpdateLinkedVar() at numerous points within
the 'wrapper.c' file which ties the armulator to gdb.

PROBLEM: This does not seem to work.

The problem I"m having is this:

I can only get the variables to update if I execute a command directly
from the console window - and proceed it with an uplevel #0 prefix

Example - I have a C function, force_all_vars_to_update, that
is exported as a TCL command executing:

   (gdb) tk force_all_vars_to_update

Does not work, but

   (gb) tk uplevel \#0 force_all_vars_to_update

works.

Also - if I set variables at the GDB command line - they work - and
the display is updated, but only if I use uplevel #0

 ie: tk uplevel \#0 set sim_register_timer_remain 123

>From what I can tell - I"m doing the same thing that is done in
gdbtk-stack.c [linking gdb_selected_stack_frame] and in gdbtk-cmds.c
(I"m not doing readonly - I"m doing read-write)

And it seems I call the update var function the same way that
gdbtk-hooks.c calls it.

Is gdb/tk/whatever wrapping my code in some type of funy scope rules?

Any suggestions?

Or explaination on what to look for - or how this might be done
better?

-Duane.

BTW 

  how do I update 'tclIndex' I don't see any means to do this I had to
  add all the functions from my tcl script by hand into tclIndex to
  make things work.



    
   


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]