intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
106 stars 48 forks source link

Attach-type debugging ignores Pause request until first break has occurred #1413

Closed gjsjohnmurray closed 1 month ago

gjsjohnmurray commented 1 month ago

Type: Bug

  1. Use a simple INT routine for testing, e.g.
    Loop ;
    set i=0
    do {
    hang 1
    set i=$get(i)+1
    write *13,i
    } while (i > 0)
    quit
  2. Run the test routine in a terminal.
  3. Connect VS Code to this namespace.
  4. Define an attach-type debug configuration that does not set stopOnEntry, e.g.
        "configurations": [
            {
                "type": "objectscript",
                "request": "attach",
                "name": "Attach"
            },
    ...
  5. Use this to attach to your running process.
  6. Click the Pause button to try interrupting it. :bug: this fails.

If before you ran this debug configuration you had opened your test routine in VS Code and set a breakpoint within the loop, then the target process would stop at your breakpoint. If you now clear this breakpoint, then Go, a subsequent click on the Pause button will succeed.

Extension version: 2.12.7-beta.3 VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.22631 Modes:

gjsjohnmurray commented 1 month ago

@isc-bsaviano the absence of documentation about stopOnEntry adds to the confusion this may cause. How about we add two more entries to the initialConfigurations array in package.json to help users discover that feature?

            {
                "type": "objectscript",
                "request": "attach",
                "name": "Attach"
            },
            {
                "type": "objectscript",
                "request": "attach",
                "name": "Attach and Pause",
                "stopOnEntry": true
            },
isc-bsaviano commented 1 month ago

@gjsjohnmurray I think it makes sense to open a documentation request to get this covered. I don't mind the initialConfigurations idea either. Are you going to look at this bug or do you want me to?

gjsjohnmurray commented 1 month ago

Are you going to look at this bug or do you want me to?

Please look at it, since it may involve server-side stuff.

isc-bsaviano commented 1 month ago

@gjsjohnmurray The pause button doesn't work because the configurationDone request never completes. VS Code sends a run command to the server, but the server doesn't respond. I think what we should do is always stop on entry instead of giving people the option. That's Studio's behavior and the process always stops on attach anyways.

cc @isc-rsingh