This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/18170] New: Why does valpy_int disallow pointers?
- From: "dje at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 27 Mar 2015 16:52:37 +0000
- Subject: [Bug python/18170] New: Why does valpy_int disallow pointers?
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=18170
Bug ID: 18170
Summary: Why does valpy_int disallow pointers?
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: dje at google dot com
This came up on #gdb.
(gdb) py print int(gdb.parse_and_eval('$ebp'))
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.error: Cannot convert value to int.
Error while executing Python code.
(gdb) py print long(gdb.parse_and_eval('$ebp'))
4294957336
(gdb)
For python3, we use valpy_long for int conversions:
#ifdef IS_PY3K
valpy_long, /* nb_int */
NULL, /* reserved */
#else
NULL, /* nb_coerce */
valpy_int, /* nb_int */
valpy_long, /* nb_long */
#endif
There's no explanation in the code of why things are the way they are.
If there's a concern about loss of precision such things should be
explicitly caught instead of assuming int(gdb.parse_and_eval('some_pointer'))
won't fit. I'm guessing, however, this is just oversight.
Next step would be to start going through commit logs and emails.
--
You are receiving this mail because:
You are on the CC list for the bug.