Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Gareth McMullin <gareth@blacksphere.co.nz>
Cc: gdb-patches@sourceware.org, Pedro Alves <palves@redhat.com>
Subject: Re: Include putpkt in TRY_CATCH. PR gdb/15275
Date: Tue, 26 Mar 2013 07:27:00 -0000	[thread overview]
Message-ID: <20130325195832.GA15218@host2.jankratochvil.net> (raw)
In-Reply-To: <CAL8qUbqjtBKJFJZ6dPS78Zh8Eb3b33U9JXTmn1pS3Le93xt7Rw@mail.gmail.com>

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  <gareth@blacksphere.co.nz>
> 
>         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 <trace_status>) 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)


  parent reply	other threads:[~2013-03-25 19:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAL8qUbrD=fgMP7nE0O8tX=AXifUpQXas25o_4SfK4p79rfoUpw@mail.gmail.com>
2013-03-14  2:02 ` Include putpkt in TRY_CATCH. PR gdb/51275 Gareth McMullin
2013-03-20 17:13   ` Jan Kratochvil
2013-03-21  1:15     ` Gareth McMullin
2013-03-21  8:20       ` Gareth McMullin
2013-03-26  7:27   ` Jan Kratochvil [this message]
2013-03-27 20:17     ` [commit+7.6] Re: Include putpkt in TRY_CATCH. PR gdb/15275 Jan Kratochvil
2013-03-28 20:14     ` Pedro Alves
2013-03-28 21:11       ` [PATCH] make -gdb-exit call disconnect_tracing too, and don't lose history if the target errors on "quit" (was: Re: Include putpkt in TRY_CATCH. PR gdb/15275) Pedro Alves
2013-04-10 19:57         ` [PATCH] make -gdb-exit call disconnect_tracing too, and don't lose history if the target errors on "quit" Pedro Alves
2013-03-29  0:44       ` Include putpkt in TRY_CATCH. PR gdb/15275 Gareth McMullin
2013-03-29 16:26       ` Jan Kratochvil
2013-04-02 15:24         ` Pedro Alves
2013-04-02 15:26           ` Jan Kratochvil
2013-04-09  7:15       ` [PATCH] Avoid potencially-stale errno usage (was: Re: Include putpkt in TRY_CATCH. PR gdb/15275) Pedro Alves
2013-04-09  8:21         ` Jan Kratochvil
2013-04-09 15:28           ` [commit] Re: [PATCH] Avoid potencially-stale errno usage Pedro Alves
2013-04-11 12:53             ` [patch] " Jan Kratochvil
2013-04-11 16:55               ` Pedro Alves
2013-04-11 22:59                 ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130325195832.GA15218@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gareth@blacksphere.co.nz \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox