GDB stdout support

This allows tests that run programs and check its output (stdout only, not stderr) to work transparently under GDB.