[PATCH v9 06/10] python: Add clear() to gdb.Record.
Tom Tromey
tom@tromey.com
Thu Jul 6 16:11:39 GMT 2023
>>>>> Felix Willgerodt via Gdb-patches <gdb-patches@sourceware.org> writes:
> This function allows to clear the trace data from python, forcing to
> re-decode the trace for successive commands.
> This will be used in future ptwrite patches, to trigger re-decoding when
> the ptwrite filter changes.
> +PyObject *
> +recpy_bt_clear (PyObject *self, PyObject *args)
> +{
> + const recpy_record_object * const record = (recpy_record_object *) self;
> + thread_info *const tinfo = record->thread;
Normally in the Python layer, some care must be taken to ensure that
something sensible happens when a Python object outlives some underlying
gdb object. That is why some types have an 'is_valid' method and why
there are the various *_REQUIRE_VALID macros.
It isn't a problem with this patch per se but it seems to me that this
code does not handle this situation properly.
Tom
More information about the Gdb-patches
mailing list