mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-28 22:21:26 +08:00
Preserve sign when converting gdb.Value to Python int
PR python/20126 points out that sometimes the conversion of a gdb.Value can result in a negative Python integer. This happens because valpy_int does not examine the signedness of the value's type. gdb/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/20126: * python/py-value.c (valpy_int): Respect type sign. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/20126: * gdb.python/py-value.exp (test_value_numeric_ops): Add signed-ness conversion tests.
This commit is contained in:
@ -1514,7 +1514,10 @@ valpy_int (PyObject *self)
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
return gdb_py_object_from_longest (l);
|
||||
if (TYPE_UNSIGNED (type))
|
||||
return gdb_py_object_from_ulongest (l);
|
||||
else
|
||||
return gdb_py_object_from_longest (l);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user