Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#282: Ensure we send error response for threads request #283

Merged
merged 1 commit into from
Jul 29, 2021

Conversation

martin-fleck-at
Copy link
Contributor

No description provided.

Signed-off-by: Martin Fleck <mfleck@eclipsesource.com>
@martin-fleck-at
Copy link
Contributor Author

martin-fleck-at commented Jul 29, 2021

@WebFreak001 For our own fix we also added a retry behavior for the threadsRequest because we noticed that when we start a new debugging session the request sometimes comes a little bit "too early" and we receive an error from GDB:

Cannot execute this command while the target is running.
Use the interrupt command to stop the target and try again.

Simply re-trying after a short delay (without interrupt) solved that problem for us. So basically we are doing this:

protected threadsRequest(response: DebugProtocol.ThreadsResponse, request: DebugProtocol.ThreadsRequest, retry = 5, delay = 100): void {
   ...
   this.miDebugger.getThreads().then(threads => {
      ...
   }).catch(error => {
      if(retry > 1) {
         setTimeout(() => this.threadsRequest(response, request, retry - 1, delay), delay);
      } else {
         this.sendErrorResponse(response, 1, `Could not get threads: ${error}`);
   });
}

I'm not sure if this is specific to our scenario. Do you think it is worth adding that to the code here as well or, in general, to have a generic "retry" behavior or is that out of scope for the debug adapter?

@WebFreak001
Copy link
Owner

I think for this PR it's good as it is, for retrying I'm not too sure if it's a good idea just retrying

@WebFreak001 WebFreak001 merged commit b6536ac into WebFreak001:master Jul 29, 2021
@martin-fleck-at martin-fleck-at deleted the issue-282 branch July 29, 2021 14:19
@martin-fleck-at
Copy link
Contributor Author

@WebFreak001 Thanky you! I opened a separate issue for the retry discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants