This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[PATCH] Fix target output in console window
- From: Keith Seitz <keiths at redhat dot com>
- To: Insight Maling List <insight at sources dot redhat dot com>
- Date: Wed, 2 Jan 2002 15:45:59 -0800 (PST)
- Subject: [PATCH] Fix target output in console window
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
}
# ------------------------------------------------------------------