summaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/utils.py
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2022-09-06 09:45:27 +0300
committerTony Lindgren <tony@atomide.com>2022-09-06 09:45:27 +0300
commit2a906db2824b75444982f5e9df870106982afca8 (patch)
tree8cda7a970356f63f2a9d3246ca69ef16220041d3 /scripts/gdb/linux/utils.py
parent2eb502f496f7764027b7958d4e74356fed918059 (diff)
parent6a6d9ecff14a2a46c1deeffa3eb3825349639bdd (diff)
downloadlinux-2a906db2824b75444982f5e9df870106982afca8.tar.xz
Merge branch 'am5748-fix' into fixes
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