This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/16798] New: gdb.Value does not accept values which fit in unsigned long on python3


https://sourceware.org/bugzilla/show_bug.cgi?id=16798

            Bug ID: 16798
           Summary: gdb.Value does not accept values which fit in unsigned
                    long on python3
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: tgrabiec at gmail dot com

GDB's convert_value_from_python() with python2 was interpreting 'long' typed
value which doesn't fit into 'long long' as 'unsigned long long'. On python3 we
only have 'int' but the function was not adjusted to replicate 'long' behavior,
it throws overflow error if the value exceeds 'long' range.

On GDB with linked with python2 it was possible to create gdb.Value like this
(x86_64):

 value = gdb.Value(long(0xf000000000000000))

because python3 no longer has 'long' type, what was 'long' needs to be 'int'
now. However the following fails with overflow error:

 value = gdb.Value(0xf000000000000000)

Another manifestation of the same problem. This:

 if gdb_value == 0xffff000000000000:
    pass

will fail on python3 with:

 OverflowError: Python int too large to convert to C long

However it was possible to do this on python2:

 if gdb_value == long(0xffff000000000000):
   pass

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]