From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31109 invoked by alias); 10 Dec 2013 12:23:05 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 31098 invoked by uid 89); 10 Dec 2013 12:23:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oa0-f41.google.com Received: from Unknown (HELO mail-oa0-f41.google.com) (209.85.219.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 10 Dec 2013 12:23:01 +0000 Received: by mail-oa0-f41.google.com with SMTP id j17so5490652oag.0 for ; Tue, 10 Dec 2013 04:22:54 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.178.236 with SMTP id db12mr10377963oec.1.1386678174116; Tue, 10 Dec 2013 04:22:54 -0800 (PST) Received: by 10.76.9.170 with HTTP; Tue, 10 Dec 2013 04:22:54 -0800 (PST) Date: Tue, 10 Dec 2013 12:23:00 -0000 Message-ID: Subject: Multi-packet gdb server request/response - problem? From: Ivo Raisr To: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00010.txt.bz2 https://sourceware.org/gdb/onlinedocs/gdb/Overview.htmlGood morning all! I use gdb 7.6 (on Solaris 11.1 x86 if that matters) which is used to talk to a remote gdb server stub implementation (inside valgrind, if that matters). gdb is invoked as follows: $ gdb --quiet -l 60 --nx ./my_binary After the instrumented binary (with remote gdb server stub implementation) starts, gdb is commanded to talk to it: (gdb) set debug remote 1 (gdb) target remote | valgrind-gdb-relay --along-with-other-options Then the conversation starts (seemingly correctly) with: ----------- Sending packet: $qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+#b5...relaying data between gdb and process 12033 Ack Packet received: PacketSize=3fff;QStartNoAckMode+;QPassSignals+;qXfer:auxv:read+; qXfer:features:read+ Packet qSupported (supported-packets) is supported Sending packet: $QStartNoAckMode#b0...Ack Packet received: OK ... ----------- After a while, program gets stopped. If I then enter: (gdb) continue conversation continues (approx 40 packets are exchanged) but then abruptly ends with error: Sending packet: $s#73...Sending packet: $mfe7c852c,4#34...Packet received: T0505:08f8fe37;04:e8f7fe37;08:4d761100;thread:1; Reply contains invalid hex digit 84 Please take a particular note that in this case gdb did not wait for a reply to its '$s' packet but instead immediately issued another '$mfe7c852c,4' packet. This is also verified by dumping packets on the other side in the gdb server stub implementation: - read from gdb $s#73$mfe7c852c,4#34 - write to gdb $T0505:08f8fe37;04:e8f7fe37;08:4d761100;thread:1;#d8$0*"00#dc So on the wires it looks like: - gdb wrote two requests without waiting for a response for the first one - gdb received two concatenated responses for these two requests - requests and responses alone look well-formed My questions are: - Is multi-packet request/response supported by gdb? - In other words, is that gdb's behaviour intentional? - If yes, then why it cannot handle multi-packet response? - If no, then is that a bug? I was trying to confirm this with a protocol description available at https://sourceware.org/gdb/onlinedocs/gdb/Overview.html but in vain. Should you need more information, let me know.