开发者

visualizing non linear data structures in gdb

开发者 https://www.devze.com 2023-01-19 08:04 出处:网络
is there an easy way to visualize non linear(non contiguous) data structures like linked list or binary trees of a program in gnu debugger(gdb)....

is there an easy way to visualize non linear(non contiguous) data structures like linked list or binary trees of a program in gnu debugger(gdb)....

to visualize an array of structures we can simply use....

p开发者_运维百科rint *array@len

if more indirection is needed we can also use

print **array@len

but above works for only linear data structures like arrays...

Please let me know if non linear(non contiguous) data structures likes linked list or binary trees can be visualized in a similar way... Thanks in advance...


You might give ddd a try. It'll even create fancy maps of your data structure.


GDB 7.x contains embedded Python interpreter (if so configured) and can be used to examine arbitrarily complicated data structures.

In particular, it can print contents of std::map and std::set, which are much more complicated "inside" than binary trees.

More info here and here.

0

精彩评论

暂无评论...
验证码 换一张
取 消