public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/18170] New: Why does valpy_int disallow pointers?
@ 2015-03-27 23:00 dje at google dot com
  0 siblings, 0 replies; only message in thread
From: dje at google dot com @ 2015-03-27 23:00 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-27 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-27 23:00 [Bug python/18170] New: Why does valpy_int disallow pointers? dje at google dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).