summaryrefslogtreecommitdiff
path: root/scripts/gdb/linux
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2020-08-14 23:31:24 +0206
committerPetr Mladek <pmladek@suse.com>2020-09-08 09:33:15 +0200
commit3e0d075cb0ab3b1fbddc14855985215407f8a48b (patch)
tree1bfa4ed36072e5ec09ec879696aa34490623ce7e /scripts/gdb/linux
parentf8ff195ef1b9b84111f1872d70919fbfb38f2a5f (diff)
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 <john.ogness@linutronix.de> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20200814212525.6118-2-john.ogness@linutronix.de
Diffstat (limited to 'scripts/gdb/linux')
-rw-r--r--scripts/gdb/linux/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py
index ea94221dbd39..ff7c1799d588 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