From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11857 invoked by alias); 25 Mar 2013 19:58:48 -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 11489 invoked by uid 89); 25 Mar 2013 19:58:40 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 25 Mar 2013 19:58:40 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2PJwcNN006145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 25 Mar 2013 15:58:38 -0400 Received: from host2.jankratochvil.net (ovpn-116-100.ams2.redhat.com [10.36.116.100]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2PJwXin029964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 25 Mar 2013 15:58:36 -0400 Date: Tue, 26 Mar 2013 07:27:00 -0000 From: Jan Kratochvil To: Gareth McMullin Cc: gdb-patches@sourceware.org, Pedro Alves Subject: Re: Include putpkt in TRY_CATCH. PR gdb/15275 Message-ID: <20130325195832.GA15218@host2.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-03/txt/msg00955.txt.bz2 On Thu, 14 Mar 2013 03:02:29 +0100, Gareth McMullin wrote: > If debugging with a remote connection over a serial link and the link is > disconnected, say by disconnecting USB serial port, the GDB quit command no > longer works. [...] > 2013-03-14 Gareth McMullin > > PR gdb/15275 > * remote.c (remote_get_trace_status): Include putpkt in TRY_CATCH. I am OK with the patch. Ccing also Pedro, the TARGET_CLOSE_ERROR was probably meant to handle it. I will check it in. Used this patch to simulate the problem with TCP gdbserver: (gdb) q A debugging session is active. Inferior 1 [process 30674] will be killed. Quit anyway? (y or n) y Sending packet: $qTStatus#49...putpkt: write failed: Input/output error. (gdb) q -> (gdb) q A debugging session is active. Inferior 1 [process 31864] will be killed. Quit anyway? (y or n) y Sending packet: $qTStatus#49...qTStatus: putpkt: write failed: Input/output error. Sending packet: $k#6b...putpkt: write failed: Input/output error. $ _ #0 net_write_prim (scb=0x41f4b90, buf=0x7fff617af320, count=12) at ser-tcp.c:352 #1 in ser_base_write (scb=0x41f4b90, str=0x7fff617af320 "$qTStatus#49", len=12) at ser-base.c:449 #2 in serial_write (scb=0x41f4b90, str=0x7fff617af320 "$qTStatus#49", len=12) at serial.c:427 #3 in putpkt_binary (buf=0xf617b7 "qTStatus", cnt=8) at remote.c:7183 #4 in putpkt (buf=0xf617b7 "qTStatus") at remote.c:7114 #5 in remote_get_trace_status (ts=0x1ebd860 ) at remote.c:10695 #6 in disconnect_tracing (from_tty=1) at tracepoint.c:2224 #7 in quit_command (args=0x0, from_tty=1) at ./cli/cli-cmds.c:325 #--- a/gdb/ser-tcp.c #+++ b/gdb/ser-tcp.c #@@ -341,9 +341,19 @@ net_read_prim (struct serial *scb, size_t count) # return recv (scb->fd, scb->buf, count, 0); # } # #+static volatile int hacked; #+static void hackusr2(int signo) { #+ hacked=1; #+} #+ # int # net_write_prim (struct serial *scb, const void *buf, size_t count) # { #+signal(SIGUSR2,hackusr2); #+if (hacked) { #+ errno=EIO; #+ return -1; #+} # return send (scb->fd, buf, count, 0); # } # Thanks, Jan > --- > diff --git a/gdb/remote.c b/gdb/remote.c > index 21d86f7..29c64c0 100644 > --- 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)