1 # connect gdb to Valgrind gdbserver:
2 target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcleak
3 echo vgdb launched process attached\n
4 monitor v.set vgdb-error 999999
10 # continue till each break and execute via gdb the leak search as done in the C code.
14 # fprintf(stderr, "expecting details 10 bytes reachable\n"); fflush(stderr); breakme();
16 monitor leak_check full reachable any
18 # VALGRIND_DO_LEAK_CHECK;
20 # fprintf(stderr, "expecting to have NO details\n"); fflush(stderr);
22 monitor leak_check full reachable increased
24 # VALGRIND_DO_ADDED_LEAK_CHECK;
28 # fprintf(stderr, "expecting details +10 bytes lost, +21 bytes reachable\n"); fflush(stderr); breakme();
30 monitor leak_check full reachable increased
32 # VALGRIND_DO_ADDED_LEAK_CHECK;
34 # for (i = 0; i < 2; i ++)
35 # b32_33[i] = malloc (32+i);
36 # fprintf(stderr, "expecting details +65 bytes reachable\n"); fflush(stderr); breakme();
38 monitor leak_check full reachable increased
40 # VALGRIND_DO_ADDED_LEAK_CHECK;
42 # fprintf(stderr, "expecting to have NO details\n"); fflush(stderr); breakme();
44 monitor leak_check full reachable increased
46 # VALGRIND_DO_ADDED_LEAK_CHECK;
49 # fprintf(stderr, "expecting details +10 bytes reachable\n"); fflush(stderr); breakme();
51 monitor leak_check full reachable increased
53 # VALGRIND_DO_ADDED_LEAK_CHECK;
56 # fprintf(stderr, "expecting details -10 bytes reachable, +10 bytes lost\n"); fflush(stderr); breakme();
58 monitor leak_check full reachable changed
60 # VALGRIND_DO_CHANGED_LEAK_CHECK;
63 # fprintf(stderr, "expecting details -10 bytes lost, +10 bytes reachable\n"); fflush(stderr); breakme();
65 monitor leak_check full reachable changed
67 # VALGRIND_DO_CHANGED_LEAK_CHECK;
70 # fprintf(stderr, "expecting details 32 (+32) bytes lost, 33 (-32) bytes reachable\n"); fflush(stderr); breakme();
72 monitor leak_check full reachable changed
73 # output all leak records:
74 monitor leak_check full reachable any unlimited
75 # output the 2 biggest leak records:
76 monitor leak_check full reachable any limited 2
77 #output the biggest leak record:
78 monitor leak_check full reachable any limited 1
79 # output the biggest definitely leaked record:
80 monitor leak_check full definiteleak any limited 1
82 # VALGRIND_DO_CHANGED_LEAK_CHECK;