From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/7] range stepping: gdbserver on x86/linux
Date: Tue, 14 May 2013 18:30:00 -0000 [thread overview]
Message-ID: <519282CB.4030800@redhat.com> (raw)
In-Reply-To: <1363006291-13334-4-git-send-email-yao@codesourcery.com>
On 03/11/2013 12:51 PM, Yao Qi wrote:
> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index 922a5bf..0b330d1 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -1871,10 +1871,15 @@ handle_v_cont (char *own_buf)
> p = &own_buf[5];
> while (*p)
> {
> + CORE_ADDR start = 0;
> + CORE_ADDR end = 0;
> +
> p++;
>
> if (p[0] == 's' || p[0] == 'S')
> resume_info[i].kind = resume_step;
> + else if (p[0] == 'r')
> + resume_info[i].kind = resume_step;
> else if (p[0] == 'c' || p[0] == 'C')
> resume_info[i].kind = resume_continue;
> else if (p[0] == 't')
> @@ -1894,6 +1899,21 @@ handle_v_cont (char *own_buf)
> goto err;
> resume_info[i].sig = gdb_signal_to_host (sig);
> }
> + else if (p[0] == 'r')
> + {
> + char *p1;
> +
> + p = p + 1;
> + p1 = strchr (p, ',');
> + decode_address (&start, p, p1 - p);
> +
> + p = p1 + 1;
> + p1 = strchr (p, ':');
> + decode_address (&end, p, p1 - p);
> +
> + resume_info[i].sig = 0;
> + p = p1;
> + }
> else
> {
> resume_info[i].sig = 0;
> @@ -1919,6 +1939,21 @@ handle_v_cont (char *own_buf)
> goto err;
>
> resume_info[i].thread = ptid;
> + if (end > 0)
> + {
> + struct thread_info *tp = find_thread_ptid (ptid);
> +
> + /* GDB should not send range stepping for all threads of
> + a process, like 'vCont;rSTART,END:pPID.-1', TP can't
> + be NULL. */
> + gdb_assert (tp != NULL);
> +
> + tp->start = start;
> + tp->end = end;
> +
> + start = 0;
> + end = 0;
> + }
My main issues with this are:
- it assumes GDB will ever only send one r action per vCont. I'd much
rather we don't bake in that assumption.
- GDBserver should not gdb_assert for unexpected input it can't control.
- It seems like this leaves threads with stale step ranges. Because
linux-low.c only clears the stepping range of the thread that is reporting
the event (here):
> @@ -2685,6 +2705,8 @@ Check if we're already there.\n",
> fprintf (stderr, "Hit a non-gdbserver trap event.\n");
> }
>
> + thread_clear_range_stepping (current_inferior);
> +
> /* Alright, we're going to report a stop. */
>
> if (!non_stop && !stabilizing_threads)
> @@ -5081,6 +5103,15 @@ linux_supports_agent (void)
> return 1;
> }
That is, e.g.,:
- user "step"s thread 1 (vCont;r)
- thread 2 hits breakpoint (step range of thread 2 is cleared)
- user goes back to thread 1, and does "si".
- GDB sends vCont;s, but thread 1 still has the stale step range
from the previous vCont;r.
We should probably have an explicit test for this, though I
haven't added one myself (at least yet).
--
Pedro Alves
next prev parent reply other threads:[~2013-05-14 18:30 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-11 12:52 [PATCH 0/7] Range stepping Yao Qi
2013-03-11 12:53 ` [PATCH 2/7] Move rs->support_vCont_t to a separate struct Yao Qi
2013-03-11 12:53 ` [PATCH 7/7] range stepping: doc and NEWS Yao Qi
2013-03-11 13:38 ` Abid, Hafiz
2013-03-11 17:01 ` Eli Zaretskii
2013-05-14 18:32 ` Pedro Alves
2013-03-11 12:53 ` [PATCH 3/7] range stepping: gdbserver on x86/linux Yao Qi
2013-05-14 18:30 ` Pedro Alves [this message]
2013-05-15 7:40 ` Yao Qi
2013-05-20 18:00 ` Pedro Alves
2013-05-22 10:06 ` Yao Qi
2013-03-11 12:53 ` [PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE Yao Qi
2013-05-14 19:24 ` Pedro Alves
2013-03-11 12:53 ` [PATCH 4/7] range stepping: gdb Yao Qi
2013-05-14 18:31 ` Pedro Alves
2013-05-15 8:07 ` Yao Qi
2013-05-20 17:59 ` Pedro Alves
2013-03-11 12:53 ` [PATCH 5/7] range stepping: New command 'maint set range stepping' Yao Qi
2013-03-11 17:05 ` Eli Zaretskii
2013-03-18 3:10 ` Yao Qi
2013-03-18 5:39 ` Eli Zaretskii
2013-05-14 18:31 ` Pedro Alves
2013-03-11 12:53 ` [PATCH 6/7] range stepping: test case Yao Qi
2013-05-14 18:32 ` Pedro Alves
2013-05-15 8:27 ` Yao Qi
2013-05-20 18:29 ` Pedro Alves
2013-05-22 14:01 ` Yao Qi
2013-03-14 20:12 ` [PATCH 0/7] Range stepping Pedro Alves
2013-03-15 19:54 ` Pedro Alves
2013-03-22 2:25 ` Yao Qi
2013-03-22 20:24 ` Pedro Alves
2013-04-11 6:16 ` [PATCH 0/7 V2] " Yao Qi
2013-04-11 6:17 ` [PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE Yao Qi
2013-04-11 6:17 ` [PATCH 2/7] Move rs->support_vCont_t to a separate struct Yao Qi
2013-04-11 6:18 ` [PATCH 3/7] range stepping: gdbserver on x86/linux Yao Qi
2013-04-11 6:19 ` [PATCH 4/7] range stepping: gdb Yao Qi
2013-04-11 13:22 ` Yao Qi
2013-04-12 12:35 ` Yao Qi
2013-04-11 6:19 ` [PATCH 5/7] range stepping: New command 'maint set range stepping' Yao Qi
2013-04-11 23:00 ` Eli Zaretskii
2013-04-11 6:38 ` [PATCH 6/7] range stepping: test case Yao Qi
2013-04-11 7:30 ` [PATCH 7/7] range stepping: doc and NEWS Yao Qi
2013-04-11 23:00 ` Eli Zaretskii
2013-04-12 20:48 ` [PATCH 0/7 V2] Range stepping Pedro Alves
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=519282CB.4030800@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=yao@codesourcery.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