nuttxgdb: fix container_of pointer offset calc problem

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen 2024-09-23 22:34:03 +08:00 committed by Xiang Xiao
parent b296b1debe
commit bb461b532b

View file

@ -96,7 +96,9 @@ def offset_of(typeobj: gdb.Type, field: str) -> Union[int, None]:
def container_of(ptr: gdb.Value, typeobj: gdb.Type, member: str) -> gdb.Value:
"""Return pointer to containing data structure"""
return gdb.Value(ptr.address - offset_of(typeobj, member)).cast(typeobj.pointer())
return gdb.Value(int(ptr.address) - offset_of(typeobj, member)).cast(
typeobj.pointer()
)
class ContainerOf(gdb.Function):