Re: [PATCH 1/5] gdb/python: handle saving user registers in a frame unwinder

Lancelot SIX via Gdb-patches
2021-06-07T17:07:37Z

Hi,

I just have a minor stylistic remark in the python code in the test:

> […]
> +
> + def __call__(self, pending_frame):
> + pc_desc = pending_frame.architecture().registers().find("pc")
> + pc = pending_frame.read_register(pc_desc)
> +
> + sp_desc = pending_frame.architecture().registers().find("sp")
> + sp = pending_frame.read_register(sp_desc)
> +
> + block = gdb.block_for_pc(int(pc))
> + if block == None:

When looking for None, it is usually prefered to use 'is None' instead
of '== None'. The result is the same unless there is a strange overload
of __eq__.

This pattern can also be seen in patch 3 and 4 of your series (patch 4
using both '==' and 'is' to check for None).

Lancelot.

> + return None
> + func = block.function
> + if func == None:
> + return None