Repository navigation
Monitor: skip a stop reply that arrives before an ack - #58
Merged
Merged
Conversation
Renode sometimes sends a late stop reply ("S02") to the interrupt the
monitor sends while connecting, after the next command has gone out but
before its '+'. gdb_wait_for_ack() read the reply's leading '$' as the
ack, logged "Unexpected GDB response: $" and failed the memory read - the
Renode test in dmod-boot then found no boot logs at all.
Receive, acknowledge and skip such packets (at most 8) and keep waiting
for the ack. The packet body reading is split out of
gdb_receive_packet() into gdb_receive_packet_body() so both share it.
Reproduced with a fake GDB server sending the stop reply before the ack:
the old code fails the read with exactly the CI error, the new one skips
the packet and reads the data.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVi4u4Lf8HPw1emy5uyGSB
JohnAmadis
pushed a commit
to choco-technologies/dmod-boot
that referenced
this pull request
Oct 5, 2026
choco-technologies/dmlog#58 is merged; same tree as the commit tested before, now on dmlog master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVi4u4Lf8HPw1emy5uyGSB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Renode test in dmod-boot fails intermittently at step 4 (
monitor-gdb). The master run after #117 failed this way:While connecting, the monitor sends
c, then Ctrl-C after 1 s. Renode sometimes sends a late extra stop reply ($S02#b5) after the next command (m…) has already gone out, but before its+.gdb_wait_for_ack()read that packet's leading$as the response, treated it as an error and failed the memory read. The read path (is_stop_reply+ retry) only handles a stop reply that arrives after the ack, not before it.Fix
gdb_wait_for_ack()now receives, acknowledges and skips such a packet and keeps waiting for+. It skips at most 8 packets, so it cannot loop forever. Packet body reading moved fromgdb_receive_packet()intogdb_receive_packet_body(), so both paths share it.Verification
I used a fake GDB server that, for the
mcommand, sends$S02#b5before+and the data. The test program linksgdb.cdirectly and callsgdb_connect()+gdb_read_memory():gdb.cUnexpected GDB response: $, read = -1 (the CI error)gdb.cSkipped packet 'S02' …, read = 0, data correctdmlog_monitorbuilds with-DDMLOG_BUILD_TOOLS=ONwithout warnings.dmod-boot builds the monitor from its
lib/dmlogsubmodule, so once this is merged the submodule there needs bumping.🤖 Generated with Claude Code
https://claude.ai/code/session_01SVi4u4Lf8HPw1emy5uyGSB
Generated by Claude Code