diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 23:08:51 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 23:08:51 -0400 |
| commit | 1064d857738187c764c0bd76040f424397f857c7 (patch) | |
| tree | 13d16c0aed50b64c20b8fe235b15172f3c997f15 /scripts/gdb/linux/lists.py | |
| parent | 35c99ffa20edd3c24be352d28a63cd3a23121282 (diff) | |
| parent | def0fdae813dbbbbb588bfc5f52856be2e842b35 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton:
- a couple of hotfixes
- almost all of the rest of MM
- lib/ updates
- binfmt_elf updates
- autofs updates
- quite a lot of misc fixes and updates
- reiserfs, fatfs
- signals
- exec
- cpumask
- rapidio
- sysctl
- pids
- eventfd
- gcov
- panic
- pps
- gdb script updates
- ipc updates
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (126 commits)
mm: memcontrol: fix NUMA round-robin reclaim at intermediate level
mm: memcontrol: fix recursive statistics correctness & scalabilty
mm: memcontrol: move stat/event counting functions out-of-line
mm: memcontrol: make cgroup stats and events query API explicitly local
drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl
drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
mm, memcg: rename ambiguously named memory.stat counters and functions
arch: remove <asm/sizes.h> and <asm-generic/sizes.h>
treewide: replace #include <asm/sizes.h> with #include <linux/sizes.h>
fs/block_dev.c: Remove duplicate header
fs/cachefiles/namei.c: remove duplicate header
include/linux/sched/signal.h: replace `tsk' with `task'
fs/coda/psdev.c: remove duplicate header
ipc: do cyclic id allocation for the ipc object.
ipc: conserve sequence numbers in ipcmni_extend mode
ipc: allow boot time extension of IPCMNI from 32k to 16M
ipc/mqueue: optimize msg_get()
ipc/mqueue: remove redundant wq task assignment
ipc: prevent lockup on alloc_msg and free_msg
scripts/gdb: print cached rate in lx-clk-summary
...
Diffstat (limited to 'scripts/gdb/linux/lists.py')
| -rw-r--r-- | scripts/gdb/linux/lists.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py index 2f335fbd86fd..c487ddf09d38 100644 --- a/scripts/gdb/linux/lists.py +++ b/scripts/gdb/linux/lists.py | |||
| @@ -16,13 +16,15 @@ import gdb | |||
| 16 | from linux import utils | 16 | from linux import utils |
| 17 | 17 | ||
| 18 | list_head = utils.CachedType("struct list_head") | 18 | list_head = utils.CachedType("struct list_head") |
| 19 | hlist_head = utils.CachedType("struct hlist_head") | ||
| 20 | hlist_node = utils.CachedType("struct hlist_node") | ||
| 19 | 21 | ||
| 20 | 22 | ||
| 21 | def list_for_each(head): | 23 | def list_for_each(head): |
| 22 | if head.type == list_head.get_type().pointer(): | 24 | if head.type == list_head.get_type().pointer(): |
| 23 | head = head.dereference() | 25 | head = head.dereference() |
| 24 | elif head.type != list_head.get_type(): | 26 | elif head.type != list_head.get_type(): |
| 25 | raise gdb.GdbError("Must be struct list_head not {}" | 27 | raise TypeError("Must be struct list_head not {}" |
| 26 | .format(head.type)) | 28 | .format(head.type)) |
| 27 | 29 | ||
| 28 | node = head['next'].dereference() | 30 | node = head['next'].dereference() |
| @@ -33,9 +35,24 @@ def list_for_each(head): | |||
| 33 | 35 | ||
| 34 | def list_for_each_entry(head, gdbtype, member): | 36 | def list_for_each_entry(head, gdbtype, member): |
| 35 | for node in list_for_each(head): | 37 | for node in list_for_each(head): |
| 36 | if node.type != list_head.get_type().pointer(): | 38 | yield utils.container_of(node, gdbtype, member) |
| 37 | raise TypeError("Type {} found. Expected struct list_head *." | 39 | |
| 38 | .format(node.type)) | 40 | |
| 41 | def hlist_for_each(head): | ||
| 42 | if head.type == hlist_head.get_type().pointer(): | ||
| 43 | head = head.dereference() | ||
| 44 | elif head.type != hlist_head.get_type(): | ||
| 45 | raise TypeError("Must be struct hlist_head not {}" | ||
| 46 | .format(head.type)) | ||
| 47 | |||
| 48 | node = head['first'].dereference() | ||
| 49 | while node.address: | ||
| 50 | yield node.address | ||
| 51 | node = node['next'].dereference() | ||
| 52 | |||
| 53 | |||
| 54 | def hlist_for_each_entry(head, gdbtype, member): | ||
| 55 | for node in hlist_for_each(head): | ||
| 39 | yield utils.container_of(node, gdbtype, member) | 56 | yield utils.container_of(node, gdbtype, member) |
| 40 | 57 | ||
| 41 | 58 | ||
| @@ -110,4 +127,5 @@ class LxListChk(gdb.Command): | |||
| 110 | raise gdb.GdbError("lx-list-check takes one argument") | 127 | raise gdb.GdbError("lx-list-check takes one argument") |
| 111 | list_check(gdb.parse_and_eval(argv[0])) | 128 | list_check(gdb.parse_and_eval(argv[0])) |
| 112 | 129 | ||
| 130 | |||
| 113 | LxListChk() | 131 | LxListChk() |
