(create_command_window): Use gdb_prompt rather than "(gdb) ".
(gdbtk_tcl_preloop): Proc executed just prior to Tk main loop.
(tclsh): If an evaluation window already exists, just bring it
to the front instead of trying to create another.
* gdbtk.c (tk_command_loop): New function.
(gdbtk_init): Call tk_command_loop rather than Tk_MainLoop.
start-sanitize-gdbtk
+Thu May 16 19:20:29 1996 Fred Fish <fnf@fishfood.ninemoons.com>
+
+ * gdbtk.tcl (gdb_prompt): Set this early on.
+ (create_command_window): Use gdb_prompt rather than "(gdb) ".
+ (gdbtk_tcl_preloop): Proc executed just prior to Tk main loop.
+ (tclsh): If an evaluation window already exists, just bring it
+ to the front instead of trying to create another.
+ * gdbtk.c (tk_command_loop): New function.
+ (gdbtk_init): Call tk_command_loop rather than Tk_MainLoop.
+
Thu May 16 16:16:35 1996 Fred Fish <fnf@cygnus.com>
* gdbtk.tcl (evaluate_tcl_command, tclsh): New functions that
(*cmdblk->function.cfunc)(arg, from_tty);
}
+/* This function is called instead of gdb's internal command loop. This is the
+ last chance to do anything before entering the main Tk event loop. */
+
+static void
+tk_command_loop ()
+{
+ Tcl_Eval (interp, "gdbtk_tcl_preloop");
+ Tk_MainLoop ();
+}
+
static void
gdbtk_init ()
{
Tcl_CreateCommand (interp, "gdb_get_breakpoint_info", call_wrapper,
gdb_get_breakpoint_info, NULL);
- command_loop_hook = Tk_MainLoop;
+ command_loop_hook = tk_command_loop;
print_frame_info_listing_hook = null_routine;
query_hook = gdbtk_query;
flush_hook = gdbtk_flush;
set breakpoint_file(-1) {[garbage]}
set disassemble_with_source nosource
set expr_update_list(0) 0
+set gdb_prompt "(gdb) "
set debug_interface 0
proc create_command_window {} {
global command_line
global saw_tab
+ global gdb_prompt
set saw_tab 0
if {[winfo exists .cmd]} {raise .cmd ; return}
# %W insert end $result
set command_line {}
# update_ptr
- %W insert end "(gdb) "
+ %W insert end "$gdb_prompt"
%W see end
break
}
if {[regexp ".* " $command_line prefix]} {
regsub -all $prefix $choices {} choices
}
- %W insert end "\n[join $choices { }]\n(gdb) $command_line"
+ %W insert end "\n[join $choices { }]\n$gdb_prompt$command_line"
%W see end
}
break
proc tclsh {} {
global tcl_prompt
+ # If another evaluation window already exists, just bring it to the front.
+ if {[winfo exists .eval]} {raise .eval ; return}
+
# Create top level frame with scrollbar and text widget.
toplevel .eval
wm title .eval "Tcl Evaluation"
bindtags .eval.text {.eval.text Text all}
}
+# This proc is executed just prior to falling into the Tk main event loop.
+proc gdbtk_tcl_preloop {} {
+ global gdb_prompt
+ .cmd.text insert end "$gdb_prompt"
+ .cmd.text see end
+ update
+}
+
# FIXME need to handle mono here. In Tk4 that is more complicated.
set highlight "-background red2 -borderwidth 2 -relief sunken"