binutils-gdb/gdb/python
Joel Brobecker df7752b044 Fix int() builtin with range type gdb.Value objects.
Consider the following variable:

    type Small is range -128 .. 127;
    SR : Small := 48;

Trying to get its value as an integer within Python code yields:

    (gdb) python sr = gdb.parse_and_eval('sr')
    (gdb) python print int(sr)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    gdb.error: Cannot convert value to int.
    Error while executing Python code.

This is happening because our variable is a range type, and
py-value's is_intlike does not handle TYPE_CODE_RANGE. This
patch fixes this.

gdb/ChangeLog:

        * python/py-value.c (is_intlike): Add TYPE_CODE_RANGE handling.

gdb/testsuite/ChangeLog:

        * gdb.ada/py_range: New testcase.
2013-11-19 06:44:40 +04:00
..
lib/gdb 2013-10-02 Phil Muldoon <pmuldoon@redhat.com> 2013-10-02 08:33:27 +00:00
py-arch.c 2013-10-03 Phil Muldoon <pmuldoon@redhat.com> 2013-10-03 14:43:32 +00:00
py-auto-load.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
py-block.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-bpevent.c
py-breakpoint.c 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> 2013-11-07 12:04:45 +00:00
py-cmd.c 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> 2013-11-07 12:32:31 +00:00
py-continueevent.c
py-event.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-event.h * python/py-arch.c (gdbpy_initialize_arch): Return 'int'. 2013-05-20 20:28:52 +00:00
py-events.h
py-evtregistry.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-evts.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-exitedevent.c
py-finishbreakpoint.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-frame.c 2013-10-02 Phil Muldoon <pmuldoon@redhat.com> 2013-10-02 08:37:11 +00:00
py-framefilter.c 2013-08-29 Phil Muldoon <pmuldoon@redhat.com> 2013-08-29 10:06:18 +00:00
py-function.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-gdb-readline.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
py-inferior.c * aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. 2013-09-30 11:50:12 +00:00
py-infthread.c * aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. 2013-09-30 11:50:12 +00:00
py-lazy-string.c * python/py-arch.c (gdbpy_initialize_arch): Return 'int'. 2013-05-20 20:28:52 +00:00
py-linetable.c off-by-one fix for py-linetable.c 2013-11-14 11:09:14 -07:00
py-newobjfileevent.c
py-objfile.c Code cleanup: Add objfile_name accessor 2013-09-24 13:57:38 +00:00
py-param.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-prettyprint.c * defs.h (enum val_prettyformat): Renamed from val_prettyprint. 2013-07-09 16:57:09 +00:00
py-progspace.c Code cleanup: Add objfile_name accessor 2013-09-24 13:57:38 +00:00
py-signalevent.c
py-stopevent.c
py-stopevent.h
py-symbol.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-symtab.c 2013-11-11 Phil Muldoon <pmuldoon@redhat.com> 2013-11-11 19:49:45 +00:00
py-threadevent.c * python/py-threadevent.c (get_event_thread): Use 2013-05-20 20:10:03 +00:00
py-type.c * python/py-type.c (typy_fields): Unconditionally decref 'r'. 2013-05-20 20:37:48 +00:00
py-utils.c * python/py-utils.c (gdb_pymodule_addobject): Cast away const. 2013-06-05 17:32:51 +00:00
py-value.c Fix int() builtin with range type gdb.Value objects. 2013-11-19 06:44:40 +04:00
python-config.py
python-internal.h 2013-11-11 Phil Muldoon <pmuldoon@redhat.com> 2013-11-11 19:49:45 +00:00
python.c 2013-11-11 Phil Muldoon <pmuldoon@redhat.com> 2013-11-11 19:49:45 +00:00
python.h