This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix GDBHISTSIZE test failure on i686
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 23 Jun 2015 15:35:59 -0400
- Subject: Re: [PATCH] Fix GDBHISTSIZE test failure on i686
- Authentication-results: sourceware.org; auth=none
- References: <1435069850-11830-1-git-send-email-patrick at parcs dot ath dot cx> <5589952A dot 8010003 at redhat dot com>
On Tue, Jun 23, 2015 at 1:19 PM, Pedro Alves <palves@redhat.com> wrote:
> On 06/23/2015 03:30 PM, Patrick Palka wrote:
>> The test
>>
>> test_histsize_history_setting "99999999999999999999999999999999999" "unlimited"
>>
>> was failing on i686 because the condition in init_history() for
>> determining whether to map a large GDBHISTSIZE value to infinity was
>>
>> long var = strtol (tmpenv);
>> if (var > INT_MAX)
>> history_size = unlimited;
>>
>> but this condition is never true on i686 because INT_MAX == LONG_MAX.
>> So in order to properly map large out-of-range values of GDBHISTSIZE to
>> infinity on targets where LONG_MAX > INT_MAX as well as on i686, we have
>> to instead change the above condition to
>>
>> if (var > INT_MAX
>> || (var == INT_MAX && errno == ERANGE))
>> history_size = unlimited;
>>
>> [ I did not test this patch on i686 because I don't have access to
>> such a machine. But the patch seems straightforward enough... ]
>
> Looks fine to me, with the missing errno=0, but note that assuming you
> install the 32-bit dependencies in your distro, you can easily build
> a 32-bit gdb on a 64-bit host. E.g., on x86-64 GNU/Linux, configure with:
>
> CC="gcc -m32" /path/to/configure \
> --host=i686-pc-linux-gnu \
> --build=i686-pc-linux-gnu \
> --target=i686-pc-linux-gnu
Cool. I will commit the patch after confirming that it's fixed on
i686 this way.
>
> Thanks,
> Pedro Alves
>