I have a program with a race condition. On Windows it hits an access violation eventually if I run it in a loop (like very 400 runs). I want to test it on a Unix system (e.g. GNU/Linux or MacOSX or Solaris or OpenBSD). On Windows I use: foo.cmd: @echo off setlocal set a=1 :loop echo %a% \bin\x86\cdb -g -G foo.exe set /a a=a + 1 goto :loop
this runs my program in a loop, in a debugger, until it hits an access violation. It prints how many times it has run before each run. -g means go right away at the start of the process -G means go past the end of the process By default the debugger stops on access violation (SIGSEGV). set /a is for "arithmetic" (expression evaluation) What is the equivalent with gdb/sh? (Or at least gdb). I've tried a bit with -x and -batch, no luck. Thanks, - Jay