[PATCH v2] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment (Re: [PATCH] [COMMITTED] Fix PR gdb/17820)
Patrick Palka
patrick@parcs.ath.cx
Fri May 15 21:43:00 GMT 2015
On Fri, May 15, 2015 at 2:33 PM, Pedro Alves <palves@redhat.com> wrote:
> On 05/15/2015 06:03 PM, Patrick Palka wrote:
>> On Fri, May 15, 2015 at 12:05 PM, Pedro Alves <palves@redhat.com> wrote:
>>> + if {$have_old_histsize} {
>>> + set env(HISTSIZE) $old_histsize
>>> + }
>>
>> Why not change this predicate to
>>
>> if [info exists old_histsize]
>>
>> to obviate the need for $have_old_histsize altogether?
>
> Yeah, "info exists" is ok since this is local scope; I was worrying
> that the code ends up copied elsewhere to global context, and
> then the "info exists" would be the wrong thing to use, considering
> e.g., [1] and [2]. Maybe I'm worrying too much. But how about instead
> simply saving/restoring the whole env array, like in the updated
> patch below, which sidesteps that issue?
What a neat language (TCL).
Both the original approach (with $have_old_histsize) and this one look
fine by me.
More information about the Gdb-patches
mailing list