From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] [GDBserver] Make Zx/zx packet handling idempotent.
Date: Wed, 21 May 2014 09:02:00 -0000 [thread overview]
Message-ID: <537C6B73.60704@redhat.com> (raw)
In-Reply-To: <537C0F4A.8060708@codesourcery.com>
On 05/21/2014 03:28 AM, Yao Qi wrote:
> The patch is good!
>
> On 04/24/2014 07:41 AM, Pedro Alves wrote:
>> So the fix is to generalize mem-break.c to track all kinds of Zx
>> breakpoints, and filter out duplicates. As mentioned, this ends up
>> adding support for target-side conditions on hardware breakpoints and
>> watchpoints too (though GDB itself doesn't support the latter yet).
>>
>
> Can GDBserver returns feature "ConditionalWatchpoints" for qSupported
> query now?
I think so, yes, though I haven't tried it. (and I'm not planning to,
feel free to pick that.)
>> As software/memory breakpoints work by poking at memory, when setting
>> a GDB Z0 breakpoint (but not internal breakpoints, as those can assume
>> the conditions are already right), we need to tell the target to
>> prepare to access memory (which on Linux means stop threads). If that
>> operation fails, we need to return error to GDB. Seeing an error, if
>> this is the first breakpoint of that type that GDB tries to insert,
>> GDB would then assume the breakpoint type is supported, but it may
>> actually not be. So we need to check whether the type is supported at
>
> I am confused by this, isn't it "GDB would then assume the breakpoint
> type is NOT supported, but it may actually be"?
Nope. It's like this:
Say Z0 is NOT supported by the target.
- GDB sends Z0
- GDBserver asks the backend to prepare to access memory
- GDBserver's target backend tries to stop threads or whatever
- that fails, and GDBserver returns E01
- GDB interprets that as:
"target supports Z0, but something went wrong with
inserting the breakpoint, say, e.g., that address is
unmapped?"
- GDB now "knows" the target supports Z0, so sends another
the next time a breakpoint needs to be inserted
- This time preparing to access memory actually suceeds,
and then GDBserver finds out the target backend actually
doesn't support Z0.
- GDBserver returns the empty reply, indicating no support
for Z0.
- GDB hits this error in packet_ok:
case PACKET_UNKNOWN:
/* The stub does not support the packet. */
if (config->detect == AUTO_BOOLEAN_AUTO
&& config->support == PACKET_ENABLE)
{
/* If the stub previously indicated that the packet was
supported then there is a protocol error. */
error (_("Protocol error: %s (%s) conflicting enabled responses."),
config->name, config->title);
}
That's why the sequence must be:
- GDB sends Z0
- GDBserver checks whether the target backend supports Z0 before
actually trying to do anything to the inferior.
- The backend says it doesn't support Z0.
- GDBserver returns empty reply.
--
Pedro Alves
next prev parent reply other threads:[~2014-05-21 9:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 23:41 [PATCH 0/3] [GDBserver] Fix hardware breakpoint regressions Pedro Alves
2014-04-23 23:41 ` [PATCH 1/3] [GDBserver][Aarch64] Make watchpoint support use target_hw_bp_type Pedro Alves
2014-04-23 23:41 ` [PATCH 3/3] [GDBserver] Make Zx/zx packet handling idempotent Pedro Alves
2014-05-21 2:31 ` Yao Qi
2014-05-21 9:02 ` Pedro Alves [this message]
2014-05-21 9:33 ` Yao Qi
2014-04-23 23:41 ` [PATCH 2/3] [GDBserver] Move Z packet defines and type convertion routines to shared code Pedro Alves
2014-05-20 18:02 ` [PATCH 0/3] [GDBserver] Fix hardware breakpoint regressions 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=537C6B73.60704@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