Skip to content

Plist

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='Dumps the elements of a linked list.\n\nThis command traverses the linked list beginning at a given element, dumping its\ncontents and the contents of all the elements that come after it in the list.\nTraversal is configurable and can handle multiple types of linked lists, but will\nalways stop when a cycle is detected.\n\nThe path to the first element can be any GDB expression that evaluates to either\nthe first element directly, or a to pointer to it. The next element is the name\nof the field containing the next pointer, in either the structure itself or in\nthe structure given by --inner.\n\nAn address value may be given with --sentinel that signals the end of the list.\nBy default, the value used is NULL (0).\n\nIf only one field inside each node is desired, it can be printed exclusively by\nspecifying its name with --field.\n\nThis command supports traversing three types of linked lists, classified by how\nthe next pointer can be found in the structure and what type it is:\n 1 - Next pointer is field of structure, type is the same as structure.\n 2 - Next pointer is field of inner nested structure, pointed to type is the\n same as outer structure.\n 3 - Next pointer is field of inner nested structure, pointed to type is the\n same as inner structure.\nTypes 2 and 3 require --inner to be specified.\n\nExample 1:\n\n```\nstruct node {\n int value;\n struct node *next;\n};\nstruct node node_c = { 2, NULL };\nstruct node node_b = { 1, &node_c };\nstruct node node_a = { 0, &node_b };\n```\n\npwndbg> plist node_a next\n0x4000011050 <node_a>: {\n value = 0,\n next = 0x4000011040 <node_b>\n}\n0x4000011040 <node_b>: {\n value = 1,\n next = 0x4000011010 <node_c>\n}\n0x4000011010 <node_c>: {\n value = 2,\n next = 0x0\n}\n\nExample 2:\n\n```\nstruct node_inner_a {\n struct node_inner_a *next;\n};\nstruct inner_a_node {\n int value;\n struct node_inner_a inner;\n};\nstruct inner_a_node inner_a_node_c = { 2, { NULL } };\nstruct inner_a_node inner_a_node_b = { 1, { &inner_a_node_c.inner } };\nstruct inner_a_node inner_a_node_a = { 0, { &inner_a_node_b.inner } };\n```\n\npwndbg> plist inner_a_node_a -i inner next\n0x4000011070 <inner_a_node_a>: {\n value = 0,\n inner = {\n next = 0x4000011068 <inner_a_node_b+8>\n }\n}\n0x4000011060 <inner_a_node_b>: {\n value = 1,\n inner = {\n next = 0x4000011028 <inner_a_node_c+8>\n }\n}\n0x4000011020 <inner_a_node_c>: {\n value = 2,\n inner = {\n next = 0x0\n }\n}\n\nExample 3:\n\n```\nstruct inner_b_node;\nstruct node_inner_b {\n struct inner_b_node *next;\n};\nstruct inner_b_node {\n int value;\n struct node_inner_b inner;\n};\nstruct inner_b_node inner_b_node_c = { 2, { NULL } };\nstruct inner_b_node inner_b_node_b = { 1, { &inner_b_node_c } };\nstruct inner_b_node inner_b_node_a = { 0, { &inner_b_node_b } };\n```\n\npwndbg> plist inner_b_node_a -i inner next\n0x4000011090 <inner_b_node_a>: {\n value = 0,\n inner = {\n next = 0x4000011080 <inner_b_node_b>\n }\n}\n0x4000011080 <inner_b_node_b>: {\n value = 1,\n inner = {\n next = 0x4000011030 <inner_b_node_c>\n }\n}\n0x4000011030 <inner_b_node_c>: {\n value = 2,\n inner = {\n next = 0x0\n }\n}\n\n') module-attribute

bit_offset_of_field(struct, field_name, inner_name=None)

get_byte_offset(bit_offset)

plist(path, next, sentinel, inner_name, field_name)