This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [Patch] PR python/15464 and python/16113
- From: Tom Tromey <tromey at redhat dot com>
- To: Siva Chandra <sivachandra at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 06 Jan 2014 13:50:51 -0700
- Subject: Re: [Patch] PR python/15464 and python/16113
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gyT_vfZaFPSbBMVn5oZ+awqzEiMXGD5-ffowDdWMPv3uA at mail dot gmail dot com> <CAGyQ6gwgsCuOu_bSVVWumcVKPs3fyB41KS-QDgCafQggpWBHgg at mail dot gmail dot com>
>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:
Siva> Attached is a newer version of the patch which an 'xfree' moved to a
Siva> more appropriate place.
Thanks.
Siva> + if (name_obj != Py_None)
Siva> + {
Siva> + field = python_string_to_host_string (name_obj);
Siva> + Py_DECREF (name_obj);
Siva> + name_obj = NULL;
Siva> + if (field == NULL)
Siva> + return NULL;
Siva> + }
Siva> +
Siva> + if (name_obj == Py_None || field[0] == '\0')
Siva> + {
Siva> + PyObject *bitpos_obj;
Siva> + int valid;
Siva> +
Siva> + Py_XDECREF (name_obj);
I think that if name_obj is the Python string "", then it will be
decref'd twice.
Siva> + res_val = value_struct_elt_bitpos (&tmp, bitpos, "struct/class/union");
I think this approach will fail in the situation where multiple
anonymous sub-objects appear at the same bitpos. I think this happens
with inheritance, typically at bitpos 0 but perhaps elsewhere with
multiple inheritance.
It may be sufficient to also pass in an expected type, which could be
extracted from the Field object.
Tom