From: Philippe Waroquiers Date: Mon, 15 Feb 2016 22:53:45 +0000 (+0000) Subject: Speed up vgdb in standalone mode by using noack mode X-Git-Tag: svn/VALGRIND_3_12_0~235 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2d594ccbc8f778c8d2fb748df16d6301c1b0cd9;p=thirdparty%2Fvalgrind.git Speed up vgdb in standalone mode by using noack mode git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15788 --- diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index cc528eccbe..fe079830f1 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -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);