aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/utils.py
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2022-09-21 09:58:02 +0200
committerIngo Molnar <mingo@kernel.org>2022-09-21 09:58:02 +0200
commit74656d03ac36fabb16b9df5221cf398ee3a9ca08 (patch)
tree0600e619ac817e2c016c148810814f55280316cc /scripts/gdb/linux/utils.py
parent0d97db026509c1a13f732b22670ab1f0ac9d8d87 (diff)
parent521a547ced6477c54b4b0cc206000406c221b4d6 (diff)
downloadlinux-74656d03ac36fabb16b9df5221cf398ee3a9ca08.tar.gz
linux-74656d03ac36fabb16b9df5221cf398ee3a9ca08.tar.bz2
linux-74656d03ac36fabb16b9df5221cf398ee3a9ca08.zip
Merge tag 'v6.0-rc6' into locking/core, to refresh the branch
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'scripts/gdb/linux/utils.py')
-rw-r--r--scripts/gdb/linux/utils.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py
index ff7c1799d588..1553f68716cc 100644
--- a/scripts/gdb/linux/utils.py
+++ b/scripts/gdb/linux/utils.py
@@ -35,13 +35,12 @@ class CachedType:
long_type = CachedType("long")
-
+atomic_long_type = CachedType("atomic_long_t")
def get_long_type():
global long_type
return long_type.get_type()
-
def offset_of(typeobj, field):
element = gdb.Value(0).cast(typeobj)
return int(str(element[field].address).split()[0], 16)
@@ -129,6 +128,17 @@ def read_ulong(buffer, offset):
else:
return read_u32(buffer, offset)
+atomic_long_counter_offset = atomic_long_type.get_type()['counter'].bitpos
+atomic_long_counter_sizeof = atomic_long_type.get_type()['counter'].type.sizeof
+
+def read_atomic_long(buffer, offset):
+ global atomic_long_counter_offset
+ global atomic_long_counter_sizeof
+
+ if atomic_long_counter_sizeof == 8:
+ return read_u64(buffer, offset + atomic_long_counter_offset)
+ else:
+ return read_u32(buffer, offset + atomic_long_counter_offset)
target_arch = None