Skip to content

DAP server: buffer_full() not correct #199

Closed

Description

@rgrr

Hello

I'ld say that buffer_full() needs also the modulo operation for rptr, so that it reads

bool buffer_full(buffer_t *buffer)
{
	return ((buffer->wptr + 1) % DAP_PACKET_COUNT == buffer->rptr % DAP_PACKET_COUNT);
}

instead of

bool buffer_full(buffer_t *buffer)
{
	return ((buffer->wptr + 1) % DAP_PACKET_COUNT == buffer->rptr);
}

Activity

  1. P33M commented on May 27, 2026

    @P33M
    Contributor

    Yep - rptr is incremented without modulo so the fullness check will fail. However debug hosts are meant to respect the maximum packet count that a CMSIS-DAP probe advertises, and not queue up any more than that. But that does rely on correct accounting in every debug host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions