This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Patch: restoring multi-line breakpoint commands
- To: Insight List <insight at sourceware dot cygnus dot com>
- Subject: Patch: restoring multi-line breakpoint commands
- From: Tom Tromey <tromey at redhat dot com>
- Date: 02 Oct 2001 12:20:45 -0600
- Reply-To: tromey at redhat dot com
I looked into this problem a bit today:
http://sources.redhat.com/ml/insight/2001-q3/msg00180.html
At first I thought this was going to be really hard to fix. Then I
remembered that we already have this somewhat ugly gdb-readline hook
code in place to handle the same problem for the console window. By
changing this a little bit we can make this work. I think this is ok
since the code here already seems built for this purpose.
BTW I looked around and couldn't find command::end_multi_line_input
anywhere. Where is this defined?
Ok to commit?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* library/session.tcl (SESSION_recreate_bps): Use
gdb_run_readline_command_no_output to recreate breakpoints.
* library/interface.tcl (gdb_run_readline_command): Set
readlineShowUser element of gdbtk_state.
(gdb_run_readline_command_no_output): New proc.
(initialize_gdbtk): Initialize readlineShowUser element.
(gdbtk_tcl_readline_begin): Use readlineShowUser element.
(gdbtk_tcl_readline): Likewise.
Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.29
diff -u -r1.29 interface.tcl
--- library/interface.tcl 2001/08/13 18:30:36 1.29
+++ library/interface.tcl 2001/10/02 17:47:53
@@ -509,17 +509,30 @@
global gdbtk_state
# debug "$command $args"
set gdbtk_state(readlineArgs) $args
+ set gdbtk_state(readlineShowUser) 1
gdb_cmd $command
}
# ------------------------------------------------------------------
+# PROC: gdb_run_readline_command_no_output
+# Run a readline command, but don't show the commands to the user.
+# ------------------------------------------------------------------
+proc gdb_run_readline_command_no_output {command args} {
+ global gdbtk_state
+# debug "$command $args"
+ set gdbtk_state(readlineArgs) $args
+ set gdbtk_state(readlineShowUser) 0
+ gdb_cmd $command
+}
+
+# ------------------------------------------------------------------
# PROC: gdbtk_tcl_readline_begin -
# ------------------------------------------------------------------
proc gdbtk_tcl_readline_begin {message} {
global gdbtk_state
# debug "readline begin"
set gdbtk_state(readline) 0
- if {$gdbtk_state(console) != ""} {
+ if {$gdbtk_state(console) != "" && $gdbtk_state(readlineShowUser)} {
$gdbtk_state(console) insert $message
}
}
@@ -533,7 +546,9 @@
if {[info exists gdbtk_state(readlineArgs)]} {
# Not interactive, so pop the list, and print element.
set cmd [lvarpop gdbtk_state(readlineArgs)]
- command::insert_command $cmd
+ if {$gdbtk_state(readlineShowUser)} {
+ command::insert_command $cmd
+ }
} else {
# Interactive.
# debug "interactive"
@@ -1718,6 +1733,7 @@
# Only do this once...
set gdbtk_state(readline) 0
set gdbtk_state(console) ""
+ set gdbtk_state(readlineShowUser) 1
}
# check for existence of a kod command and get it's name and
Index: library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.7
diff -u -r1.7 session.tcl
--- library/session.tcl 2001/06/11 23:08:05 1.7
+++ library/session.tcl 2001/10/02 17:47:53
@@ -91,7 +91,8 @@
if {[llength $commands]} {
lappend commands end
- gdb_cmd "commands \$bpnum\n[join $commands \n]"
+ eval gdb_run_readline_command_no_output [list "commands \$bpnum"] \
+ $commands
}
}
}