From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7626 invoked by alias); 21 Mar 2013 03:50:25 -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 7608 invoked by uid 89); 21 Mar 2013 03:50:14 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from mail-ob0-f177.google.com (HELO mail-ob0-f177.google.com) (209.85.214.177) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 21 Mar 2013 03:50:11 +0000 Received: by mail-ob0-f177.google.com with SMTP id eh20so2381840obb.8 for ; Wed, 20 Mar 2013 20:50:09 -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=z0CAWTxXk/s+gyE4qKvBKgkpsnoQy88RS+rJNukITDc=; b=HkKrPXM0aFLvt25naQsD8pfXz/p8ewIF0rbNDMKPPGVCo2wvnnJHlD5ekXNxlVvCA2 v0NYPFFEApaL86ddOm5ShrAG4rKSq2eB4QvGdFWDQe/euv6jg0A5RNWodwxAxeldOgKW wg68CXq802+T5qHz3eOUhHyOkxD4rpHx5T6hO9nNToX0A8TgVfwI727yfVPUVo22wm5A uvho4M0hQWz09tf0QN8eG6I4zPrWDTPDiIcSyQeFG3sFT3Wecs/bdpJk365ENvKYcKg2 8OYRvKbkfiuyo1i+P3lWZC3DpS2wgfCVWBuGNXZyo5WFUe/5QhY9/D6bdinseKevRbWE hV1g== X-Received: by 10.60.31.225 with SMTP id d1mr5681024oei.120.1363837809318; Wed, 20 Mar 2013 20:50:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.98.232 with HTTP; Wed, 20 Mar 2013 20:49:49 -0700 (PDT) In-Reply-To: References: <20130320170829.GA29887@host2.jankratochvil.net> From: Gareth McMullin Date: Thu, 21 Mar 2013 08:20: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: ALoCoQk+XLt7zUH6VpsM4rX3YfPJT0ptnVhfy8iifhfdqgXz8N/saB0Ea4xq3ndJEfYzmLV3kbDn X-SW-Source: 2013-03/txt/msg00775.txt.bz2 On Thu, Mar 21, 2013 at 1:41 PM, Gareth McMullin wrote: > On Thu, Mar 21, 2013 at 6:08 AM, Jan Kratochvil > wrote: >> 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. Changing ser-unix.c to use ser_base_readchar and faking success on EIO in ser_unix_write_prim fixes this for me. There are warnings in the comments about using user_base_readchar in ser-unix.c because of read returning no data on timeout, but if I read it correctly, read won't be called unless select found it ready to read. The timeout is handled by select which works for me on Linux/termios and seems like a better solution than using the termios VTIME parameter. It also appears that this is exactly what it would be doing if using the SGTTY serial code too. Is there a reason we would prefer to use VTIME for the timeout rather than select when using the termio/termios interface? Regards, Gareth