From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32124 invoked by alias); 8 Jul 2007 14:45:53 -0000 Received: (qmail 32116 invoked by uid 22791); 8 Jul 2007 14:45:53 -0000 X-Spam-Check-By: sourceware.org Received: from wr-out-0506.google.com (HELO wr-out-0506.google.com) (64.233.184.235) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 08 Jul 2007 14:45:49 +0000 Received: by wr-out-0506.google.com with SMTP id i21so315772wra for ; Sun, 08 Jul 2007 07:45:47 -0700 (PDT) Received: by 10.78.123.4 with SMTP id v4mr1115215huc.1183905945952; Sun, 08 Jul 2007 07:45:45 -0700 (PDT) Received: from ?88.210.65.204? ( [88.210.65.204]) by mx.google.com with ESMTP id k9sm9966931nfh.2007.07.08.07.45.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 08 Jul 2007 07:45:40 -0700 (PDT) Message-ID: <4690F4C8.10704@portugalmail.pt> Date: Sun, 08 Jul 2007 14:45:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [gdbserver/win32]: Ignore OUTPUT_DEBUG_STRING_EVENT events when remote is not connected. References: <4690375A.6030009@portugalmail.pt> <20070708034833.GA18642@caradoc.them.org> In-Reply-To: <20070708034833.GA18642@caradoc.them.org> Content-Type: multipart/mixed; boundary="------------040001060203030801070304" X-IsSubscribed: yes 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 X-SW-Source: 2007-07/txt/msg00137.txt.bz2 This is a multi-part message in MIME format. --------------040001060203030801070304 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1099 Daniel Jacobowitz wrote: > On Sun, Jul 08, 2007 at 02:01:14AM +0100, Pedro Alves wrote: >> Hi, >> >> OUTPUT_DEBUG_STRING_EVENT events can happen from after the inferior >> is created, until it is stopped at the initial breakpoint, waiting >> for gdb. The OUTPUT_DEBUG_STRING_EVENT handler doesn't currently >> check if a remote connection is open before sending data, generating >> annoying putpkt error logs to gdbserver's console. This >> patch fixes it by simply ignoring those events when there isn't any >> gdb connected yet. I didn't use server_wait, because this event >> is also handled in win32_kill, outside of a wait. > > But don't you want to discard it if you're outside of a wait? I don't > see how GDB would display them otherwise; remote_wait handles the 'O' > response. > I woke up this morning hoping you still hadn't looked at this path yet. :) Sorry for the extra review work. Here goes a new version using server_waiting. If you don't mind, I would like to keep the option to see the outputs in debug mode. I've had a use for it in the past. Cheers, Pedro Alves --------------040001060203030801070304 Content-Type: text/x-diff; name="outputdebugstring_no_server_waiting.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="outputdebugstring_no_server_waiting.diff" Content-length: 755 2007-07-08 Pedro Alves * win32-low.c (handle_output_debug_string): Ignore event if not waiting. --- gdb/gdbserver/win32-low.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Index: src/gdb/gdbserver/win32-low.c =================================================================== --- src.orig/gdb/gdbserver/win32-low.c 2007-07-08 15:14:56.000000000 +0100 +++ src/gdb/gdbserver/win32-low.c 2007-07-08 15:27:26.000000000 +0100 @@ -568,7 +568,15 @@ handle_output_debug_string (struct targe } if (strncmp (s, "cYg", 3) != 0) - monitor_output (s); + { + if (!server_waiting) + { + OUTMSG2(("%s", s)); + return; + } + + monitor_output (s); + } #undef READ_BUFFER_LEN } --------------040001060203030801070304--