1 # connect gdb to Valgrind gdbserver: 2 target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcbreak 3 echo vgdb launched process attached\n 4 monitor v.set vgdb-error 999999 5 # 6 define checkstep 7 set $old_pc=$pc 8 step 9 if $old_pc == $pc 10 echo Bizarre the oldpc has not changed after step\n 11 print $oldpc 12 print $pc 13 else 14 echo old_pc has changed after step\n 15 end 16 end 17 # 18 # break1 and break2 19 break t.c:112 20 break t.c:117 21 # 22 continue 23 # first break encountered. 24 checkstep 25 checkstep 26 checkstep 27 # 28 monitor v.set vgdb-error 0 29 # 30 next 31 print whoami("first") 32 print undefined 33 print i 34 checkstep 35 checkstep 36 next 37 print whoami("second") 38 print undefined 39 print i 40 next 41 print whoami("third") 42 print undefined 43 print i 44 next 45 print whoami("fourth") 46 print undefined 47 print i 48 # modify sleeps so as to have a shorter test: 49 print sleeps=1 50 # 51 print whoami("after next: inferior call pushed from mcbreak.stdinB.gdb") 52 continue 53 # 54 # encountered second break 55 step 56 finish 57 # delete all breaks 58 delete 59 continue 60 monitor v.info n_errs_found 61 monitor v.info n_errs_found a 62 monitor v.info n_errs_found b 63 monitor v.info n_errs_found c d 64 monitor v.info n_errs_found eeeeeee fffffff ggggggg 65 # inferior call "in the middle" of an instruction is not working at least 66 # on all platforms, so comment the below. 67 # print whoami("after error: inferior call pushed from mcbreak.stdinB.gdb") 68 checkstep 69 monitor v.set vgdb-error 0 70 continue 71 # stop the process a.o. to avoid non deterministic output 72 monitor v.kill 73 quit 74