c++ - Print the whole linked list in gdb? -
i have linked list
struct node { data_t data; node_t *next; }; typedef struct { node_t *head; node_t *foot; node_t *curr; // iterator unsigned int size; } list_t; with structure, let defined list
list_t* mylist; how can use gdb print whole linked list?
this should work (but untested):
define plist set var $n = $arg0->head while $n printf "%d ", $n->data set var $n = $n->next end end (gdb) plist mylist you put plist ~/.gdbinit
Comments
Post a Comment