RE: [PATCH v10 05/10] python: Introduce gdb.RecordAuxiliary class.

Metzger, Markus T via Gdb-patches
2023-08-08T09:37:34Z

Hello Felix,

>> >@@ -455,10 +511,10 @@ btpy_list_item (PyObject *self, Py_ssize_t index)
>> >
>> > number = obj->first + (obj->step * index);
>> >
>> >- if (obj->element_type == &recpy_insn_type)
>> >- return recpy_insn_new (obj->thread, RECORD_METHOD_BTRACE, number);
>> >- else
>> >+ if (obj->element_type == &recpy_func_type)
>> > return recpy_func_new (obj->thread, RECORD_METHOD_BTRACE, number);
>> >+ else
>> >+ return btpy_item_new (obj->thread, number);
>> > }
>>
>> Why do we need to change the order?
>
>Because we no longer call recpy_insn_new only for recpy_insn_type but also for
>recpy_aux_type.

I think it would be clearer if we checked each type separately and errored
out by default. Like a switch.

Regards,
Markus.