sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 1 | # connect gdb to Valgrind gdbserver: |
| 2 | target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcleak |
sewardj | eefeeb7 | 2011-05-10 11:01:07 +0000 | [diff] [blame] | 3 | echo vgdb launched process attached\n |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 4 | monitor v.set vgdb-error 999999 |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 5 | # |
| 6 | # |
| 7 | # insert break: |
| 8 | break breakme |
| 9 | # |
| 10 | # continue till each break and execute via gdb the leak search as done in the C code. |
| 11 | continue |
| 12 | # |
| 13 | # |
| 14 | # fprintf(stderr, "expecting details 10 bytes reachable\n"); fflush(stderr); breakme(); |
| 15 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 16 | monitor leak_check full reachable any |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 17 | continue |
| 18 | # VALGRIND_DO_LEAK_CHECK; |
| 19 | # |
| 20 | # fprintf(stderr, "expecting to have NO details\n"); fflush(stderr); |
| 21 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 22 | monitor leak_check full reachable increased |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 23 | continue |
| 24 | # VALGRIND_DO_ADDED_LEAK_CHECK; |
| 25 | # |
| 26 | # b10--; // lose b10 |
| 27 | # b21 = malloc (21); |
| 28 | # fprintf(stderr, "expecting details +10 bytes lost, +21 bytes reachable\n"); fflush(stderr); breakme(); |
| 29 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 30 | monitor leak_check full reachable increased |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 31 | continue |
| 32 | # VALGRIND_DO_ADDED_LEAK_CHECK; |
| 33 | # |
| 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(); |
| 37 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 38 | monitor leak_check full reachable increased |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 39 | continue |
| 40 | # VALGRIND_DO_ADDED_LEAK_CHECK; |
| 41 | # |
| 42 | # fprintf(stderr, "expecting to have NO details\n"); fflush(stderr); breakme(); |
| 43 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 44 | monitor leak_check full reachable increased |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 45 | continue |
| 46 | # VALGRIND_DO_ADDED_LEAK_CHECK; |
| 47 | # |
| 48 | # b10++; |
| 49 | # fprintf(stderr, "expecting details +10 bytes reachable\n"); fflush(stderr); breakme(); |
| 50 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 51 | monitor leak_check full reachable increased |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 52 | continue |
| 53 | # VALGRIND_DO_ADDED_LEAK_CHECK; |
| 54 | # |
| 55 | # b10--; |
| 56 | # fprintf(stderr, "expecting details -10 bytes reachable, +10 bytes lost\n"); fflush(stderr); breakme(); |
| 57 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 58 | monitor leak_check full reachable changed |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 59 | continue |
| 60 | # VALGRIND_DO_CHANGED_LEAK_CHECK; |
| 61 | # |
| 62 | # b10++; |
| 63 | # fprintf(stderr, "expecting details -10 bytes lost, +10 bytes reachable\n"); fflush(stderr); breakme(); |
| 64 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 65 | monitor leak_check full reachable changed |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 66 | continue |
| 67 | # VALGRIND_DO_CHANGED_LEAK_CHECK; |
| 68 | # |
| 69 | # b32_33[0]--; |
| 70 | # fprintf(stderr, "expecting details 32 (+32) bytes lost, 33 (-32) bytes reachable\n"); fflush(stderr); breakme(); |
| 71 | up |
sewardj | 30b3eca | 2011-06-28 08:20:39 +0000 | [diff] [blame] | 72 | monitor leak_check full reachable changed |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 73 | continue |
| 74 | # VALGRIND_DO_CHANGED_LEAK_CHECK; |
| 75 | # |
| 76 | quit |