walk [-l] struct field|offset addr [-f] [-n] [-h n|p] struct field|offset addr -s [-h n|p] struct field|offset addr -h n|p -t address offset size [-i iteration_threshold] [-w outfile]
Walk a linked list of kernel structures or memory blocks. OPTIONS: -l Show a list of special structures, which can be displayed in a predefined formatted manner. Currently there is support for a handful special structures. struct field|offset addr [-f] [-n] [-h n|p] Display each entry of a linked list of special structures in a predefined formatted way. By default, the output consists of one line for each structure. Using '-f' and/or '-n' a more detailed output is given. '-f' can be used for all special structures. '-n' works for special structures "mm_struct" and "task_struct". struct field|offset addr -s [-h n|p] Each structure of a linked list is displayed in its entirety - in a C-like format. All structures for which type information is available can be displayed in this manner. -h n|p A linked list is constructed by following "list_head" structures instead of next pointers. The argument specifies wether to follow the next pointers of struct list_head (using 'n') or to follow the prev pointers of struct list_head (by using 'p'). 'field' or 'offset' is regarded as a member of type "list_head" instead of a next pointer within the 'struct'. 'addr' is interpreted as a pointer to an anchor of a linked list of "struct list_head" structures. struct field|offset addr -h n|p -t Display each entry of a linked "list_head"-list in one line. For each entry the address to the 'struct' structure, the address to the "list_head" member within 'struct', and previous and next pointer of the embedded "list_head" are given. address offset size Do a hex memory dump of each structure in a list. A start address ('address') of a structure, a byte offset ('offset') for the next pointer in the structure, and a structure size ('size') are required. 'size' bytes will be dumped for each entry in the constructed list. -i iteration_threshold By default, certain loops are interrupted after 10'000 iterations to avoid endless loops while following invalid pointers. Using this option you can change the threshold for the current command. A value '0' means infinite iteration threshold, i.e. no interruption of the loop is caused by reaching any threshold. While using "struct field|offset addr" without '-h', a structure name ('struct'), a field name ('field') or byte offset ('offset') for the next pointer within the structure, and a pointer ('addr') to the first entry of the linked list must be given. Note: Using '-h' the anchor is not displayed as a structure 'struct'.
Example 4-22. walk
>> module ADDR SIZE USED NAME REFS =========================================================================== d0103000 17928 1 ibmtr_cs [] d00fe000 6608 2 ds [ibmtr_cs] d00f3000 23408 2 i82365 [] d00e6000 46848 0 pcmcia_core [ibmtr_cs ds i82365] c02ad0e0 0 1 kernel_module [] =========================================================================== >> print ((module*) d00e6000)->refs 0xd0106b80 >> walk -s module_ref next_ref 0xd0106b80 struct module_ref { dep = 0xd00e6000 ref = 0xd0103000 next_ref = 0xd00ff9bc } struct module_ref { dep = 0xd00e6000 ref = 0xd00fe000 next_ref = 0xd00f8b38 } struct module_ref { dep = 0xd00e6000 ref = 0xd00f3000 next_ref = (nil) }
Example 4-23. walk
>> findsym inode_unused ADDR OFFSET TYPE NAME ============================================================ 0xc0243e48 0 LOCAL_DATA inode_unused ============================================================ 1 symbol found >> walk list_head next 0xc0243e48 -h n -t STRUCT ADDR PREV LISTHEAD NEXT ============================================ 0 0xc2faca48 0xc0243e48 0xc4d8d340 0xc4d8d340 0xc0243e48 0xc4d8d340 0xc416ef68 0xc416ef68 0xc4d8d340 0xc416ef68 0xc7ab55d0 0xc7ab55d0 0xc416ef68 0xc7ab55d0 0xc3244298 0xc3244298 0xc7ab55d0 0xc3244298 0xc328c3e0 0xc328c3e0 0xc3244298 0xc328c3e0 0xc3baf0b0 ... 0xc32767b8 0xc3276cd8 0xc32767b8 0xc7ab50b0 0xc7ab50b0 0xc32767b8 0xc7ab50b0 0xc79e7af0 0xc79e7af0 0xc7ab50b0 0xc79e7af0 0xc3289af0 0xc3289af0 0xc79e7af0 0xc3289af0 0xc32623e0 0xc32623e0 0xc3289af0 0xc32623e0 0xc31f2150 0xc31f2150 0xc32623e0 0xc31f2150 0xc314b0b0 0xc314b0b0 0xc31f2150 0xc314b0b0 0xc2ff3c38 0xc2ff3c38 0xc314b0b0 0xc2ff3c38 0xc2fd2528 0xc2fd2528 0xc2ff3c38 0xc2fd2528 0xc2faca48 0xc2faca48 0xc2fd2528 0xc2faca48 0xc0243e48 ============================================ >> walk inode i_list 0xc0243e48 -h n -t STRUCT ADDR PREV LISTHEAD NEXT ============================================ 0 0xc2faca48 0xc0243e48 0xc4d8d340 0xc4d8d338 0xc0243e48 0xc4d8d340 0xc416ef68 0xc416ef60 0xc4d8d340 0xc416ef68 0xc7ab55d0 0xc7ab55c8 0xc416ef68 0xc7ab55d0 0xc3244298 0xc3244290 0xc7ab55d0 0xc3244298 0xc328c3e0 0xc328c3d8 0xc3244298 0xc328c3e0 0xc3baf0b0 ... 0xc32767b0 0xc3276cd8 0xc32767b8 0xc7ab50b0 0xc7ab50a8 0xc32767b8 0xc7ab50b0 0xc79e7af0 0xc79e7ae8 0xc7ab50b0 0xc79e7af0 0xc3289af0 0xc3289ae8 0xc79e7af0 0xc3289af0 0xc32623e0 0xc32623d8 0xc3289af0 0xc32623e0 0xc31f2150 0xc31f2148 0xc32623e0 0xc31f2150 0xc314b0b0 0xc314b0a8 0xc31f2150 0xc314b0b0 0xc2ff3c38 0xc2ff3c30 0xc314b0b0 0xc2ff3c38 0xc2fd2528 0xc2fd2520 0xc2ff3c38 0xc2fd2528 0xc2faca48 0xc2faca40 0xc2fd2528 0xc2faca48 0xc0243e48 ============================================ >> findsym inode_in_use ADDR OFFSET TYPE NAME ============================================================ 0xc0243e40 0 GLOBAL_DATA inode_in_use ============================================================ 1 symbol found >> walk inode i_list 0xc0243e40 -h n -t -i 5 STRUCT ADDR PREV LISTHEAD NEXT ============================================ 0 0xcff38008 0xc0243e40 0xc5501c38 WARNING: Previous pointer broken. PREV: 0xc579c3e0, SHOULD BE: 0xc0243e40 0xc5501c30 0xc579c3e0 0xc5501c38 0xc6314f68 0xc6314f60 0xc5501c38 0xc6314f68 0xc2c44e20 0xc2c44e18 0xc6314f68 0xc2c44e20 0xc8671340 0xc8671338 0xc2c44e20 0xc8671340 0xc54da528 0xc54da520 0xc8671340 0xc54da528 0xcbde6528 WARNING: Iteration threshold reached. Current threshold: 5. Use "-i" to change threshold.
Example 4-24. walk
>> module ADDR SIZE USED NAME REFS =========================================================================== 0xd00f6000 17928 1 ibmtr_cs [] 0xd00f1000 6608 2 ds [ibmtr_cs] 0xd00e6000 23408 2 i82365 [] ... 0xd002b000 27168 0 snd-ac97-codec [snd-cs461x] 0xd0023000 28624 0 snd-mixer [snd-ac97-codec] 0xd0017000 43632 1 snd [snd-seq-midi snd-seq-midi-event snd-seq snd-card-cs461x snd-cs461x snd-pcm snd-timer snd-rawmidi snd-seq-device snd-ac97-codec snd-mixer] 0xd0015000 2576 2 soundcore [snd] 0xc0241980 0 1 kernel_module [] =========================================================================== >> sizeof module Size of "module": 72 bytes >> offset module.next Offset: 4 bytes. >> walk 0xd002b000 4 72 Dumping 72 byte block at 0xd002b000: 0xd002b000: 00000060 d0023000 d00314c9 00006a20 : `....0...... j.. 0xd002b010: 00000000 00000011 0000000a 00000002 : ................ 0xd002b020: d00315a0 d0031a08 d0058134 d0030350 : ........4...P... 0xd002b030: d003035c 00000000 00000000 00000000 : \............... 0xd002b040: 00000000 00000000 : ........ Dumping 72 byte block at 0xd0023000: 0xd0023000: 00000060 d0017000 d0029cc1 00006fd0 : `....p.......o.. 0xd0023010: 00000000 00000019 00000035 00000001 : ........5....... 0xd0023020: d0029d78 d0029fc4 d0031a08 d00266b4 : x............f.. 0xd0023030: d00266c0 d00296e0 d00297e8 00000000 : .f.............. 0xd0023040: 00000000 00000000 : ........ Dumping 72 byte block at 0xd0017000: 0xd0017000: 00000060 d0015000 d00200c1 0000aa70 : `....P......p... 0xd0017010: 00000001 00000019 0000005f 00000001 : ........_....... 0xd0017020: d0020170 d0021a60 d0080fd0 d0017ba4 : p...`........{.. 0xd0017030: d0017bb0 d001f8a4 d001f8fc 00000000 : .{.............. 0xd0017040: 00000000 00000000 : ........ Dumping 72 byte block at 0xd0015000: 0xd0015000: 00000060 c0241980 d0015825 00000a10 : `.....$.%X...... 0xd0015010: 00000002 00000019 00000010 00000000 : ................ 0xd0015020: d00158f8 00000000 d0021a60 d001545c : .X......`...\T.. 0xd0015030: d0015440 00000000 00000000 00000000 : @T.............. 0xd0015040: 00000000 00000000 : ........ Dumping 72 byte block at 0xc0241980: 0xc0241980: 00000048 00000000 c0205380 00000000 : H........S ..... 0xc0241990: 00000001 00000001 00000339 00000000 : ........9....... 0xc02419a0: c0233958 00000000 00000000 00000000 : X9#............. 0xc02419b0: 00000000 c0232aa0 c0233958 00000000 : .....*#.X9#..... 0xc02419c0: 00000000 00000000 : ........ 5 blocks in linked list