From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68347 invoked by alias); 30 Nov 2016 19:28:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 66139 invoked by uid 89); 30 Nov 2016 19:28:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Sending X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Nov 2016 19:28:52 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9A8CC05AA54; Wed, 30 Nov 2016 19:28:50 +0000 (UTC) Received: from [127.0.0.1] (ovpn03.gateway.prod.ext.phx2.redhat.com [10.5.9.3]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAUJSnAD006936; Wed, 30 Nov 2016 14:28:50 -0500 Subject: Re: [PATCH] Don't print too much if remote_debug is on To: Yao Qi , Luis Machado References: <1480433898-19584-1-git-send-email-yao.qi@linaro.org> <20161130125433.GH22209@E107787-LIN> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <2701f36d-f144-2fde-e899-0ccc69805763@redhat.com> Date: Wed, 30 Nov 2016 19:28:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161130125433.GH22209@E107787-LIN> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-11/txt/msg01012.txt.bz2 On 11/30/2016 12:54 PM, Yao Qi wrote: > On Tue, Nov 29, 2016 at 09:45:59AM -0600, Luis Machado wrote: >> On 11/29/2016 09:38 AM, Yao Qi wrote: >>> If we turn "remote debug" on and GDB does some vFile operations, >>> a lot of things will be printed in the screen, which makes >>> "remote debug" useless. >>> >>> This patch changes the code that we don't print messages if >>> messages are too long, greater than 512. Instead, print >>> "Sending packet: $vFile:pread:5,3fff,e0d12#c4...Packet received: [16384 bytes omitted]". >> >> How about not printing binary data at all and instead print some >> useful information about contents being sent? Like the number of >> bytes and maybe how many still need to be read? > > In putpkt/getpkt, we don't know the data is binary or not, unless we > pass an additional parameter to indicate this. Then, we need to > go through every calls to putpkt/getpkt, check the data is plain text > or binary, so pass the right value to putpkt/getpkt. > > The binary and plain data is mixed in the buffer in some packets, like > "vFile:pwrite: fd, offset, data". If we want to print > "Sending packet: $vFile:pwrite:5,e0d12,[16384 bytes]#c4" in the debug > output, we need to move the debugging output from buffer level to > packet level. I agree it is better than > "Sending packet: [16384 bytes omitted]" which is what my patch does. > > We can omit the received packet if it is more than REMOTE_DEBUG_MAX_CHAR > chars; if the sent packet is more than REMOTE_DEBUG_MAX_CHAR chars, only > print the first 50 chars, and omit the rest of them, so the debug > output is like, > > Sending packet: $vFile:pread:5,3fff,e0d12#c4...Packet received: [16384 bytes omitted] > Sending packet: $vFile:pwrite:5,e0d12,xxxyyyzzz[384 bytes omitted] ... Packet received: 358 > > What do you think? I was just now writing a reply to the OP to suggest something like that, not noticing this reply. So +1 from me. But I'm not sure I follow the "50" in "50 chars". Why not instead: If REMOTE_DEBUG_MAX_CHAR is more than REMOTE_DEBUG_MAX_CHAR chars, only print the first REMOTE_DEBUG_MAX_CHAR chars. Thanks, Pedro Alves