This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch][python] 1/3 Python representation of GDB line tables (Python code)
- From: Tom Tromey <tromey at redhat dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 07 Nov 2013 10:06:50 -0700
- Subject: Re: [patch][python] 1/3 Python representation of GDB line tables (Python code)
- Authentication-results: sourceware.org; auth=none
- References: <5253F4D4 dot 1050600 at redhat dot com> <87ob6fd8c7 dot fsf at fleche dot redhat dot com> <527BC0F3 dot 1080800 at redhat dot com>
>> I think it's cheaper, and no more difficult, to just build a set object
>> from the start rather than make a list and the convert it. I'm not sure
>> what to about Python 2.4 though.
Phil> All API access to sets is new in 2.5 (sets appeared in the Python
Phil> default library in 2.3)
Phil> I elected here just to use a dictionary to ensure unique line numbers
Phil> only.
Thanks, Phil. Python 2.4 support is getting to be a pain.
Phil> + if (item->line > 0)
Phil> + {
Phil> + line = PyLong_FromUnsignedLongLong (item->line);
This should use gdb_py_object_from_longest.
Phil> +static PyObject *
Phil> +ltpy_entry_get_line (PyObject *self, void *closure)
Phil> +{
Phil> + linetable_entry_object *obj = (linetable_entry_object *) self;
Phil> +
Phil> + return PyLong_FromUnsignedLongLong (obj->line);
This one too.
Phil> +static PyObject *
Phil> +ltpy_entry_get_pcs (PyObject *self, void *closure)
Phil> +{
Phil> + linetable_entry_object *obj = (linetable_entry_object *) self;
Phil> +
Phil> + return PyLong_FromUnsignedLongLong (obj->pc);
I think this one should use gdb_py_long_from_ulongest.
The patch is ok with those changes.
Tom