>>>>> "q" == quillion  <me / privacy.net> writes:

q> The program will not accept keystrokes when attached to gdb

 Well, here an example (~/b.rb is the example that you have posted)

svg% gdb ruby
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) set li 32
(gdb) r ~/b.rb
Starting program: /home/ts/ruby/ruby-1.8.1/ruby ~/b.rb

Program received signal SIGSEGV, Segmentation fault.

 [[ it crash on the second keystroke ]]

0x42074bd0 in _int_free () from /lib/i686/libc.so.6
(gdb) bt
#0  0x42074bd0 in _int_free () from /lib/i686/libc.so.6
#1  0x42075a5c in free () from /lib/i686/libc.so.6
#2  0x4027f403 in TclpFree () from /usr/lib/libtcl.so.0
#3  0x40284153 in Tcl_Free () from /usr/lib/libtcl.so.0
#4  0x401dcfc2 in Tk_FreeGC () from /usr/lib/libtk.so.0
#5  0x4023f5f8 in FreeStyle () from /usr/lib/libtk.so.0
#6  0x4023fd7e in LayoutDLine () from /usr/lib/libtk.so.0
#7  0x4023ffc8 in UpdateDisplayInfo () from /usr/lib/libtk.so.0
#8  0x402433cc in TkTextPixelIndex () from /usr/lib/libtk.so.0
#9  0x402485e6 in TkTextPickCurrent () from /usr/lib/libtk.so.0
#10 0x4024114c in DisplayText () from /usr/lib/libtk.so.0
#11 0x402c4319 in TclServiceIdle () from /usr/lib/libtcl.so.0
#12 0x402b6672 in Tcl_DoOneEvent () from /usr/lib/libtcl.so.0
#13 0x400169f0 in lib_eventloop_core (check_root=1, check_var=0x0)
    at tcltklib.c:426
#14 0x40016cf1 in lib_eventloop_main (check_rootwidget=2) at tcltklib.c:520
#15 0x0805a60d in rb_ensure (b_proc=0x40016cc4 <lib_eventloop_main>, data1=2, 
    e_proc=0x40016d04 <lib_eventloop_ensure>, data2=0) at eval.c:4717
#16 0x40016e79 in lib_eventloop_launcher (check_rootwidget=2) at tcltklib.c:555
#17 0x40016edc in lib_mainloop (argc=1, argv=0xbfffec20, self=1075273536)
    at tcltklib.c:576
#18 0x080653f7 in call_cfunc (func=0x40016e9c <lib_mainloop>, recv=1075273536, 
    len=109051920, argc=1, argv=0x42138c80) at eval.c:4929
#19 0x0805af55 in rb_call0 (klass=1075273296, recv=1075273536, id=10353, 
    oid=2, argc=1, argv=0xbfffec20, body=0x40175e3c, nosuper=0) at eval.c:5066
#20 0x0805b73d in rb_call (klass=1075273296, recv=1075273536, mid=10353, 
    argc=1, argv=0xbfffec20, scope=0) at eval.c:5287
#21 0x08056e81 in rb_eval (self=1075264456, n=0x2) at eval.c:3078
#22 0x0805b23e in rb_call0 (klass=1075270816, recv=1075264456, id=10353, 
    oid=2, argc=0, argv=0x0, body=0x4007f670, nosuper=0) at eval.c:5194
#23 0x0805b73d in rb_call (klass=1075270816, recv=1075264456, mid=10353, 
    argc=0, argv=0x0, scope=0) at eval.c:5287
#24 0x08056e81 in rb_eval (self=1074436664, n=0x2) at eval.c:3078
#25 0x0805385c in ruby_exec () at eval.c:1436
#26 0x0805389d in ruby_run () at eval.c:1457
#27 0x08051d79 in main () at main.c:50
#28 0x420158f7 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) 

(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /home/ts/ruby/ruby-1.8.1/ruby ~/b.rb

Program received signal SIGSEGV, Segmentation fault.
0x3030772e in ?? ()
(gdb) bt
#0  0x3030772e in ?? ()
#1  0x4023ffc8 in UpdateDisplayInfo () from /usr/lib/libtk.so.0
#2  0x402433cc in TkTextPixelIndex () from /usr/lib/libtk.so.0
#3  0x402485e6 in TkTextPickCurrent () from /usr/lib/libtk.so.0
#4  0x4024114c in DisplayText () from /usr/lib/libtk.so.0
#5  0x402c4319 in TclServiceIdle () from /usr/lib/libtcl.so.0
#6  0x402b6672 in Tcl_DoOneEvent () from /usr/lib/libtcl.so.0
#7  0x400169f0 in lib_eventloop_core (check_root=1, check_var=0x0)
    at tcltklib.c:426
#8  0x40016cf1 in lib_eventloop_main (check_rootwidget=2) at tcltklib.c:520
#9  0x0805a60d in rb_ensure (b_proc=0x40016cc4 <lib_eventloop_main>, data1=2, 
    e_proc=0x40016d04 <lib_eventloop_ensure>, data2=0) at eval.c:4717
#10 0x40016e79 in lib_eventloop_launcher (check_rootwidget=2) at tcltklib.c:555
#11 0x40016edc in lib_mainloop (argc=1, argv=0xbfffec20, self=1075273536)
    at tcltklib.c:576
#12 0x080653f7 in call_cfunc (func=0x40016e9c <lib_mainloop>, recv=1075273536, 
    len=136699464, argc=1, argv=0x0) at eval.c:4929
#13 0x0805af55 in rb_call0 (klass=1075273296, recv=1075273536, id=10353, 
    oid=2, argc=1, argv=0xbfffec20, body=0x40175e3c, nosuper=0) at eval.c:5066
#14 0x0805b73d in rb_call (klass=1075273296, recv=1075273536, mid=10353, 
    argc=1, argv=0xbfffec20, scope=0) at eval.c:5287
#15 0x08056e81 in rb_eval (self=1075264456, n=0x2) at eval.c:3078
#16 0x0805b23e in rb_call0 (klass=1075270816, recv=1075264456, id=10353, 
    oid=2, argc=0, argv=0x0, body=0x4007f670, nosuper=0) at eval.c:5194
#17 0x0805b73d in rb_call (klass=1075270816, recv=1075264456, mid=10353, 
    argc=0, argv=0x0, scope=0) at eval.c:5287
#18 0x08056e81 in rb_eval (self=1074436664, n=0x2) at eval.c:3078
#19 0x0805385c in ruby_exec () at eval.c:1436
#20 0x0805389d in ruby_run () at eval.c:1457
#21 0x08051d79 in main () at main.c:50
#22 0x420158f7 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) 


 but I know nothing about Tcl/Tk



Guy Decoux