[PATCH] Implement floordiv operator for gdb.Value

Jonathan Wakely jwakely@redhat.com
Tue Sep 20 18:20:00 GMT 2016


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.




More information about the Gdb-patches mailing list