This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Implement floordiv operator for gdb.Value
> On Sep 20, 2016, at 1:11 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On 20/09/16 17:00 +0000, Paul.Koning@dell.com wrote:
>>
>>> On Sep 20, 2016, at 12:35 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>
>>>> ...
>>>
>>> This seems to be an existing property of gdb.Value, as even using the
>>> normal division operator (and without my patch) I see floats printed
>>> without a decimal part when they are an integer value:
>>>
>>> (gdb) python print (gdb.Value(5.0)/5.0)
>>> 1
>>> (gdb) python print (5.0/5.0)
>>> 1.0
>>
>> In all this, please keep in mind that this is one place where Python 2 and Python 3 differ:
>
> Right, see https://sourceware.org/ml/gdb-patches/2016-09/msg00221.html
> for a crazy idea that would make gdb.Value match the Python version
> it's built against.
>
> That wouldn't help for Python 2 using __future__ division though.
Yes. You'd expect that this would be easy to find, but that isn't the case. It may be accessible from C code, if you can find the parser flags from where you are. Look for CO_FUTURE in the source tree.
paul