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

Update README for additional debugging details #46

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,71 @@ supports the following features:

![Debugger](doc-assets/debugger.png)

#### Launch Script

Example launch configuration to run the current script in the Visual Studio Code
editor:

```json
{
"type": "pol",
"request": "launch",
"name": "Launch current script",
"port": 5002,
"script": "${relativeFile}",
"stopAtEntry": true
}
```

#### Attach to Script

Example launch configuration to attach to the current script in the Visual Studio Code
editor, displaying a PID selection of multiple scripts found:

```json
{
"type": "pol",
"request": "attach",
"name": "Attach to script",
"port": 5002,

"pid": 0,
// if "pid" not provided, must provide "script":
"script": "${relativeFile}"
}
```

### Tips and Tricks

- To constantly refresh a compiled program from disk, add this to the top of
your source file:

```
use polsys;
Unload_Scripts(GetProcess().name);
```

- To launch interactive scripts (eg. item use scripts), provide values for
parameters that are not passed, eg.:

```
program use_script(who, item)
if (!who) who := SystemFindObjectBySerial(123, SYSFIND_SEARCH_OFFLINE_MOBILES); endif
if (!item) item := SystemFindObjectBySerial(789); endif
// ... rest of use script ...
endprogram
```

### Notes

- Currently, the debugger cannot determine that a source file does not match the
current compiled file. Please ensure your source scripts and compiled programs
are in-sync.
- Attaching to a script currently sleeping (eg. `Sleep()`, `Wait_For_Event()`)
will not wake the script. The function call must complete in order for the
debugger to break.

## Troubleshooting/bugs

The extension uses a built-in version of the Escript compiler, and may crash
Expand Down
Loading