From bb366d605bb4e1fca189efc713de8e0e26df771e Mon Sep 17 00:00:00 2001 From: Emilien Lemaire Date: Fri, 8 Sep 2023 16:23:47 +0200 Subject: [PATCH 01/15] Update deps and fix gcov parsing (#1) * Update deps and fix gcov parsing --- .eslintrc.cjs | 31 + README.md | 75 +- package-lock.json | 1029 ------------------------- package.json | 133 ++-- src/coverage.ts | 33 +- src/extension.ts | 113 ++- src/gcov.ts | 98 +++ src/gdb.ts | 1253 +++++++++++++++++-------------- src/mi2.ts | 1827 ++++++++++++++++++++++----------------------- src/parser.c.ts | 3 - src/parser.mi2.ts | 45 +- src/settings.ts | 17 +- tsconfig.json | 13 +- yarn.lock | 1252 +++++++++++++++++++++++++++++++ 14 files changed, 3180 insertions(+), 2742 deletions(-) create mode 100644 .eslintrc.cjs delete mode 100644 package-lock.json create mode 100644 src/gcov.ts create mode 100644 yarn.lock diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..b24cc29 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,31 @@ +module.exports = { + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + ], + plugins: [ + "@typescript-eslint" + ], + parser: "@typescript-eslint/parser", + parserOptions: { + project: true, + tsconfigRootDir: __dirname, + }, + root: true, + rules: { + "@typescript-eslint/no-unused-vars": "off", + "no-unused-vars": [ + 1, + { + argsIgnorePattern: "^_" + } + ], + "max-len": [ + 1, + { + code: 100, + } + ] + } +} diff --git a/README.md b/README.md index f61f550..4d6478c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,19 @@

-An extension to debug or execute GnuCOBOL code. Install from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=OlegKunitsyn.gnucobol-debug) or [Open VSX-Registry](https://open-vsx.org/extension/OlegKunitsyn/gnucobol-debug). +An extension to debug or execute GnuCOBOL code. Forked from [COBOL Degub](https://github.com/OlegKunitsyn/gnucobol-debug). + +- [Features](#features) +- [Requirements](#requirements) + - [Binaries](#binaries) +- [Usage](#usage) +- [Code coverage](#code-coverage) +- [Attaching to a running process](#attaching-to-a-running-process) + - [Local Process](#local-process) + - [Remote Debugger (GDBServer)](#remote-debugger-gdbserver) +- [Documentation](#documentation) +- [Troubleshooting](#troubleshooting) +- [Development](#development) ### Features * Setting breakpoints @@ -26,23 +38,15 @@ An extension to debug or execute GnuCOBOL code. Install from [VS Code Marketplac * Watch pane with expressions * Code coverage * No mainframe required -* GnuCOBOL Docker ![Screenshot](screenshot.png) ### Requirements -A COBOL-syntax extension i.e. `bitlang.gnucobol` (recommended, note: the previously recommended `bitlang.cobol` was split and now is intended to target MicroFocus products only), or - if you target a mainframe dialect: `broadcommfd.cobol-language-support`, `rechinformatica.rech-editor-cobol` or `ibm.zopeneditor` installed. -Otherwise, the breakpoints will be unavailable. +This extension is meant to work with our COBOL language extension [Superbol VSCode](https://github.com/OCamlPro/superbol-vscode-platform). -Now you may choose between *local* and *container* execution environment. Or try both of them :) - -#### Local -* GnuCOBOL `cobc` 2.2+ installed. -* GNU Debugger `gdb` 6.0+ installed. - -#### Container -* [GnuCOBOL Docker](https://hub.docker.com/r/olegkunitsyn/gnucobol) container up and running. -The image includes GnuCOBOL, GNU Debugger and all required dependencies needed to debug or execute your code. See an example below. +#### Binaries +* GnuCOBOL `cobc` 3.1+ installed. +* GNU Debugger `gdb` 13.0+ installed. ### Usage When your `launch.json` config is set up, you can debug or execute your COBOL program. If you debug a Compilation Group (main- and sub- programs), you need to list sub-programs inside `group` property. Here's an example: @@ -66,7 +70,7 @@ Pick `COBOL debugger` from the dropdown on the Debug pane in VS Code. Press the The debugger uses C sourcecode generated by the compiler upon each debugging session. If the sourcemap isn't accurate or you see any other issues, please make a bug-report. ### Code coverage -You can estimate an execution flow of your COBOL program. +You can estimate an execution flow of your COBOL program. ![Coverage](coverage.png) @@ -88,36 +92,6 @@ Set `coverage` property to `true` in your `launch.json` and start debugging sess The extension decodes the code-coverage files in `gcov` format generated by the compiler. -### Docker -You may debug or execute your COBOL program inside [GnuCOBOL Docker](https://hub.docker.com/r/olegkunitsyn/gnucobol) container. Start the container and share your working directory by `Ctrl+Shift+P` and command `GnuCOBOL Docker: start`, or in the terminal: -```bash -docker run -d -i --name gnucobol -w ${workspaceRoot} -v ${workspaceRoot}:${workspaceRoot} olegkunitsyn/gnucobol:3.1-dev -docker exec -i gnucobol cobc -V -docker exec -i gnucobol gdb -v -``` - -Add `docker` property to your `launch.json` and start debugging session. -Here's an example: -```json -{ - "version": "0.2.0", - "configurations": [ - { - "name": "COBOL debugger", - "type": "gdb", - "request": "launch", - "cobcargs": ["-free", "-x"], - "docker": "olegkunitsyn/gnucobol:3.1-dev" - } - ] -} -``` - -Stop the container by `Ctrl+Shift+P` and command `GnuCOBOL Docker: stop`, or in the terminal: -```bash -docker rm --force gnucobol -``` - ### Attaching to a running process You may debug your COBOL program attaching to a running process. In order to achieve that, you have two options: @@ -147,7 +121,8 @@ Here's an example: ``` #### Remote Debugger (GDBServer) -Add `remoteDebugger` property to your `launch.json`. +Add `remoteDebugger` property to your `launch.json`. + Here's an example: ```json { @@ -164,12 +139,12 @@ Here's an example: } ``` -### Roadmap -- Mac -- Unit testing - Your contribution is always welcome! +### Documentation + +For a more in depth documentation please check the [Superbol Documentation](https://ocamlpro.com/superbol/) + ### Troubleshooting Add `verbose` property to your `launch.json` and start debugging session. In `DEBUG CONSOLE` you will see complete communication log between `gdb` and VS Code. Here's an example: ```json @@ -190,7 +165,7 @@ Add `verbose` property to your `launch.json` and start debugging session. In `DE ### Development * Fork the repository. * Clone it to your machine and open with VS Code. -* Install dependencies by `npm install` command in the terminal. +* Install dependencies by `yarn install` command in the terminal. * Pick `Extension` from the dropdown on the Debug pane and press `F5`. This will open new VS Code instance with your cloned extension in debugging mode. * Follow Requirements and Usage sections above. * In the first VS Code instance you may put breakpoints to explore the functionality. diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index de66f5d..0000000 --- a/package-lock.json +++ /dev/null @@ -1,1029 +0,0 @@ -{ - "name": "gnucobol-debug", - "version": "2.31.37", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.8.3" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", - "dev": true - }, - "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.9.0", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, - "@types/node": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.0.tgz", - "integrity": "sha512-WE4IOAC6r/yBZss1oQGM5zs2D7RuKR6Q+w+X2SouPofnWn+LbCqClRyhO3ZE7Ix8nmFgo/oVuuE01cJT2XB13A==", - "dev": true - }, - "@types/vscode": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.45.0.tgz", - "integrity": "sha512-b0Gyir7sPBCqiKLygAhn/AYVfzWD+SMPkWltBrIuPEyTOxSU1wVApWY/FcxYO2EWTRacoubTl4+gvZf86RkecA==", - "dev": true - }, - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "es-abstract": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", - "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "dev": true, - "requires": { - "is-buffer": "~2.0.3" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "gcov-parse": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gcov-parse/-/gcov-parse-1.0.1.tgz", - "integrity": "sha512-W6D3ea3aso6ri4KkR4kGHLUm0KzDwKq5FzQlja4k7quaA8CDv5FhizJdH/2GVJ8MuMuBZHETIgkcV8mu015gtg==" - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", - "dev": true - }, - "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", - "dev": true - }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dev": true, - "requires": { - "chalk": "^2.0.1" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "requires": { - "minimist": "^1.2.5" - } - }, - "mocha": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", - "integrity": "sha512-0R/3FvjIGH3eEuG17ccFPk117XL2rWxatr81a57D+r/x2uTYZRbdZ4oVidEUMh2W2TJDa7MdAb12Lm2/qrKajg==", - "dev": true, - "requires": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "2.2.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.4", - "ms": "2.1.1", - "node-environment-flags": "1.0.5", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "mkdirp": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", - "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - } - } - }, - "n-readlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/n-readlines/-/n-readlines-1.0.0.tgz", - "integrity": "sha512-ISDqGcspVu6U3VKqtJZG1uR55SmNNF9uK0EMq1IvNVVZOui6MW6VR0+pIZhqz85ORAGp+4zW+5fJ/SE7bwEibA==" - }, - "node-environment-flags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", - "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "resolve": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz", - "integrity": "sha512-rmAglCSqWWMrrBv/XM6sW0NuRFiKViw/W4d9EbC4pt+49H8JwHy+mcGmALTEg504AUDcLTvb1T2q3E9AnmY+ig==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - } - }, - "string.prototype.trimleft": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", - "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimstart": "^1.0.0" - } - }, - "string.prototype.trimright": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", - "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "string.prototype.trimend": "^1.0.0" - } - }, - "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "tslib": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", - "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", - "dev": true - }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - }, - "dependencies": { - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", - "dev": true - }, - "vscode-debugadapter": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/vscode-debugadapter/-/vscode-debugadapter-1.40.0.tgz", - "integrity": "sha512-cudm9ROtFRxiBgcM+B8cQXA1DfsRKaOfEYDMh9upxbYxN3v0c40SHCPmNivIYp7LDzcG60UGaIYD1vsUfC1Qcg==", - "requires": { - "mkdirp": "^0.5.1", - "vscode-debugprotocol": "1.40.0" - } - }, - "vscode-debugadapter-testsupport": { - "version": "1.40.3", - "resolved": "https://registry.npmjs.org/vscode-debugadapter-testsupport/-/vscode-debugadapter-testsupport-1.40.3.tgz", - "integrity": "sha512-geWmnxFX2Z7wxlgRHUaULtPj3u6d29reGzzKLFXYPd59I9xgudcFdS1dSczjO6Pwkb2jkfFcXAyNGRSzu+kBSg==", - "dev": true, - "requires": { - "vscode-debugprotocol": "1.40.0" - } - }, - "vscode-debugprotocol": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.40.0.tgz", - "integrity": "sha512-Fwze+9qbLDPuQUhtITJSu/Vk6zIuakNM1iR2ZiZRgRaMEgBpMs2JSKaT0chrhJHCOy6/UbpsUbUBIseF6msV+g==" - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - } - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", - "dev": true - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" - } - } - } -} diff --git a/package.json b/package.json index e597762..760fa55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "gnucobol-debug", - "displayName": "COBOL debugger", + "name": "superbol-vscode-debug", + "displayName": "Superbol debugger", "description": "Debug or execute COBOL code. No mainframe required.", "keywords": [ "cobol", @@ -10,7 +10,17 @@ "code coverage" ], "version": "2.31.37", - "publisher": "OlegKunitsyn", + "publisher": "OCamlPro SAS", + "contributors": [ + { + "name": "Emilien Lemaire", + "email": "emilien.lemaire@ocamlpro.com" + }, + { + "name": "Olegs Kunicins", + "email": "olegs.kunicins@gmail.com" + } + ], "license": "GPL-3.0", "icon": "icon.png", "engines": { @@ -18,16 +28,14 @@ }, "main": "./out/src/extension", "activationEvents": [ - "onDebugResolve", - "onCommand:gnucobol-debug.dockerStart", - "onCommand:gnucobol-debug.dockerStop" + "onDebugResolve" ], "categories": [ "Debuggers" ], "repository": { "type": "git", - "url": "https://github.com/OlegKunitsyn/gnucobol-debug.git" + "url": "https://github.com/OCamlPro/superbol-vscode-debug.git" }, "capabilities": { "untrustedWorkspaces": { @@ -35,39 +43,15 @@ } }, "contributes": { - "commands": [ - { - "command": "gnucobol-debug.dockerStart", - "title": "GnuCOBOL Docker: start" - }, - { - "command": "gnucobol-debug.dockerStop", - "title": "GnuCOBOL Docker: stop" - } - ], "breakpoints": [ { "language": "cobol" - }, - { - "language": "COBOL" - }, - { - "language": "ACUCOBOL" - }, - { - "language": "OpenCOBOL" - }, - { - "language": "GnuCOBOL" - }, - { - "language": "entcobol" } ], "debuggers": [ { "type": "gdb", + "languages": ["cobol", "COBOL"], "program": "./out/src/gdb.js", "runtime": "node", "label": "COBOL debugger", @@ -95,11 +79,6 @@ "description": "Path to gdb", "default": "gdb" }, - "docker": { - "type": "string", - "description": "Docker image", - "default": "olegkunitsyn/gnucobol:3.1-dev" - }, "cobcpath": { "type": "string", "description": "Path to cobc", @@ -201,7 +180,7 @@ }, "initialConfigurations": [ { - "name": "COBOL debugger", + "name": "Superbol debugger", "type": "gdb", "request": "launch", "cobcargs": [ @@ -209,59 +188,69 @@ "-x" ], "coverage": true + } + ], + "configurationSnippets": [ + { + "label": "Superbol: debug launch", + "description": "New Superbol launch request", + "body": { + "type": "gdb", + "request": "launch", + "name": "${2: Superbol debugger}" + } }, { - "name": "COBOL debugger attach local", - "type": "gdb", - "request": "attach", - "cobcargs": [ - "-free", - "-x" - ], - "pid": "${input:pid}" + "label": "Superbol: debug attach local", + "description": "New Superbol attach local request", + "body": { + "type": "gdb", + "request": "attach", + "name": "${2: Superbol debugger}", + "pid": "${3:0}" + } }, { - "name": "COBOL debugger attach remote", - "type": "gdb", - "request": "attach", - "cobcargs": [ - "-free", - "-x" - ], - "remoteDebugger": "${input:remoteDebugger}" + "label": "Superbol: debug attach remote", + "description": "New Superbol attach remote request", + "body": { + "type": "gdb", + "request": "attach", + "name": "${2: Superbol debugger}", + "remoteDebugger": "${3:host:port}" + } } ] } ], "configuration": { - "type": "object", - "title": "COBOL Debugger", + "title": "Superbol Debugger", "properties": { - "Cobol_Debugger.display_variable_attributes": { + "superbol_debugger.display_variable_attributes": { "type": "boolean", "default": false, "description": "Displaying Data Storages and Fields attributes(e.g. size of Alphanumerics or digits and scale of numerics).", "scope": "resource" }, - "Cobol_Debugger.cwd": { + "superbol_debugger.cwd": { "type": "string", "default": "${workspaceRoot}", "description": "Path to project", "scope": "application" }, - "Cobol_Debugger.target": { + "superbol_debugger.target": { "type": "string", "description": "Path to source code", "default": "${file}", "scope": "application" }, - "Cobol_Debugger.gdbpath": { + "superbol_debugger.gdbpath": { "type": "string", "description": "Path to gdb", "default": "gdb", "scope": "application" }, - "Cobol_Debugger.cobcpath": { + "superbol_debugger.cobcpath": { "type": "string", "description": "Path to cobc", "default": "cobc", @@ -277,18 +266,20 @@ "test": "mocha -u tdd ./out/test/" }, "devDependencies": { - "@types/node": "^13.13.0", - "@types/mocha": "^5.2.7", + "@types/mocha": "^10.0.1", + "@types/node": "^20.3.2", "@types/vscode": "^1.44.0", - "typescript": "^3.8.3", - "mocha": "^6.2.0", - "vscode-debugadapter-testsupport": "^1.40.3", - "tslint": "^5.18.0" + "@typescript-eslint/eslint-plugin": "^5.60.1", + "@typescript-eslint/parser": "^5.60.1", + "eslint": "^8.43.0", + "eslint_d": "^12.2.1", + "mocha": "^10.2.0", + "typescript": "^5.1.6", + "vscode-debugadapter-testsupport": "^1.40.3" }, "dependencies": { - "gcov-parse": "^1.0.1", - "n-readlines": "^1.0.0", - "vscode-debugadapter": "^1.40.0", - "vscode-debugprotocol": "^1.40.0" + "@vscode/debugadapter": "^1.40.0", + "@vscode/debugprotocol": "^1.40.0", + "n-readlines": "^1.0.0" } } diff --git a/src/coverage.ts b/src/coverage.ts index 62330d2..90469a1 100644 --- a/src/coverage.ts +++ b/src/coverage.ts @@ -14,11 +14,11 @@ import { import * as os from "os"; import * as nativePath from "path"; import * as ChildProcess from "child_process"; -import {SourceMap} from "./parser.c"; -import * as gcov from "gcov-parse"; +import { SourceMap } from "./parser.c"; +import { GcovData, loadGcovData } from "./gcov"; export class CoverageStatus implements Disposable { - private coverages: gcov.Coverage[] = []; + private coverages: GcovData[] = []; private sourceMap: SourceMap; private statusBar: StatusBarItem = window.createStatusBarItem(StatusBarAlignment.Right, 100); readonly RED: TextEditorDecorationType = window.createTextEditorDecorationType({ @@ -55,19 +55,10 @@ export class CoverageStatus implements Disposable { this.statusBar.command = this.COMMAND; } - public show(gcovFiles: string[], sourceMap: SourceMap, docker: string = undefined) { - if (docker !== undefined) { - for (let i = 0; i < gcovFiles.length; i++) { - const localPath = nativePath.resolve(os.tmpdir(), nativePath.basename(gcovFiles[i])); - ChildProcess.spawnSync('docker', ['cp', `gnucobol:${gcovFiles[i]}.gcda`, `${localPath}.gcda`]); - ChildProcess.spawnSync('docker', ['cp', `gnucobol:${gcovFiles[i]}.gcno`, `${localPath}.gcno`]); - gcovFiles[i] = localPath; - } - } - - this.coverages = gcov.parse(gcovFiles); - this.sourceMap = sourceMap; - this.updateStatus(); + public async show(cFiles: string[], sourceMap: SourceMap) { + this.coverages = await loadGcovData(cFiles); + this.sourceMap = sourceMap; + this.updateStatus(); } public dispose() { @@ -83,20 +74,22 @@ export class CoverageStatus implements Disposable { const red: Range[] = []; const green: Range[] = []; for (const coverage of this.coverages) { - for (const line of coverage.lines) { - if (this.sourceMap.hasLineCobol(coverage.file, line.line)) { - const map = this.sourceMap.getLineCobol(coverage.file, line.line); + for (const file of coverage.files) { + for (const line of file.lines) { + if (this.sourceMap.hasLineCobol(file.file, line.line_number)) { + const map = this.sourceMap.getLineCobol(file.file, line.line_number); if (editor.document.uri.fsPath !== map.fileCobol) { continue; } const range = new Range(map.lineCobol - 1, 0, map.lineCobol - 1, Number.MAX_VALUE); - if (line.executed) { + if (line.count > 0) { green.push(range); } else { red.push(range); } } } + } } if (red.length === 0 || !this.highlight) { editor.setDecorations(this.RED, []); diff --git a/src/extension.ts b/src/extension.ts index 947b83a..1042d2a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3,71 +3,24 @@ import {GDBDebugSession} from "./gdb"; import {CoverageStatus} from './coverage'; import {DebuggerSettings} from "./settings"; -const dockerTerminal = vscode.window.createTerminal("GnuCOBOL Docker"); -const dockerMessage = "Property 'docker' is not defined in launch.json"; export function activate(context: vscode.ExtensionContext) { - const dockerStart = vscode.commands.registerCommand('gnucobol-debug.dockerStart', function () { - let config: vscode.DebugConfiguration; - let workspaceRoot: string = vscode.workspace.workspaceFolders[0].uri.fsPath; - for (config of vscode.workspace.getConfiguration('launch', vscode.workspace.workspaceFolders[0].uri).get('configurations') as []) { - if (config.type !== 'gdb') { - continue; - } - if (config.docker === undefined) { - vscode.window.showInformationMessage(dockerMessage); - break; - } - if (process.platform === "win32") { - workspaceRoot = workspaceRoot - .replace(/.*:/, s => "/" + s.toLowerCase().replace(":", "")) - .replace(/\\/g, "/"); - } - vscode.workspace.workspaceFolders[0].uri.fsPath - .replace(/.*:/, s => "/" + s.toLowerCase().replace(":", "")).replace(/\\/g, "/"); - dockerTerminal.show(true); - dockerTerminal.sendText(`docker run -d -i --name gnucobol -w ${workspaceRoot} -v ${workspaceRoot}:${workspaceRoot} ${config.docker}`); - break; - } - }); - - const dockerStop = vscode.commands.registerCommand('gnucobol-debug.dockerStop', function () { - let config: vscode.DebugConfiguration; - for (config of vscode.workspace.getConfiguration('launch', vscode.workspace.workspaceFolders[0].uri).get('configurations') as []) { - if (config.type !== 'gdb') { - continue; - } - if (config.docker === undefined) { - vscode.window.showInformationMessage(dockerMessage); - break; - } - dockerTerminal.show(true); - dockerTerminal.sendText(`docker rm --force gnucobol`); - break; - } - }); - context.subscriptions.push( - dockerStart, - dockerStop, vscode.debug.registerDebugConfigurationProvider('gdb', new GdbConfigurationProvider()), - vscode.debug.registerDebugAdapterDescriptorFactory('gdb', new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession())), - ); -} - -export function deactivate() { - dockerTerminal.dispose(); + vscode.debug. + registerDebugAdapterDescriptorFactory( + 'gdb', + new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession()))); } class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { - resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult { + resolveDebugConfiguration( + _folder: vscode.WorkspaceFolder | undefined, + config: vscode.DebugConfiguration, + _token?: vscode.CancellationToken): + vscode.ProviderResult + { config.gdbargs = ["-q", "--interpreter=mi2"]; - if (config.docker !== undefined) { - config.cobcpath = 'docker'; - config.gdbpath = 'docker'; - config.cobcargs = ['exec', '-i', 'gnucobol', 'cobc'].concat(config.cobcargs); - config.gdbargs = ['exec', '-i', 'gnucobol', 'gdb'].concat(config.gdbargs); - } const settings = new DebuggerSettings(); if (config.cwd === undefined) { config.cwd = settings.cwd; @@ -89,13 +42,57 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { } return config; } + + provideDebugConfigurations( + _folder: vscode.WorkspaceFolder, + _token?: vscode.CancellationToken): + vscode.ProviderResult { + const launchConfigDefault: vscode.DebugConfiguration = { + name: "Superbol debugger", + type: "gdb", + request: "launch", + cobcargs: [ + "-free", + "-x" + ], + coverage: true + }; + + const attachLocalConfiguration: vscode.DebugConfiguration = { + name: "Superbol debugger attach local", + type: "gdb", + request: "attach", + cobcargs: [ + "-free", + "-x" + ], + pid: "${input:pid}" + }; + + const attachRemoteConfiguration: vscode.DebugConfiguration = { + name: "Superbol debugger attach remote", + type: "gdb", + request: "attach", + cobcargs: [ + "-free", + "-x" + ], + remoteDebugger: "${input:remoteDebugger}" + } + + return [ + launchConfigDefault, + attachLocalConfiguration, + attachRemoteConfiguration + ]; + } } class GdbAdapterDescriptorFactory implements vscode.DebugAdapterDescriptorFactory { constructor(public coverageBar: CoverageStatus, public debugSession: GDBDebugSession) { } - createDebugAdapterDescriptor(session: vscode.DebugSession): vscode.ProviderResult { + createDebugAdapterDescriptor(_session: vscode.DebugSession): vscode.ProviderResult { this.debugSession.coverageStatus = this.coverageBar; return new vscode.DebugAdapterInlineImplementation(this.debugSession); } diff --git a/src/gcov.ts b/src/gcov.ts new file mode 100644 index 0000000..8a374b3 --- /dev/null +++ b/src/gcov.ts @@ -0,0 +1,98 @@ +import * as vscode from "vscode"; +import * as child_process from "child_process"; + +export interface GcovLineData { + count: number; + function_name: string; + line_number: number; + unexecuted_block: boolean; +} + +export interface GcovFunctionData { + blocks: number; + blocks_executed: number; + demangled_name: string; + start_column: number; + start_line: number; + end_column: number; + end_line: number; + execution_count: number; + name: string; +} + +export interface GcovFileData { + file: string; + lines: GcovLineData[]; + functions: GcovFunctionData[]; +} + +export interface GcovData { + files: GcovFileData[]; + current_working_directory: string; + data_file: string; +} + +function getGcovBinary() { + return "gcov"; +} + +export async function isGcovCompatible() { + const gcovBinary = getGcovBinary(); + const command = `${gcovBinary} --help`; + return new Promise((resolve, _reject) => { + child_process.exec(command, (err, stdout, _stderr) => { + if (err) { + void vscode.window.showErrorMessage( + `Error while trying to run gcov, try to change the "Gcov Binary" setting. ${err.message}` + ); + resolve(false); + return; + } + const gcovOutput = stdout.toString(); + const supportsRequiredArgs = + gcovOutput.includes("--json-format") && gcovOutput.includes("--stdout"); + if (!supportsRequiredArgs) { + void vscode.window.showErrorMessage( + `The gcov version is not compatible. Please use at least version 9.` + ); + } + resolve(supportsRequiredArgs); + }); + }); +} + +export async function loadGcovData(paths: string[]): Promise { + if (paths.length === 0) { + return []; + } + + const gcovBinary = getGcovBinary(); + + let command = `${gcovBinary} --stdout --json-format`; + for (const path of paths) { + command += ` "${path}"`; + } + return new Promise((resolve, reject) => { + child_process.exec( + command, + { maxBuffer: 256 * 1024 * 1024 }, + (err, stdout, _stderr) => { + if (err) { + console.error(`exec error: ${err.message}`); + reject(); + return; + } + const gcovOutput = stdout.toString(); + const output = []; + const parts = gcovOutput.split("\n"); + for (const part of parts) { + if (part.length === 0) { + continue; + } + output.push(JSON.parse(part)); + } + resolve(output); + } + ); + }); +} diff --git a/src/gdb.ts b/src/gdb.ts index eb8ca1d..27525ca 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -1,597 +1,726 @@ -import * as DebugAdapter from 'vscode-debugadapter'; +import * as DebugAdapter from '@vscode/debugadapter'; import { - DebugSession, - Handles, - InitializedEvent, - OutputEvent, - Scope, - Source, - StackFrame, - StoppedEvent, - TerminatedEvent, - Thread, - ThreadEvent -} from 'vscode-debugadapter'; -import {DebugProtocol} from 'vscode-debugprotocol'; -import {VariableObject} from './debugger'; -import {MINode} from './parser.mi2'; -import {MI2} from './mi2'; -import {CoverageStatus} from './coverage'; -import {DebuggerSettings} from './settings'; + DebugSession, + Handles, + InitializedEvent, + OutputEvent, + Scope, + Source, + StackFrame, + StoppedEvent, + TerminatedEvent, + Thread, + ThreadEvent +} from '@vscode/debugadapter'; +import { DebugProtocol } from 'vscode-debugprotocol'; +import { Breakpoint, VariableObject } from './debugger'; +import { MINode } from './parser.mi2'; +import { MI2 } from './mi2'; +import { CoverageStatus } from './coverage'; +import { DebuggerSettings } from './settings'; const STACK_HANDLES_START = 1000; const VAR_HANDLES_START = 512 * 256 + 1000; class ExtendedVariable { - constructor(public name, public options) { - } + constructor(public _name: string, public _options: unknown) { + } } export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments { - cwd: string; - target: string; - arguments: string; - gdbpath: string; - gdbargs: string[]; - cobcpath: string; - cobcargs: string[]; - env: any; - group: string[]; - verbose: boolean; - coverage: boolean; - docker: string; + cwd: string; + target: string; + arguments: string; + gdbpath: string; + gdbargs: string[]; + cobcpath: string; + cobcargs: string[]; + env: NodeJS.ProcessEnv; + group: string[]; + verbose: boolean; + coverage: boolean; } export interface AttachRequestArguments extends DebugProtocol.LaunchRequestArguments { - cwd: string; - target: string; - arguments: string; - gdbpath: string; - gdbargs: string[]; - cobcpath: string; - cobcargs: string[]; - env: any; - group: string[]; - verbose: boolean; - pid: string; - remoteDebugger: string; + cwd: string; + target: string; + arguments: string; + gdbpath: string; + gdbargs: string[]; + cobcpath: string; + cobcargs: string[]; + env: NodeJS.ProcessEnv; + group: string[]; + verbose: boolean; + pid: string; + remoteDebugger: string; } export class GDBDebugSession extends DebugSession { - protected variableHandles = new Handles(VAR_HANDLES_START); - protected variableHandlesReverse: { [id: string]: number } = {}; - protected useVarObjects: boolean; - protected quit: boolean; - protected needContinue: boolean; - protected started: boolean; - protected attached: boolean; - protected crashed: boolean; - protected debugReady: boolean; - protected miDebugger: MI2; - coverageStatus: CoverageStatus; - private docker: string; - private showVariableDetails: boolean; - private settings = new DebuggerSettings(); - - protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void { - response.body.supportsSetVariable = true; + protected variableHandles = + new Handles(VAR_HANDLES_START); + protected variableHandlesReverse: { [id: string]: number } = {}; + protected useVarObjects: boolean; + protected quit: boolean; + protected needContinue: boolean; + protected started: boolean; + protected attached: boolean; + protected crashed: boolean; + protected debugReady: boolean; + protected miDebugger: MI2; + coverageStatus: CoverageStatus; + private showVariableDetails: boolean; + private settings = new DebuggerSettings(); + + protected initializeRequest( + response: DebugProtocol.InitializeResponse, + _args: DebugProtocol.InitializeRequestArguments): + void + { + response.body.supportsSetVariable = true; + this.sendResponse(response); + } + + protected launchRequest( + response: DebugProtocol.LaunchResponse, + args: LaunchRequestArguments): + void + { + if (!args.coverage) { + this.coverageStatus = undefined; + } + this.started = false; + this.attached = false; + + this.miDebugger = + new MI2( + args.gdbpath, + args.gdbargs, + args.cobcpath, + args.cobcargs, + args.env, + args.verbose, + args.noDebug); + this.miDebugger.on("launcherror", (err: Error) => this.launchError(err)); + this.miDebugger.on("quit", () => this.quitEvent()); + this.miDebugger.on("exited-normally", () => this.quitEvent()); + this.miDebugger.on("stopped", (info: MINode) => this.stopEvent(info)); + this.miDebugger.on("msg", (type: string, message: string) => this.handleMsg(type, message)); + this.miDebugger.on("breakpoint", (info: MINode) => this.handleBreakpoint(info)); + this.miDebugger.on("step-end", (info?: MINode) => this.handleBreak(info)); + this.miDebugger.on("step-out-end", (info?: MINode) => this.handleBreak(info)); + this.miDebugger.on("step-other", (info?: MINode) => this.handleBreak(info)); + this.miDebugger.on("signal-stop", (info: MINode) => this.handlePause(info)); + this.miDebugger.on("thread-created", (info: MINode) => this.threadCreatedEvent(info)); + this.miDebugger.on("thread-exited", (info: MINode) => this.threadExitedEvent(info)); + this.sendEvent(new InitializedEvent()); + this.quit = false; + this.needContinue = false; + this.crashed = false; + this.debugReady = false; + this.useVarObjects = false; + this.miDebugger.load(args.cwd, args.target, args.arguments, args.group).then( + /*onfulfilled:*/ () => { + setTimeout(() => { + this.miDebugger.emit("ui-break-done"); + }, 50); this.sendResponse(response); - } - - protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { - if (!args.coverage) { - this.coverageStatus = undefined; - } - this.docker = args.docker; - this.started = false; - this.attached = false; - - this.miDebugger = new MI2(args.gdbpath, args.gdbargs, args.cobcpath, args.cobcargs, args.env, args.verbose, args.noDebug); - this.miDebugger.on("launcherror", this.launchError.bind(this)); - this.miDebugger.on("quit", this.quitEvent.bind(this)); - this.miDebugger.on("exited-normally", this.quitEvent.bind(this)); - this.miDebugger.on("stopped", this.stopEvent.bind(this)); - this.miDebugger.on("msg", this.handleMsg.bind(this)); - this.miDebugger.on("breakpoint", this.handleBreakpoint.bind(this)); - this.miDebugger.on("step-end", this.handleBreak.bind(this)); - this.miDebugger.on("step-out-end", this.handleBreak.bind(this)); - this.miDebugger.on("step-other", this.handleBreak.bind(this)); - this.miDebugger.on("signal-stop", this.handlePause.bind(this)); - this.miDebugger.on("thread-created", this.threadCreatedEvent.bind(this)); - this.miDebugger.on("thread-exited", this.threadExitedEvent.bind(this)); - this.sendEvent(new InitializedEvent()); - this.quit = false; - this.needContinue = false; - this.crashed = false; - this.debugReady = false; - this.useVarObjects = false; - this.miDebugger.load(args.cwd, args.target, args.arguments, args.group).then(() => { - setTimeout(() => { - this.miDebugger.emit("ui-break-done"); - }, 50); - this.sendResponse(response); - this.miDebugger.start().then(() => { - this.started = true; - if (this.crashed) - this.handlePause(undefined); - }, err => { - this.sendErrorResponse(response, 100, `Failed to start MI Debugger: ${err.toString()}`); - }); - }, err => { - this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`); + this.miDebugger.start().then(() => { + this.started = true; + if (this.crashed) + this.handlePause(undefined); + }, + (err: Error) => { + this.sendErrorResponse(response, 100, `Failed to start MI Debugger: ${err.toString()}`); }); - } - - protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { - if (!args.pid && !args.remoteDebugger) { - this.sendErrorResponse(response, 100, `Failed to start MI Debugger: pid or remoteDebugger is mandatory`); - return; - } - - this.coverageStatus = undefined; - this.attached = true; - this.started = false; - - this.miDebugger = new MI2(args.gdbpath, args.gdbargs, args.cobcpath, args.cobcargs, args.env, args.verbose, false); - this.miDebugger.on("launcherror", this.launchError.bind(this)); - this.miDebugger.on("quit", this.quitEvent.bind(this)); - this.miDebugger.on("exited-normally", this.quitEvent.bind(this)); - this.miDebugger.on("stopped", this.stopEvent.bind(this)); - this.miDebugger.on("msg", this.handleMsg.bind(this)); - this.miDebugger.on("breakpoint", this.handleBreakpoint.bind(this)); - this.miDebugger.on("step-end", this.handleBreak.bind(this)); - this.miDebugger.on("step-out-end", this.handleBreak.bind(this)); - this.miDebugger.on("step-other", this.handleBreak.bind(this)); - this.miDebugger.on("signal-stop", this.handlePause.bind(this)); - this.miDebugger.on("thread-created", this.threadCreatedEvent.bind(this)); - this.miDebugger.on("thread-exited", this.threadExitedEvent.bind(this)); - this.sendEvent(new InitializedEvent()); - this.quit = false; - this.needContinue = true; - this.crashed = false; - this.debugReady = false; - this.useVarObjects = false; - this.miDebugger.attach(args.cwd, args.target, args.arguments, args.group).then(() => { - setTimeout(() => { - this.miDebugger.emit("ui-break-done"); - }, 50); - this.sendResponse(response); - this.miDebugger.start(args.pid || args.remoteDebugger).then(() => { - this.attached = true; - if (this.crashed) - this.handlePause(undefined); - }, err => { - this.sendErrorResponse(response, 100, `Failed to start MI Debugger: ${err.toString()}`); - }); - }, err => { - this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`); + }, + /*onrejected:*/ (err: Error) => { + this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`); + }); + } + + protected attachRequest( + response: DebugProtocol.AttachResponse, + args: AttachRequestArguments): + void + { + if (!args.pid && !args.remoteDebugger) { + this.sendErrorResponse( + response, + 100, + `Failed to start MI Debugger: pid or remoteDebugger is mandatory`); + return; + } + + this.coverageStatus = undefined; + this.attached = true; + this.started = false; + + this.miDebugger = new MI2( + args.gdbpath, + args.gdbargs, + args.cobcpath, + args.cobcargs, + args.env, + args.verbose, + false); + this.miDebugger.on("launcherror", (err: Error) => this.launchError(err)); + this.miDebugger.on("quit", () => this.quitEvent()); + this.miDebugger.on("exited-normally", () => this.quitEvent()); + this.miDebugger.on("stopped", (info: MINode) => this.stopEvent(info)); + this.miDebugger.on("msg", (type: string, message: string) => this.handleMsg(type, message)); + this.miDebugger.on("breakpoint", (info: MINode) => this.handleBreakpoint(info)); + this.miDebugger.on("step-end", (info?: MINode) => this.handleBreak(info)); + this.miDebugger.on("step-out-end", (info?: MINode) => this.handleBreak(info)); + this.miDebugger.on("step-other", (info?: MINode) => this.handleBreak(info)); + this.miDebugger.on("signal-stop", (info: MINode) => this.handlePause(info)); + this.miDebugger.on("thread-created", (info: MINode) => this.threadCreatedEvent(info)); + this.miDebugger.on("thread-exited", (info: MINode) => this.threadExitedEvent(info)); + this.sendEvent(new InitializedEvent()); + this.quit = false; + this.needContinue = true; + this.crashed = false; + this.debugReady = false; + this.useVarObjects = false; + this.miDebugger.attach(args.cwd, args.target, args.arguments, args.group).then( + () => { + setTimeout(() => { + this.miDebugger.emit("ui-break-done"); + }, 50); + this.sendResponse(response); + this.miDebugger.start(args.pid || args.remoteDebugger).then(() => { + this.attached = true; + if (this.crashed) + this.handlePause(undefined); + }, + (err: Error) => { + this.sendErrorResponse(response, 100, `Failed to start MI Debugger: ${err.toString()}`); }); - } - - protected handleMsg(type: string, msg: string) { - if (type == "target") - type = "stdout"; - if (type == "log") - type = "stderr"; - this.sendEvent(new OutputEvent(msg, type)); - } - - protected handleBreakpoint(info: MINode) { - const event = new StoppedEvent("breakpoint", parseInt(info.record("thread-id"))); - (event as DebugProtocol.StoppedEvent).body.allThreadsStopped = info.record("stopped-threads") == "all"; - this.sendEvent(event); - } - - protected handleBreak(info?: MINode) { - const event = new StoppedEvent("step", info ? parseInt(info.record("thread-id")) : 1); - (event as DebugProtocol.StoppedEvent).body.allThreadsStopped = info ? info.record("stopped-threads") == "all" : true; - this.sendEvent(event); - } - - protected handlePause(info: MINode) { - const event = new StoppedEvent("user request", parseInt(info.record("thread-id"))); - (event as DebugProtocol.StoppedEvent).body.allThreadsStopped = info.record("stopped-threads") == "all"; - this.sendEvent(event); - } - - protected stopEvent(info: MINode) { - if (!this.started) - this.crashed = true; - if (!this.quit) { - const event = new StoppedEvent("exception", parseInt(info.record("thread-id"))); - (event as DebugProtocol.StoppedEvent).body.allThreadsStopped = info.record("stopped-threads") == "all"; - this.sendEvent(event); + }, + (err: Error) => { + this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`); + }); + } + + protected handleMsg(type: string, msg: string) { + if (type == "target") + type = "stdout"; + if (type == "log") + type = "stderr"; + this.sendEvent(new OutputEvent(msg, type)); + } + + protected handleBreakpoint(info: MINode) { + const event = new StoppedEvent("breakpoint", parseInt(info.record("thread-id"))); + (event).body.allThreadsStopped = + info.record("stopped-threads") == "all"; + this.sendEvent(event); + } + + protected handleBreak(info?: MINode) { + const event = new StoppedEvent("step", info ? parseInt(info.record("thread-id")) : 1); + (event).body.allThreadsStopped = + info ? info.record("stopped-threads") == "all" : true; + this.sendEvent(event); + } + + protected handlePause(info: MINode) { + const event = new StoppedEvent("user request", parseInt(info.record("thread-id"))); + (event).body.allThreadsStopped = + info.record("stopped-threads") == "all"; + this.sendEvent(event); + } + + protected stopEvent(info: MINode) { + if (!this.started) + this.crashed = true; + if (!this.quit) { + const event = new StoppedEvent("exception", parseInt(info.record("thread-id"))); + (event).body.allThreadsStopped = + info.record("stopped-threads") == "all"; + this.sendEvent(event); + } + } + + protected threadCreatedEvent(info: MINode) { + this.sendEvent(new ThreadEvent("started", info.record("id"))); + } + + protected threadExitedEvent(info: MINode) { + this.sendEvent(new ThreadEvent("exited", info.record("id"))); + } + + protected quitEvent() { + if (this.quit) + return; + + if (this.coverageStatus !== undefined) { + this.coverageStatus.show( + this.miDebugger.getGcovFiles(), + this.miDebugger.getSourceMap()).catch( + (err: Error) => console.log(err)); + } + + this.quit = true; + this.sendEvent(new TerminatedEvent()); + } + + protected launchError(err: Error) { + this.handleMsg("stderr", "Could not start debugger process\n"); + this.handleMsg("stderr", err.toString() + "\n"); + this.quitEvent(); + } + + protected disconnectRequest( + response: DebugProtocol.DisconnectResponse, + _args: DebugProtocol.DisconnectArguments): + void + { + if (this.attached) + this.miDebugger.detach(); + else + this.miDebugger.stop(); + this.sendResponse(response); + } + + protected async setVariableRequest( + response: DebugProtocol.SetVariableResponse, + args: DebugProtocol.SetVariableArguments): + Promise + { + try { + let id: number | string | VariableObject | ExtendedVariable; + if (args.variablesReference < VAR_HANDLES_START) { + id = args.variablesReference - STACK_HANDLES_START; + } else { + id = this.variableHandles.get(args.variablesReference); + } + + let name = args.name; + if (typeof id == "string") { + name = `${id}.${args.name}`; + if (this.showVariableDetails && args.name === "value") { + name = id; } - } - - protected threadCreatedEvent(info: MINode) { - this.sendEvent(new ThreadEvent("started", info.record("id"))); - } - - protected threadExitedEvent(info: MINode) { - this.sendEvent(new ThreadEvent("exited", info.record("id"))); - } - - protected quitEvent() { - if (this.quit) - return; - - if (this.coverageStatus !== undefined) { - this.coverageStatus.show(this.miDebugger.getGcovFiles(), this.miDebugger.getSourceMap(), this.docker); + } + if (!this.showVariableDetails || args.name === "value") { + await this.miDebugger.changeVariable(name, args.value); + response.body = { + value: args.value + }; + } + this.sendResponse(response); + } catch (err) { + this.sendErrorResponse(response, 11, `Could not continue: ${err}`); + } + } + + protected setFunctionBreakPointsRequest( + response: DebugProtocol.SetFunctionBreakpointsResponse, + args: DebugProtocol.SetFunctionBreakpointsArguments): + void + { + const cb = () => { + this.debugReady = true; + const all: Thenable<[boolean, Breakpoint]>[] = []; + args.breakpoints.forEach(brk => { + all.push(this.miDebugger.addBreakPoint({ + raw: brk.name, + condition: brk.condition, + countCondition: brk.hitCondition + })); + }); + Promise.all(all).then(brkpoints => { + const finalBrks: DebugProtocol.Breakpoint[] = []; + brkpoints.forEach(brkp => { + if (brkp[0]) + finalBrks.push({ line: brkp[1].line, verified: brkp[0] }); + }); + response.body = { + breakpoints: finalBrks + }; + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 10, msg.toString()); + }); + }; + if (this.debugReady) + cb(); + else + this.miDebugger.once("debug-ready", cb); + } + + protected setBreakPointsRequest( + response: DebugProtocol.SetBreakpointsResponse, + args: DebugProtocol.SetBreakpointsArguments): + void + { + const cb = () => { + this.debugReady = true; + this.miDebugger.clearBreakPoints().then(() => { + const path = args.source.path; + const all = args.breakpoints.map(brk => { + return this.miDebugger.addBreakPoint({ + file: path, + line: brk.line, + condition: brk.condition, + countCondition: brk.hitCondition + }); + }); + Promise.all(all).then(brkpoints => { + const finalBrks: DebugAdapter.Breakpoint[] = []; + brkpoints.forEach(brkp => { + if (brkp[0]) + finalBrks.push(new DebugAdapter.Breakpoint(true, brkp[1].line)); + }); + response.body = { + breakpoints: finalBrks + }; + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 9, msg.toString()); + }); + }, + (msg: Error) => { + this.sendErrorResponse(response, 9, msg.toString()); + }); + }; + if (this.debugReady) + cb(); + else + this.miDebugger.once("debug-ready", cb); + } + + protected threadsRequest(response: DebugProtocol.ThreadsResponse): void { + if (!this.miDebugger) { + this.sendResponse(response); + return; + } + this.miDebugger.getThreads().then( + threads => { + response.body = { + threads: [] + }; + for (const thread of threads) { + let threadName = thread.name; + if (threadName === undefined) { + threadName = thread.targetId; + } + if (threadName === undefined) { + threadName = ""; + } + response.body.threads.push( + new Thread(thread.id, thread.id.toString() + ":" + threadName)); } - - this.quit = true; - this.sendEvent(new TerminatedEvent()); - } - - protected launchError(err: any) { - this.handleMsg("stderr", "Could not start debugger process\n"); - this.handleMsg("stderr", err.toString() + "\n"); - this.quitEvent(); - } - - protected disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): void { - if (this.attached) - this.miDebugger.detach(); - else - this.miDebugger.stop(); this.sendResponse(response); - } - - protected async setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): Promise { - try { - let id: number | string | VariableObject | ExtendedVariable; - if (args.variablesReference < VAR_HANDLES_START) { - id = args.variablesReference - STACK_HANDLES_START; - } else { - id = this.variableHandles.get(args.variablesReference); - } - - let name = args.name; - if (typeof id == "string") { - name = `${id}.${args.name}`; - if (this.showVariableDetails && args.name === "value") { - name = id; - } - } - if (!this.showVariableDetails || args.name === "value") { - await this.miDebugger.changeVariable(name, args.value); - response.body = { - value: args.value - }; - } - this.sendResponse(response); - } catch (err) { - this.sendErrorResponse(response, 11, `Could not continue: ${err}`); + }, + (err: Error) => { + this.sendErrorResponse(response, 13, `Could not get threads: ${err.toString()}`) + }); + } + + // Supports 256 threads. + protected threadAndLevelToFrameId(threadId: number, level: number) { + return level << 8 | threadId; + } + + protected frameIdToThreadAndLevel(frameId: number) { + return [frameId & 0xff, frameId >> 8]; + } + + protected stackTraceRequest( + response: DebugProtocol.StackTraceResponse, + args: DebugProtocol.StackTraceArguments): + void + { + this.miDebugger.getStack(args.levels, args.threadId).then( + stack => { + const ret: StackFrame[] = []; + stack.forEach(element => { + let source: Source = undefined; + const file = element.file; + if (file) { + source = new Source(element.fileName, file); } - } - - protected setFunctionBreakPointsRequest(response: DebugProtocol.SetFunctionBreakpointsResponse, args: DebugProtocol.SetFunctionBreakpointsArguments): void { - const cb = (() => { - this.debugReady = true; - const all = []; - args.breakpoints.forEach(brk => { - all.push(this.miDebugger.addBreakPoint({ - raw: brk.name, - condition: brk.condition, - countCondition: brk.hitCondition - })); - }); - Promise.all(all).then(brkpoints => { - const finalBrks = []; - brkpoints.forEach(brkp => { - if (brkp[0]) - finalBrks.push({line: brkp[1].line}); - }); - response.body = { - breakpoints: finalBrks - }; - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 10, msg.toString()); - }); - }).bind(this); - if (this.debugReady) - cb(); - else - this.miDebugger.once("debug-ready", cb); - } - protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void { - const cb = (() => { - this.debugReady = true; - this.miDebugger.clearBreakPoints().then(() => { - const path = args.source.path; - const all = args.breakpoints.map(brk => { - return this.miDebugger.addBreakPoint({ - file: path, - line: brk.line, - condition: brk.condition, - countCondition: brk.hitCondition - }); - }); - Promise.all(all).then(brkpoints => { - const finalBrks = []; - brkpoints.forEach(brkp => { - if (brkp[0]) - finalBrks.push(new DebugAdapter.Breakpoint(true, brkp[1].line)); - }); - response.body = { - breakpoints: finalBrks - }; - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 9, msg.toString()); - }); - }, msg => { - this.sendErrorResponse(response, 9, msg.toString()); - }); - }).bind(this); - if (this.debugReady) - cb(); - else - this.miDebugger.once("debug-ready", cb); - } - - protected threadsRequest(response: DebugProtocol.ThreadsResponse): void { - if (!this.miDebugger) { - this.sendResponse(response); - return; + ret.push(new StackFrame( + this.threadAndLevelToFrameId(args.threadId, element.level), + element.function + "@" + element.address, + source, + element.line, + 0)); + }); + response.body = { + stackFrames: ret + }; + this.sendResponse(response); + }, + (err: Error) => { + this.sendErrorResponse(response, 12, `Failed to get Stack Trace: ${err.toString()}`); + }); + } + + protected configurationDoneRequest( + response: DebugProtocol.ConfigurationDoneResponse, + _args: DebugProtocol.ConfigurationDoneArguments): + void + { + if (this.needContinue) { + this.miDebugger.continue().then(_done => { + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 2, `Could not continue: ${msg.toString()}`); + }); + } else + this.sendResponse(response); + } + + protected scopesRequest( + response: DebugProtocol.ScopesResponse, + args: DebugProtocol.ScopesArguments): + void + { + const scopes = new Array(); + scopes.push(new Scope("Local", STACK_HANDLES_START + (args.frameId || 0), false)); + + response.body = { + scopes: scopes + }; + this.sendResponse(response); + } + + protected async variablesRequest( + response: DebugProtocol.VariablesResponse, + args: DebugProtocol.VariablesArguments): + Promise + { + this.showVariableDetails = this.settings.displayVariableAttributes; + + let id: number | string | VariableObject | ExtendedVariable; + if (args.variablesReference < VAR_HANDLES_START) { + id = args.variablesReference - STACK_HANDLES_START; + } else { + id = this.variableHandles.get(args.variablesReference); + } + + if (typeof id == "number") { + try { + const variables: DebugProtocol.Variable[] = []; + const [threadId, level] = this.frameIdToThreadAndLevel(id); + const stackVariables = await this.miDebugger.getStackVariables(threadId, level); + for (const stackVariable of stackVariables) { + let reference = 0; + if (this.showVariableDetails || !!stackVariable.children.size) { + reference = this.variableHandles.create(stackVariable.cobolName); + } + + let value = stackVariable.value || "null"; + if (this.showVariableDetails) { + value = stackVariable.displayableType; + } + + variables.push({ + name: stackVariable.cobolName, + evaluateName: stackVariable.cobolName, + value: value, + type: stackVariable.displayableType, + variablesReference: reference + }); } - this.miDebugger.getThreads().then( - threads => { - response.body = { - threads: [] - }; - for (const thread of threads) { - let threadName = thread.name; - if (threadName === undefined) { - threadName = thread.targetId; - } - if (threadName === undefined) { - threadName = ""; - } - response.body.threads.push(new Thread(thread.id, thread.id + ":" + threadName)); - } - this.sendResponse(response); - }); - } - - // Supports 256 threads. - protected threadAndLevelToFrameId(threadId: number, level: number) { - return level << 8 | threadId; - } - - protected frameIdToThreadAndLevel(frameId: number) { - return [frameId & 0xff, frameId >> 8]; - } - - protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments): void { - this.miDebugger.getStack(args.levels, args.threadId).then(stack => { - const ret: StackFrame[] = []; - stack.forEach(element => { - let source = undefined; - const file = element.file; - if (file) { - source = new Source(element.fileName, file); - } - - ret.push(new StackFrame( - this.threadAndLevelToFrameId(args.threadId, element.level), - element.function + "@" + element.address, - source, - element.line, - 0)); - }); - response.body = { - stackFrames: ret - }; - this.sendResponse(response); - }, err => { - this.sendErrorResponse(response, 12, `Failed to get Stack Trace: ${err.toString()}`); - }); - } - - protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, args: DebugProtocol.ConfigurationDoneArguments): void { - if (this.needContinue) { - this.miDebugger.continue().then(done => { - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 2, `Could not continue: ${msg}`); - }); - } else - this.sendResponse(response); - } - - protected scopesRequest(response: DebugProtocol.ScopesResponse, args: DebugProtocol.ScopesArguments): void { - const scopes = new Array(); - scopes.push(new Scope("Local", STACK_HANDLES_START + (parseInt(args.frameId as any) || 0), false)); response.body = { - scopes: scopes + variables: variables }; this.sendResponse(response); - } - - protected async variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): Promise { - this.showVariableDetails = this.settings.displayVariableAttributes; - - let id: number | string | VariableObject | ExtendedVariable; - if (args.variablesReference < VAR_HANDLES_START) { - id = args.variablesReference - STACK_HANDLES_START; - } else { - id = this.variableHandles.get(args.variablesReference); - } - - if (typeof id == "number") { - try { - const variables: DebugProtocol.Variable[] = []; - const [threadId, level] = this.frameIdToThreadAndLevel(id); - const stackVariables = await this.miDebugger.getStackVariables(threadId, level); - for (const stackVariable of stackVariables) { - let reference = 0; - if (this.showVariableDetails || !!stackVariable.children.size) { - reference = this.variableHandles.create(stackVariable.cobolName); - } - - let value = stackVariable.value || "null"; - if (this.showVariableDetails) { - value = stackVariable.displayableType; - } - - variables.push({ - name: stackVariable.cobolName, - evaluateName: stackVariable.cobolName, - value: value, - type: stackVariable.displayableType, - variablesReference: reference - }); - } - - response.body = { - variables: variables - }; - this.sendResponse(response); - } catch (err) { - this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`); - } - } else if (typeof id == "string") { - try { - // TODO: this evals on an (effectively) unknown thread for multithreaded programs. - const stackVariable = await this.miDebugger.evalCobField(id, 0, 0); - - let variables: DebugProtocol.Variable[] = []; - - if (this.showVariableDetails) { - variables = stackVariable.toDebugProtocolVariable(this.showVariableDetails); - } - - for (const child of stackVariable.children.values()) { - const childId = `${id}.${child.cobolName}`; - let reference = 0; - if (this.showVariableDetails || !!child.children.size) { - reference = this.variableHandles.create(childId); - } - - let value = child.displayableType; - if (!this.showVariableDetails) { - const evaluatedChild = await this.miDebugger.evalCobField(childId, 0, 0); - value = evaluatedChild.value || "null"; - } - - variables.push({ - name: child.cobolName, - evaluateName: child.cobolName, - value: value, - type: child.displayableType, - variablesReference: reference - }); - } - response.body = { - variables: variables - }; - this.sendResponse(response); - } catch (err) { - this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`); - } - } else { - response.body = { - variables: [] - }; - this.sendResponse(response); + } catch (err) { + this.sendErrorResponse( + response, + 1, + `Could not expand variable: ${(err).toString()}`); + } + } else if (typeof id == "string") { + try { + // TODO: this evals on an (effectively) unknown thread for multithreaded programs. + const stackVariable = await this.miDebugger.evalCobField(id, 0, 0); + + let variables: DebugProtocol.Variable[] = []; + + if (this.showVariableDetails) { + variables = stackVariable.toDebugProtocolVariable(this.showVariableDetails); } - } - - protected pauseRequest(response: DebugProtocol.ContinueResponse, args: DebugProtocol.ContinueArguments): void { - this.miDebugger.interrupt().then(done => { - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 3, `Could not pause: ${msg}`); - }); - } - - protected continueRequest(response: DebugProtocol.ContinueResponse, args: DebugProtocol.ContinueArguments): void { - this.miDebugger.continue().then(done => { - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 2, `Could not continue: ${msg}`); - }); - } - - protected stepInRequest(response: DebugProtocol.NextResponse, args: DebugProtocol.NextArguments): void { - this.miDebugger.stepInto().then(done => { - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 4, `Could not step in: ${msg}`); - }); - } - - protected stepOutRequest(response: DebugProtocol.NextResponse, args: DebugProtocol.NextArguments): void { - this.miDebugger.stepOut().then(done => { - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 5, `Could not step out: ${msg}`); - }); - } - - protected nextRequest(response: DebugProtocol.NextResponse, args: DebugProtocol.NextArguments): void { - this.miDebugger.stepOver().then(done => { - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 6, `Could not step over: ${msg}`); - }); - } - protected evaluateRequest(response: DebugProtocol.EvaluateResponse, args: DebugProtocol.EvaluateArguments): void { - const [threadId, level] = this.frameIdToThreadAndLevel(args.frameId); - if (args.context == "watch" || args.context == "variables" || args.context == "hover") { - this.miDebugger.evalExpression(args.expression, threadId, level).then((res) => { - response.body = { - variablesReference: 0, - result: !!res ? res : "not available" - }; - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 7, msg.toString()); - }); - } else { - this.miDebugger.sendUserInput(args.expression, threadId, level).then(output => { - if (typeof output == "undefined") - response.body = { - result: "", - variablesReference: 0 - }; - else - response.body = { - result: JSON.stringify(output), - variablesReference: 0 - }; - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 8, msg.toString()); - }); + for (const child of stackVariable.children.values()) { + const childId = `${id}.${child.cobolName}`; + let reference = 0; + if (this.showVariableDetails || !!child.children.size) { + reference = this.variableHandles.create(childId); + } + + let value = child.displayableType; + if (!this.showVariableDetails) { + const evaluatedChild = await this.miDebugger.evalCobField(childId, 0, 0); + value = evaluatedChild.value || "null"; + } + + variables.push({ + name: child.cobolName, + evaluateName: child.cobolName, + value: value, + type: child.displayableType, + variablesReference: reference + }); } - } - - protected gotoTargetsRequest(response: DebugProtocol.GotoTargetsResponse, args: DebugProtocol.GotoTargetsArguments): void { - this.miDebugger.goto(args.source.path, args.line).then(done => { - response.body = { - targets: [{ - id: 1, - label: args.source.name, - column: args.column, - line: args.line - }] - }; - this.sendResponse(response); - }, msg => { - this.sendErrorResponse(response, 16, `Could not jump: ${msg}`); - }); - } - - protected gotoRequest(response: DebugProtocol.GotoResponse, args: DebugProtocol.GotoArguments): void { + response.body = { + variables: variables + }; this.sendResponse(response); - } + } catch (err) { + this.sendErrorResponse( + response, + 1, + `Could not expand variable: ${(err).toString()}`); + } + } else { + response.body = { + variables: [] + }; + this.sendResponse(response); + } + } + + protected pauseRequest( + response: DebugProtocol.ContinueResponse, + _args: DebugProtocol.ContinueArguments): + void + { + this.miDebugger.interrupt().then(_done => { + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 3, `Could not pause: ${msg.toString()}`); + }); + } + + protected continueRequest( + response: DebugProtocol.ContinueResponse, + _args: DebugProtocol.ContinueArguments): + void + { + this.miDebugger.continue().then(_done => { + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 2, `Could not continue: ${msg.toString()}`); + }); + } + + protected stepInRequest( + response: DebugProtocol.NextResponse, + _args: DebugProtocol.NextArguments): + void + { + this.miDebugger.stepInto().then(_done => { + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 4, `Could not step in: ${msg.toString()}`); + }); + } + + protected stepOutRequest( + response: DebugProtocol.NextResponse, + _args: DebugProtocol.NextArguments): + void + { + this.miDebugger.stepOut().then(_done => { + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 5, `Could not step out: ${msg.toString()}`); + }); + } + + protected nextRequest( + response: DebugProtocol.NextResponse, + _args: DebugProtocol.NextArguments): + void + { + this.miDebugger.stepOver().then(_done => { + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 6, `Could not step over: ${msg.toString()}`); + }); + } + + protected evaluateRequest( + response: DebugProtocol.EvaluateResponse, + args: DebugProtocol.EvaluateArguments): + void + { + const [threadId, level] = this.frameIdToThreadAndLevel(args.frameId); + if (args.context == "watch" || args.context == "variables" || args.context == "hover") { + this.miDebugger.evalExpression(args.expression, threadId, level).then((res) => { + response.body = { + variablesReference: 0, + result: res ? res : "not available" + }; + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 7, msg.toString()); + }); + } else { + this.miDebugger.sendUserInput(args.expression, threadId, level).then(output => { + if (typeof output == "undefined") + response.body = { + result: "", + variablesReference: 0 + }; + else + response.body = { + result: JSON.stringify(output), + variablesReference: 0 + }; + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 8, msg.toString()); + }); + } + } + + protected gotoTargetsRequest( + response: DebugProtocol.GotoTargetsResponse, + args: DebugProtocol.GotoTargetsArguments): + void + { + this.miDebugger.goto(args.source.path, args.line).then(_done => { + response.body = { + targets: [{ + id: 1, + label: args.source.name, + column: args.column, + line: args.line + }] + }; + this.sendResponse(response); + }, + (msg: Error) => { + this.sendErrorResponse(response, 16, `Could not jump: ${msg.toString()}`); + }); + } + + protected gotoRequest( + response: DebugProtocol.GotoResponse, + _args: DebugProtocol.GotoArguments): + void + { + this.sendResponse(response); + } } DebugSession.run(GDBDebugSession); diff --git a/src/mi2.ts b/src/mi2.ts index 1eef1bf..a7f7745 100644 --- a/src/mi2.ts +++ b/src/mi2.ts @@ -2,979 +2,972 @@ import {Breakpoint, IDebugger, MIError, Stack, Thread, DebuggerVariable} from ". import * as ChildProcess from "child_process"; import {EventEmitter} from "events"; import {MINode, parseMI} from './parser.mi2'; -import * as nativePathFromPath from "path"; +import * as path from "path"; import * as fs from "fs"; import {SourceMap} from "./parser.c"; import {parseExpression, cleanRawValue} from "./functions"; -const nativePath = { - resolve: function (...args: string[]): string { - const nat = nativePathFromPath.resolve(...args); - if (process.platform === "win32" && this.cobcpath === "docker" && this.gdbpath === "docker") { - return nat.replace(/.*:/, s => "/" + s.toLowerCase().replace(":", "")).replace(/\\/g, "/"); - } - return nat; - }, - dirname: function (path: string): string { - const nat = nativePathFromPath.dirname(path); - if (process.platform === "win32" && this.cobcpath === "docker" && this.gdbpath === "docker") { - return nat.replace(/.*:/, s => "/" + s.toLowerCase().replace(":", "")).replace(/\\/g, "/"); - } - return nat; - }, - basename: function (path: string): string { - return nativePathFromPath.basename(path); - }, - isAbsolute: function (path: string): boolean { - return nativePathFromPath.isAbsolute(path); - }, - join: function (...args: string[]) { - return nativePathFromPath.join(...args); - }, - normalize: function (path: string) { - return nativePathFromPath.normalize(path); - } -}; - -const nonOutput = /(^(?:\d*|undefined)[\*\+\-\=\~\@\&\^])([^\*\+\-\=\~\@\&\^]{1,})/; +const nonOutput = /(^(?:\d*|undefined)[*+\-=~@&^])([^*+\-=~@&]{1,})/; const gdbRegex = /(?:\d*|undefined)\(gdb\)/; const numRegex = /\d+/; -const gcovRegex = /\"([0-9a-z_\-\/\s\\:]+\.o)\"/gi; +const gcovRegex = /"([0-9a-z_\-/\s\\:]+\.o)"/gi; export function escape(str: string) { - return str.replace(/\\/g, "\\\\").replace(/"/g, "\\\""); + return str.replace(/\\/g, "\\\\").replace(/"/g, "\\\""); } export function couldBeOutput(line: string) { - return !nonOutput.exec(line); + return !nonOutput.exec(line); } export class MI2 extends EventEmitter implements IDebugger { - private map: SourceMap; - private gcovFiles: Set = new Set(); - public procEnv: any; - private currentToken: number = 1; - private handlers: { [index: number]: (info: MINode) => any } = {}; - private breakpoints: Map = new Map(); - private buffer: string; - private errbuf: string; - private process: ChildProcess.ChildProcess; - private lastStepCommand: Function; - private hasCobGetFieldStringFunction: boolean = true; - private hasCobPutFieldStringFunction: boolean = true; - - constructor(public gdbpath: string, public gdbArgs: string[], public cobcpath: string, public cobcArgs: string[], procEnv: any, public verbose: boolean, public noDebug: boolean) { - super(); - if (procEnv) { - const env = {}; - // Duplicate process.env so we don't override it - for (const key in process.env) - if (process.env.hasOwnProperty(key)) { - env[key] = process.env[key]; - } - // Overwrite with user specified variables - for (const key in procEnv) { - if (procEnv.hasOwnProperty(key)) { - if (procEnv === null) { - delete env[key]; - } else { - env[key] = procEnv[key]; - } - } - } - this.procEnv = env; - } - } - - load(cwd: string, target: string, targetargs: string, group: string[]): Thenable { - if (!nativePath.isAbsolute(target) || (this.cobcpath === "docker" && this.gdbpath === "docker")) { - target = nativePath.resolve(cwd, target); - } - group.forEach(e => { - e = nativePath.join(cwd, e); - }); - - return new Promise((resolve, reject) => { - if (!fs.existsSync(cwd)) { - reject(new Error("cwd does not exist.")); - } - - if (!!this.noDebug) { - const args = this.cobcArgs - .concat([target]) - .concat(group) - .concat(['-job=' + targetargs]); - this.process = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); - this.process.stderr.on("data", ((data) => { - this.log("stderr", data); - }).bind(this)); - this.process.stdout.on("data", ((data) => { - this.log("stdout", data); - }).bind(this)); - this.process.on("exit", (() => { - this.emit("quit"); - }).bind(this)); - return; - } - - const args = this.cobcArgs.concat([ - '-g', - '-fsource-location', - '-ftraceall', - '-Q', - '--coverage', - '-A', - '--coverage', - '-v', - target - ]).concat(group); - const buildProcess = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); - buildProcess.stderr.on('data', (data) => { - if (this.verbose) - this.log("stderr", data); - let match; - do { - match = gcovRegex.exec(data); - if (match) { - this.gcovFiles.add(match[1].split('.').slice(0, -1).join('.')); - } - } while (match); - }); - buildProcess.on('exit', (code) => { - if (code !== 0) { - this.emit("quit"); - return; - } - - if (this.verbose) { - this.log("stderr", `COBOL file ${target} compiled with exit code: ${code}`); - } - - try { - this.map = new SourceMap(cwd, [target].concat(group)); - } catch (e) { - this.log('stderr', e); - } - - if (this.verbose) { - this.log("stderr", this.map.toString()); - } - - target = nativePath.resolve(cwd, nativePath.basename(target)); - target = target.split('.').slice(0, -1).join('.'); - // FIXME: the following should prefix "cobcrun.exe" if in "module mode", see #13 - // FIXME: if we need this code twice then add a comment why, otherwise move to a new function - if (process.platform === "win32" && this.cobcpath !== "docker" && this.gdbpath !== "docker") { - target = target + '.exe'; - } - - this.process = ChildProcess.spawn(this.gdbpath, this.gdbArgs, {cwd: cwd, env: this.procEnv}); - this.process.stdout.on("data", this.stdout.bind(this)); - this.process.stderr.on("data", ((data) => { - this.log("stderr", data); - }).bind(this)); - this.process.on("exit", (() => { - this.emit("quit"); - }).bind(this)); - this.process.on("error", ((err) => { - this.emit("launcherror", err); - }).bind(this)); - const promises = this.initCommands(target, targetargs, cwd); - Promise.all(promises).then(() => { - this.emit("debug-ready"); - resolve(); - }, reject); - }); - }); - } - - attach(cwd: string, target: string, targetargs: string, group: string[]): Thenable { - if (!nativePath.isAbsolute(target)) { - target = nativePath.join(cwd, target); - } - group.forEach(e => { - e = nativePath.join(cwd, e); - }); - - return new Promise((resolve, reject) => { - if (!fs.existsSync(cwd)) { - reject(new Error("cwd does not exist.")); - } - - const args = this.cobcArgs.concat([ - '-g', - '-fsource-location', - '-ftraceall', - '-v', - target - ]).concat(group); - const buildProcess = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); - buildProcess.stderr.on('data', (data) => { - if (this.verbose) - this.log("stderr", data); - }); - buildProcess.on('exit', (code) => { - if (code !== 0) { - this.emit("quit"); - return; - } - - if (this.verbose) { - this.log("stderr", `COBOL file ${target} compiled with exit code: ${code}`); - } - - try { - this.map = new SourceMap(cwd, [target].concat(group)); - } catch (e) { - this.log('stderr', e); - } - - if (this.verbose) { - this.log("stderr", this.map.toString()); - } - - target = nativePath.resolve(cwd, nativePath.basename(target)); - target = target.split('.').slice(0, -1).join('.'); - // FIXME: the following should prefix "cobcrun.exe" if in "module mode", see #13 - if (process.platform === "win32") { - target = target + '.exe'; - } - - this.process = ChildProcess.spawn(this.gdbpath, this.gdbArgs, {cwd: cwd, env: this.procEnv}); - this.process.stdout.on("data", this.stdout.bind(this)); - this.process.stderr.on("data", ((data) => { - this.log("stderr", data); - }).bind(this)); - this.process.on("exit", (() => { - this.emit("quit"); - }).bind(this)); - this.process.on("error", ((err) => { - this.emit("launcherror", err); - }).bind(this)); - const promises = this.initCommands(target, targetargs, cwd); - Promise.all(promises).then(() => { - this.emit("debug-ready"); - resolve(); - }, reject); - }); - }); - } - - protected initCommands(target: string, targetargs: string, cwd: string) { - if (!nativePath.isAbsolute(target)) { - target = nativePath.join(cwd, target); - } - if (process.platform === "win32") { - cwd = nativePath.dirname(target); - } - - const cmds = [ - this.sendCommand("gdb-set target-async on", false), - this.sendCommand("gdb-set print repeats 1000", false), - this.sendCommand("gdb-set args " + targetargs, false), - this.sendCommand("environment-directory \"" + escape(cwd) + "\"", false), - this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\"", false), - ]; - return cmds; - } - - stdout(data) { - if (this.verbose) { - this.log("stderr", "stdout: " + data); - } - if (typeof data == "string") { - this.buffer += data; - } else { - this.buffer += data.toString("utf8"); - } - const end = this.buffer.lastIndexOf('\n'); - if (end != -1) { - this.onOutput(this.buffer.substr(0, end)); - this.buffer = this.buffer.substr(end + 1); - } - if (this.buffer.length) { - if (this.onOutputPartial(this.buffer)) { - this.buffer = ""; - } - } - } - - stderr(data) { - if (this.verbose) { - this.log("stderr", "stderr: " + data); - } - if (typeof data == "string") { - this.errbuf += data; - } else { - this.errbuf += data.toString("utf8"); - } - const end = this.errbuf.lastIndexOf('\n'); - if (end != -1) { - this.onOutputStderr(this.errbuf.substr(0, end)); - this.errbuf = this.errbuf.substr(end + 1); - } - if (this.errbuf.length) { - this.logNoNewLine("stderr", this.errbuf); - this.errbuf = ""; - } - } - - stdin(data: string, cb?: any) { - if (this.isReady()) { - if (this.verbose) { - this.log("stderr", "stdin: " + data); - } - this.process.stdin.write(data + "\n", cb); - } - } - - onOutputStderr(lines) { - lines = lines.split('\n'); - lines.forEach(line => { - this.log("stderr", line); - }); - } - - onOutputPartial(line) { - if (couldBeOutput(line)) { - this.logNoNewLine("stdout", line); - return true; - } - return false; - } - - onOutput(linesStr: string) { - const lines = linesStr.split('\n'); - lines.forEach(line => { - if (couldBeOutput(line)) { - if (!gdbRegex.exec(line)) { - this.log("stdout", line); - } + private map: SourceMap; + private gcovFiles: Set = new Set(); + public procEnv: NodeJS.ProcessEnv; + private currentToken = 1; + private handlers: { [index: number]: (_: MINode) => unknown } = {}; + private breakpoints: Map = new Map(); + private buffer: string; + private errbuf: string; + private process: ChildProcess.ChildProcess; + private lastStepCommand: () => Thenable; + private hasCobGetFieldStringFunction = true; + private hasCobPutFieldStringFunction = true; + + constructor( + public gdbpath: string, + public gdbArgs: string[], + public cobcpath: string, + public cobcArgs: string[], + procEnv: NodeJS.ProcessEnv, + public verbose: boolean, + public noDebug: boolean | null) + { + super(); + if (procEnv) { + const env = {}; + // Duplicate process.env so we don't override it + for (const key in process.env) + if (key in process.env) { + env[key] = process.env[key]; + } + // Overwrite with user specified variables + for (const key in procEnv) { + if (key in procEnv) { + if (procEnv === null) { + delete env[key]; } else { - const parsed = parseMI(line); - if (this.verbose) { - this.log("stderr", "GDB -> App: " + JSON.stringify(parsed)); - } - let handled = false; - if (parsed.token !== undefined) { - if (this.handlers[parsed.token]) { - this.handlers[parsed.token](parsed); - delete this.handlers[parsed.token]; - handled = true; - } - } - if (!handled && parsed.resultRecords && parsed.resultRecords.resultClass == "error") { - this.log("stderr", parsed.result("msg") || line); - } - if (parsed.outOfBandRecord) { - parsed.outOfBandRecord.forEach(record => { - if (record.isStream) { - this.log(record.type, record.content); - } else { - if (record.type == "exec") { - this.emit("exec-async-output", parsed); - if (record.asyncClass == "running") { - this.emit("running", parsed); - } else if (record.asyncClass == "stopped") { - const reason = parsed.record("reason"); - if (this.verbose) { - this.log("stderr", "stop: " + reason); - } - if (reason == "breakpoint-hit") { - this.emit("breakpoint", parsed); - } else if (reason == "end-stepping-range") { - if (!this.map.hasLineCobol(parsed.record('frame.fullname'), parseInt(parsed.record('frame.line')))) { - this.lastStepCommand(); - } else { - this.emit("step-end", parsed); - } - } else if (reason == "function-finished") { - if (!this.map.hasLineCobol(parsed.record('frame.fullname'), parseInt(parsed.record('frame.line')))) { - this.lastStepCommand(); - } else { - this.emit("step-out-end", parsed); - } - } else if (reason == "signal-received") { - this.emit("signal-stop", parsed); - } else if (reason == "exited-normally") { - this.emit("exited-normally", parsed); - } else if (reason == "exited") { // exit with error code != 0 - if (this.verbose) { - this.log("stderr", "Program exited with code " + parsed.record("exit-code")); - } - this.emit("quit", parsed); - } else { - if (!this.map.hasLineCobol(parsed.record('frame.fullname'), parseInt(parsed.record('frame.line')))) { - this.continue(); - } else { - if (this.verbose) { - this.log("stderr", "Not implemented stop reason (assuming exception): " + reason); - } - this.emit("stopped", parsed); - } - } - } else { - if (this.verbose) { - this.log("stderr", JSON.stringify(parsed)); - } - } - } else if (record.type == "notify") { - if (record.asyncClass == "thread-created") { - this.emit("thread-created", parsed); - } else if (record.asyncClass == "thread-exited") { - this.emit("thread-exited", parsed); - } - } - } - }); - handled = true; - } - if (parsed.token == undefined && parsed.resultRecords == undefined && parsed.outOfBandRecord.length == 0) { - handled = true; - } - if (!handled) { - if (this.verbose) { - this.log("stderr", "Unhandled: " + JSON.stringify(parsed)); - } - } + env[key] = procEnv[key]; } - }); - } - - start(attachTarget?: string): Thenable { - return new Promise((resolve, reject) => { - if (!!this.noDebug) { - return; - } - this.once("ui-break-done", () => { - let command = "exec-run"; - let expectingResultClass = "running"; - if (!!attachTarget) { - if (/^d+$/.test(attachTarget)) { - command = `target-attach ${attachTarget}`; - expectingResultClass = "done"; - } else { - command = `target-select remote ${attachTarget}`; - expectingResultClass = "connected"; - } - } - - this.sendCommand(command).then((info) => { - if (info.resultRecords.resultClass == expectingResultClass) { - resolve(); - } else { - reject(); - } - }, reject); - }); - }); - } - - stop() { - const proc = this.process; - const to = setTimeout(() => { - process.kill(-proc.pid); - }, 1000); - this.process.on("exit", function (code) { - clearTimeout(to); - }); - this.sendCommand("gdb-exit"); - } - - detach() { - const proc = this.process; - const to = setTimeout(() => { - process.kill(-proc.pid); - }, 1000); - this.process.on("exit", function (code) { - clearTimeout(to); - }); - this.sendCommand("target-detach"); - } - - interrupt(): Thenable { - if (this.verbose) { - this.log("stderr", "interrupt"); + } + } + this.procEnv = env; + } + } + + load(cwd: string, target: string, targetargs: string, group: string[]): Thenable { + group.map(e => { path.join(cwd, e); }); + + return new Promise((resolve, reject) => { + if (!fs.existsSync(cwd)) { + reject(new Error("cwd does not exist.")); + } + + if (this.noDebug) { + const args = (this.cobcArgs || []) + .concat([target]) + .concat(group) + .concat(['-job=' + targetargs]); + this.process = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); + this.process.stderr.on("data", ((data: string) => { + this.log("stderr", data); + })); + this.process.stdout.on("data", ((data: string) => { + this.log("stdout", data); + })); + this.process.on("exit", (() => { + this.emit("quit"); + })); + return; + } + + const args = (this.cobcArgs || []).concat([ + '-g', //enable debugger + '-fsource-location', //generate source location code + '-ftraceall', // generate trace code + '-Q', // (with `--coverage`): enable C linker coverage + '--coverage', + '-A', // (with `--coverage`): enable C compiler coverage + '--coverage', + '-v', // verbose mode + target + ]).concat(group); + const buildProcess = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); + buildProcess.stderr.on('data', (data: string) => { + if (this.verbose) + this.log("stderr", data); + let match: RegExpExecArray; + do { + match = gcovRegex.exec(data); + if (match) { + this.gcovFiles.add(match[1].split('.').slice(0, -1).join('.')); + } + } while (match); + }); + buildProcess.on('exit', (code) => { + if (code !== 0) { + this.emit("quit"); + return; } - return new Promise((resolve, reject) => { - this.sendCommand("exec-interrupt").then((info) => { - resolve(info.resultRecords.resultClass == "done"); - }, reject); - }); - } - continue(): Thenable { if (this.verbose) { - this.log("stderr", "continue"); + this.log("stderr", `COBOL file ${target} compiled with exit code: ${code}`); } - return new Promise((resolve, reject) => { - this.sendCommand("exec-continue").then((info) => { - resolve(info.resultRecords.resultClass == "running"); - }, reject); - }); - } - /** - * The command executes the line, then pauses at the next line. - * The underlying function executes entirely. - * FIXME: Implement execution graph instead of exec-next fallback - */ - stepOver(): Thenable { - this.lastStepCommand = this.stepOver; - if (this.verbose) { - this.log("stderr", "stepOver"); - } - return new Promise((resolve, reject) => { - this.sendCommand("exec-next").then((info) => { - resolve(info.resultRecords.resultClass == "running"); - }, reject); - }); - } - - /** - * The command executes the line, then pauses at the next line. - * The command goes into the underlying function, then pauses at the first line. - */ - stepInto(): Thenable { - this.lastStepCommand = this.stepInto; - if (this.verbose) { - this.log("stderr", "stepInto"); + try { + this.map = new SourceMap(cwd, [target].concat(group)); + } catch (e) { + this.log('stderr', (e).toString()); } - return new Promise((resolve, reject) => { - this.sendCommand("exec-step").then((info) => { - resolve(info.resultRecords.resultClass == "running"); - }, reject); - }); - } - /** - * The comand executes the function, then pauses at the next line outside. - */ - stepOut(): Thenable { - this.lastStepCommand = this.stepOut; if (this.verbose) { - this.log("stderr", "stepOut"); + this.log("stderr", this.map.toString()); } - return new Promise((resolve, reject) => { - this.sendCommand("exec-finish").then((info) => { - resolve(info.resultRecords.resultClass == "running"); - }, reject); - }); - } - goto(filename: string, line: number): Thenable { - if (this.verbose) { - this.log("stderr", "goto"); + target = path.resolve(cwd, path.basename(target)); + target = target.split('.').slice(0, -1).join('.'); + // FIXME: the following should prefix "cobcrun.exe" if in "module mode", see #13 + // FIXME: if we need this code twice then add a comment why, otherwise move to a new + // function + if (process.platform === "win32") { + target = target + '.exe'; + } + + this.process = ChildProcess.spawn( + this.gdbpath, + this.gdbArgs, + { cwd: cwd, + env: this.procEnv }); + this.process.stdout.on("data", (data: string) => this.stdout(data)); + this.process.stderr.on("data", (data: string) => { this.log("stderr", data); }); + this.process.on("exit", () => { this.emit("quit"); }); + this.process.on("error", (err) => { this.emit("launcherror", err); }); + const promises = this.initCommands(target, targetargs, cwd); + Promise.all(promises).then(() => { + this.emit("debug-ready"); + resolve(undefined); + }, reject); + }); + }); + } + + attach(cwd: string, target: string, targetargs: string, group: string[]): Thenable { + if (!path.isAbsolute(target)) { + target = path.join(cwd, target); + } + group.map(e => { path.join(cwd, e) }); + + return new Promise((resolve, reject) => { + if (!fs.existsSync(cwd)) { + reject(new Error("cwd does not exist.")); + } + + const args = (this.cobcArgs || []).concat([ + '-g', + '-fsource-location', + '-ftraceall', + '-v', + target + ]).concat(group); + const buildProcess = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); + buildProcess.stderr.on('data', (data: string) => { + if (this.verbose) + this.log("stderr", data); + }); + buildProcess.on('exit', (code) => { + if (code !== 0) { + this.emit("quit"); + return; } - return new Promise((resolve, reject) => { - const target: string = '"' + (filename ? escape(filename) + ":" : "") + line + '"'; - this.sendCommand("break-insert -t " + target).then(() => { - this.sendCommand("exec-jump " + target).then((info) => { - resolve(info.resultRecords.resultClass == "running"); - }, reject); - }, reject); - }); - } - async changeVariable(name: string, rawValue: string): Promise { if (this.verbose) { - this.log("stderr", "changeVariable"); + this.log("stderr", `COBOL file ${target} compiled with exit code: ${code}`); } - const functionName = await this.getCurrentFunctionName(); - - const cleanedRawValue = cleanRawValue(rawValue); - try { - const variable = this.map.getVariableByCobol(`${functionName}.${name.toUpperCase()}`); - - if (variable.attribute.type === "integer") { - await this.sendCommand(`gdb-set var ${variable.cName}=${cleanedRawValue}`); - } else if (this.hasCobPutFieldStringFunction && variable.cName.startsWith("f_")) { - await this.sendCommand(`data-evaluate-expression "(int)cob_put_field_str(&${variable.cName}, \\"${cleanedRawValue}\\")"`); - } else { - const finalValue = variable.formatValue(cleanedRawValue); - let cName = variable.cName; - if (variable.cName.startsWith("f_")) { - cName += ".data"; - } - await this.sendCommand(`data-evaluate-expression "(void)memcpy(${cName}, \\"${finalValue}\\", ${variable.size})"`); - } + this.map = new SourceMap(cwd, [target].concat(group)); } catch (e) { - if (e.message.includes("No symbol \"cob_put_field_str\"")) { - this.hasCobPutFieldStringFunction = false; - return this.changeVariable(name, rawValue); - } - this.log("stderr", `Failed to set cob field value on ${functionName}.${name}`); - this.log("stderr", e.message); - throw e; - } - } - - loadBreakPoints(breakpoints: Breakpoint[]): Thenable<[boolean, Breakpoint][]> { - if (this.verbose) { - this.log("stderr", "loadBreakPoints"); + this.log('stderr', (e).toString()); } - const promisses = []; - breakpoints.forEach(breakpoint => { - promisses.push(this.addBreakPoint(breakpoint)); - }); - return Promise.all(promisses); - } - setBreakPointCondition(bkptNum, condition): Thenable { if (this.verbose) { - this.log("stderr", "setBreakPointCondition"); + this.log("stderr", this.map.toString()); } - return this.sendCommand("break-condition " + bkptNum + " " + condition); - } - addBreakPoint(breakpoint: Breakpoint): Thenable<[boolean, Breakpoint]> { + target = path.resolve(cwd, path.basename(target)); + target = target.split('.').slice(0, -1).join('.'); + // FIXME: the following should prefix "cobcrun.exe" if in "module mode", see #13 + if (process.platform === "win32") { + target = target + '.exe'; + } + + this.process = ChildProcess.spawn( + this.gdbpath, + this.gdbArgs, + { cwd: cwd, + env: this.procEnv }); + this.process.stdout.on("data", (data: string) => this.stdout(data)); + this.process.stderr.on("data", (data: string) => { this.log("stderr", data); }); + this.process.on("exit", () => { this.emit("quit"); }); + this.process.on("error", (err) => { this.emit("launcherror", err); }); + const promises = this.initCommands(target, targetargs, cwd); + Promise.all(promises).then(() => { + this.emit("debug-ready"); + resolve(undefined); + }, reject); + }); + }); + } + + protected initCommands(target: string, targetargs: string, cwd: string) { + if (!path.isAbsolute(target)) { + target = path.join(cwd, target); + } + if (process.platform === "win32") { + cwd = path.dirname(target); + } + + const cmds = [ + this.sendCommand("gdb-set target-async on", false), + this.sendCommand("gdb-set print repeats 1000", false), + this.sendCommand("gdb-set args " + targetargs, false), + this.sendCommand("environment-directory \"" + escape(cwd) + "\"", false), + this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\"", false), + ]; + return cmds; + } + + stdout(data: string) { + if (this.verbose) { + this.log("stderr", "stdout: " + data); + } + this.buffer += data; + const end = this.buffer.lastIndexOf('\n'); + if (end != -1) { + this.onOutput(this.buffer.substring(0, end)); + this.buffer = this.buffer.substring(end + 1); + } + if (this.buffer.length) { + if (this.onOutputPartial(this.buffer)) { + this.buffer = ""; + } + } + } + + stderr(data: string) { + if (this.verbose) { + this.log("stderr", "stderr: " + data); + } + this.errbuf += data; + const end = this.errbuf.lastIndexOf('\n'); + if (end != -1) { + this.onOutputStderr(this.errbuf.substring(0, end)); + this.errbuf = this.errbuf.substring(end + 1); + } + if (this.errbuf.length) { + this.logNoNewLine("stderr", this.errbuf); + this.errbuf = ""; + } + } + + stdin(data: string, cb?: (_err: Error) => void) { + if (this.isReady()) { + if (this.verbose) { + this.log("stderr", "stdin: " + data); + } + this.process.stdin.write(data + "\n", cb); + } + } + + onOutputStderr(lines: string) { + const linesArr = lines.split('\n'); + linesArr.forEach(line => { + this.log("stderr", line); + }); + } + + onOutputPartial(line: string) { + if (couldBeOutput(line)) { + this.logNoNewLine("stdout", line); + return true; + } + return false; + } + + onOutput(linesStr: string) { + const lines = linesStr.split('\n'); + lines.forEach(line => { + if (couldBeOutput(line)) { + if (!gdbRegex.exec(line)) { + this.log("stdout", line); + } + } else { + const parsed = parseMI(line); if (this.verbose) { - this.log("stderr", "addBreakPoint "); - } - - return new Promise((resolve, reject) => { - if (this.breakpoints.has(breakpoint)) { - return resolve([false, undefined]); - } - let location = ""; - if (breakpoint.countCondition) { - if (breakpoint.countCondition[0] == ">") { - location += "-i " + numRegex.exec(breakpoint.countCondition.substr(1))[0] + " "; - } else { - const match = numRegex.exec(breakpoint.countCondition)[0]; - if (match.length != breakpoint.countCondition.length) { - this.log("stderr", "Unsupported break count expression: '" + breakpoint.countCondition + "'. Only supports 'X' for breaking once after X times or '>X' for ignoring the first X breaks"); - location += "-t "; - } else if (parseInt(match) != 0) { - location += "-t -i " + parseInt(match) + " "; - } - } - } - - const map = this.map.getLineC(breakpoint.file, breakpoint.line); - if (map.fileC === '' && map.lineC === 0) { - return; - } - - if (breakpoint.raw) { - location += '"' + escape(breakpoint.raw) + '"'; + this.log("stderr", "GDB -> App: " + JSON.stringify(parsed)); + } + let handled = false; + if (parsed.token !== undefined) { + if (this.handlers[parsed.token]) { + this.handlers[parsed.token](parsed); + delete this.handlers[parsed.token]; + handled = true; + } + } + if (!handled && parsed.resultRecords && parsed.resultRecords.resultClass == "error") { + this.log("stderr", parsed.result("msg") || line); + } + if (parsed.outOfBandRecord) { + parsed.outOfBandRecord.forEach(record => { + if (record.isStream) { + this.log(record.type, record.content); } else { - location += '"' + escape(map.fileC) + ":" + map.lineC + '"'; - } - - this.sendCommand("break-insert -f " + location).then((result) => { - if (result.resultRecords.resultClass == "done") { - const bkptNum = parseInt(result.result("bkpt.number")); - const map = this.map.getLineCobol(result.result("bkpt.file"), parseInt(result.result("bkpt.line"))); - const newBrk = { - file: map.fileCobol, - line: map.lineCobol, - condition: breakpoint.condition - }; - if (breakpoint.condition) { - this.setBreakPointCondition(bkptNum, breakpoint.condition).then((result) => { - if (result.resultRecords.resultClass == "done") { - this.breakpoints.set(newBrk, bkptNum); - resolve([true, newBrk]); - } else { - resolve([false, undefined]); - } - }, reject); + if (record.type == "exec") { + this.emit("exec-async-output", parsed); + if (record.asyncClass == "running") { + this.emit("running", parsed); + } else if (record.asyncClass == "stopped") { + const reason = parsed.record("reason"); + if (this.verbose) { + this.log("stderr", "stop: " + reason); + } + if (reason == "breakpoint-hit") { + this.emit("breakpoint", parsed); + } else if (reason == "end-stepping-range") { + if (!this.map.hasLineCobol( + parsed.record('frame.fullname'), + parseInt(parsed.record('frame.line')))) + { + void this.lastStepCommand().then(); } else { - this.breakpoints.set(newBrk, bkptNum); - resolve([true, newBrk]); + this.emit("step-end", parsed); } - } else { - reject(result); - } - }, reject); - }); - } - - removeBreakPoint(breakpoint: Breakpoint): Thenable { - if (this.verbose) { - this.log("stderr", "removeBreakPoint"); - } - return new Promise((resolve, reject) => { - if (!this.breakpoints.has(breakpoint)) { - return resolve(false); - } - this.sendCommand("break-delete " + this.breakpoints.get(breakpoint)).then((result) => { - if (result.resultRecords.resultClass == "done") { - this.breakpoints.delete(breakpoint); - resolve(true); - } else resolve(false); - }); - }); - } - - clearBreakPoints(): Thenable { - if (this.verbose) { - this.log("stderr", "clearBreakPoints"); - } - return new Promise((resolve, reject) => { - this.sendCommand("break-delete").then((result) => { - if (result.resultRecords.resultClass == "done") { - this.breakpoints.clear(); - resolve(true); - } else resolve(false); - }, () => { - resolve(false); - }); - }); - } - - async getThreads(): Promise { - if (this.verbose) { - this.log("stderr", "getThreads"); - } - return new Promise((resolve, reject) => { - if (!!this.noDebug) { - return; - } - this.sendCommand("thread-info").then((result) => { - resolve(result.result("threads").map(element => { - const ret: Thread = { - id: parseInt(MINode.valueOf(element, "id")), - targetId: MINode.valueOf(element, "target-id") - }; - const name = MINode.valueOf(element, "name"); - if (name) { - ret.name = name; + } else if (reason == "function-finished") { + if (!this.map.hasLineCobol( + parsed.record('frame.fullname'), + parseInt(parsed.record('frame.line')))) + { + void this.lastStepCommand(); + } else { + this.emit("step-out-end", parsed); } - return ret; - })); - }, reject); - }); - } - - async getStack(maxLevels: number, thread: number): Promise { - if (this.verbose) { - this.log("stderr", "getStack"); - } - let command = "stack-list-frames"; - if (thread != 0) { - command += ` --thread ${thread}`; - } - if (maxLevels) { - command += " 0 " + maxLevels; - } - const result = await this.sendCommand(command); - const stack = result.result("stack"); - const ret: Stack[] = []; - return stack.map(element => { - const level = MINode.valueOf(element, "@frame.level"); - const addr = MINode.valueOf(element, "@frame.addr"); - const func = MINode.valueOf(element, "@frame.func"); - const filename = MINode.valueOf(element, "@frame.file"); - let file: string = MINode.valueOf(element, "@frame.fullname"); - if (file) { - file = nativePath.normalize(file); - } - const from = parseInt(MINode.valueOf(element, "@frame.from")); - - let line = 0; - const lnstr = MINode.valueOf(element, "@frame.line"); - if (lnstr) { - line = parseInt(lnstr); - } - - const map = this.map.getLineCobol(file, line); - return { - address: addr, - fileName: nativePath.basename(map.fileCobol), - file: map.fileCobol, - function: func || from, - level: level, - line: map.lineCobol - }; - }); - } - - async getCurrentFunctionName(): Promise { - if (this.verbose) { - this.log("stderr", "getCurrentFunctionName"); - } - const response = await this.sendCommand("stack-info-frame"); - return response.result("frame.func").toLowerCase(); - } - - async getStackVariables(thread: number, frame: number): Promise { - if (this.verbose) { - this.log("stderr", "getStackVariables"); - } - - const functionName = await this.getCurrentFunctionName(); - - const variablesResponse = await this.sendCommand(`stack-list-variables --thread ${thread} --frame ${frame} --all-values`); - const variables = variablesResponse.result("variables"); - - const currentFrameVariables = new Set(); - for (const element of variables) { - const key = MINode.valueOf(element, "name"); - const value = MINode.valueOf(element, "value"); - - if (key.startsWith("b_")) { - const cobolVariable = this.map.getVariableByC(`${functionName}.${key}`); - - if (cobolVariable) { - try { - cobolVariable.setValue(value); - } catch (e) { - this.log("stderr", `Failed to set value on ${functionName}.${key}`); - this.log("stderr", e.message); - throw e; + } else if (reason == "signal-received") { + this.emit("signal-stop", parsed); + } else if (reason == "exited-normally") { + this.emit("exited-normally", parsed); + } else if (reason == "exited") { // exit with error code != 0 + if (this.verbose) { + this.log("stderr", "Program exited with code " + + parsed.record("exit-code")); + } + this.emit("quit", parsed); + } else { + if (!this.map.hasLineCobol( + parsed.record('frame.fullname'), + parseInt(parsed.record('frame.line')))) + { + void this.continue(); + } else { + if (this.verbose) { + this.log( + "stderr", + "Not implemented stop reason (assuming exception): " + reason); + } + this.emit("stopped", parsed); } - currentFrameVariables.add(cobolVariable); + } + } else { + if (this.verbose) { + this.log("stderr", JSON.stringify(parsed)); + } } + } else if (record.type == "notify") { + if (record.asyncClass == "thread-created") { + this.emit("thread-created", parsed); + } else if (record.asyncClass == "thread-exited") { + this.emit("thread-exited", parsed); + } + } } - } - return Array.from(currentFrameVariables); - } - - examineMemory(from: number, length: number): Thenable { - if (this.verbose) { - this.log("stderr", "examineMemory"); - } - return new Promise((resolve, reject) => { - this.sendCommand("data-read-memory-bytes 0x" + from.toString(16) + " " + length).then((result) => { - resolve(result.result("memory[0].contents")); + }); + handled = true; + } + if (parsed.token == undefined + && parsed.resultRecords == undefined + && parsed.outOfBandRecord.length == 0) + { + handled = true; + } + if (!handled) { + if (this.verbose) { + this.log("stderr", "Unhandled: " + JSON.stringify(parsed)); + } + } + } + }); + } + + start(attachTarget?: string): Thenable { + return new Promise((resolve, reject) => { + if (this.noDebug) { + return; + } + this.once("ui-break-done", () => { + let command = "exec-run"; + let expectingResultClass = "running"; + if (attachTarget) { + if (/^d+$/.test(attachTarget)) { + command = `target-attach ${attachTarget}`; + expectingResultClass = "done"; + } else { + command = `target-select remote ${attachTarget}`; + expectingResultClass = "connected"; + } + } + + this.sendCommand(command).then((info) => { + if (info.resultRecords.resultClass == expectingResultClass) { + resolve(true); + } else { + reject(); + } + }, reject); + }); + }); + } + + stop() { + const proc = this.process; + if (proc) { + const to = setTimeout(() => { + process.kill(-proc.pid); + }, 1000); + this.process.on("exit", function (_code) { + clearTimeout(to); + }); + } + void this.sendCommand("gdb-exit"); + } + + detach() { + const proc = this.process; + if (proc) { + const to = setTimeout(() => { + process.kill(-proc.pid); + }, 1000); + this.process.on("exit", function (_code) { + clearTimeout(to); + }); + } + void this.sendCommand("target-detach"); + } + + interrupt(): Thenable { + if (this.verbose) { + this.log("stderr", "interrupt"); + } + return new Promise((resolve, reject) => { + this.sendCommand("exec-interrupt").then((info) => { + resolve(info.resultRecords.resultClass == "done"); + }, reject); + }); + } + + continue(): Thenable { + if (this.verbose) { + this.log("stderr", "continue"); + } + return new Promise((resolve, reject) => { + this.sendCommand("exec-continue").then((info) => { + resolve(info.resultRecords.resultClass == "running"); + }, reject); + }); + } + + /** + * The command executes the line, then pauses at the next line. + * The underlying function executes entirely. + * FIXME: Implement execution graph instead of exec-next fallback + */ + stepOver(): Thenable { + this.lastStepCommand = () => this.stepOver(); + if (this.verbose) { + this.log("stderr", "stepOver"); + } + return new Promise((resolve, reject) => { + this.sendCommand("exec-next").then((info) => { + resolve(info.resultRecords.resultClass == "running"); + }, reject); + }); + } + + /** + * The command executes the line, then pauses at the next line. + * The command goes into the underlying function, then pauses at the first line. + */ + stepInto(): Thenable { + this.lastStepCommand = () => this.stepInto() ; + if (this.verbose) { + this.log("stderr", "stepInto"); + } + return new Promise((resolve, reject) => { + this.sendCommand("exec-step").then((info) => { + resolve(info.resultRecords.resultClass == "running"); + }, reject); + }); + } + + /** + * The comand executes the function, then pauses at the next line outside. + */ + stepOut(): Thenable { + this.lastStepCommand = () => this.stepOut() ; + if (this.verbose) { + this.log("stderr", "stepOut"); + } + return new Promise((resolve, reject) => { + this.sendCommand("exec-finish").then((info) => { + resolve(info.resultRecords.resultClass == "running"); + }, reject); + }); + } + + goto(filename: string, line: number): Thenable { + if (this.verbose) { + this.log("stderr", "goto"); + } + return new Promise((resolve, reject) => { + const target: string = '"' + (filename ? escape(filename) + ":" : "") + line.toString() + '"'; + this.sendCommand("break-insert -t " + target).then(() => { + this.sendCommand("exec-jump " + target).then((info) => { + resolve(info.resultRecords.resultClass == "running"); + }, reject); + }, reject); + }); + } + + async changeVariable(name: string, rawValue: string): Promise { + if (this.verbose) { + this.log("stderr", "changeVariable"); + } + + const functionName = await this.getCurrentFunctionName(); + + const cleanedRawValue = cleanRawValue(rawValue); + + try { + const variable = this.map.getVariableByCobol(`${functionName}.${name.toUpperCase()}`); + + if (variable.attribute.type === "integer") { + await this.sendCommand(`gdb-set var ${variable.cName}=${cleanedRawValue}`); + } else if (this.hasCobPutFieldStringFunction && variable.cName.startsWith("f_")) { + await this.sendCommand( + `data-evaluate-expression + "(int)cob_put_field_str(&${variable.cName}, \\"${cleanedRawValue}\\")"`); + } else { + const finalValue = variable.formatValue(cleanedRawValue); + let cName = variable.cName; + if (variable.cName.startsWith("f_")) { + cName += ".data"; + } + await + this.sendCommand(`data-evaluate-expression + "(void)memcpy(${cName}, \\"${finalValue}\\", ${variable.size})"`); + } + } catch (e) { + if ((e).message.includes("No symbol \"cob_put_field_str\"")) { + this.hasCobPutFieldStringFunction = false; + return this.changeVariable(name, rawValue); + } + this.log("stderr", `Failed to set cob field value on ${functionName}.${name}`); + this.log("stderr", (e).message); + throw e; + } + } + + loadBreakPoints(breakpoints: Breakpoint[]): Thenable<[boolean, Breakpoint][]> { + if (this.verbose) { + this.log("stderr", "loadBreakPoints"); + } + const promisses = []; + breakpoints.forEach(breakpoint => { + promisses.push(this.addBreakPoint(breakpoint)); + }); + return Promise.all(promisses); + } + + setBreakPointCondition(bkptNum: number, condition: string): Thenable { + if (this.verbose) { + this.log("stderr", "setBreakPointCondition"); + } + return this.sendCommand("break-condition " + bkptNum.toString() + " " + condition); + } + + addBreakPoint(breakpoint: Breakpoint): Thenable<[boolean, Breakpoint]> { + if (this.verbose) { + this.log("stderr", "addBreakPoint "); + } + + return new Promise((resolve, reject) => { + if (this.breakpoints.has(breakpoint)) { + return resolve([false, undefined]); + } + let location = ""; + if (breakpoint.countCondition) { + if (breakpoint.countCondition[0] == ">") { + location += "-i " + numRegex.exec(breakpoint.countCondition.substring(1))[0] + " "; + } else { + const match = numRegex.exec(breakpoint.countCondition)[0]; + if (match.length != breakpoint.countCondition.length) { + this.log( + "stderr", + "Unsupported break count expression: '" + + breakpoint.countCondition + + "'. Only supports 'X' for breaking once after X times or '>X' for ignoring the " + + "first X breaks"); + location += "-t "; + } else if (parseInt(match) != 0) { + location += "-t -i " + parseInt(match).toString() + " "; + } + } + } + + const map = this.map.getLineC(breakpoint.file, breakpoint.line); + if (map.fileC === '' && map.lineC === 0) { + return; + } + + if (breakpoint.raw) { + location += '"' + escape(breakpoint.raw) + '"'; + } else { + location += '"' + escape(map.fileC) + ":" + map.lineC.toString() + '"'; + } + + this.sendCommand("break-insert -f " + location).then((result) => { + if (result.resultRecords.resultClass == "done") { + const bkptNum = parseInt(result.result("bkpt.number")); + const bkptlocation = (result.result("bkpt.original-location")).split(':'); + const map = this.map.getLineCobol(bkptlocation[0], parseInt(bkptlocation[1])); + const newBrk = { + file: map.fileCobol, + line: map.lineCobol, + condition: breakpoint.condition + }; + if (breakpoint.condition) { + this.setBreakPointCondition(bkptNum, breakpoint.condition) + .then((result: MINode) => { + if (result.resultRecords.resultClass == "done") { + this.breakpoints.set(newBrk, bkptNum); + resolve([true, newBrk]); + } else { + resolve([false, undefined]); + } }, reject); - }); - } - - async evalExpression(expression: string, thread: number, frame: number): Promise { - const functionName = await this.getCurrentFunctionName(); - - if (this.verbose) { - this.log("stderr", "evalExpression"); - } - - let [finalExpression, variableNames] = parseExpression(expression, functionName, this.map); - - for (const variableName of variableNames) { - const variable = this.map.getVariableByC(`${functionName}.${variableName}`); - if (variable) { - await this.evalVariable(variable, thread, frame); - const value = variable.value; - finalExpression = `const ${variableName}=${value};` + finalExpression; - } - } - - try { - const result = `${eval(finalExpression)}`; - if (/[^0-9.\-+]/g.test(result)) { - return `"${result}"`; - } - return result; - } catch (e) { - this.log("stderr", e.message); - return `Failed to evaluate ${expression}`; - } - } - - async evalCobField(name: string, thread: number, frame: number): Promise { - const functionName = await this.getCurrentFunctionName(); - - if (this.verbose) { - this.log("stderr", "evalCobField"); - } - - try { - const variable = this.map.getVariableByCobol(`${functionName}.${name.toUpperCase()}`); - return await this.evalVariable(variable, thread, frame); - } catch (e) { - this.log("stderr", `Failed to eval cob field value on ${functionName}.${name}`); + } else { + this.breakpoints.set(newBrk, bkptNum); + resolve([true, newBrk]); + } + } else { + reject(result); + } + }, reject); + }); + } + + removeBreakPoint(breakpoint: Breakpoint): Thenable { + if (this.verbose) { + this.log("stderr", "removeBreakPoint"); + } + return new Promise((resolve, _reject) => { + if (!this.breakpoints.has(breakpoint)) { + return resolve(false); + } + this.sendCommand("break-delete " + this.breakpoints.get(breakpoint).toString()) + .then( + (result: MINode) => { + if (result.resultRecords.resultClass == "done") { + this.breakpoints.delete(breakpoint); + resolve(true); + } else resolve(false); + }, + (err: Error) => console.log(err)); + }); + } + + clearBreakPoints(): Thenable { + if (this.verbose) { + this.log("stderr", "clearBreakPoints"); + } + return new Promise((resolve, _reject) => { + this.sendCommand("break-delete").then((result) => { + if (result.resultRecords.resultClass == "done") { + this.breakpoints.clear(); + resolve(true); + } else resolve(false); + }, () => { + resolve(false); + }); + }); + } + + async getThreads(): Promise { + if (this.verbose) { + this.log("stderr", "getThreads"); + } + return new Promise((resolve, reject) => { + if (this.noDebug) { + return; + } + this.sendCommand("thread-info").then((result) => { + resolve((result.result("threads")).map(element => { + const ret: Thread = { + id: parseInt(MINode.valueOf(element, "id")), + targetId: MINode.valueOf(element, "target-id") + }; + const name = MINode.valueOf(element, "name"); + if (name) { + ret.name = name; + } + return ret; + })); + }, reject); + }); + } + + async getStack(maxLevels: number, thread: number): Promise { + if (this.verbose) { + this.log("stderr", "getStack"); + } + let command = "stack-list-frames"; + if (thread != 0) { + command += ` --thread ${thread}`; + } + if (maxLevels) { + command += " 0 " + maxLevels.toString(); + } + const result = await this.sendCommand(command); + const stack = result.result("stack"); + return stack.map(element => { + const level = MINode.valueOf(element, "@frame.level"); + const addr = MINode.valueOf(element, "@frame.addr"); + const func = MINode.valueOf(element, "@frame.func"); + const filename = MINode.valueOf(element, "@frame.file"); + let file: string = MINode.valueOf(element, "@frame.fullname"); + if (file) { + file = path.normalize(file); + } + const from = parseInt(MINode.valueOf(element, "@frame.from")); + + let line = 0; + const lnstr = MINode.valueOf(element, "@frame.line"); + if (lnstr) { + line = parseInt(lnstr); + } + + const map = this.map.getLineCobol(file, line); + return { + address: addr, + fileName: path.basename(map.fileCobol), + file: map.fileCobol, + function: func || from, + level: level, + line: map.lineCobol + }; + }); + } + + async getCurrentFunctionName(): Promise { + if (this.verbose) { + this.log("stderr", "getCurrentFunctionName"); + } + const response = await this.sendCommand("stack-info-frame"); + return response.result("frame.func").toLowerCase(); + } + + async getStackVariables(thread: number, frame: number): Promise { + if (this.verbose) { + this.log("stderr", "getStackVariables"); + } + + const functionName = await this.getCurrentFunctionName(); + + const variablesResponse = await this.sendCommand(`stack-list-variables --thread ${thread} --frame ${frame} --all-values`); + const variables = variablesResponse.result("variables"); + + const currentFrameVariables = new Set(); + for (const element of variables) { + const key = MINode.valueOf(element, "name"); + const value = MINode.valueOf(element, "value"); + + if (key.startsWith("b_")) { + const cobolVariable = this.map.getVariableByC(`${functionName}.${key}`); + + if (cobolVariable) { + try { + cobolVariable.setValue(value); + } catch (e) { + this.log("stderr", `Failed to set value on ${functionName}.${key}`); this.log("stderr", e.message); throw e; + } + currentFrameVariables.add(cobolVariable); } + } } + return Array.from(currentFrameVariables); + } - private async evalVariable(variable: DebuggerVariable, thread: number, frame: number): Promise { - if (this.verbose) { - this.log("stderr", "evalVariable"); - } - - let command = "data-evaluate-expression "; - if (thread != 0) { - command += `--thread ${thread} --frame ${frame} `; - } - - if (this.hasCobGetFieldStringFunction && variable.cName.startsWith("f_")) { - command += `"(char *)cob_get_field_str_buffered(&${variable.cName})"`; - } else if (variable.cName.startsWith("f_")) { - command += `${variable.cName}.data`; - } else { - command += variable.cName; - } - - let dataResponse; - let value = null; - try { - dataResponse = await this.sendCommand(command); - value = dataResponse.result("value"); - if (value === "0x0") { - value = null; - } - } catch (error) { - if (error.message.includes("No symbol \"cob_get_field_str_buffered\"")) { - this.hasCobGetFieldStringFunction = false; - return this.evalVariable(variable, thread, frame); - } - this.log("stderr", error.message); - } - - if (this.hasCobGetFieldStringFunction) { - variable.setValueUsage(value); - } else { - variable.setValue(value); - } - - return variable; - } - - private logNoNewLine(type: string, msg: string): void { - this.emit("msg", type, msg); + examineMemory(from: number, length: number): Thenable { + if (this.verbose) { + this.log("stderr", "examineMemory"); } + return new Promise((resolve, reject) => { + this.sendCommand("data-read-memory-bytes 0x" + from.toString(16) + " " + length).then((result) => { + resolve(result.result("memory[0].contents")); + }, reject); + }); + } - private log(type: string, msg: string): void { - this.emit("msg", type, msg[msg.length - 1] == '\n' ? msg : (msg + "\n")); - } - - sendUserInput(command: string, threadId: number = 0, frameLevel: number = 0): Thenable { - return new Promise((resolve, reject) => { - this.stdin(command, resolve); - }); - } + async evalExpression(expression: string, thread: number, frame: number): Promise { + const functionName = await this.getCurrentFunctionName(); - private sendCommand(command: string, suppressFailure: boolean = false): Thenable { - return new Promise((resolve, reject) => { - const sel = this.currentToken++; - this.handlers[sel] = (node: MINode) => { - if (node && node.resultRecords && node.resultRecords.resultClass === "error") { - if (suppressFailure) { - this.log("stderr", `WARNING: Error executing command '${command}'`); - resolve(node); - } else - reject(new MIError(node.result("msg") || "Internal error", command)); - } else - resolve(node); - }; - this.stdin(sel + "-" + command); - }); + if (this.verbose) { + this.log("stderr", "evalExpression"); } - isReady(): boolean { - return !!this.process; - } + let [finalExpression, variableNames] = parseExpression(expression, functionName, this.map); - getGcovFiles(): string[] { - return Array.from(this.gcovFiles); - } - - getSourceMap(): SourceMap { - return this.map; - } + for (const variableName of variableNames) { + const variable = this.map.getVariableByC(`${functionName}.${variableName}`); + if (variable) { + await this.evalVariable(variable, thread, frame); + const value = variable.value; + finalExpression = `const ${variableName}=${value};` + finalExpression; + } + } + + try { + const result = `${eval(finalExpression)}`; + if (/[^0-9.\-+]/g.test(result)) { + return `"${result}"`; + } + return result; + } catch (e) { + this.log("stderr", e.message); + return `Failed to evaluate ${expression}`; + } + } + + async evalCobField(name: string, thread: number, frame: number): Promise { + const functionName = await this.getCurrentFunctionName(); + + if (this.verbose) { + this.log("stderr", "evalCobField"); + } + + try { + const variable = this.map.getVariableByCobol(`${functionName}.${name.toUpperCase()}`); + return await this.evalVariable(variable, thread, frame); + } catch (e) { + this.log("stderr", `Failed to eval cob field value on ${functionName}.${name}`); + this.log("stderr", e.message); + throw e; + } + } + + private async evalVariable(variable: DebuggerVariable, thread: number, frame: number): Promise { + if (this.verbose) { + this.log("stderr", "evalVariable"); + } + + let command = "data-evaluate-expression "; + if (thread != 0) { + command += `--thread ${thread} --frame ${frame} `; + } + + if (this.hasCobGetFieldStringFunction && variable.cName.startsWith("f_")) { + command += `"(char *)cob_get_field_str_buffered(&${variable.cName})"`; + } else if (variable.cName.startsWith("f_")) { + command += `${variable.cName}.data`; + } else { + command += variable.cName; + } + + let dataResponse; + let value = null; + try { + dataResponse = await this.sendCommand(command); + value = dataResponse.result("value"); + if (value === "0x0") { + value = null; + } + } catch (error) { + if (error.message.includes("No symbol \"cob_get_field_str_buffered\"")) { + this.hasCobGetFieldStringFunction = false; + return this.evalVariable(variable, thread, frame); + } + this.log("stderr", error.message); + } + + if (this.hasCobGetFieldStringFunction) { + variable.setValueUsage(value); + } else { + variable.setValue(value); + } + + return variable; + } + + private logNoNewLine(type: string, msg: string): void { + this.emit("msg", type, msg); + } + + private log(type: string, msg: string): void { + this.emit("msg", type, msg[msg.length - 1] == '\n' ? msg : (msg + "\n")); + } + + sendUserInput(command: string, threadId: number = 0, frameLevel: number = 0): Thenable { + return new Promise((resolve, reject) => { + this.stdin(command, resolve); + }); + } + + private sendCommand(command: string, suppressFailure: boolean = false): Thenable { + return new Promise((resolve, reject) => { + const sel = this.currentToken++; + this.handlers[sel] = (node: MINode) => { + if (node && node.resultRecords && node.resultRecords.resultClass === "error") { + if (suppressFailure) { + this.log("stderr", `WARNING: Error executing command '${command}'`); + resolve(node); + } else + reject(new MIError(node.result("msg") || "Internal error", command)); + } else + resolve(node); + }; + this.stdin(sel + "-" + command); + }); + } + + isReady(): boolean { + return !!this.process; + } + + getGcovFiles(): string[] { + return Array.from(this.gcovFiles); + } + + getSourceMap(): SourceMap { + return this.map; + } } diff --git a/src/parser.c.ts b/src/parser.c.ts index 0a5c9f3..fdbf657 100644 --- a/src/parser.c.ts +++ b/src/parser.c.ts @@ -5,9 +5,6 @@ import {DebuggerVariable, Attribute, VariableType} from "./debugger"; const nativePath = { resolve: function (...args: string[]): string { const nat = nativePathFromPath.resolve(...args); - if (process.platform === "win32" && this.cobcpath === "docker" && this.gdbpath === "docker") { - return nat.replace(/.*:/, s => "/" + s.toLowerCase().replace(":", "")).replace(/\\/g, "/"); - } return nat; }, basename: function (path: string): string { diff --git a/src/parser.mi2.ts b/src/parser.mi2.ts index 876005c..fbf7ddc 100644 --- a/src/parser.mi2.ts +++ b/src/parser.mi2.ts @@ -42,7 +42,7 @@ function parseString(str: string): string { bufIndex += ret.write('\v', bufIndex); else if (str[i] == '0') bufIndex += ret.write('\0', bufIndex); - else if (m = octalMatch.exec(str.substr(i))) { + else if (m = octalMatch.exec(str.substring(i))) { ret.writeUInt8(parseInt(m[0], 8), bufIndex++); i += 2; } else @@ -60,10 +60,15 @@ function parseString(str: string): string { return ret.slice(0, bufIndex).toString("utf8"); } +export type ResultRecords = { + resultClass: string; + results: [string, unknown][] +} + export class MINode implements MIInfo { token: number; outOfBandRecord: { isStream: boolean, type: string, asyncClass: string, output: [string, any][], content: string }[]; - resultRecords: { resultClass: string, results: [string, any][] }; + resultRecords: ResultRecords; constructor(token: number, info: { isStream: boolean, type: string, asyncClass: string, output: [string, any][], content: string }[], result: { resultClass: string, results: [string, any][] }) { this.token = token; @@ -95,7 +100,7 @@ export class MINode implements MIInfo { do { let target = pathRegex.exec(path); if (target) { - path = path.substr(target[0].length); + path = path.substring(target[0].length); if (current.length && typeof current != "string") { const found = []; for (const element of current) { @@ -111,11 +116,11 @@ export class MINode implements MIInfo { } else return undefined; } else if (path[0] == '@') { current = [current]; - path = path.substr(1); + path = path.substring(1); } else { target = indexRegex.exec(path); if (target) { - path = path.substr(target[0].length); + path = path.substring(target[0].length); const i = parseInt(target[1]); if (current.length && typeof current != "string" && i >= 0 && i < current.length) { current = current[i]; @@ -166,7 +171,7 @@ export function parseMI(output: string): MINode { return ""; let stringEnd = 1; let inString = true; - let remaining = output.substr(1); + let remaining = output.substring(1); let escaped = false; while (inString) { if (escaped) @@ -176,16 +181,16 @@ export function parseMI(output: string): MINode { else if (remaining[0] == '"') inString = false; - remaining = remaining.substr(1); + remaining = remaining.substring(1); stringEnd++; } let str; try { - str = parseString(output.substr(0, stringEnd)); + str = parseString(output.substring(0, stringEnd)); } catch (e) { - str = output.substr(0, stringEnd); + str = output.substring(0, stringEnd); } - output = output.substr(stringEnd); + output = output.substring(stringEnd); return str; }; @@ -196,9 +201,9 @@ export function parseMI(output: string): MINode { return undefined; const oldContent = output; const canBeValueList = output[0] == '['; - output = output.substr(1); + output = output.substring(1); if (output[0] == '}' || output[0] == ']') { - output = output.substr(1); // ] or } + output = output.substring(1); // ] or } return []; } if (canBeValueList) { @@ -209,7 +214,7 @@ export function parseMI(output: string): MINode { const remaining = output; while ((value = parseCommaValue()) !== undefined) values.push(value); - output = output.substr(1); // ] + output = output.substring(1); // ] return values; } } @@ -219,7 +224,7 @@ export function parseMI(output: string): MINode { results.push(result); while (result = parseCommaResult()) results.push(result); - output = output.substr(1); // } + output = output.substring(1); // } return results; } output = (canBeValueList ? '[' : '{') + output; @@ -239,7 +244,7 @@ export function parseMI(output: string): MINode { const variableMatch = variableRegex.exec(output); if (!variableMatch) return undefined; - output = output.substr(variableMatch[0].length + 1); + output = output.substring(variableMatch[0].length + 1); const variable = variableMatch[1]; return [variable, parseValue()]; }; @@ -247,28 +252,28 @@ export function parseMI(output: string): MINode { parseCommaValue = () => { if (output[0] != ',') return undefined; - output = output.substr(1); + output = output.substring(1); return parseValue(); }; parseCommaResult = () => { if (output[0] != ',') return undefined; - output = output.substr(1); + output = output.substring(1); return parseResult(); }; let match = undefined; while (match = outOfBandRecordRegex.exec(output)) { - output = output.substr(match[0].length); + output = output.substring(match[0].length); if (match[1] && token === undefined && match[1] !== "undefined") { token = parseInt(match[1]); } if (match[2]) { const classMatch = asyncClassRegex.exec(output); - output = output.substr(classMatch[1].length); + output = output.substring(classMatch[1].length); const asyncRecord = { isStream: false, type: asyncRecordType[match[2]], @@ -292,7 +297,7 @@ export function parseMI(output: string): MINode { } if (match = resultRecordRegex.exec(output)) { - output = output.substr(match[0].length); + output = output.substring(match[0].length); if (match[1] && token === undefined) { token = parseInt(match[1]); } diff --git a/src/settings.ts b/src/settings.ts index ab4cd08..d2bcfdb 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,14 +1,27 @@ import * as vscode from 'vscode'; +type InspectResult = { + key: string; + defaultValue?: T; + globalValue?: T; + workspaceValue?: T; + workspaceFolderValue?: T; + defaultLanguageValue?: T; + globalLanguageValue?: T; + workspaceLanguageValue?: T; + workspaceFolderLanguageValue?: T; + languageIds?: string[]; +} | undefined + export class DebuggerSettings { private readonly extensionSettings: vscode.WorkspaceConfiguration; constructor() { - this.extensionSettings = vscode.workspace.getConfiguration("Cobol_Debugger"); + this.extensionSettings = vscode.workspace.getConfiguration("superbol_debugger"); } private getWithFallback(settings: vscode.WorkspaceConfiguration, section: string): T { - const info: any = settings.inspect(section); + const info: InspectResult = settings.inspect(section); if (info.workspaceFolderValue !== undefined) { return info.workspaceFolderValue; } else if (info.workspaceValue !== undefined) { diff --git a/tsconfig.json b/tsconfig.json index eaf29ab..0bc5e51 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,21 +1,14 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "target": "es2020", "outDir": "out", - "lib": [ - "es6" - ], "sourceMap": true, "rootDir": ".", - "plugins": [ - { - "name": "tslint-language-service" - } - ] }, + "include": ["src"], "exclude": [ "node_modules", ".vscode-test" ] -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..abc796a --- /dev/null +++ b/yarn.lock @@ -0,0 +1,1252 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + +"@eslint/eslintrc@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.3.tgz#4910db5505f4d503f27774bf356e3704818a0331" + integrity sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.5.2" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.43.0": + version "8.43.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.43.0.tgz#559ca3d9ddbd6bf907ad524320a0d14b85586af0" + integrity sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg== + +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@types/json-schema@^7.0.9": + version "7.0.12" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" + integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== + +"@types/mocha@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.1.tgz#2f4f65bb08bc368ac39c96da7b2f09140b26851b" + integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q== + +"@types/node@^20.3.2": + version "20.3.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.2.tgz#fa6a90f2600e052a03c18b8cb3fd83dd4e599898" + integrity sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw== + +"@types/semver@^7.3.12": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" + integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== + +"@types/vscode@^1.44.0": + version "1.79.1" + resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.79.1.tgz#ab568315f9c844a8f4fa8f168b2d6dbf1f58dd02" + integrity sha512-Ikwc4YbHABzqthrWfeAvItaAIfX9mdjMWxqNgTpGjhgOu0TMRq9LzyZ2yBK0JhYqoSjEubEPawf6zJgnl6Egtw== + +"@typescript-eslint/eslint-plugin@^5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz#81382d6ecb92b8dda70e91f9035611cb2fecd1c3" + integrity sha512-KSWsVvsJsLJv3c4e73y/Bzt7OpqMCADUO846bHcuWYSYM19bldbAeDv7dYyV0jwkbMfJ2XdlzwjhXtuD7OY6bw== + dependencies: + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.60.1" + "@typescript-eslint/type-utils" "5.60.1" + "@typescript-eslint/utils" "5.60.1" + debug "^4.3.4" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.60.1.tgz#0f2f58209c0862a73e3d5a56099abfdfa21d0fd3" + integrity sha512-pHWlc3alg2oSMGwsU/Is8hbm3XFbcrb6P5wIxcQW9NsYBfnrubl/GhVVD/Jm/t8HXhA2WncoIRfBtnCgRGV96Q== + dependencies: + "@typescript-eslint/scope-manager" "5.60.1" + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/typescript-estree" "5.60.1" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.60.1.tgz#35abdb47f500c68c08f2f2b4f22c7c79472854bb" + integrity sha512-Dn/LnN7fEoRD+KspEOV0xDMynEmR3iSHdgNsarlXNLGGtcUok8L4N71dxUgt3YvlO8si7E+BJ5Fe3wb5yUw7DQ== + dependencies: + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/visitor-keys" "5.60.1" + +"@typescript-eslint/type-utils@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.60.1.tgz#17770540e98d65ab4730c7aac618003f702893f4" + integrity sha512-vN6UztYqIu05nu7JqwQGzQKUJctzs3/Hg7E2Yx8rz9J+4LgtIDFWjjl1gm3pycH0P3mHAcEUBd23LVgfrsTR8A== + dependencies: + "@typescript-eslint/typescript-estree" "5.60.1" + "@typescript-eslint/utils" "5.60.1" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.60.1.tgz#a17473910f6b8d388ea83c9d7051af89c4eb7561" + integrity sha512-zDcDx5fccU8BA0IDZc71bAtYIcG9PowaOwaD8rjYbqwK7dpe/UMQl3inJ4UtUK42nOCT41jTSCwg76E62JpMcg== + +"@typescript-eslint/typescript-estree@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.60.1.tgz#8c71824b7165b64d5ebd7aa42968899525959834" + integrity sha512-hkX70J9+2M2ZT6fhti5Q2FoU9zb+GeZK2SLP1WZlvUDqdMbEKhexZODD1WodNRyO8eS+4nScvT0dts8IdaBzfw== + dependencies: + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/visitor-keys" "5.60.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.60.1.tgz#6861ebedbefba1ac85482d2bdef6f2ff1eb65b80" + integrity sha512-tiJ7FFdFQOWssFa3gqb94Ilexyw0JVxj6vBzaSpfN/8IhoKkDuSAenUKvsSHw2A/TMpJb26izIszTXaqygkvpQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.60.1" + "@typescript-eslint/types" "5.60.1" + "@typescript-eslint/typescript-estree" "5.60.1" + eslint-scope "^5.1.1" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.60.1": + version "5.60.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.60.1.tgz#19a877358bf96318ec35d90bfe6bd1445cce9434" + integrity sha512-xEYIxKcultP6E/RMKqube11pGjXH1DCo60mQoWhVYyKfLkwbIVVjYxmOenNMxILx0TjCujPTjjnTIVzm09TXIw== + dependencies: + "@typescript-eslint/types" "5.60.1" + eslint-visitor-keys "^3.3.0" + +"@vscode/debugadapter@^1.40.0": + version "1.61.0" + resolved "https://registry.yarnpkg.com/@vscode/debugadapter/-/debugadapter-1.61.0.tgz#5e40595ee2e699b5fd447f3ea3c961a8e8573bc3" + integrity sha512-VDGLUFDVAdnftUebZe4uQCIFUbJ7rTc2Grps4D/CXl+qyzTZSQLv5VADEOZ6kBYG4SvlnMLql5vPQ0G6XvUCvQ== + dependencies: + "@vscode/debugprotocol" "1.61.0" + +"@vscode/debugprotocol@1.61.0", "@vscode/debugprotocol@^1.40.0": + version "1.61.0" + resolved "https://registry.yarnpkg.com/@vscode/debugprotocol/-/debugprotocol-1.61.0.tgz#82bbcaba5a925f1f58246c9f50b669855c9f23f9" + integrity sha512-K/kF27jIStVFqlmUaGc2u+Dj8IR7YdEiSqShWr7MWhDudqpAW7uu7XMwoFwjpuC9LSaVwJMIX7EFC5OJ/RmnDQ== + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn@^8.8.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59" + integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== + +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-colors@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.2, braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^6.0.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +chalk@^4.0.0, chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chokidar@3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +core_d@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/core_d/-/core_d-5.0.1.tgz#695c9c9baa483d7321db47a452887738048a1822" + integrity sha512-37lZyhJY1hzgFbfU4LzY4zL09QPwPfV2W/3YBOtN7mkdvVaeP1OVnDZI6zxggtlPwG/BuE5wIr0xptlVJk5EPA== + dependencies: + supports-color "^8.1.0" + +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@4.3.4, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + +diff@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== + +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + +eslint@^8.12.0, eslint@^8.43.0: + version "8.43.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.43.0.tgz#3e8c6066a57097adfd9d390b8fc93075f257a094" + integrity sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.4.0" + "@eslint/eslintrc" "^2.0.3" + "@eslint/js" "8.43.0" + "@humanwhocodes/config-array" "^0.11.10" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.5.2" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + +eslint_d@^12.2.1: + version "12.2.1" + resolved "https://registry.yarnpkg.com/eslint_d/-/eslint_d-12.2.1.tgz#e5faf55acdc74d0e6e4f13ade464421f1f8e4152" + integrity sha512-qOJ9cTi5AaH5bOgEoCkv41DJ637mHgzffbOLojwU4wadwC6qbR+OxVJRvVzH0v2XYmQOvw4eiJK7ivrr5SvzsA== + dependencies: + core_d "^5.0.1" + eslint "^8.12.0" + nanolru "^1.0.0" + optionator "^0.9.1" + +espree@^9.5.2: + version "9.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.2.tgz#e994e7dc33a082a7a82dceaf12883a829353215b" + integrity sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw== + dependencies: + acorn "^8.8.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.2.9: + version "3.2.12" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@5.0.0, find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +flatted@^3.1.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.1.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^13.19.0: + version "13.20.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" + integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== + dependencies: + type-fest "^0.20.2" + +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +he@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +ignore@^5.2.0: + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +js-yaml@4.1.0, js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +log-symbols@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== + dependencies: + chalk "^4.1.0" + is-unicode-supported "^0.1.0" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +minimatch@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" + integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +mocha@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" + integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== + dependencies: + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.5.3" + debug "4.3.4" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.2.0" + he "1.2.0" + js-yaml "4.1.0" + log-symbols "4.1.0" + minimatch "5.0.1" + ms "2.1.3" + nanoid "3.3.3" + serialize-javascript "6.0.0" + strip-json-comments "3.1.1" + supports-color "8.1.1" + workerpool "6.2.1" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +n-readlines@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/n-readlines/-/n-readlines-1.0.1.tgz#bbb7364d38bc31a170a199f986fcacfa76b95f6e" + integrity sha512-z4SyAIVgMy7CkgsoNw7YVz40v0g4+WWvvqy8+ZdHrCtgevcEO758WQyrYcw3XPxcLxF+//RszTz/rO48nzD0wQ== + +nanoid@3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" + integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== + +nanolru@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/nanolru/-/nanolru-1.0.0.tgz#0a5679cd4e4578c4ca3741e610b71c4c9b5afaf8" + integrity sha512-GyQkE8M32pULhQk7Sko5raoIbPalAk90ICG+An4fq6fCsFHsP6fB2K46WGXVdoJpy4SGMnZ/EKbo123fZJomWg== + +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +optionator@^0.9.1: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +punycode@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +semver@^7.3.7: + version "7.5.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" + integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== + dependencies: + lru-cache "^6.0.0" + +serialize-javascript@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" + integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== + dependencies: + randombytes "^2.1.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@8.1.1, supports-color@^8.1.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +typescript@^5.1.6: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +vscode-debugadapter-testsupport@^1.40.3: + version "1.51.0" + resolved "https://registry.yarnpkg.com/vscode-debugadapter-testsupport/-/vscode-debugadapter-testsupport-1.51.0.tgz#d60c4d9e2b70d094d9449abffdf3745898e698a4" + integrity sha512-rb8tfn7J3kxLi1rRhEyG5ggGkFcJH2WrYYrq6Vb1tDAcHoFXF580M1dAA2jPOrc0I14GuWxMnndvfGkfG10VxA== + dependencies: + vscode-debugprotocol "1.51.0" + +vscode-debugprotocol@1.51.0: + version "1.51.0" + resolved "https://registry.yarnpkg.com/vscode-debugprotocol/-/vscode-debugprotocol-1.51.0.tgz#c03168dac778b6c24ce17b3511cb61e89c11b2df" + integrity sha512-dzKWTMMyebIMPF1VYMuuQj7gGFq7guR8AFya0mKacu+ayptJfaRuM0mdHCqiOth4FnRP8mPhEroFPx6Ift8wHA== + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +workerpool@6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" + integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@20.2.4: + version "20.2.4" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== + +yargs-parser@^20.2.2: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== From 351f4f694981b40f446ec226bc3b21eef646afa7 Mon Sep 17 00:00:00 2001 From: David Declerck Date: Thu, 23 Nov 2023 16:39:48 +0100 Subject: [PATCH 02/15] Some improvements --- package.json | 130 +++++++++++++++++++++++++---------------------- src/extension.ts | 79 +++++++++++++++++++--------- src/settings.ts | 25 ++++----- 3 files changed, 135 insertions(+), 99 deletions(-) diff --git a/package.json b/package.json index 760fa55..a947d87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "superbol-vscode-debug", - "displayName": "Superbol debugger", + "displayName": "SuperBOL Debugger for GnuCOBOL", "description": "Debug or execute COBOL code. No mainframe required.", "keywords": [ "cobol", @@ -11,16 +11,16 @@ ], "version": "2.31.37", "publisher": "OCamlPro SAS", - "contributors": [ - { - "name": "Emilien Lemaire", - "email": "emilien.lemaire@ocamlpro.com" - }, - { - "name": "Olegs Kunicins", - "email": "olegs.kunicins@gmail.com" - } - ], + "contributors": [ + { + "name": "Emilien Lemaire", + "email": "emilien.lemaire@ocamlpro.com" + }, + { + "name": "Olegs Kunicins", + "email": "olegs.kunicins@gmail.com" + } + ], "license": "GPL-3.0", "icon": "icon.png", "engines": { @@ -28,7 +28,8 @@ }, "main": "./out/src/extension", "activationEvents": [ - "onDebugResolve" + "onDebugResolve", + "onDebugInitialConfigurations" ], "categories": [ "Debuggers" @@ -54,7 +55,7 @@ "languages": ["cobol", "COBOL"], "program": "./out/src/gdb.js", "runtime": "node", - "label": "COBOL debugger", + "label": "SuperBOL Debugger for GnuCOBOL", "configurationAttributes": { "launch": { "required": [], @@ -84,13 +85,15 @@ "description": "Path to cobc", "default": "cobc" }, + "libcobpath": { + "type": "string", + "description": "Path to libcob", + "default": null + }, "cobcargs": { "type": "array", "description": "Extra arguments for cobc", - "default": [ - "-free", - "-x" - ] + "default": ["-free", "-x"] }, "group": { "type": "array", @@ -142,13 +145,15 @@ "description": "Path to cobc", "default": "cobc" }, + "libcobpath": { + "type": "string", + "description": "Path to libcob", + "default": null + }, "cobcargs": { "type": "array", "description": "Extra arguments for cobc", - "default": [ - "-free", - "-x" - ] + "default": ["-free", "-x"] }, "group": { "type": "array", @@ -178,82 +183,83 @@ } } }, - "initialConfigurations": [ - { - "name": "Superbol debugger", - "type": "gdb", - "request": "launch", - "cobcargs": [ - "-free", - "-x" - ], - "coverage": true - } - ], "configurationSnippets": [ { - "label": "Superbol: debug launch", - "description": "New Superbol launch request", + "label": "SuperBOL: debug launch", + "description": "New SuperBOL launch request", "body": { + "name": "${2:SuperBOL: debug launch}", "type": "gdb", "request": "launch", - "name": "${2: Superbol debugger}" + "target": "$${_:{file}}", + "arguments": "", + "cwd": "$${_:{workspaceRoot}}", + "group": [], + "cobcargs": ["-free", "-x"], + "coverage": true, + "verbose": false } }, { - "label": "Superbol: debug attach local", - "description": "New Superbol attach local request", + "label": "SuperBOL: debug attach local", + "description": "New SuperBOL attach local request", "body": { + "name": "${2:SuperBOL: debug attach local}", "type": "gdb", "request": "attach", - "name": "${2: Superbol debugger}", - "pid": "${3:0}" + "pid": "${3:0}", + "target": "$${_:{file}}", + "arguments": "", + "cwd": "$${_:{workspaceRoot}}", + "group": [], + "cobcargs": ["-free", "-x"], + "verbose": false } }, { - "label": "Superbol: debug attach remote", - "description": "New Superbol attach remote request", + "label": "SuperBOL: debug attach remote", + "description": "New SuperBOL attach remote request", "body": { + "name": "${2:SuperBOL: debug attach remote}", "type": "gdb", "request": "attach", - "name": "${2: Superbol debugger}", - "remoteDebugger": "${3:host:port}" + "remoteDebugger": "${3:host:port}", + "target": "$${_:{file}}", + "arguments": "", + "cwd": "$${_:{workspaceRoot}}", + "group": [], + "cobcargs": ["-free", "-x"], + "verbose": false } } ] } ], "configuration": { - "title": "Superbol Debugger", + "title": "SuperBOL Debugger", "properties": { - "superbol_debugger.display_variable_attributes": { + "superbol-vscode-debug.displayVariableAttributes": { "type": "boolean", "default": false, - "description": "Displaying Data Storages and Fields attributes(e.g. size of Alphanumerics or digits and scale of numerics).", + "description": "Displaying Data Storages and Fields attributes (e.g. size of Alphanumerics or digits and scale of numerics).", "scope": "resource" }, - "superbol_debugger.cwd": { - "type": "string", - "default": "${workspaceRoot}", - "description": "Path to project", - "scope": "application" - }, - "superbol_debugger.target": { + "superbol-vscode-debug.pathToGDB": { "type": "string", - "description": "Path to source code", - "default": "${file}", + "description": "Path to the `gdb` command", + "default": "gdb", "scope": "application" }, - "superbol_debugger.gdbpath": { + "superbol-vscode-debug.pathToCobc": { "type": "string", - "description": "Path to gdb", - "default": "gdb", + "description": "Path to the `cobc` command", + "default": "/usr/local/gnucobol/bin/cobc", "scope": "application" }, - "superbol_debugger.cobcpath": { + "superbol-vscode-debug.pathToLibCob": { "type": "string", - "description": "Path to cobc", - "default": "cobc", + "description": "Path to the folder containing `libcob`", + "default": "/usr/local/gnucobol/lib", "scope": "application" } } diff --git a/src/extension.ts b/src/extension.ts index 1042d2a..a1286df 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -20,26 +20,49 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { _token?: vscode.CancellationToken): vscode.ProviderResult { - config.gdbargs = ["-q", "--interpreter=mi2"]; const settings = new DebuggerSettings(); - if (config.cwd === undefined) { - config.cwd = settings.cwd; + if (config.name === undefined) { + config.name = "SuperBOL: default debug"; } - if (config.target === undefined) { - config.target = settings.target; + if (config.type === undefined) { + config.type = "gdb"; } - if (config.group === undefined) { - config.group = []; + if (config.request === undefined) { + config.request = "launch"; + } + if (config.target === undefined) { + config.target = "${file}"; } if (config.arguments === undefined) { config.arguments = ""; } + if (config.cwd === undefined) { + config.cwd = "${workspaceRoot}"; + } + if (config.group === undefined) { + config.group = []; + } if (config.gdbpath === undefined) { config.gdbpath = settings.gdbpath; } if (config.cobcpath === undefined) { config.cobcpath = settings.cobcpath; } + if (config.cobcargs === undefined) { + config.cobcargs = ["-free", "-x"]; + } + if (config.libcobpath === undefined) { + config.libcobpath = settings.libcobpath; + } + if (config.env === undefined) { + config.env = { ["LD_LIBRARY_PATH"] : config.libcobpath }; + } else { + config.env.LD_LIBRARY_PATH = config.libcobpath + ";" + config.env.LD_LIBRARY_PATH; + } + if (config.coverage === undefined) { + config.coverage = true; + } + config.gdbargs = ["-q", "--interpreter=mi2"]; return config; } @@ -48,36 +71,42 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { _token?: vscode.CancellationToken): vscode.ProviderResult { const launchConfigDefault: vscode.DebugConfiguration = { - name: "Superbol debugger", + name: "SuperBOL: debug launch", type: "gdb", request: "launch", - cobcargs: [ - "-free", - "-x" - ], - coverage: true + target: "${file}", + arguments: "", + cwd: "${workspaceRoot}", + group: [], + cobcargs: ["-free", "-x"], + coverage: true, + verbose: false }; const attachLocalConfiguration: vscode.DebugConfiguration = { - name: "Superbol debugger attach local", + name: "SuperBOL: debug attach local", type: "gdb", request: "attach", - cobcargs: [ - "-free", - "-x" - ], - pid: "${input:pid}" + pid: "${input:pid}", + target: "${file}", + arguments: "", + cwd: "${workspaceRoot}", + group: [], + cobcargs: ["-free", "-x"], + verbose: false }; const attachRemoteConfiguration: vscode.DebugConfiguration = { - name: "Superbol debugger attach remote", + name: "SuperBOL: debug attach remote", type: "gdb", request: "attach", - cobcargs: [ - "-free", - "-x" - ], - remoteDebugger: "${input:remoteDebugger}" + remoteDebugger: "${input:remoteDebugger}", + target: "${file}", + arguments: "", + cwd: "${workspaceRoot}", + group: [], + cobcargs: ["-free", "-x"], + verbose: false } return [ diff --git a/src/settings.ts b/src/settings.ts index d2bcfdb..ca01fb0 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -15,9 +15,14 @@ type InspectResult = { export class DebuggerSettings { private readonly extensionSettings: vscode.WorkspaceConfiguration; + private readonly superbolExtensionSettings: vscode.WorkspaceConfiguration; constructor() { - this.extensionSettings = vscode.workspace.getConfiguration("superbol_debugger"); + this.extensionSettings = vscode.workspace.getConfiguration("superbol-vscode-debug"); + this.superbolExtensionSettings = vscode.workspace.getConfiguration("superbol"); + +console.log(this.getWithFallback(this.superbolExtensionSettings, "path")); + } private getWithFallback(settings: vscode.WorkspaceConfiguration, section: string): T { @@ -33,22 +38,18 @@ export class DebuggerSettings { } public get displayVariableAttributes(): boolean { - return this.getWithFallback(this.extensionSettings, "display_variable_attributes"); - } - - public get cwd(): string { - return this.getWithFallback(this.extensionSettings, "cwd"); - } - - public get target(): string { - return this.getWithFallback(this.extensionSettings, "target"); + return this.getWithFallback(this.extensionSettings, "displayVariableAttributes"); } public get gdbpath(): string { - return this.getWithFallback(this.extensionSettings, "gdbpath"); + return this.getWithFallback(this.extensionSettings, "pathToGDB"); } public get cobcpath(): string { - return this.getWithFallback(this.extensionSettings, "cobcpath"); + return this.getWithFallback(this.extensionSettings, "pathToCobc"); + } + + public get libcobpath(): string { + return this.getWithFallback(this.extensionSettings, "pathToLibCob"); } } From 33be1a04a6d25ceb43892ab08427595ea6fff784 Mon Sep 17 00:00:00 2001 From: David Declerck Date: Wed, 6 Dec 2023 16:14:03 +0100 Subject: [PATCH 03/15] Remove compilation from extenstion - should rely on preBuildTask --- package.json | 29 ------------------ src/extension.ts | 9 ------ src/gdb.ts | 8 ----- src/mi2.ts | 79 ++---------------------------------------------- src/parser.c.ts | 3 ++ src/settings.ts | 9 ++---- 6 files changed, 7 insertions(+), 130 deletions(-) diff --git a/package.json b/package.json index a947d87..d629a45 100644 --- a/package.json +++ b/package.json @@ -80,21 +80,11 @@ "description": "Path to gdb", "default": "gdb" }, - "cobcpath": { - "type": "string", - "description": "Path to cobc", - "default": "cobc" - }, "libcobpath": { "type": "string", "description": "Path to libcob", "default": null }, - "cobcargs": { - "type": "array", - "description": "Extra arguments for cobc", - "default": ["-free", "-x"] - }, "group": { "type": "array", "description": "Compilation Group for executable", @@ -140,21 +130,11 @@ "description": "Path to gdb", "default": "gdb" }, - "cobcpath": { - "type": "string", - "description": "Path to cobc", - "default": "cobc" - }, "libcobpath": { "type": "string", "description": "Path to libcob", "default": null }, - "cobcargs": { - "type": "array", - "description": "Extra arguments for cobc", - "default": ["-free", "-x"] - }, "group": { "type": "array", "description": "Compilation Group for executable", @@ -195,7 +175,6 @@ "arguments": "", "cwd": "$${_:{workspaceRoot}}", "group": [], - "cobcargs": ["-free", "-x"], "coverage": true, "verbose": false } @@ -212,7 +191,6 @@ "arguments": "", "cwd": "$${_:{workspaceRoot}}", "group": [], - "cobcargs": ["-free", "-x"], "verbose": false } }, @@ -228,7 +206,6 @@ "arguments": "", "cwd": "$${_:{workspaceRoot}}", "group": [], - "cobcargs": ["-free", "-x"], "verbose": false } } @@ -250,12 +227,6 @@ "default": "gdb", "scope": "application" }, - "superbol-vscode-debug.pathToCobc": { - "type": "string", - "description": "Path to the `cobc` command", - "default": "/usr/local/gnucobol/bin/cobc", - "scope": "application" - }, "superbol-vscode-debug.pathToLibCob": { "type": "string", "description": "Path to the folder containing `libcob`", diff --git a/src/extension.ts b/src/extension.ts index a1286df..c7f7dd9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -45,12 +45,6 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { if (config.gdbpath === undefined) { config.gdbpath = settings.gdbpath; } - if (config.cobcpath === undefined) { - config.cobcpath = settings.cobcpath; - } - if (config.cobcargs === undefined) { - config.cobcargs = ["-free", "-x"]; - } if (config.libcobpath === undefined) { config.libcobpath = settings.libcobpath; } @@ -78,7 +72,6 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { arguments: "", cwd: "${workspaceRoot}", group: [], - cobcargs: ["-free", "-x"], coverage: true, verbose: false }; @@ -92,7 +85,6 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { arguments: "", cwd: "${workspaceRoot}", group: [], - cobcargs: ["-free", "-x"], verbose: false }; @@ -105,7 +97,6 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { arguments: "", cwd: "${workspaceRoot}", group: [], - cobcargs: ["-free", "-x"], verbose: false } diff --git a/src/gdb.ts b/src/gdb.ts index 27525ca..52fe4e9 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -33,8 +33,6 @@ export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArgum arguments: string; gdbpath: string; gdbargs: string[]; - cobcpath: string; - cobcargs: string[]; env: NodeJS.ProcessEnv; group: string[]; verbose: boolean; @@ -47,8 +45,6 @@ export interface AttachRequestArguments extends DebugProtocol.LaunchRequestArgum arguments: string; gdbpath: string; gdbargs: string[]; - cobcpath: string; - cobcargs: string[]; env: NodeJS.ProcessEnv; group: string[]; verbose: boolean; @@ -96,8 +92,6 @@ export class GDBDebugSession extends DebugSession { new MI2( args.gdbpath, args.gdbargs, - args.cobcpath, - args.cobcargs, args.env, args.verbose, args.noDebug); @@ -159,8 +153,6 @@ export class GDBDebugSession extends DebugSession { this.miDebugger = new MI2( args.gdbpath, args.gdbargs, - args.cobcpath, - args.cobcargs, args.env, args.verbose, false); diff --git a/src/mi2.ts b/src/mi2.ts index a7f7745..ab812ae 100644 --- a/src/mi2.ts +++ b/src/mi2.ts @@ -37,8 +37,6 @@ export class MI2 extends EventEmitter implements IDebugger { constructor( public gdbpath: string, public gdbArgs: string[], - public cobcpath: string, - public cobcArgs: string[], procEnv: NodeJS.ProcessEnv, public verbose: boolean, public noDebug: boolean | null) @@ -73,57 +71,6 @@ export class MI2 extends EventEmitter implements IDebugger { reject(new Error("cwd does not exist.")); } - if (this.noDebug) { - const args = (this.cobcArgs || []) - .concat([target]) - .concat(group) - .concat(['-job=' + targetargs]); - this.process = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); - this.process.stderr.on("data", ((data: string) => { - this.log("stderr", data); - })); - this.process.stdout.on("data", ((data: string) => { - this.log("stdout", data); - })); - this.process.on("exit", (() => { - this.emit("quit"); - })); - return; - } - - const args = (this.cobcArgs || []).concat([ - '-g', //enable debugger - '-fsource-location', //generate source location code - '-ftraceall', // generate trace code - '-Q', // (with `--coverage`): enable C linker coverage - '--coverage', - '-A', // (with `--coverage`): enable C compiler coverage - '--coverage', - '-v', // verbose mode - target - ]).concat(group); - const buildProcess = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); - buildProcess.stderr.on('data', (data: string) => { - if (this.verbose) - this.log("stderr", data); - let match: RegExpExecArray; - do { - match = gcovRegex.exec(data); - if (match) { - this.gcovFiles.add(match[1].split('.').slice(0, -1).join('.')); - } - } while (match); - }); - buildProcess.on('exit', (code) => { - if (code !== 0) { - this.emit("quit"); - return; - } - - if (this.verbose) { - this.log("stderr", `COBOL file ${target} compiled with exit code: ${code}`); - } - try { this.map = new SourceMap(cwd, [target].concat(group)); } catch (e) { @@ -157,7 +104,7 @@ export class MI2 extends EventEmitter implements IDebugger { this.emit("debug-ready"); resolve(undefined); }, reject); - }); + }); } @@ -172,28 +119,6 @@ export class MI2 extends EventEmitter implements IDebugger { reject(new Error("cwd does not exist.")); } - const args = (this.cobcArgs || []).concat([ - '-g', - '-fsource-location', - '-ftraceall', - '-v', - target - ]).concat(group); - const buildProcess = ChildProcess.spawn(this.cobcpath, args, {cwd: cwd, env: this.procEnv}); - buildProcess.stderr.on('data', (data: string) => { - if (this.verbose) - this.log("stderr", data); - }); - buildProcess.on('exit', (code) => { - if (code !== 0) { - this.emit("quit"); - return; - } - - if (this.verbose) { - this.log("stderr", `COBOL file ${target} compiled with exit code: ${code}`); - } - try { this.map = new SourceMap(cwd, [target].concat(group)); } catch (e) { @@ -225,7 +150,7 @@ export class MI2 extends EventEmitter implements IDebugger { this.emit("debug-ready"); resolve(undefined); }, reject); - }); + }); } diff --git a/src/parser.c.ts b/src/parser.c.ts index fdbf657..e37e316 100644 --- a/src/parser.c.ts +++ b/src/parser.c.ts @@ -203,6 +203,9 @@ export class SourceMap { if (!nativePath.isAbsolute(fileCobol)) { fileCobol = nativePath.join(this.cwd, fileCobol); } + if ((process.platform === "win32") && (/[a-z]:/.test(fileCobol))) { + fileCobol = fileCobol.charAt(0).toUpperCase() + fileCobol.slice(1); + } return this.lines.find(e => e.fileCobol === fileCobol && e.lineCobol === lineCobol) ?? new Line('', 0, '', 0); } diff --git a/src/settings.ts b/src/settings.ts index ca01fb0..d73217e 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -19,10 +19,9 @@ export class DebuggerSettings { constructor() { this.extensionSettings = vscode.workspace.getConfiguration("superbol-vscode-debug"); +// Get SuperBOL base extension settings (for instance to get LibCob path) +// Though shouls should be obtained by querying the extension instead ? this.superbolExtensionSettings = vscode.workspace.getConfiguration("superbol"); - -console.log(this.getWithFallback(this.superbolExtensionSettings, "path")); - } private getWithFallback(settings: vscode.WorkspaceConfiguration, section: string): T { @@ -45,10 +44,6 @@ console.log(this.getWithFallback(this.superbolExtensionSettings, "path") return this.getWithFallback(this.extensionSettings, "pathToGDB"); } - public get cobcpath(): string { - return this.getWithFallback(this.extensionSettings, "pathToCobc"); - } - public get libcobpath(): string { return this.getWithFallback(this.extensionSettings, "pathToLibCob"); } From 49c057dba8533ae72998155afb877c5d4acb631e Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Tue, 19 Dec 2023 13:57:27 +0100 Subject: [PATCH 04/15] Minor adaptations for integration into SuperBOL --- src/debugger.ts | 2 +- src/extension.ts | 17 +++++++++-------- src/gdb.ts | 21 ++++++++++++--------- src/mi2.ts | 2 +- src/settings.ts | 42 ++++++++---------------------------------- 5 files changed, 31 insertions(+), 53 deletions(-) diff --git a/src/debugger.ts b/src/debugger.ts index b62db68..5721bc1 100644 --- a/src/debugger.ts +++ b/src/debugger.ts @@ -1,5 +1,5 @@ import {MINode} from "./parser.mi2"; -import {DebugProtocol} from "vscode-debugprotocol/lib/debugProtocol"; +import {DebugProtocol} from "@vscode/debugprotocol"; import {removeLeadingZeroes} from "./functions"; import {SourceMap} from "./parser.c"; diff --git a/src/extension.ts b/src/extension.ts index c7f7dd9..6b1ff27 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -37,7 +37,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { config.arguments = ""; } if (config.cwd === undefined) { - config.cwd = "${workspaceRoot}"; + config.cwd = "${workspaceFolder}"; } if (config.group === undefined) { config.group = []; @@ -65,37 +65,38 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { _token?: vscode.CancellationToken): vscode.ProviderResult { const launchConfigDefault: vscode.DebugConfiguration = { - name: "SuperBOL: debug launch", + name: "SuperBOL: debug (launch)", type: "gdb", request: "launch", + preLaunchTask: "Superbol: build (debug)", target: "${file}", arguments: "", - cwd: "${workspaceRoot}", + cwd: "${workspaceFolder}", group: [], coverage: true, verbose: false }; const attachLocalConfiguration: vscode.DebugConfiguration = { - name: "SuperBOL: debug attach local", + name: "SuperBOL: debug (attach local)", type: "gdb", request: "attach", pid: "${input:pid}", target: "${file}", arguments: "", - cwd: "${workspaceRoot}", + cwd: "${workspaceFolder}", group: [], verbose: false }; const attachRemoteConfiguration: vscode.DebugConfiguration = { - name: "SuperBOL: debug attach remote", + name: "SuperBOL: debug (attach remote)", type: "gdb", request: "attach", - remoteDebugger: "${input:remoteDebugger}", + remoteDebugger: "${input:remote-debugger}", target: "${file}", arguments: "", - cwd: "${workspaceRoot}", + cwd: "${workspaceFolder}", group: [], verbose: false } diff --git a/src/gdb.ts b/src/gdb.ts index 52fe4e9..8c4376c 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -12,7 +12,7 @@ import { Thread, ThreadEvent } from '@vscode/debugadapter'; -import { DebugProtocol } from 'vscode-debugprotocol'; +import { DebugProtocol } from '@vscode/debugprotocol'; import { Breakpoint, VariableObject } from './debugger'; import { MINode } from './parser.mi2'; import { MI2 } from './mi2'; @@ -125,11 +125,13 @@ export class GDBDebugSession extends DebugSession { this.handlePause(undefined); }, (err: Error) => { - this.sendErrorResponse(response, 100, `Failed to start MI Debugger: ${err.toString()}`); + this.sendErrorResponse(response, 100, + `Failed to start MI Debugger: ${err.toString()}`); }); }, /*onrejected:*/ (err: Error) => { - this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`); + this.sendErrorResponse(response, 103, + `Failed to load MI Debugger: ${err.toString()}`); }); } @@ -139,10 +141,9 @@ export class GDBDebugSession extends DebugSession { void { if (!args.pid && !args.remoteDebugger) { - this.sendErrorResponse( - response, - 100, - `Failed to start MI Debugger: pid or remoteDebugger is mandatory`); + this.sendErrorResponse (response, 100, + `Failed to start MI Debugger: PID or remote-debugger argument + required`); return; } @@ -186,11 +187,13 @@ export class GDBDebugSession extends DebugSession { this.handlePause(undefined); }, (err: Error) => { - this.sendErrorResponse(response, 100, `Failed to start MI Debugger: ${err.toString()}`); + this.sendErrorResponse(response, 100, + `Failed to start MI Debugger: ${err.toString()}`); }); }, (err: Error) => { - this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`); + this.sendErrorResponse(response, 103, + `Failed to load MI Debugger: ${err.toString()}`); }); } diff --git a/src/mi2.ts b/src/mi2.ts index ab812ae..b2fae46 100644 --- a/src/mi2.ts +++ b/src/mi2.ts @@ -163,7 +163,7 @@ export class MI2 extends EventEmitter implements IDebugger { } const cmds = [ - this.sendCommand("gdb-set target-async on", false), + this.sendCommand("gdb-set mi-async on", false), this.sendCommand("gdb-set print repeats 1000", false), this.sendCommand("gdb-set args " + targetargs, false), this.sendCommand("environment-directory \"" + escape(cwd) + "\"", false), diff --git a/src/settings.ts b/src/settings.ts index d73217e..7aaeb84 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,50 +1,24 @@ import * as vscode from 'vscode'; -type InspectResult = { - key: string; - defaultValue?: T; - globalValue?: T; - workspaceValue?: T; - workspaceFolderValue?: T; - defaultLanguageValue?: T; - globalLanguageValue?: T; - workspaceLanguageValue?: T; - workspaceFolderLanguageValue?: T; - languageIds?: string[]; -} | undefined - export class DebuggerSettings { - private readonly extensionSettings: vscode.WorkspaceConfiguration; - private readonly superbolExtensionSettings: vscode.WorkspaceConfiguration; + private readonly debugSettings: vscode.WorkspaceConfiguration; constructor() { - this.extensionSettings = vscode.workspace.getConfiguration("superbol-vscode-debug"); -// Get SuperBOL base extension settings (for instance to get LibCob path) -// Though shouls should be obtained by querying the extension instead ? - this.superbolExtensionSettings = vscode.workspace.getConfiguration("superbol"); - } - - private getWithFallback(settings: vscode.WorkspaceConfiguration, section: string): T { - const info: InspectResult = settings.inspect(section); - if (info.workspaceFolderValue !== undefined) { - return info.workspaceFolderValue; - } else if (info.workspaceValue !== undefined) { - return info.workspaceValue; - } else if (info.globalValue !== undefined) { - return info.globalValue; - } - return info.defaultValue; + this.debugSettings = + vscode.workspace.getConfiguration("superbol.debugger"); + //this.globalSettings = + // vscode.workspace.getConfiguration("superbol"); } public get displayVariableAttributes(): boolean { - return this.getWithFallback(this.extensionSettings, "displayVariableAttributes"); + return this.debugSettings.get ("display-variable-attributes"); } public get gdbpath(): string { - return this.getWithFallback(this.extensionSettings, "pathToGDB"); + return this.debugSettings.get ("gdb-path"); } public get libcobpath(): string { - return this.getWithFallback(this.extensionSettings, "pathToLibCob"); + return this.debugSettings.get ("libcob-path"); } } From 576a36ad20514331d7ba7457a6227dd02a01fb0c Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Wed, 20 Dec 2023 09:51:58 +0100 Subject: [PATCH 05/15] Fix warning about a call to namespace object --- src/parser.c.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.c.ts b/src/parser.c.ts index e37e316..b69346c 100644 --- a/src/parser.c.ts +++ b/src/parser.c.ts @@ -1,4 +1,4 @@ -import * as readline from "n-readlines"; +import readline from "n-readlines"; import * as nativePathFromPath from "path"; import {DebuggerVariable, Attribute, VariableType} from "./debugger"; From a19b379babb23eff609454336447ab906166d4eb Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Wed, 20 Dec 2023 10:05:52 +0100 Subject: [PATCH 06/15] Change some fields to match the SuperBOL main extension --- src/extension.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 6b1ff27..57da0c6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -68,7 +68,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { name: "SuperBOL: debug (launch)", type: "gdb", request: "launch", - preLaunchTask: "Superbol: build (debug)", + preLaunchTask: "SuperBOL: build (debug)", target: "${file}", arguments: "", cwd: "${workspaceFolder}", @@ -93,7 +93,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { name: "SuperBOL: debug (attach remote)", type: "gdb", request: "attach", - remoteDebugger: "${input:remote-debugger}", + "remote-debugger": "${input:remote-debugger}", target: "${file}", arguments: "", cwd: "${workspaceFolder}", From dd2a466a9e396012aa32dfb59200cba40084a510 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Mon, 8 Apr 2024 13:54:51 +0200 Subject: [PATCH 07/15] Fix default config resolver This aligns the code of `extension.GdbConfigurationProvider.resolveDebugConfiguration` with `extension.GdbConfigurationProvider.provideDebugConfigurations`, so that the debugger can be launched directly in workspaces that lack a `launch.json`. --- src/extension.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 047b836..586158a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -38,6 +38,9 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { if (config.request === undefined) { config.request = "launch"; } + if (config.preLaunchTask === undefined) { + config.preLaunchTask = "SuperBOL: build (debug)"; + } if (config.target === undefined) { config.target = "${file}"; } From ba251cfae08d9af87ce7a8689b311ea6c480ce59 Mon Sep 17 00:00:00 2001 From: marcsosduma <31162117+marcsosduma@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:16:12 +0200 Subject: [PATCH 08/15] Add support for several terminal emulator programs --- README.md | 10 +---- package.json | 4 ++ src/mi2.ts | 121 ++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 111 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 242fcba..cec5ffa 100644 --- a/README.md +++ b/README.md @@ -156,13 +156,6 @@ Add `gdbtty` property to your `launch.json`. Here’s an example: ``` ![GdbTTY](gdbttydisplay.png) -* Linux Requirements: `xterm` - -How to install xterm on Ubuntu: -``` -sudo apt-get install xterm -``` - On Linux you can see the output of the application in Vs Code itself. Add `gdbtty` property with `vscode` value to your `launch.json`. Here is an example: ```json { @@ -179,8 +172,9 @@ On Linux you can see the output of the application in Vs Code itself. Add `gdbtt ``` ![GdbTTY](gdbttyvscode.png) -### Documentation +You can also use these options with `gdbtty`: `xterm`, `gnome-terminal`, `konsole` and `xfce4-terminal`. +### Documentation For a more in depth documentation please check the [Superbol Documentation](https://ocamlpro.com/superbol/) ### Troubleshooting diff --git a/package.json b/package.json index e437aeb..365d467 100644 --- a/package.json +++ b/package.json @@ -116,6 +116,10 @@ true, false, "vscode", + "xterm", + "gnome-terminal", + "xfce4-terminal", + "konsole", "external" ] } diff --git a/src/mi2.ts b/src/mi2.ts index c37f6a1..57d5eeb 100644 --- a/src/mi2.ts +++ b/src/mi2.ts @@ -943,7 +943,7 @@ export class MI2 extends EventEmitter implements IDebugger { try_find++; if (xterm_device != "") break; } - if (xterm_device === "") this.log("stderr", "tty: Install 'xterm' to use gdb's tty option\n"); + if (xterm_device === "") this.log("stderr", "tty: Install a terminal to use gdb's tty option\n"); } if (xterm_device.includes("pts")) { this.gdbArgs.push("--tty=" + xterm_device); @@ -991,24 +991,113 @@ export class MI2 extends EventEmitter implements IDebugger { return strCode; } + isTerminalInstalled(terminalCommand: string): boolean { + try { + ChildProcess.execSync(`command -v ${terminalCommand}`); + return true; + } catch (error) { + return false; + } + } + + createXFCETerminal(sleepVal, target) { + let dispTarget = (target.length > 50) ? "..." + target.substr(target.length - 50, target.length) : target; + let param = "bash -c 'echo \"GnuCOBOL DEBUG\"; sleep " + sleepVal + ";'"; + const xfce4_terminal_args = [ + "--title", "GnuCOBOL Debug - " + dispTarget, + "--font=DejaVu Sans Mono 14", + "--command", param + ] + const xfce_process = ChildProcess.spawn("xfce4-terminal", xfce4_terminal_args, { + detached: true, + stdio: 'ignore' + }); + xfce_process.unref(); + } + + createKDETerminal(sleepVal, target) { + let dispTarget = (target.length > 50) ? "..." + target.substr(target.length - 50, target.length) : target; + let param = "bash -c 'echo \"GnuCOBOL DEBUG\"; sleep " + sleepVal + ";'"; + const konsole_args = [ + "--title", "GnuCOBOL Debug - " + dispTarget, + "--separate", + "--nofork", + "--hold", + "-e", + param + ] + const kde_process = ChildProcess.spawn("konsole", konsole_args, { + detached: true, + stdio: 'ignore' + }); + kde_process.unref(); + } + + createGNOMETerminal(sleepVal, target) { + let dispTarget = (target.length > 50) ? "..." + target.substr(target.length - 50, target.length) : target; + const gnome_terminal_args = [ + "--title", "GnuCOBOL Debug - " + dispTarget, + "--", + "bash", "-c","echo 'GnuCOBOL DEBUG';" + "sleep " + sleepVal + ";" + ] + const gnome_process = ChildProcess.spawn("gnome-terminal", gnome_terminal_args, { + detached: true, + stdio: 'ignore', + }); + gnome_process.unref(); + } + + createXtermTerminal(sleepVal, target) { + let dispTarget = (target.length > 50) ? "..." + target.substr(target.length - 50, target.length) : target; + const xterm_args = [ + "-title", "GnuCOBOL Debug - " + dispTarget, + "-fa", "DejaVu Sans Mono", + "-fs", "14", + "-e", "/usr/bin/tty;" + + "echo 'GnuCOBOL DEBUG';" + + "sleep " + sleepVal + ";" + ] + const xterm_process = ChildProcess.spawn("xterm", xterm_args, { + detached: true, + stdio: 'ignore', + }); + xterm_process.unref(); + } + // Opens a terminal to show the application screen - gdbtty createTerminal(gdbtty, sleepVal, target) { + let findTerminal = true; if (gdbtty != "vscode") { - let dispTarget = (target.length > 50) ? "..." + target.substr(target.length - 50, target.length) : target; - const xterm_args = [ - "-title", "GnuCOBOL Debug - " + dispTarget, - "-fa", "DejaVu Sans Mono", - "-fs", "14", - "-e", "/usr/bin/tty;" + - "echo 'GnuCOBOL DEBUG';" + - "sleep " + sleepVal + ";" - ] - - const xterm_process = ChildProcess.spawn("xterm", xterm_args, { - detached: true, - stdio: 'ignore', - }); - xterm_process.unref(); + if (typeof gdbtty === 'string' && gdbtty!="external") { + if(this.isTerminalInstalled(gdbtty)){ + findTerminal = false; + switch (gdbtty) { + case "xterm": + this.createXtermTerminal(sleepVal, target); + break; + case "gnome-terminal": + this.createGNOMETerminal(sleepVal, target); + break; + case "konsole": + this.createKDETerminal(sleepVal, target); + break; + case "xfce4-terminal": + this.createXFCETerminal(sleepVal, target); + break; + } + } + } + if(findTerminal){ + if(this.isTerminalInstalled("xterm")){ + this.createXtermTerminal(sleepVal, target); + }else if(this.isTerminalInstalled("gnome-terminal")){ + this.createGNOMETerminal(sleepVal, target); + }else if(this.isTerminalInstalled("xfce4-terminal")){ + this.createXFCETerminal(sleepVal, target); + }else if(this.isTerminalInstalled("konsole")){ + this.createKDETerminal(sleepVal, target); + } + } } else { let terminal = this.selectTerminal(); if (!terminal) { From b6180e11955c2906be9b07ea0812b340d9511253 Mon Sep 17 00:00:00 2001 From: marcsosduma <31162117+marcsosduma@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:19:15 +0200 Subject: [PATCH 09/15] Correction of BUG in subroutine parser --- src/parser.c.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/parser.c.ts b/src/parser.c.ts index 52279aa..9954933 100644 --- a/src/parser.c.ts +++ b/src/parser.c.ts @@ -31,6 +31,7 @@ const versionRegex = /\/\*\sGenerated by\s+cobc\s([0-9a-z\-\.]+)\s+\*\//i; const subroutineRegex = /\sPerform\s/i; const frame_ptrFindRegex = /frame\_ptr\-\-\;/; const fixOlderFormat = /cob\_trace\_stmt/; +const programExit = /\/\*\sProgram\s\exit\s+\*\//i; globalThis.varOccurs = []; @@ -75,6 +76,8 @@ export class SourceMap { private parse(fileC: string): void { let nat = fileC; + let hasProgramExit = false; + if (!nativePath.isAbsolute(fileC)) { nat = nativePathFromPath.resolve(this.cwd, fileC); fileC = nativePath.resolve(this.cwd, fileC); @@ -116,9 +119,9 @@ export class SourceMap { } // fix new codegen match = procedureFixRegex.exec(line); - if (match && this.lines.length > 0) { + if (match && this.lines.length > 0 && !hasProgramExit) { let isOldFormat = fixOlderFormat.exec(this.lineBefore); - if(this.isVersion2_2_or_3_1_1 || !isOldFormat){ // Is it in the old format? + if(fileNameCompare(this.lines[this.lines.length - 1].fileCobol, fileCobol) && (this.isVersion2_2_or_3_1_1 || !isOldFormat)){ // Is it in the old format? let line = this.lines.pop(); line.lineC = parseInt(match[1]); this.lines.push(line); @@ -173,6 +176,10 @@ export class SourceMap { } } this.lineBefore = line; + match = programExit.exec(line); + if (match) { + hasProgramExit=true;; + } lineNumber++; } } From ac6e7d43be647590d911ae3c93ec0899aecfc95e Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Tue, 9 Apr 2024 11:46:14 +0200 Subject: [PATCH 10/15] Fix some links in the README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cec5ffa..a930da9 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ An extension to debug or execute GnuCOBOL code. Forked from [COBOL Degub](https: ![Screenshot](screenshot.png) ### Requirements -This extension is meant to work with our COBOL language extension [Superbol VSCode](https://github.com/OCamlPro/superbol-vscode-platform). +This extension is meant to work in combination with the [SuperBOL Studio](https://github.com/OCamlPro/superbol-vscode-platform) extension for COBOL. #### Binaries * GnuCOBOL `cobc` 3.1+ installed. @@ -175,7 +175,7 @@ On Linux you can see the output of the application in Vs Code itself. Add `gdbtt You can also use these options with `gdbtty`: `xterm`, `gnome-terminal`, `konsole` and `xfce4-terminal`. ### Documentation -For a more in depth documentation please check the [Superbol Documentation](https://ocamlpro.com/superbol/) +For a more in depth documentation please check the [SuperBOL Documentation](https://get-superbol.com/studio/) ### Troubleshooting Add `verbose` property to your `launch.json` and start debugging session. In `DEBUG CONSOLE` you will see complete communication log between `gdb` and VS Code. Here's an example: From 3e61d84f4f6972395ede9fb6573c6ee87dfaf0e4 Mon Sep 17 00:00:00 2001 From: Emilien Lemaire Date: Fri, 3 May 2024 11:09:22 +0200 Subject: [PATCH 11/15] Auto-update coverage highlighting (#7) * Restore gcovFiles retrieval * Fix coverage disabling * Remove formatting changes --- src/coverage.ts | 10 ++++++++++ src/gdb.ts | 11 ++++++----- src/mi2.ts | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/coverage.ts b/src/coverage.ts index a12305a..251c05f 100644 --- a/src/coverage.ts +++ b/src/coverage.ts @@ -56,6 +56,7 @@ export class CoverageStatus implements Disposable { } public async show(cFiles: string[], sourceMap: SourceMap) { + this.highlight = true; this.coverages = await loadGcovData(cFiles); this.sourceMap = sourceMap; this.updateStatus(); @@ -65,6 +66,15 @@ export class CoverageStatus implements Disposable { this.statusBar.dispose(); } + public setHighlight(highlighted: boolean) { + this.highlight = highlighted; + } + + public hide() { + this.highlight = false; + this.updateStatus(); + } + private updateStatus() { const editor = window.activeTextEditor; if (editor === undefined) { diff --git a/src/gdb.ts b/src/gdb.ts index d46e13b..e3d7512 100644 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -67,6 +67,7 @@ export class GDBDebugSession extends DebugSession { coverageStatus: CoverageStatus; private showVariableDetails: boolean; private settings = new DebuggerSettings(); + private showCoverage: boolean = true; protected initializeRequest(response: DebugProtocol.InitializeResponse, _args: DebugProtocol.InitializeRequestArguments): void { response.body.supportsSetVariable = true; @@ -74,9 +75,7 @@ export class GDBDebugSession extends DebugSession { } protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { - if (!args.coverage) { - this.coverageStatus = undefined; - } + this.showCoverage = args.coverage; this.started = false; this.attached = false; @@ -124,7 +123,7 @@ export class GDBDebugSession extends DebugSession { return; } - this.coverageStatus = undefined; + this.showCoverage = false; this.attached = true; this.started = false; @@ -212,8 +211,10 @@ export class GDBDebugSession extends DebugSession { if (this.quit) return; - if (this.coverageStatus !== undefined) { + if (this.showCoverage) { this.coverageStatus.show(this.miDebugger.getGcovFiles(), this.miDebugger.getSourceMap()).catch((err: Error) => console.log(err)); + } else { + this.coverageStatus.hide(); } this.quit = true; diff --git a/src/mi2.ts b/src/mi2.ts index 57d5eeb..e985692 100644 --- a/src/mi2.ts +++ b/src/mi2.ts @@ -70,6 +70,8 @@ export class MI2 extends EventEmitter implements IDebugger { reject(new Error("cwd does not exist.")); } + let target_no_ext = target.split('.').slice(0, -1).join('.'); + this.gcovFiles.add(target_no_ext); try { this.map = new SourceMap(cwd, [target].concat(group)); } catch (e) { From 07ab8b419e2e660216de3c85c6c2ce3b1f442353 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 26 Jul 2024 12:21:46 +0200 Subject: [PATCH 12/15] Make the `preLaunchTask` optional in launch configuration --- src/extension.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 586158a..f9d8796 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -38,9 +38,12 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { if (config.request === undefined) { config.request = "launch"; } - if (config.preLaunchTask === undefined) { - config.preLaunchTask = "SuperBOL: build (debug)"; - } + if (config.preLaunchTask === undefined) { + config.preLaunchTask = "SuperBOL: build (debug)"; + } else if (config.preLaunchTask === "none" || + config.preLaunchTask === "") { + delete config.preLaunchTask; + } if (config.target === undefined) { config.target = "${file}"; } From d203ea1be727e9c32fea0861d9f3a89d94cb09a5 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 26 Jul 2024 12:22:40 +0200 Subject: [PATCH 13/15] Proper disposal of the debug adapter factory --- src/extension.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index f9d8796..b5a2b5f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -10,15 +10,18 @@ const MAX_COLUMN_INDEX = 300; const COBOL_RESERVED_WORDS = ["perform", "move", "to", "set", "add", "subtract", "call", "inquire", "modify", "invoke", "if", "not", "end-if", "until", "varying", "evaluate", "true", "when", "false", "go", "thru", "zeros", "spaces", "zero", "space", "inspect", "tallying", "exit", "paragraph", "method", "cycle", "from", "by", "and", "or", "of", "length", "function", "program", "synchronized", "end-synchronized", "string", "end-string", "on", "reference", "value", "returning", "giving", "replacing", "goback", "all", "open", "i-o", "input", "output", "close", "compute", "unstring", "using", "delete", "start", "read", "write", "rewrite", "with", "lock", "else", "upper-case", "lower-case", "display", "accept", "at", "clear-screen", "initialize", "line", "col", "key", "is", "self", "null", "stop", "run", "upon", "environment-name", "environment-value"] export function activate(context: vscode.ExtensionContext) { + const provider = new GdbConfigurationProvider(); + const factory = new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession()); context.subscriptions.push( - vscode.debug.registerDebugConfigurationProvider('gdb', new GdbConfigurationProvider()), - vscode.debug.registerDebugAdapterDescriptorFactory('gdb', new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession())), + vscode.debug.registerDebugConfigurationProvider('gdb', provider), + vscode.debug.registerDebugAdapterDescriptorFactory('gdb', factory, vscode.DebugConfigurationProviderTriggerKind.Dynamic), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL31', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL3.1', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL32', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL3.2', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('COBOL', new GnuCOBOLEvalExpressionFactory()), + factory, ); } From 2fec4e8c13ad1c44b163ab2822fa8da5d3ea9005 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 26 Jul 2024 15:44:47 +0200 Subject: [PATCH 14/15] Disable handling of code coverage by default --- package.json | 4 ++-- src/extension.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 365d467..a72f350 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "coverage": { "type": "boolean", "description": "Enable code coverage", - "default": true + "default": false }, "verbose": { "type": "boolean", @@ -193,7 +193,7 @@ "arguments": "", "cwd": "$${_:{workspaceRoot}}", "group": [], - "coverage": true, + "coverage": false, "verbose": false, "gdbtty": true } diff --git a/src/extension.ts b/src/extension.ts index b5a2b5f..7162a36 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -71,7 +71,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { config.env.LD_LIBRARY_PATH = config.libcobpath + ";" + config.env.LD_LIBRARY_PATH; } if (config.coverage === undefined) { - config.coverage = true; + config.coverage = false; } if (config.gdbtty === undefined) { config.gdbtty = true; @@ -92,7 +92,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { arguments: "", cwd: "${workspaceFolder}", group: [], - coverage: true, + coverage: false, verbose: false, gdbtty: true }; From eb434cba87e619872c5205414a5eea6a4fdb4e97 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 26 Jul 2024 10:13:04 +0200 Subject: [PATCH 15/15] Rename debugger type to avoid conflicting with proper "gdb" --- package.json | 8 ++++---- src/extension.ts | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index a72f350..82aa1ba 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ ], "debuggers": [ { - "type": "gdb", + "type": "superbol-gdb", "languages": ["cobol", "COBOL"], "program": "./out/src/gdb.js", "runtime": "node", @@ -187,7 +187,7 @@ "description": "New SuperBOL launch request", "body": { "name": "${2:SuperBOL: debug launch}", - "type": "gdb", + "type": "superbol-gdb", "request": "launch", "target": "$${_:{file}}", "arguments": "", @@ -203,7 +203,7 @@ "description": "New SuperBOL attach local request", "body": { "name": "${2:SuperBOL: debug attach local}", - "type": "gdb", + "type": "superbol-gdb", "request": "attach", "pid": "${3:0}", "target": "$${_:{file}}", @@ -218,7 +218,7 @@ "description": "New SuperBOL attach remote request", "body": { "name": "${2:SuperBOL: debug attach remote}", - "type": "gdb", + "type": "superbol-gdb", "request": "attach", "remoteDebugger": "${3:host:port}", "target": "$${_:{file}}", diff --git a/src/extension.ts b/src/extension.ts index 7162a36..5abdbd2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -13,8 +13,8 @@ export function activate(context: vscode.ExtensionContext) { const provider = new GdbConfigurationProvider(); const factory = new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession()); context.subscriptions.push( - vscode.debug.registerDebugConfigurationProvider('gdb', provider), - vscode.debug.registerDebugAdapterDescriptorFactory('gdb', factory, vscode.DebugConfigurationProviderTriggerKind.Dynamic), + vscode.debug.registerDebugConfigurationProvider('superbol-gdb', provider), + vscode.debug.registerDebugAdapterDescriptorFactory('superbol-gdb', factory, vscode.DebugConfigurationProviderTriggerKind.Dynamic), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL31', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL3.1', new GnuCOBOLEvalExpressionFactory()), @@ -29,14 +29,14 @@ export function deactivate() { } class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { - resolveDebugConfiguration(_folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, _token?: vscode.CancellationToken): vscode.ProviderResult { + public resolveDebugConfiguration(_folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, _token?: vscode.CancellationToken): vscode.ProviderResult { config.gdbargs = ["-q", "--interpreter=mi2"]; const settings = new DebuggerSettings(); if (config.name === undefined) { config.name = "SuperBOL: default debug"; } if (config.type === undefined) { - config.type = "gdb"; + config.type = "superbol-gdb"; } if (config.request === undefined) { config.request = "launch"; @@ -79,13 +79,13 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { return config; } - provideDebugConfigurations( + public provideDebugConfigurations( _folder: vscode.WorkspaceFolder, _token?: vscode.CancellationToken): vscode.ProviderResult { const launchConfigDefault: vscode.DebugConfiguration = { name: "SuperBOL: debug (launch)", - type: "gdb", + type: "superbol-gdb", request: "launch", preLaunchTask: "SuperBOL: build (debug)", target: "${file}", @@ -99,7 +99,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { const attachLocalConfiguration: vscode.DebugConfiguration = { name: "SuperBOL: debug (attach local)", - type: "gdb", + type: "superbol-gdb", request: "attach", pid: "${input:pid}", target: "${file}", @@ -111,7 +111,7 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { const attachRemoteConfiguration: vscode.DebugConfiguration = { name: "SuperBOL: debug (attach remote)", - type: "gdb", + type: "superbol-gdb", request: "attach", "remote-debugger": "${input:remote-debugger}", target: "${file}",