This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Patch: preference saving fix
- To: tromey at redhat dot com
- Subject: Re: Patch: preference saving fix
- From: Fernando Nasser <fnasser at redhat dot com>
- Date: Fri, 11 May 2001 21:33:39 -0400
- CC: Insight List <insight at sourceware dot cygnus dot com>
- Organization: Red Hat Canada
- References: <87ae4j7386.fsf@creche.redhat.com>
Tom Tromey wrote:
>
> 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?
>
It is OK with me.
Thanks.
> 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]]
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9