public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix target output in console window
@ 2002-01-02 15:46 Keith Seitz
  0 siblings, 0 replies; only message in thread
From: Keith Seitz @ 2002-01-02 15:46 UTC (permalink / raw)
  To: Insight Maling List

Hi,

Turns out that ConsoleWin::einsert is just plain wrong. It inserts text at
the insertion cursor, so it looks like a command. (I.e., if you run a
program which prints "hello" to stdout, pressing return in the console
window will make gdb think you've entered the command "hello". Not quite
what we want.)

To prevent this from happening again, I've whacked ConsoleWin::einsert
entirely. As far as I can tell, it is not used anywhere else.

Please let me know if there are problems.
Keith

ChangeLog
2002-01-02  Keith Seitz  <kseitz@redhat.com>

	* library/console.ith (insert): Add tag parameter.
	(einsert): Delete.
	* library/console.itb: (insert): Add tag parameter.
	(einsert): Delete.
	* library/interface.tcl (gdbtk_tcl_fputs): Use Console::insert.
	(gdbtk_tcl_fputs_error): Likewise.
	(gdbtk_tcl_fputs_log): Likewise.
	(gdbtk_tcl_fputs_target): Likewise.
	(set_target): Likewise.

Patch
Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.35
diff -u -p -r1.35 interface.tcl
--- library/interface.tcl	2001/12/11 08:55:52	1.35
+++ library/interface.tcl	2002/01/02 23:40:34
@@ -418,7 +418,7 @@ proc echo {args} {
 # ------------------------------------------------------------------
 proc gdbtk_tcl_fputs_error {message} {
   if {$::gdbtk_state(console) != ""} {
-    $::gdbtk_state(console) einsert $message err_tag
+    $::gdbtk_state(console) insert $message err_tag
     update
   }
 }
@@ -428,7 +428,7 @@ proc gdbtk_tcl_fputs_error {message} {
 # ------------------------------------------------------------------
 proc gdbtk_tcl_fputs_log {message} {
   if {$::gdbtk_state(console) != ""} {
-    $::gdbtk_state(console) einsert $message log_tag
+    $::gdbtk_state(console) insert $message log_tag
     update
   }
 }
@@ -438,7 +438,7 @@ proc gdbtk_tcl_fputs_log {message} {
 # ------------------------------------------------------------------
 proc gdbtk_tcl_fputs_target {message} {
   if {$::gdbtk_state(console) != ""} {
-    $::gdbtk_state(console) einsert $message target_tag
+    $::gdbtk_state(console) insert $message target_tag
     update
   }
 }
@@ -1106,7 +1106,7 @@ necessary,\nmodify the port setting with

     if {![catch {pref get gdb/load/$gdb_target_name-after_attaching} aa] && $aa != ""} {
       if {[catch {gdb_cmd $aa} err]} {
-	catch {[ManagedWin::find Console] einsert $err err_tag}
+	catch {[ManagedWin::find Console] insert $err err_tag}
       }
     }
     set gdb_target_changed 0
@@ -1429,7 +1429,7 @@ proc gdbtk_nexti {} {
   catch {gdb_immediate nexti}
 }

-  # ------------------------------------------------------------------
+# ------------------------------------------------------------------
 #  PROC: gdbtk_attached
 # ------------------------------------------------------------------
 #
Index: library/console.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
retrieving revision 1.6
diff -u -p -r1.6 console.ith
--- library/console.ith	2001/09/28 16:36:50	1.6
+++ library/console.ith	2002/01/02 23:40:34
@@ -26,8 +26,7 @@ class Console {

     method constructor {args}
     method destructor {}
-    method insert {line}
-    method einsert {line tag}
+    method insert {line {tag ""}}
     method invoke {}
     method _insertion {args}
     method get_text {}
Index: library/console.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
retrieving revision 1.15
diff -u -p -r1.15 console.itb
--- library/console.itb	2001/12/05 17:08:06	1.15
+++ library/console.itb	2002/01/02 23:40:34
@@ -219,13 +219,13 @@ body Console::busy {event} {
 # ------------------------------------------------------------------
 #  METHOD:  insert - insert new text in the text widget
 # ------------------------------------------------------------------
-body Console::insert {line} {
+body Console::insert {line {tag ""}} {
   if {$_needNL} {
     $_twin insert {insert linestart} "\n"
   }
   # Remove all \r characters from line.
   set line [join [split $line \r] {}]
-  $_twin insert {insert -1 line lineend} $line
+  $_twin insert {insert -1 line lineend} $line $tag

   set nlines [lindex [split [$_twin index end] .] 0]
   if {$nlines > $throttle} {
@@ -236,19 +236,6 @@ body Console::insert {line} {
   $_twin see insert
   set _needNL 0
   ::update idletasks
-}
-
-#-------------------------------------------------------------------
-#  METHOD:  einsert - insert error text in the text widget
-# ------------------------------------------------------------------
-body Console::einsert {line tag} {
-  debug $line
-  if {$_needNL} {
-    $_twin insert end "\n"
-  }
-  $_twin insert end $line $tag
-  $_twin see insert
-  set _needNL 0
 }

 # ------------------------------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-02 23:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-02 15:46 [PATCH] Fix target output in console window Keith Seitz

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