WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [PATCH] add a quiet option to gdbproxy preventing gdb from inte

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [PATCH] add a quiet option to gdbproxy preventing gdb from interpreting the connection phase output
From: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2007 09:04:19 +0200
Cc: tbreeds@xxxxxxxxxxx
Delivery-date: Wed, 18 Apr 2007 00:02:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070301)
[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 GmbH
Vorsitzender 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
<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [PATCH] add a quiet option to gdbproxy preventing gdb from interpreting the connection phase output, Christian Ehrhardt <=