Re: [PATCH v2 2/3] gdb/python doc: Add enable property to the unwinder example

Paulo Neves via Gdb-patches
2022-06-03T15:55:02Z

On 5/30/22 11:57, Andrew Burgess wrote:
> Paulo Neves via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> The enable property is now also in the example code making it clear how
>> it is used and how it influences the operation of an unwinder.
>> ---
>> gdb/doc/python.texi | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
>> index 5b7fba798a9..444e332d752 100644
>> --- a/gdb/doc/python.texi
>> +++ b/gdb/doc/python.texi
>> @@ -2796,6 +2796,11 @@ class FrameId(object):
>> class MyUnwinder(Unwinder):
>> def __init__(....):
>> super(MyUnwinder, self).__init___(<expects unwinder name argument>)
>> + # If set to True the unwinder will be enabled.
>> + # If upon registration the enable property is True, the unwinder
>> + # will be usable immediately.
>> + # gdb or code may change value.
>> + self.enabled = <True|False>
> Everything I said about patch #1 applies here too.
>
> I think your comment could be shortened to just:
>
> # If set to True the unwinder will be enabled and available for use.
>
> Given that text I think most users will assume that setting the field to
> `True` in the constructor will result in the unwinder being available
> upon registration.
I think that part can be indeed removed but I think the hint that gdb
may change values of your unwinder is important. I wrote these changes
though the eyes of the difficulties I had as an absolute GDB extension
newbie.

> Thanks,
> Andrew
>
>
>>
>> def __call__(pending_frame):
>> if not <we recognize frame>:
>> --
>> 2.25.1