This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: preference saving fix


Sorry about the last mail.  My finger slipped.

Today I looked at my ~/.gdbtkinit and was suprised to find, in the
`[gdb]' section, a number of lines of the form `session=random stuff'.

I tracked this down to an interaction between session.tcl and
prefs.tcl.  I chose to fix prefs.tcl.

session.tcl creates keys like `gdb/session//x2/egcs/whatever', where
`/x2/egcs/whatever' is the session key -- the name of the executable,
which often starts with `/'.

This confuses the logic in prefs.tcl.
Fixing it in prefs.tcl was easier.

Ok to commit?

2001-05-11  Tom Tromey  <tromey@redhat.com>

	* library/prefs.tcl (pref_save): Fix bug when key in gdb space has
	extra `/' in it.

Tom

Index: library/prefs.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v
retrieving revision 1.8
diff -u -r1.8 prefs.tcl
--- prefs.tcl	2001/04/05 00:04:28	1.8
+++ prefs.tcl	2001/05/12 01:24:30
@@ -167,7 +167,12 @@
     puts $fd "\[gdb\]"
     foreach var $plist {
       set t [split $var /]
-      if {[lindex $t 0] == "gdb" && [lindex $t 2] == ""} {
+      # We use the funny join/lreplace code because the session code
+      # can generate a key where [lindex $t 2] is empty but there is
+      # still stuff after that.  This happens because the session code
+      # uses filenames, which can start with `/'.
+      if {[lindex $t 0] == "gdb"
+	  && [string compare [join [lreplace $t 0 1] /] ""] == 0} {
 	set x [lindex $t 1]
 	if {$x != ""} {
 	  set v [escape_value [pref get $var]]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]