1 # connect gdb to Valgrind gdbserver: 2 target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcblocklistsearch 3 echo vgdb launched process attached\n 4 monitor v.set vgdb-error 999999 5 # 6 # 7 # insert break after the allocation of A 8 break leak-tree.c:42 9 # insert break after returning from function f 10 break leak-tree.c:67 11 # 12 # continue till //1break: 13 continue 14 # save the value of A 15 set $0xA = t 16 # 17 # continue till 2nd break 18 continue 19 # 20 # check who points at A 21 eval "monitor who_points_at 0x%lx 1", $0xA 22 # do a leak check, and then list the blocks lost 23 echo full leak search \n 24 monitor leak_check full reachable any 25 # 26 echo block list 6 D \n 27 monitor block_list 6 28 echo block list 7 C F G \n 29 monitor block_list 7 30 monitor v.kill 31 quit 32