Our tree example here has greater complexity, and thus, more sophisticated methods are needed. We'll take a look at some here.
In earlier chapters you have used GDB's basic
insert(), so that would be a good place to start. While running GDB within the
while loop in that function, you could issue a set of three GDB commands each time you hit a breakpoint:
(gdb) p tmp->val $1 = 12 (gdb) p tmp->left $2 = (struct node *) 0x8049698 (gdb) p tmp->right $3 = (struct node *) 0x0
(Recall from Chapter 1 that the output from GDB is labeled
$2, and so on, with these quantities collectively called the value history ...