From: John Ogness Date: Fri, 14 Aug 2020 21:25:24 +0000 (+0206) Subject: scripts/gdb: add utils.read_ulong() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3e0d075cb0ab3b1fbddc14855985215407f8a48b;p=linux.git scripts/gdb: add utils.read_ulong() Add a function for reading unsigned long values, which vary in size depending on the architecture. Signed-off-by: John Ogness Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Tested-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20200814212525.6118-2-john.ogness@linutronix.de --- diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index ea94221dbd392..ff7c1799d588f 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -123,6 +123,13 @@ def read_u64(buffer, offset): return read_u32(buffer, offset + 4) + (read_u32(buffer, offset) << 32) +def read_ulong(buffer, offset): + if get_long_type().sizeof == 8: + return read_u64(buffer, offset) + else: + return read_u32(buffer, offset) + + target_arch = None