From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20796 invoked by alias); 21 Mar 2013 00:42:30 -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 20777 invoked by uid 89); 21 Mar 2013 00:42:22 -0000 X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from mail-ob0-f172.google.com (HELO mail-ob0-f172.google.com) (209.85.214.172) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 21 Mar 2013 00:42:18 +0000 Received: by mail-ob0-f172.google.com with SMTP id tb18so2335472obb.31 for ; Wed, 20 Mar 2013 17:42:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-originating-ip:in-reply-to:references :from:date:message-id:subject:to:cc:content-type:x-gm-message-state; bh=Dv0mk0YGiF/8MDNTYAV6rwhDBfHnjPOe0bGs/bK8zV0=; b=SJ4J7x1Zl6mRS8t8t5VzFDaIx744t6vVIY2XeqjfxG+MC6cotOm5UVlCvTFuaja4Y9 oBqU7VQNcuzwu2QJuBdLZGTMr8QKn0pRWKSyYfr13ByIxQI04UoLmfj/WU4N87rsH1Yf ebzqJ6nGWG9rwXqzqxG/DfQXJT1N1GXb3ttEoXNtZbZe5T9M/lnhFdlCmLX8K93i2tNV SYDc+sgVu4LrFAEpXWvknLOCq2KBwxreZN1rLG9BNggjEniQe5gd3dFDgBzVSrOzrddh V2mpPOaKkOAHyWCgVraCQfKF17gWUtQG+LG+wpa9Fcquju9jCeFKKV1CbO4pi9NEpODW YsJQ== X-Received: by 10.182.146.42 with SMTP id sz10mr5508521obb.83.1363826537128; Wed, 20 Mar 2013 17:42:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.98.232 with HTTP; Wed, 20 Mar 2013 17:41:56 -0700 (PDT) In-Reply-To: <20130320170829.GA29887@host2.jankratochvil.net> References: <20130320170829.GA29887@host2.jankratochvil.net> From: Gareth McMullin Date: Thu, 21 Mar 2013 01:15:00 -0000 Message-ID: Subject: Re: Include putpkt in TRY_CATCH. PR gdb/51275 To: Jan Kratochvil Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlhZDoy5J44V6RTyjH0UjJzawWTvOaNdEq3/cvWyoIf13Y5txfDeNIe0qeH+aNacEoIYcad X-SW-Source: 2013-03/txt/msg00772.txt.bz2 On Thu, Mar 21, 2013 at 6:08 AM, Jan Kratochvil wrote: > On Thu, 14 Mar 2013 03:02:29 +0100, Gareth McMullin wrote: >> --- a/gdb/remote.c >> +++ b/gdb/remote.c >> @@ -10695,10 +10695,9 @@ remote_get_trace_status (struct trace_status *ts) >> >> trace_regblock_size = get_remote_arch_state ()->sizeof_g_packet; >> >> - putpkt ("qTStatus"); >> - >> TRY_CATCH (ex, RETURN_MASK_ERROR) >> { >> + putpkt ("qTStatus"); >> p = remote_get_noisy_reply (&target_buf, &target_buf_size); >> } >> if (ex.reason < 0) > > Could you test this patch instead? > Fix 7.5 regression crashing GDB if gdbserver dies > http://sourceware.org/ml/gdb-patches/2013-03/msg00691.html That patch doesn't solve the problem, as the exception is raised in putpkt when the serial_write returns an error. The problem is not an error reported by the remote side, but an error reported by the host system because it is unable to send. Applying that patch and my patch together also does not solve the problem, as the exception raised is GENERAL_ERROR which is pushed up by your patch. > I guess it should also fix it but I probably cannot not replicate your serial > stub conditions here. I tried to reproduce with GDB server, because I expected similar behaviour on a broken socket, but this actually works, on Linux, at least: (gdb) tar ext localhost:2000 Remote debugging using localhost:2000 (gdb) set debug remote 1 ... gdbserver killed from another terminal ... (gdb) quit Sending packet: $qTStatus#49...Remote connection closed (gdb) quit The send(2) ultimately called by putpkt actually succeeds on the broken socket, while the write(2) used for Unix serial ports fails with EIO. Changing ser_unix_write_prim to fake success on EIO doesn't solve the problem as the serial read doesn't distinguish between EOF and TIMEOUT. I'll need to examine ser-unix.c in more detail to see exactly what's going on there. Is reworking ser-unix.c to behave more like ser-tcp.c a better fix than catching the exception raised by putpkt? Regards, Gareth