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

Handling the ContinuedEvent #335

Conversation

asimgunes
Copy link
Contributor

This update implements handling mechanism for "resume" gdb signal and redirect the "resume" signal as "ContinuedEvent" as described in the Debug Adapter Protocol.

This implementation is related to the issue #332

@jonahgraham
Copy link
Contributor

@asimgunes this looks promising - it over sends ContinuedEvent, which is not strictly a bug, but may be undesired. From the DAP docs:

Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. launch or continue.

It is only necessary to send a continued event if there was no previous request that implied this.

See here that VSCode already sends a simulated continued event on operations like next.

We could avoid sending these unnecessary ContinuedEvents to avoid unnecessary updates to the UI and related code.

The flip-side of this issue is that we aren't testing that we are sending continued events when no previous request implies one. To achieve this, instead of doing dc.continueRequest to continue, send a CLI command for continue either by using cdt-gdb-tests/executeCommand as you did previously here, or by sending an evaluate request with the > prefix to make it a GDB command like here


// if gdbNonStop=false stop the thread for next iteration
if (!gdbNonStop) {
await dc.pauseRequest({ threadId: thread.id });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work on Windows in non-async case. see

if (os.platform() === 'win32' && (!isRemoteTest || !gdbAsync)) {
// win32 host can only pause remote + mi-async targets
this.skip();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a similar implementation, thanks for the suggestion.

Copy link
Contributor

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asimgunes I have completed a review

@asimgunes asimgunes force-pushed the improvement/handling-the-continued-event branch 4 times, most recently from 43dfd2c to 9b92965 Compare September 26, 2024 16:09
@asimgunes
Copy link
Contributor Author

Hi @jonahgraham ,

I updated the test scenarios and split the non-stop and all-stop cases in multithread environment. Also, switched to use cdt-gdb-tests/executeCommand for sending the continue commands.

Is it possible to re-check the pull-request again?

Copy link
Contributor

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, apart from thread id == 1, see line comments

src/gdb/GDBDebugSessionBase.ts Outdated Show resolved Hide resolved
src/integration-tests/multithread.spec.ts Outdated Show resolved Hide resolved
@asimgunes asimgunes force-pushed the improvement/handling-the-continued-event branch 4 times, most recently from 5a382b3 to 07e5814 Compare September 27, 2024 16:02
This update implements handling mechanism for "resume" gdb signal and
redirect the "resume" signal as "ContinuedEvent" as described in the
Debug Adapter Protocol
@asimgunes asimgunes force-pushed the improvement/handling-the-continued-event branch from 07e5814 to 07aaf82 Compare September 27, 2024 16:16
@asimgunes
Copy link
Contributor Author

Hi @jonahgraham ,

I made the suggested changes, could you please review again when you are suitable?

Could you please check the update when you are suitable?

@jonahgraham jonahgraham merged commit 44fda62 into eclipse-cdt-cloud:main Sep 27, 2024
4 checks passed
@jonahgraham
Copy link
Contributor

The version with this fix is published to NPM https://www.npmjs.com/package/cdt-gdb-adapter/v/1.0.1-next.20240927165134.44fda62.0

jonahgraham added a commit to jonahgraham/cdt-gdb-vscode that referenced this pull request Dec 4, 2024
Includes:

- Refactor code to allow web extension
  - eclipse-cdt-cloud/cdt-gdb-adapter#328
- Improved handling of ContinuedEvent
  - eclipse-cdt-cloud/cdt-gdb-adapter#335
- Ensure 'interrupt' and 'disconnect' signals are sent before '-gdb-exit'
  - eclipse-cdt-cloud/cdt-gdb-adapter#338
- Add API to pause target and wait for debugger to be suspended
  - eclipse-cdt-cloud/cdt-gdb-adapter#339
jonahgraham added a commit to jonahgraham/cdt-gdb-vscode that referenced this pull request Dec 4, 2024
Includes:

- Refactor code to allow web extension
  - eclipse-cdt-cloud/cdt-gdb-adapter#328
- Improved handling of ContinuedEvent
  - eclipse-cdt-cloud/cdt-gdb-adapter#335
- Ensure 'interrupt' and 'disconnect' signals are sent before '-gdb-exit'
  - eclipse-cdt-cloud/cdt-gdb-adapter#338
- Add API to pause target and wait for debugger to be suspended
  - eclipse-cdt-cloud/cdt-gdb-adapter#339
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