[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [PATCH] add a quiet option to gdbproxy preventing gdb from interpreting the connection phase output
[GDBPROXY] add a quit option to gdbproxy preventing gdb from interpreting the connection phase output - add a command line parameter -q - redirect some output until a connection is established Signed-off-by: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx> diff -Naur gdbproxy-0.0.1a/SOL-connect.c gdbproxy-0.0.1a_new/SOL-connect.c --- gdbproxy-0.0.1a/SOL-connect.c 2006-08-28 07:49:03.000000000 +0200 +++ gdbproxy-0.0.1a_new/SOL-connect.c 2007-04-13 10:11:34.000000000 +0200 @@ -50,6 +50,11 @@ #define PROXY_PRG "/usr/bin/telnet" +#define QUIET_OFF 0 +#define QUIET_ON 1 +#define QUIET_DONE 2 + + typedef uint8_t byte; static pid_t telnet_pid = -1; @@ -57,6 +62,7 @@ static int remote_out; static int local_in; static int local_out; +static int quiet=QUIET_OFF; static struct expect { char *expect; @@ -152,8 +158,13 @@ int send_len; uint8_t out_buf[4096]; - if (expects[next_expect].expect == NULL) + if (expects[next_expect].expect == NULL) { + if (quiet==QUIET_ON) { + local_out = fileno(stdout); + quiet=QUIET_DONE; + } return; + } /* Yck! */ if (strstr((char*)in_buf, expects[next_expect].expect)) { @@ -204,11 +215,11 @@ int opt, ret; fd_set fds; struct timeval *timeout = NULL; - char *server = "blademm1", *port = "23"; + char *server = "mmc8", *port = "23"; debug_init(".SOL-connect.log"); - while ( (opt = getopt(argc, argv, "s:p:")) != EOF) { + while ( (opt = getopt(argc, argv, "s:p:q")) != EOF) { switch(opt) { case 's': server = optarg; @@ -216,6 +227,9 @@ case 'p': port = optarg; break; + case 'q': + quiet = QUIET_ON; + break; default: errx(1, "Unknown ARG '%s'", optarg); } @@ -233,7 +247,11 @@ run_telnet(server, port); local_in = fileno(stdin); - local_out = fileno(stdout); + if (quiet)+ local_out = creat("silent.out",(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)); + else + local_out = fileno(stdout);+ #ifdef WITH_TIMEOUT timeout = calloc(1, sizeof(*timeout)); --Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization +49 7031/16-3385 Ehrhardt@xxxxxxxxxxxxxxxxxxx Ehrhardt@xxxxxxxxxx IBM Deutschland Entwicklung GmbHVorsitzender des Aufsichtsrats: Johann Weihen Geschäftsführung: Herbert Kircher Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 diff -Naur gdbproxy-0.0.1a/SOL-connect.c gdbproxy-0.0.1a_new/SOL-connect.c --- gdbproxy-0.0.1a/SOL-connect.c 2006-08-28 07:49:03.000000000 +0200 +++ gdbproxy-0.0.1a_new/SOL-connect.c 2007-04-13 10:11:34.000000000 +0200 @@ -50,6 +50,11 @@ #define PROXY_PRG "/usr/bin/telnet" +#define QUIET_OFF 0 +#define QUIET_ON 1 +#define QUIET_DONE 2 + + typedef uint8_t byte; static pid_t telnet_pid = -1; @@ -57,6 +62,7 @@ static int remote_out; static int local_in; static int local_out; +static int quiet=QUIET_OFF; static struct expect { char *expect; @@ -152,8 +158,13 @@ int send_len; uint8_t out_buf[4096]; - if (expects[next_expect].expect == NULL) + if (expects[next_expect].expect == NULL) { + if (quiet==QUIET_ON) { + local_out = fileno(stdout); + quiet=QUIET_DONE; + } return; + } /* Yck! */ if (strstr((char*)in_buf, expects[next_expect].expect)) { @@ -204,11 +215,11 @@ int opt, ret; fd_set fds; struct timeval *timeout = NULL; - char *server = "blademm1", *port = "23"; + char *server = "mmc8", *port = "23"; debug_init(".SOL-connect.log"); - while ( (opt = getopt(argc, argv, "s:p:")) != EOF) { + while ( (opt = getopt(argc, argv, "s:p:q")) != EOF) { switch(opt) { case 's': server = optarg; @@ -216,6 +227,9 @@ case 'p': port = optarg; break; + case 'q': + quiet = QUIET_ON; + break; default: errx(1, "Unknown ARG '%s'", optarg); } @@ -233,7 +247,11 @@ run_telnet(server, port); local_in = fileno(stdin); - local_out = fileno(stdout); + if (quiet) + local_out = creat("silent.out",(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)); + else + local_out = fileno(stdout); + #ifdef WITH_TIMEOUT timeout = calloc(1, sizeof(*timeout)); _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ppc-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |