Hi,
When VisualGDB sets a breakpoint while your program is running, it tells GDB to stop the program, sets the breakpoint and resumes it (GDB cannot set breakpoints asynchronously).
GDB stops the program by sending a SIGINT to it and handling it. As a side effect, any pending semaphore waits are ended with the EINTR code. As a workaround you can simply make a wrapper for sem_wait() that will check whether the return code is -1 and errno is EINTR and retry the call to sem_wait() in that case.