This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[patch] Fix handling of Trace Buttons
- To: Insight List <insight at sources dot redhat dot com>
- Subject: [patch] Fix handling of Trace Buttons
- From: Fernando Nasser <fnasser at redhat dot com>
- Date: Thu, 28 Dec 2000 19:09:45 -0500
- Organization: Red Hat Canada
While rewriting the toolbar code I found a bug in the old code.
This patch fixes it.
The error here is a classic itcl inheritance one.
Variables are not "virtual", so overloading them won't work at all.
As a result, the variable "Browsing" was never set to anything
different than 0 in the base class.
I renamed it to ToolBrowsing and made the derived class set it properly.
I also got rid of a pair of unused variables.
The trace buttons are now working properly.
Index: srcbar.tcl
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/library/srcbar.tcl,v
retrieving revision 1.1.20.1
diff -c -p -r1.1.20.1 srcbar.tcl
*** srcbar.tcl 2000/12/13 20:50:13 1.1.20.1
--- srcbar.tcl 2000/12/28 22:45:22
*************** class GDBSrcBar {
*** 446,451 ****
--- 446,452 ----
debug "set_control_mode called with mode $mode"
if {$mode} {
set Browsing 1
+ set ToolBrowsing 1
$Buttons(view) configure -image run_expt_img -command "$this set_control_mode 0"
balloon register $Buttons(view) "Switch to Control mode"
# Now swap out the buttons...
*************** class GDBSrcBar {
*** 456,461 ****
--- 457,463 ----
tfind_cmd {tfind none}
}
set Browsing 0
+ set ToolBrowsing 0
$Buttons(view) configure -image watch_movie_img -command "$this set_control_mode 1"
balloon register $Buttons(view) "Switch to Browse mode"
# Now swap out the buttons...
Index: toolbar.tcl
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/library/toolbar.tcl,v
retrieving revision 1.1.88.1
diff -c -p -r1.1.88.1 toolbar.tcl
*** toolbar.tcl 2000/12/13 23:02:15 1.1.88.1
--- toolbar.tcl 2000/12/28 22:45:22
*************** class GDBToolBar {
*** 410,416 ****
# ------------------------------------------------------------------
public method enable_ui {on} {
global tcl_platform
! debug "Toolbar::enable_ui $on - Browsing=$Browsing"
# Do the enabling so that all the disabling happens first, this way if a
# button belongs to two groups, enabling takes precedence, which is probably right.
--- 410,416 ----
# ------------------------------------------------------------------
public method enable_ui {on} {
global tcl_platform
! debug "Toolbar::enable_ui $on - ToolBrowsing=$ToolBrowsing"
# Do the enabling so that all the disabling happens first, this way if a
# button belongs to two groups, enabling takes precedence, which is probably right.
*************** class GDBToolBar {
*** 424,430 ****
Detach disabled}
}
1 {
! if {!$Browsing} {
set enable_list {Trace disabled \
Control normal \
Other normal \
--- 424,430 ----
Detach disabled}
}
1 {
! if {!$ToolBrowsing} {
set enable_list {Trace disabled \
Control normal \
Other normal \
*************** class GDBToolBar {
*** 795,803 ****
# This is a handle on our parent source window.
protected variable source {}
! public variable Tracing 0 ;# Is tracing enabled for this gdb?
! public variable Browsing 0 ;# Are we currently browsing a trace experiment?
! public variable Collecting 0 ;# Are we currently collecting a trace experiment?
# The list of all control buttons (ones which should be disabled when
# not running anything or when inferior is running)
--- 795,801 ----
# This is a handle on our parent source window.
protected variable source {}
! public variable ToolBrowsing 0 ;# Are we currently browsing a trace experiment?
# The list of all control buttons (ones which should be disabled when
# not running anything or when inferior is running)