static void expect (FILE *fp) { int fromlog; int fromgdb; if ((fromlog = logchar (fp)) != ' ') { sync_error (fp, "Sync error during gdb read of leading blank", ' ', fromlog); } do { fromlog = logchar (fp); if (fromlog == EOL) break; fromgdb = gdbchar (remote_desc); if (fromgdb < 0) remote_error ("Error during read from gdb"); } while (fromlog == fromgdb); if (fromlog != EOL) { sync_error (fp, "Sync error during read of gdb packet from log", fromlog, fromgdb); } }
static void expect (FILE *fp) { int fromlog; unsigned char fromgdb; if ((fromlog = logchar (fp)) != ' ') { sync_error (fp, "Sync error during gdb read of leading blank", ' ', fromlog); } do { fromlog = logchar (fp); if (fromlog == EOL) { break; } read (remote_desc, &fromgdb, 1); } while (fromlog == fromgdb); if (fromlog != EOL) { sync_error (fp, "Sync error during read of gdb packet", fromlog, fromgdb); } }
int main (int argc, char *argv[]) { FILE *fp; int ch; if (argc >= 2 && strcmp (argv[1], "--version") == 0) { gdbreplay_version (); exit (0); } if (argc >= 2 && strcmp (argv[1], "--help") == 0) { gdbreplay_usage (stdout); exit (0); } if (argc < 3) { gdbreplay_usage (stderr); exit (1); } fp = fopen (argv[1], "r"); if (fp == NULL) { perror_with_name (argv[1]); } remote_open (argv[2]); while ((ch = logchar (fp)) != EOF) { switch (ch) { case 'w': /* data sent from gdb to gdbreplay, accept and match it */ expect (fp); break; case 'r': /* data sent from gdbreplay to gdb, play it */ play (fp); break; case 'c': /* Command executed by gdb */ while ((ch = logchar (fp)) != EOL); break; } } remote_close (); exit (0); }
static void play (FILE *fp) { int fromlog; char ch; if ((fromlog = logchar (fp)) != ' ') { sync_error (fp, "Sync error skipping blank during write to gdb", ' ', fromlog); } while ((fromlog = logchar (fp)) != EOL) { ch = fromlog; write (remote_desc, &ch, 1); } }
int main (int argc, char *argv[]) { FILE *fp; int ch; if (argc < 3) { fprintf (stderr, "Usage: gdbreplay <logfile> <host:port>\n"); fflush (stderr); exit (1); } fp = fopen (argv[1], "r"); if (fp == NULL) { perror_with_name (argv[1]); } remote_open (argv[2]); while ((ch = logchar (fp)) != EOF) { switch (ch) { case 'w': /* data sent from gdb to gdbreplay, accept and match it */ expect (fp); break; case 'r': /* data sent from gdbreplay to gdb, play it */ play (fp); break; case 'c': /* Command executed by gdb */ while ((ch = logchar (fp)) != EOL); break; } } remote_close (); exit (0); }
int qnxinc(void) { extern int pmask, cmask; extern int tt_utf8; int ch; loop: ch = ttinc(0); if ( ch < 0 ) return ch; if ( seslog ) logchar(ch); /* Handle the UTF8 conversion if we are in that mode */ if ( tt_utf8 ) { USHORT * ucs2 = NULL; int rc = utf8_to_ucs2( (CHAR)(ch & 0xFF), &ucs2 ); if ( rc > 0 ) goto loop; else if ( rc < 0 ) ch = 0xfffd; else ch = *ucs2; } if ( !xprint ) { #ifndef NOXFER autodown(ch); #endif /* NOXFER */ autoexitchk(ch); } ch = ch & pmask & cmask; debugses(ch); if (printon && (is_xprint() || is_uprint())) prtchar(ch); return ch; }