diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-08-05 09:54:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-08-05 09:54:36 -0700 |
commit | a1b02751d6ec21ec1b9c7c6826fc896ffde1c33d (patch) | |
tree | a6ab72b41020718bfda43c813fa4101a876b02fc /scripts/gdb/linux/utils.py | |
parent | 965a9d75e3d250088a269e0c903e86fe775b48c6 (diff) | |
parent | 96dd9a2f958be4781d8d01ed881a46864bf458aa (diff) |
Merge tag 'printk-for-5.20-sane' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek:
- Allow reading kernel log in gdb even on 32 bits systems
- More granular check of the buffer usage in printf selftest
- Clang warning fix
* tag 'printk-for-5.20-sane' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
lib/test_printf.c: fix clang -Wformat warnings
scripts/gdb: fix 'lx-dmesg' on 32 bits arch
lib/test_printf.c: split write-beyond-buffer check in two
Diffstat (limited to 'scripts/gdb/linux/utils.py')
-rw-r--r-- | scripts/gdb/linux/utils.py | 14 |
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 |