cvmfs/monitor.cc
static string ReadUntilGdbPrompt(int fd_pipe) {
  static const string gdb_prompt = "\n(gdb) ";

  string        result;
  char          mini_buffer;
  int           chars_io;
  unsigned int  ring_buffer_pos = 0;

  // read from stdout of gdb until gdb prompt occures --> (gdb)
  while (1) {
    chars_io = read(fd_pipe, &mini_buffer, 1);

    // in case something goes wrong...
    if (chars_io <= 0) break;

    result += mini_buffer;

    // find the gdb_promt in the stdout data
    if (mini_buffer == gdb_prompt[ring_buffer_pos]) {
      ++ring_buffer_pos;
      if (ring_buffer_pos == gdb_prompt.size()) {
        break;
      }
    } else {
      ring_buffer_pos = 0;
    }
  }

  return result;
}
/**
 * reads from the file descriptor until the specific gdb prompt
 * is reached or the pipe gets broken
 *
 * @param fd_pipe  the file descriptor of the pipe to be read
 * @return         the data read from the pipe
 */
reads from the file descriptor until the specific gdb prompt
is reached or the pipe gets broken

@param fd_pipe  the file descriptor of the pipe to be read
@return         the data read from the pipe
reads from the file descriptor until the specific gdb prompt is reached or the pipe gets broken @param fd_pipe the file descriptor of the pipe to be read @return the data read from the pipe
static string ReadUntilGdbPrompt(int fd_pipe) {
  static const string gdb_prompt = "\n(gdb) ";
  string        result;
  char          mini_buffer;
  int           chars_io;
  unsigned int  ring_buffer_pos = 0;
  while (1) {
    chars_io = read(fd_pipe, &mini_buffer, 1);
    if (chars_io <= 0) break;
    result += mini_buffer;
    if (mini_buffer == gdb_prompt[ring_buffer_pos]) {
      ++ring_buffer_pos;
      if (ring_buffer_pos == gdb_prompt.size()) {
        break;
      }
    } else {
      ring_buffer_pos = 0;
    }
  }
  return result;
}
static string ReadUntilGdbPrompt ( int fd_pipe ) { static const string gdb_prompt = " \n " ; string result ; char mini_buffer ; int chars_io ; unsigned int ring_buffer_pos = 0 ; while ( 1 ) { chars_io = read ( fd_pipe , & mini_buffer , 1 ) ; if ( chars_io <= 0 ) break ; result += mini_buffer ; if ( mini_buffer == gdb_prompt [ ring_buffer_pos ] ) { ++ ring_buffer_pos ; if ( ring_buffer_pos == gdb_prompt . size ( ) ) { break ; } } else { ring_buffer_pos = 0 ; } } return result ; }
reads from the file descriptor until the specific gdb prompt
 is reached or the pipe gets broken
reads from the file descriptor until the specific gdb prompt is reached or the pipe gets broken
// read from stdout of gdb until gdb prompt occures --> (gdb) // in case something goes wrong... // find the gdb_promt in the stdout data