Re: [RFA/tracepoint] Make GDB can work with some old GDB server

Hui Zhu
2011-07-07T13:40:41Z

On Thu, Jul 7, 2011 at 17:19, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> On Fri, 24 Jun 2011 10:46:58 +0200, Hui Zhu wrote:
>> Sending packet: $qTStatus#49...Ack
>> Packet received: E22
>> trace API error 0x2.
> [...]
>> This is because this kgdb(I think trunk have fixed this bug) don't
>> support qtstatus and reply -0x22.
>> So gdb throw a error.  Then all connect process stop.
>
> Why not to just put it more close to the error invocation?  Still some calls
> to target_get_trace_status would remain unprotected otherwise.
>
>
> Thanks,
> Jan
>
>
> gdb/
> 2011-07-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        Work around kgdb.
>        * remote.c (remote_get_trace_status): New variable ex.  Put
>        remote_get_noisy_reply into TRY_CATCH.  Call exception_fprintf for it.
>
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -10045,11 +10045,21 @@ remote_get_trace_status (struct trace_status *ts)
>   char *p;
>   /* FIXME we need to get register block size some other way.  */
>   extern int trace_regblock_size;
> +  volatile struct gdb_exception ex;
>
>   trace_regblock_size = get_remote_arch_state ()->sizeof_g_packet;
>
>   putpkt ("qTStatus");
> -  p = remote_get_noisy_reply (&target_buf, &target_buf_size);
> +
> +  TRY_CATCH (ex, RETURN_MASK_ERROR)
> +    {
> +      p = remote_get_noisy_reply (&target_buf, &target_buf_size);
> +    }
> +  if (ex.reason < 0)
> +    {
> +      exception_fprintf (gdb_stderr, ex, "qTStatus: ");
> +      return -1;
> +    }
>
>   /* If the remote target doesn't do tracing, flag it.  */
>   if (*p == '\0')
>

Cool. This one is more better. I have reverted my patch.

Suggest this patch can check in to both 7.3 and trunk.

Thanks,
Hui