Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gareth McMullin <gareth@blacksphere.co.nz>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Include putpkt in TRY_CATCH. PR gdb/51275
Date: Thu, 21 Mar 2013 01:15:00 -0000	[thread overview]
Message-ID: <CAL8qUbrTf_GPBRwAjrnbhuqgM+eBA=aUNdAAmwN-Bp8TGCLe-A@mail.gmail.com> (raw)
In-Reply-To: <20130320170829.GA29887@host2.jankratochvil.net>

On Thu, Mar 21, 2013 at 6:08 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> 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


  reply	other threads:[~2013-03-21  0:42 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 ` Gareth McMullin
2013-03-20 17:13   ` Jan Kratochvil
2013-03-21  1:15     ` Gareth McMullin [this message]
2013-03-21  8:20       ` Gareth McMullin
2013-03-26  7:27   ` Include putpkt in TRY_CATCH. PR gdb/15275 Jan Kratochvil
2013-03-27 20:17     ` [commit+7.6] " 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='CAL8qUbrTf_GPBRwAjrnbhuqgM+eBA=aUNdAAmwN-Bp8TGCLe-A@mail.gmail.com' \
    --to=gareth@blacksphere.co.nz \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@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