]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Speed up vgdb in standalone mode by using noack mode
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 15 Feb 2016 22:53:45 +0000 (22:53 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 15 Feb 2016 22:53:45 +0000 (22:53 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15788

coregrind/vgdb.c

index cc528eccbe3bf41aad40b4b9cf6582cf6095ad3e..fe079830f14aeaa650460a88a95720596c9acf93 100644 (file)
@@ -381,7 +381,7 @@ int read_buf (int fd, char* buf, const char* desc)
    valgrind process that there is new data.
    Returns True if write is ok, False if there was a problem. */
 static
-Bool write_buf(int fd, char* buf, int size, const char* desc, Bool notify)
+Bool write_buf(int fd, const char* buf, int size, const char* desc, Bool notify)
 {
    int nrwritten;
    int nrw;
@@ -586,10 +586,9 @@ readchar (int fd)
 }
 
 /* Read a packet from fromfd, with error checking,
-   and store it in BUF.  
-   Returns length of packet, or -1 if error or -2 if EOF.
-   Writes ack on ackfd */
-
+   and store it in BUF.
+   If checksum incorrect, writes a - on ackfd.
+   Returns length of packet, or -1 if error or -2 if EOF. */
 static int
 getpkt (char *buf, int fromfd, int ackfd)
 {
@@ -647,11 +646,7 @@ getpkt (char *buf, int fromfd, int ackfd)
         add_written(1);
   }
 
-  DEBUG(2, "getpkt (\"%s\");  [sending ack] \n", buf);
-  if (write (ackfd, "+", 1) != 1)
-     ERROR(0, "error when writing + (ack)\n");
-  else
-     add_written(1);
+  DEBUG(2, "getpkt (\"%s\");  [no ack] \n", buf);
   return bp - buf;
 }
 
@@ -980,6 +975,17 @@ void standalone_send_commands(int pid,
    }
    from_pid = open_fifo(to_gdb_from_pid, O_RDONLY, 
                         "read cmd result from pid");
+
+   /* Enable no ack mode. */
+   write_buf(to_pid, "$QStartNoAckMode#b0", 19, "write start no ack mode",
+             /* notify */ True);
+   buflen = getpkt(buf, from_pid, to_pid);
+   if (buflen != 2 || strcmp(buf, "OK") != 0) {
+      if (buflen != 2)
+         ERROR (0, "no ack mode: unexpected buflen %d\n", buflen);
+      else
+         ERROR (0, "no ack mode: unexpected packet %s\n", buf);
+   }
    
    for (nc = 0; nc <= last_command; nc++) {
       fprintf (stderr, "sending command %s to pid %d\n", commands[nc], pid);