Bug 31801 - Protocol error: QThreadEvents (thread-events) conflicting enabled
Summary: Protocol error: QThreadEvents (thread-events) conflicting enabled
Status: RESOLVED NOTABUG
Alias: None
Product: gdb
Classification: Unclassified
Component: remote (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-26 16:06 UTC by Dmitry Neverov
Modified: 2024-09-01 18:51 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2024-05-26 00:00:00


Attachments
no protocol error (10.79 KB, text/plain)
2024-05-26 16:07 UTC, Dmitry Neverov
Details
protocol error (10.33 KB, text/plain)
2024-05-26 16:07 UTC, Dmitry Neverov
Details
untruncated remote log (15.87 KB, text/plain)
2024-06-04 13:08 UTC, Dmitry Neverov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Neverov 2024-05-26 16:06:42 UTC
This issue is extracted from https://sourceware.org/bugzilla/show_bug.cgi?id=31727.

I get the 'Protocol error: QThreadEvents (thread-events) conflicting
enabled' error when debugging the remote arm target in mingw. 

As suggested in https://sourceware.org/bugzilla/show_bug.cgi?id=31727
the first commit where the protocol error appears is
65c459abebf70bd5a64dcee11d4d7d4a8498465f. I get an internal error on
the previous commit 26f047ce788b42b7b5f96515d119138a8ae43979. Logs for
both commits attached.
Comment 1 Dmitry Neverov 2024-05-26 16:07:18 UTC
Created attachment 15534 [details]
no protocol error
Comment 2 Dmitry Neverov 2024-05-26 16:07:36 UTC
Created attachment 15535 [details]
protocol error
Comment 3 Tom Tromey 2024-05-26 19:56:16 UTC
Definitely a bug, because the remote clearly does not respond
with QThreadEvents+

This is a regression in 15 I think.  I'm going to set the
target milestone.
Comment 4 Tom Tromey 2024-05-26 21:04:40 UTC
I don't understand why this branch would fail:

void
remote_target::thread_events (int enable)
...
  if (m_features.packet_support (PACKET_QThreadEvents) == PACKET_DISABLE)
    return;


At least in a test build I did, if the remote doesn't include
QThreadEvents+, then this packet seems to be disabled:

(top-gdb) p m_features.packet_support(PACKET_QThreadEvents)
$15 = PACKET_DISABLE


Can you debug gdb with your remote and find out what's going on here?
There's a loop at the end of remote_target::remote_query_supported that
should make this change.
Comment 5 Dmitry Neverov 2024-06-04 13:08:58 UTC
Created attachment 15564 [details]
untruncated remote log

For me m_features.packet_support(PACKET_QThreadEvents) == PACKET_ENABLE.

I've collected untruncated remote log and it contains QThreadEvents+.
Comment 6 Tom Tromey 2024-06-04 18:13:27 UTC
Ok, in this case, gdb is correct to give an error.

What happens is that gdb sends "QThreadEvents+" in its
qSupported packet.  The remote replies "QThreadEvents+",
meaning the packet is supported.

Then later:

&"[remote] Sending packet: $QThreadEvents:1#89\n"
&"[remote] Packet received: \n"

That is, gdb asks for thread events and the remote
replies with the empty response, which means "unsupported" --
but it already said it *is* supported.

This is a bug in the remote.

Now, I do see the empty response documented in the manual.
However, I tend to think this is a cut-and-paste bug
in the manual itself, since the chart in the general
query packets node says:

     Feature Name              Value          Default   Probe
                               Required                 Allowed
...
     ‘QThreadEvents’           No             ‘-’       No

i.e., probing isn't allowed, so the empty response -- IMO --
is nonsensical.
Comment 7 Tom Tromey 2024-06-04 18:15:45 UTC
Although there's also the possibility that I am
misunderstanding what "probe allowed" actually means,
since the docs are kind of confusing on this topic.
Comment 8 Joel Brobecker 2024-07-01 02:37:27 UTC
Hey Tom,

So, if I understand correct, the Protocol Error is caused by the remote, rather than a bug in GDB?

Does it mean that this PR is no longer blocking for the GDB 15.1 release?
Comment 9 Dmitry Neverov 2024-07-02 06:37:27 UTC
It might be caused by the remote, but the same remote works
without an error with gdb-14 when the fix for
https://sourceware.org/bugzilla/show_bug.cgi?id=31727 is applied.
Comment 10 Joel Brobecker 2024-07-07 16:27:34 UTC
I seem to either not have received an email notification when Dmitry replied to my message (despite me being subscribed) or (more likely) I must have missed the message. Sorry.

Dmitry - I assume you're talking about https://sourceware.org/pipermail/gdb-patches/2024-June/209780.html

? I'm having trouble connecting the two, and so it seems to me as if the patch in question doesn't so much fix the problem as just takes GDB through a different path that no longer triggers the issue.

Meanwhile, I think at this stage, with the information we have, I think we are better off releasing GDB 15.1 without a fix for this. The good news is that we can consider the idea of backporting the fix above to the gdb-15-branch and have that for the 15.2 release. I've asked the admins to create the 15.2 target milestone, and we should change this one to it once the milestone has been created.
Comment 11 Joel Brobecker 2024-07-07 16:51:09 UTC
FTR: I'm changing the target milestone per my previous comment.
Comment 12 Dmitry Neverov 2024-07-09 11:28:12 UTC
> Dmitry - I assume you're talking about https://sourceware.org/pipermail/gdb-patches/2024-June/209780.html

Yes.

> ? I'm having trouble connecting the two, and so it seems to me as if the patch in question doesn't so much fix the problem as just takes GDB through a different path that no longer triggers the issue.

Yes, the fix just takes GDB through a different path. Without the fix, assertion in https://sourceware.org/bugzilla/show_bug.cgi?id=31727 happens first and prevents assertion in this issue to happen.
Comment 13 Joel Brobecker 2024-09-01 18:51:29 UTC
I'm removing the milestone, and making this one as closed, since there is no fix to do (the problem is in the stub).

Instead, what I have done is marked the workaround as a candidate for 15.2: https://sourceware.org/bugzilla/show_bug.cgi?id=31727