diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 782e31ce..3b686e72 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -11,14 +11,14 @@ jobs: name: Setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "22" - name: Cache NPM Install id: cache-npm - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ./node_modules key: npm-${{ hashFiles('./package-lock.json') }} @@ -32,14 +32,14 @@ jobs: needs: setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "22" - name: Load NPM install id: cache-npm - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ./node_modules key: npm-${{ hashFiles('./package-lock.json') }} @@ -48,7 +48,7 @@ jobs: - name: Package Binary run: ./node_modules/vsce/vsce package -o cortex-debug.vsix - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: cortex-debug.vsix path: ./cortex-debug.vsix @@ -58,14 +58,14 @@ jobs: needs: setup runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "22" - name: Load NPM install id: cache-npm - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ./node_modules key: npm-${{ hashFiles('./package-lock.json') }} diff --git a/CHANGELOG.md b/CHANGELOG.md index acbfc5f6..1a22e80d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +# V2.0.0-pre1 +* Forked code from Marus and started to maintain it at https://github.com/simonsso/cortex-debug/ +* Removed telemetery + + # V1.13.0-pre9 * Backed out change where we try "monitor exit". See [Issue #1185](https://github.com/Marus/cortex-debug/issues/1185) * Increased server temout to 10 mins diff --git a/README.md b/README.md index 4fc17361..0c5a1af6 100644 --- a/README.md +++ b/README.md @@ -87,5 +87,6 @@ Now, launch a debug session and you wil be able to use the primary VSCode window ## Acknowledgments +This is a fork from Marcel Ball's cortex-debug https://github.com/Marus/cortex-debug.git Parts of this extension are based upon Jan Jurzitza's (WebFreak) code-debug extension (https://github.com/WebFreak001/code-debug).
His project provided an excellent base for GDB MI parsing and interaction. diff --git a/package-lock.json b/package-lock.json index 791dd1e9..7d395c3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "1.13.0-pre9", "license": "MIT", "dependencies": { - "@vscode/extension-telemetry": "^0.9.8", "@vscode/webview-ui-toolkit": "^1.4.0", "binary-parser": "^2.3.0", "bindings": "^1.5.0", @@ -27,7 +26,6 @@ "serialport": "^13.0.0", "stream-json": "^1.9.1", "tmp": "^0.2.4", - "universal-analytics": "^0.5.3", "usb": "^2.14.0", "uuid": "^11.0.5", "vscode-jsonrpc": "^8.2.1" @@ -110,6 +108,7 @@ "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@eslint/object-schema": "^2.1.5", "debug": "^4.3.1", @@ -125,6 +124,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -136,6 +136,7 @@ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -149,6 +150,7 @@ "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@types/json-schema": "^7.0.15" }, @@ -162,6 +164,7 @@ "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -186,6 +189,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -197,6 +201,7 @@ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=18" }, @@ -210,6 +215,7 @@ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -223,6 +229,7 @@ "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -233,6 +240,7 @@ "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -243,6 +251,7 @@ "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@eslint/core": "^0.10.0", "levn": "^0.4.1" @@ -257,6 +266,7 @@ "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=18.18.0" } @@ -267,6 +277,7 @@ "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" @@ -281,6 +292,7 @@ "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=18.18" }, @@ -295,6 +307,7 @@ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=12.22" }, @@ -309,6 +322,7 @@ "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=18.18" }, @@ -385,115 +399,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@microsoft/1ds-core-js": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-4.3.4.tgz", - "integrity": "sha512-3gbDUQgAO8EoyQTNcAEkxpuPnioC0May13P1l1l0NKZ128L9Ts/sj8QsfwCRTjHz0HThlA+4FptcAJXNYUy3rg==", - "license": "MIT", - "dependencies": { - "@microsoft/applicationinsights-core-js": "3.3.4", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/ts-async": ">= 0.5.2 < 2.x", - "@nevware21/ts-utils": ">= 0.11.3 < 2.x" - } - }, - "node_modules/@microsoft/1ds-post-js": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-4.3.4.tgz", - "integrity": "sha512-nlKjWricDj0Tn68Dt0P8lX9a+X7LYrqJ6/iSfQwMfDhRIGLqW+wxx8gxS+iGWC/oc8zMQAeiZaemUpCwQcwpRQ==", - "license": "MIT", - "dependencies": { - "@microsoft/1ds-core-js": "4.3.4", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/ts-async": ">= 0.5.2 < 2.x", - "@nevware21/ts-utils": ">= 0.11.3 < 2.x" - } - }, - "node_modules/@microsoft/applicationinsights-channel-js": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.3.4.tgz", - "integrity": "sha512-Z4nrxYwGKP9iyrYtm7iPQXVOFy4FsEsX0nDKkAi96Qpgw+vEh6NH4ORxMMuES0EollBQ3faJyvYCwckuCVIj0g==", - "license": "MIT", - "dependencies": { - "@microsoft/applicationinsights-common": "3.3.4", - "@microsoft/applicationinsights-core-js": "3.3.4", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/ts-async": ">= 0.5.2 < 2.x", - "@nevware21/ts-utils": ">= 0.11.3 < 2.x" - }, - "peerDependencies": { - "tslib": ">= 1.0.0" - } - }, - "node_modules/@microsoft/applicationinsights-common": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-common/-/applicationinsights-common-3.3.4.tgz", - "integrity": "sha512-4ms16MlIvcP4WiUPqopifNxcWCcrXQJ2ADAK/75uok2mNQe6ZNRsqb/P+pvhUxc8A5HRlvoXPP1ptDSN5Girgw==", - "license": "MIT", - "dependencies": { - "@microsoft/applicationinsights-core-js": "3.3.4", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/ts-utils": ">= 0.11.3 < 2.x" - }, - "peerDependencies": { - "tslib": ">= 1.0.0" - } - }, - "node_modules/@microsoft/applicationinsights-core-js": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.3.4.tgz", - "integrity": "sha512-MummANF0mgKIkdvVvfmHQTBliK114IZLRhTL0X0Ep+zjDwWMHqYZgew0nlFKAl6ggu42abPZFK5afpE7qjtYJA==", - "license": "MIT", - "dependencies": { - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/ts-async": ">= 0.5.2 < 2.x", - "@nevware21/ts-utils": ">= 0.11.3 < 2.x" - }, - "peerDependencies": { - "tslib": ">= 1.0.0" - } - }, - "node_modules/@microsoft/applicationinsights-shims": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-shims/-/applicationinsights-shims-3.0.1.tgz", - "integrity": "sha512-DKwboF47H1nb33rSUfjqI6ryX29v+2QWcTrRvcQDA32AZr5Ilkr7whOOSsD1aBzwqX0RJEIP1Z81jfE3NBm/Lg==", - "license": "MIT", - "dependencies": { - "@nevware21/ts-utils": ">= 0.9.4 < 2.x" - } - }, - "node_modules/@microsoft/applicationinsights-web-basic": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.3.4.tgz", - "integrity": "sha512-OpEPXr8vU/t/M8T9jvWJzJx/pCyygIiR1nGM/2PTde0wn7anl71Gxl5fWol7K/WwFEORNjkL3CEyWOyDc+28AA==", - "license": "MIT", - "dependencies": { - "@microsoft/applicationinsights-channel-js": "3.3.4", - "@microsoft/applicationinsights-common": "3.3.4", - "@microsoft/applicationinsights-core-js": "3.3.4", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/ts-async": ">= 0.5.2 < 2.x", - "@nevware21/ts-utils": ">= 0.11.3 < 2.x" - }, - "peerDependencies": { - "tslib": ">= 1.0.0" - } - }, - "node_modules/@microsoft/dynamicproto-js": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.3.tgz", - "integrity": "sha512-JTWTU80rMy3mdxOjjpaiDQsTLZ6YSGGqsjURsY6AUQtIj0udlF/jYmhdLZu8693ZIC0T1IwYnFa0+QeiMnziBA==", - "license": "MIT", - "dependencies": { - "@nevware21/ts-utils": ">= 0.10.4 < 2.x" - } - }, "node_modules/@microsoft/fast-element": { "version": "1.14.0", "resolved": "https://registry.npmjs.org/@microsoft/fast-element/-/fast-element-1.14.0.tgz", @@ -540,21 +445,6 @@ "exenv-es6": "^1.1.1" } }, - "node_modules/@nevware21/ts-async": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.5.4.tgz", - "integrity": "sha512-IBTyj29GwGlxfzXw2NPnzty+w0Adx61Eze1/lknH/XIVdxtF9UnOpk76tnrHXWa6j84a1RR9hsOcHQPFv9qJjA==", - "license": "MIT", - "dependencies": { - "@nevware21/ts-utils": ">= 0.11.6 < 2.x" - } - }, - "node_modules/@nevware21/ts-utils": { - "version": "0.11.6", - "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.11.6.tgz", - "integrity": "sha512-OUUJTh3fnaUSzg9DEHgv3d7jC+DnPL65mIO7RaR+jWve7+MmcgIvF79gY97DPQ4frH+IpNR78YAYd/dW4gK3kg==", - "license": "MIT" - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -954,7 +844,6 @@ "integrity": "sha512-gKXG7A5HMyjDIedBi6bUrDcun8GIjnI8qOwVLiY3rx6T/sHP/19XLJOnIq/FgQvWLHja5JN/LSE7eklNBr612g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.20.0", "@typescript-eslint/types": "8.20.0", @@ -1135,20 +1024,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@vscode/extension-telemetry": { - "version": "0.9.8", - "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.8.tgz", - "integrity": "sha512-7YcKoUvmHlIB8QYCE4FNzt3ErHi9gQPhdCM3ZWtpw1bxPT0I+lMdx52KHlzTNoJzQ2NvMX7HyzyDwBEiMgTrWQ==", - "license": "MIT", - "dependencies": { - "@microsoft/1ds-core-js": "^4.3.4", - "@microsoft/1ds-post-js": "^4.3.4", - "@microsoft/applicationinsights-web-basic": "^3.3.4" - }, - "engines": { - "vscode": "^1.75.0" - } - }, "node_modules/@vscode/test-electron": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz", @@ -1410,7 +1285,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1457,6 +1331,7 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1721,7 +1596,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -1774,6 +1648,7 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=6" } @@ -2049,7 +1924,8 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/core-util-is": { "version": "1.0.3", @@ -2399,7 +2275,6 @@ "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", "license": "ISC", - "peer": true, "engines": { "node": ">=12" } @@ -2543,7 +2418,8 @@ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/delaunator": { "version": "5.0.1", @@ -2754,6 +2630,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2765,6 +2642,7 @@ "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -2782,6 +2660,7 @@ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "engines": { "node": ">=4.0" } @@ -2792,6 +2671,7 @@ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "is-glob": "^4.0.3" }, @@ -2805,6 +2685,7 @@ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2836,6 +2717,7 @@ "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "license": "BSD-3-Clause", + "peer": true, "dependencies": { "estraverse": "^5.1.0" }, @@ -2849,6 +2731,7 @@ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "engines": { "node": ">=4.0" } @@ -2892,6 +2775,7 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -2950,14 +2834,16 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/fast-uri": { "version": "3.1.0", @@ -3002,6 +2888,7 @@ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "flat-cache": "^4.0.0" }, @@ -3061,6 +2948,7 @@ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" @@ -3074,7 +2962,8 @@ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", "dev": true, - "license": "ISC" + "license": "ISC", + "peer": true }, "node_modules/foreground-child": { "version": "3.3.0", @@ -3342,6 +3231,7 @@ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -3359,6 +3249,7 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=4" } @@ -3389,6 +3280,7 @@ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.8.19" } @@ -3618,7 +3510,8 @@ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", @@ -3632,14 +3525,16 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/json-stream-stringify": { "version": "3.1.6", @@ -3669,6 +3564,7 @@ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "json-buffer": "3.0.1" } @@ -3689,6 +3585,7 @@ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -3742,7 +3639,8 @@ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/log-symbols": { "version": "4.1.0", @@ -4042,6 +3940,7 @@ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -4208,6 +4107,7 @@ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "callsites": "^3.0.0" }, @@ -4380,6 +4280,7 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">= 0.8.0" } @@ -4407,6 +4308,7 @@ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=6" } @@ -4718,7 +4620,6 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -5348,8 +5249,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD", - "peer": true + "license": "0BSD" }, "node_modules/tunnel-agent": { "version": "0.6.0", @@ -5369,6 +5269,7 @@ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "prelude-ls": "^1.2.1" }, @@ -5382,7 +5283,6 @@ "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -5421,28 +5321,6 @@ "dev": true, "license": "MIT" }, - "node_modules/universal-analytics": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/universal-analytics/-/universal-analytics-0.5.3.tgz", - "integrity": "sha512-HXSMyIcf2XTvwZ6ZZQLfxfViRm/yTGoRgDeTbojtq6rezeyKB0sTBcKH2fhddnteAHRcHiKgr/ACpbgjGOC6RQ==", - "license": "MIT", - "dependencies": { - "debug": "^4.3.1", - "uuid": "^8.0.0" - }, - "engines": { - "node": ">=12.18.2" - } - }, - "node_modules/universal-analytics/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -5480,6 +5358,7 @@ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "dependencies": { "punycode": "^2.1.0" } @@ -5547,7 +5426,6 @@ "integrity": "sha512-gX/dMkRQc7QOMzgTe6KsYFM7DxeIONQSui1s0n/0xht36HvrgbxtM1xBlgx596NbpHuQU8P7QpKwrZYwUX48nw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -5597,7 +5475,6 @@ "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.6.1", "@webpack-cli/configtest": "^3.0.1", @@ -5699,6 +5576,7 @@ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } diff --git a/package.json b/package.json index 89afd967..4f01ba07 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.13.0-pre9", + "version": "2.0.0-pre1", "preview": false, "activationEvents": [ "onDebugResolve:cortex-debug", @@ -653,6 +653,12 @@ "mps2-an385" ] }, + "numCaptureSerial": { + "default": 0, + "type": "number", + "minimum": 0, + "description": "QEMU only: number of serial ports to capture into separate VS Code OUTPUT tabs using -serial pipe:." + }, "device": { "default": "", "description": "Target Device Identifier", @@ -1827,6 +1833,12 @@ "lm3s6965evb" ] }, + "numCaptureSerial": { + "default": 0, + "type": "number", + "minimum": 0, + "description": "QEMU only: number of serial ports to capture into separate VS Code OUTPUT tabs using -serial pipe:." + }, "device": { "default": "", "description": "Target Device Identifier", @@ -3117,7 +3129,6 @@ } }, "dependencies": { - "@vscode/extension-telemetry": "^0.9.8", "@vscode/webview-ui-toolkit": "^1.4.0", "binary-parser": "^2.3.0", "bindings": "^1.5.0", @@ -3135,7 +3146,6 @@ "serialport": "^13.0.0", "stream-json": "^1.9.1", "tmp": "^0.2.4", - "universal-analytics": "^0.5.3", "usb": "^2.14.0", "uuid": "^11.0.5", "vscode-jsonrpc": "^8.2.1" diff --git a/src/backend/server.ts b/src/backend/server.ts index c3cc72e8..30b39daa 100644 --- a/src/backend/server.ts +++ b/src/backend/server.ts @@ -48,6 +48,7 @@ export class GDBServer extends EventEmitter { public static readonly SERVER_TIMEOUT = 10 * 60 * 1000; public static readonly LOCALHOST = '0.0.0.0'; public pid: number | undefined = -1; + private serialPipeBases: string[] = []; constructor( private cwd: string | null, private application: string | null, private args: string[], @@ -62,8 +63,9 @@ export class GDBServer extends EventEmitter { this.initReject = reject; try { await this.connectToConsole(); + this.setupSerialPipes(); } catch (e) { - ServerConsoleLog('GDBServer: Could not connect to console: ' + e); + ServerConsoleLog('GDBServer: startup preparation failed: ' + e); reject(e); } this.process = ChildProcess.spawn(this.application, this.args, { cwd: this.cwd || undefined }); @@ -137,9 +139,71 @@ export class GDBServer extends EventEmitter { ServerConsoleLog(`GDBServer(${this.pid}): exited code=${code} signal=${signal}`); this.emit('exit', code, signal); this.disconnectConsole(); + this.cleanupSerialPipes(); }, 10); } + private setupSerialPipes() { + this.serialPipeBases = []; + if (process.platform === 'win32') { + return; + } + + for (let ix = 0; ix < this.args.length - 1; ix++) { + if (this.args[ix] !== '-serial') { + continue; + } + const serialArg = this.args[ix + 1] || ''; + if (!serialArg.startsWith('pipe:')) { + continue; + } + const pipeBase = serialArg.substring(5); + if (!pipeBase) { + continue; + } + this.createSerialPipePair(pipeBase); + this.serialPipeBases.push(pipeBase); + ix++; + } + } + + private createSerialPipePair(pipeBase: string) { + const inPath = `${pipeBase}.in`; + const outPath = `${pipeBase}.out`; + this.recreateFifo(inPath); + this.recreateFifo(outPath); + } + + private recreateFifo(pathName: string) { + try { + if (fs.existsSync(pathName)) { + fs.unlinkSync(pathName); + } + } catch { + // Ignore cleanup errors and try creating the FIFO anyway. + } + ChildProcess.execFileSync('mkfifo', [pathName]); + } + + private cleanupSerialPipes() { + if (this.serialPipeBases.length === 0) { + return; + } + for (const base of this.serialPipeBases) { + for (const suffix of ['.in', '.out']) { + const fileName = `${base}${suffix}`; + try { + if (fs.existsSync(fileName)) { + fs.unlinkSync(fileName); + } + } catch { + // Ignore pipe cleanup failures at shutdown. + } + } + } + this.serialPipeBases = []; + } + private onError(err: any) { if (this.initReject) { this.initReject(err); diff --git a/src/common.ts b/src/common.ts index 86043f09..f39b0877 100644 --- a/src/common.ts +++ b/src/common.ts @@ -157,22 +157,6 @@ export class RTTConfigureEvent extends Event implements DebugProtocol.Event { } } -export class TelemetryEvent extends Event implements DebugProtocol.Event { - public body: { - category: string; - action: string; - label: string; - parameters: { [key: string]: string }; - }; - - public event: string; - - constructor(category: string, action: string, label: string, parameters: { [key: string]: string } = {}) { - const body = { category: category, action: action, label: label, parameters: parameters }; - super('record-event', body); - } -} - export enum ChainedEvents { POSTSTART = 'postStart', // Default - a connection was established with the gdb-server, before initialization is done POSTINIT = 'postInit' /* all init functionality has been done. Generally past programming and stopped at or @@ -359,6 +343,7 @@ export interface ConfigurationArguments extends DebugProtocol.LaunchRequestArgum // QEMU Specific cpu: string; machine: string; + numCaptureSerial: number; // External gdbTarget: string; @@ -538,6 +523,10 @@ export function createPortName(procNum: number, prefix: string = 'gdbPort'): str return prefix + ((procNum === 0) ? '' : procNum.toString()); } +export function qemuSerialPipePrefix(gdbPort: number): string { + return path.join(os.tmpdir(), `cortex-debug-qemu-serial-${gdbPort}`); +} + export function getAnyFreePort(preferred: number): Promise { return new Promise((resolve, reject) => { function findFreePorts() { diff --git a/src/frontend/configprovider.ts b/src/frontend/configprovider.ts index 61503f2b..06384406 100644 --- a/src/frontend/configprovider.ts +++ b/src/frontend/configprovider.ts @@ -504,6 +504,8 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati if (!config.cpu) { config.cpu = 'cortex-m3'; } if (!config.machine) { config.machine = 'lm3s6965evb'; } + const serialCount = Number(config.numCaptureSerial ?? 0); + config.numCaptureSerial = Number.isFinite(serialCount) ? Math.max(0, Math.floor(serialCount)) : 0; if (config.swoConfig.enabled) { vscode.window.showWarningMessage('SWO support is not available when using QEMU.'); diff --git a/src/frontend/extension.ts b/src/frontend/extension.ts index a49ba7b4..79fdc896 100644 --- a/src/frontend/extension.ts +++ b/src/frontend/extension.ts @@ -8,7 +8,7 @@ import { LiveWatchTreeProvider, LiveVariableNode } from './views/live-watch'; import { RTTCore, SWOCore } from './swo/core'; import { ConfigurationArguments, RTTCommonDecoderOpts, RTTConsoleDecoderOpts, - CortexDebugKeys, ChainedEvents, ADAPTER_DEBUG_MODE, ChainedConfig + CortexDebugKeys, ChainedEvents, ADAPTER_DEBUG_MODE, ChainedConfig, createPortName, qemuSerialPipePrefix } from '../common'; import { MemoryContentProvider } from './memory_content_provider'; @@ -28,6 +28,17 @@ interface SVDInfo { expression: RegExp; path: string; } + +interface QemuSerialPipeCapture { + channel: vscode.OutputChannel; + stream: fs.ReadStream | null; + timer: NodeJS.Timeout | null; +} + +interface QemuSerialSessionCapture { + captures: QemuSerialPipeCapture[]; +} + class ServerStartedPromise { constructor( public readonly name: string, @@ -49,6 +60,7 @@ export class CortexDebugExtension { private SVDDirectory: SVDInfo[] = []; private functionSymbols: SymbolInformation[] | null = null; private serverStartedEvent: ServerStartedPromise | undefined; + private qemuSerialCaptures = new Map(); constructor(private context: vscode.ExtensionContext) { const config = vscode.workspace.getConfiguration('cortex-debug'); @@ -399,6 +411,7 @@ export class CortexDebugExtension { this.functionSymbols = null; session.customRequest('get-arguments').then((args) => { newSession.config = args; + this.startQemuSerialCapture(session, args); let svdfile = args.svdFile; if (!svdfile) { svdfile = this.getSVDFile(args.device); @@ -421,6 +434,7 @@ export class CortexDebugExtension { if (session.type !== 'cortex-debug') { return; } const mySession = CDebugSession.FindSession(session); try { + this.disposeQemuSerialCapture(session); this.liveWatchProvider?.debugSessionTerminated(session); if (mySession?.swo) { mySession.swo.debugSessionTerminated(); @@ -460,9 +474,6 @@ export class CortexDebugExtension { case 'rtt-configure': this.receivedRTTConfigureEvent(e); break; - case 'record-event': - this.receivedEvent(e); - break; case 'custom-event-post-start-server': this.startChainedConfigs(e, ChainedEvents.POSTSTART); break; @@ -506,6 +517,115 @@ export class CortexDebugExtension { } } + private startQemuSerialCapture(session: vscode.DebugSession, args: ConfigurationArguments) { + this.disposeQemuSerialCapture(session); + const serialPipePaths = this.getQemuSerialPipePaths(args); + if (!Array.isArray(serialPipePaths) || serialPipePaths.length === 0) { + return; + } + + const sessionCapture: QemuSerialSessionCapture = { captures: [] }; + this.qemuSerialCaptures.set(session.id, sessionCapture); + serialPipePaths.forEach((pipePath, index) => { + if (typeof pipePath !== 'string' || pipePath.length === 0) { + return; + } + const channel = vscode.window.createOutputChannel(`QEMU Serial ${index} (${session.name})`); + const capture: QemuSerialPipeCapture = { + channel, + stream: null, + timer: null + }; + sessionCapture.captures.push(capture); + capture.channel.show(true); + capture.channel.appendLine(`[cortex-debug] Waiting for serial pipe: ${pipePath}.out`); + this.waitAndAttachQemuSerialPipe(capture, pipePath); + }); + } + + private waitAndAttachQemuSerialPipe(capture: QemuSerialPipeCapture, pipePath: string) { + const outPath = `${pipePath}.out`; + let attempts = 0; + const maxAttempts = 300; // About 60 seconds at 200ms intervals + const attach = () => { + attempts++; + if (!fs.existsSync(outPath)) { + if (attempts >= maxAttempts) { + capture.channel.appendLine(`[cortex-debug] Timed out waiting for serial pipe ${outPath}`); + if (capture.timer) { + clearInterval(capture.timer); + capture.timer = null; + } + } + return; + } + + if (capture.timer) { + clearInterval(capture.timer); + capture.timer = null; + } + + const stream = fs.createReadStream(outPath); + capture.stream = stream; + stream.on('data', (data) => { + capture.channel.append(typeof data === 'string' ? data : data.toString('utf8')); + }); + stream.on('error', (e) => { + capture.channel.appendLine(`[cortex-debug] Serial pipe read error: ${e}`); + }); + stream.on('close', () => { + capture.stream = null; + }); + capture.channel.appendLine(`[cortex-debug] Attached to serial pipe: ${outPath}`); + }; + + capture.timer = setInterval(attach, 200); + attach(); + } + + private disposeQemuSerialCapture(session: vscode.DebugSession) { + const capture = this.qemuSerialCaptures.get(session.id); + if (!capture) { + return; + } + this.qemuSerialCaptures.delete(session.id); + for (const item of capture.captures) { + if (item.timer) { + clearInterval(item.timer); + item.timer = null; + } + try { + item.stream?.destroy(); + } catch { + // Ignore stream cleanup failures at shutdown. + } + item.channel.dispose(); + } + } + + private getQemuSerialPipePaths(args: ConfigurationArguments): string[] { + const ret: string[] = []; + if (!args || args.servertype !== 'qemu') { + return ret; + } + const serialCount = Math.max(0, Math.floor(Number(args.numCaptureSerial || 0))); + if (serialCount <= 0) { + return ret; + } + + const gdbKey = createPortName(args.targetProcessor); + const gdbPort = Number(args?.pvtPorts?.[gdbKey] || args?.pvtPorts?.gdbPort || 0); + if (!Number.isFinite(gdbPort) || gdbPort <= 0) { + return ret; + } + + const prefix = qemuSerialPipePrefix(gdbPort); + for (let ix = 0; ix < serialCount; ix++) { + ret.push(`${prefix}-${ix}`); + } + return ret; + } + private signalPortsAllocated(e: vscode.DebugSessionCustomEvent) { if (this.serverStartedEvent) { this.serverStartedEvent.resolve(e); @@ -716,9 +836,6 @@ export class CortexDebugExtension { } } - private receivedEvent(e: any) { - } - private receivedSWOConfigureEvent(e: vscode.DebugSessionCustomEvent) { const mySession = CDebugSession.GetSession(e.session); if (e.body.type === 'socket') { diff --git a/src/gdb.ts b/src/gdb.ts index 69a5ce01..c0d03df3 100755 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -14,7 +14,7 @@ import { MI2, parseReadMemResults } from './backend/mi2/mi2'; import { extractBits, hexFormat } from './frontend/utils'; import { Variable, VariableObject, MIError, OurDataBreakpoint, OurInstructionBreakpoint, OurSourceBreakpoint } from './backend/backend'; import { - TelemetryEvent, ConfigurationArguments, StoppedEvent, GDBServerController, SymbolFile, + ConfigurationArguments, StoppedEvent, GDBServerController, SymbolFile, createPortName, GenericCustomEvent, quoteShellCmdLine, toStringDecHexOctBin, ADAPTER_DEBUG_MODE, defSymbolFile, CTIAction, getPathRelative, SWOConfigureEvent, RTTCommonDecoderOpts } from './common'; @@ -728,11 +728,6 @@ export class GDBDebugSession extends LoggingDebugSession { let timeout: any = setTimeout(() => { this.server.exit(); - this.sendEvent(new TelemetryEvent( - 'Error', - 'Launching Server', - `Failed to launch ${this.serverController.name || this.args.servertype} GDB Server: Timeout.` - )); this.launchErrorResponse(response, 103, `Failed to launch ${this.serverController.name || this.args.servertype} GDB Server: Timeout.`); doResolve(); }, GDBServer.SERVER_TIMEOUT); @@ -800,7 +795,6 @@ export class GDBDebugSession extends LoggingDebugSession { const e = err as Error; msg = 'Failed to generate gdb commands: ' + e.toString() + '\n' + (e.stack || '').toString(); } - this.sendEvent(new TelemetryEvent('Error', 'Launching GDB', msg)); this.launchErrorResponse(response, 104, msg); return doResolve(); } @@ -854,7 +848,6 @@ export class GDBDebugSession extends LoggingDebugSession { doResolve(); }, (err) => { this.launchErrorResponse(response, 103, `Failed to launch GDB: ${err.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Launching GDB', err.toString())); try { this.miDebugger.stop(); // This should also kill the server if there is one this.server.exit(); @@ -864,18 +857,12 @@ export class GDBDebugSession extends LoggingDebugSession { }); }, (error) => { clearTimers(); - this.sendEvent(new TelemetryEvent( - 'Error', - 'Launching Server', - `Failed to launch ${this.serverController.name || this.args.servertype} GDB Server: ${error.toString()}` - )); this.launchErrorResponse(response, 103, `Failed to launch ${this.serverController.name || this.args.servertype} GDB Server: ${error.toString()}`); doResolve(); this.server.exit(); }); }, (err) => { - this.sendEvent(new TelemetryEvent('Error', 'Launching Server', `Failed to find open ports: ${err.toString()}`)); this.launchErrorResponse(response, 103, `Failed to find open ports: ${err.toString()}`); doResolve(); }); @@ -1452,7 +1439,6 @@ export class GDBDebugSession extends LoggingDebugSession { this.sendResponse(response); }, (error) => { this.sendErrorResponse(response, 114, `Read memory error: ${error.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Reading Memory', command)); }); } @@ -1475,7 +1461,6 @@ export class GDBDebugSession extends LoggingDebugSession { }, (error) => { (response as DebugProtocol.Response).body = { error: error }; this.sendErrorResponse(response, 114, `Write memory error: ${error.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Writing Memory', `${startAddress.toString(16)}-${data.length.toString(16)}`)); }); } @@ -1499,7 +1484,6 @@ export class GDBDebugSession extends LoggingDebugSession { }, (error) => { response.body = { error: error }; this.sendErrorResponse(response, 114, `Read memory error: ${error.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Reading Memory', `${startAddress}-${length.toString(16)}`)); }); } @@ -1510,7 +1494,6 @@ export class GDBDebugSession extends LoggingDebugSession { }, (error) => { response.body = { error: error }; this.sendErrorResponse(response, 114, `Write memory error: ${error.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Writing Memory', `${startAddress.toString(16)}-${data.length.toString(16)}`)); }); } @@ -1545,7 +1528,6 @@ export class GDBDebugSession extends LoggingDebugSession { }, (error) => { response.body = { error: error }; this.sendErrorResponse(response, 115, `Unable to read registers: ${error.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Reading Registers', '')); }); if (!this.args.variableUseNaturalFormat) { @@ -1584,7 +1566,6 @@ export class GDBDebugSession extends LoggingDebugSession { }, (error) => { response.body = { error: error }; this.sendErrorResponse(response, 116, `Unable to read register list: ${(error).toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Reading Register List', '')); }); } @@ -2888,7 +2869,6 @@ export class GDBDebugSession extends LoggingDebugSession { } } catch (error) { this.sendErrorResponse(response, 116, `Unable to read register list: ${error.toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Reading Register List', '')); return; } @@ -2945,7 +2925,6 @@ export class GDBDebugSession extends LoggingDebugSession { } } catch (error) { this.sendErrorResponse(response, 115, `Unable to read registers: ${(error).toString()}`); - this.sendEvent(new TelemetryEvent('Error', 'Reading Registers', '')); return; } response.body = { variables: registers }; diff --git a/src/qemu.ts b/src/qemu.ts index 3a537889..15b7f2fc 100644 --- a/src/qemu.ts +++ b/src/qemu.ts @@ -1,6 +1,5 @@ import { DebugProtocol } from '@vscode/debugprotocol'; -import { GDBServerController, ConfigurationArguments, createPortName } from './common'; -import * as os from 'os'; +import { GDBServerController, ConfigurationArguments, createPortName, qemuSerialPipePrefix } from './common'; import { EventEmitter } from 'events'; import { sync as commandExistsSync } from 'command-exists'; @@ -75,7 +74,9 @@ export class QEMUServerController extends EventEmitter implements GDBServerContr } public serverArguments(): string[] { - const gdbport = this.ports['gdbPort']; + const gdbport = this.ports[createPortName(this.args.targetProcessor)]; + const serialCount = Math.max(0, Math.floor(Number(this.args.numCaptureSerial || 0))); + const serialPipePrefix = qemuSerialPipePrefix(gdbport); let cmdargs = [ '-cpu', this.args.cpu, @@ -86,7 +87,9 @@ export class QEMUServerController extends EventEmitter implements GDBServerContr '-S', '-kernel', this.args.executable ]; - + for (let ix = 0; ix < serialCount; ix++) { + cmdargs = cmdargs.concat('-serial', `pipe:${serialPipePrefix}-${ix}`); + } if (this.args.serverArgs) { cmdargs = cmdargs.concat(this.args.serverArgs); } diff --git a/src/reporting.ts b/src/reporting.ts deleted file mode 100644 index ef26e675..00000000 --- a/src/reporting.ts +++ /dev/null @@ -1,125 +0,0 @@ -import * as vscode from 'vscode'; -import * as os from 'os'; -import * as path from 'path'; -import * as fs from 'fs'; -import * as ua from 'universal-analytics'; -import { ConfigurationArguments } from './common'; - -import { v4 as uuidv4 } from 'uuid'; - -const extension = vscode.extensions.getExtension('marus25.cortex-debug'); -const extensionId = extension.id; -const extensionVersion = extension.packageJSON.version; -const trackingId = 'UA-113901869-1'; - -const VSCODE_VERSION_DIMENSION = 'cd1'; -const EXTENSION_VERSION_DIMENSION = 'cd2'; -const DEVICE_ID_DIMENSION = 'cd3'; -const RTOS_TYPE_DIMENSION = 'cd4'; -const GDB_SERVER_TYPE_DIMENSION = 'cd5'; -const PLATFORM_TYPE_DIMENSION = 'cd6'; -const PLATFORM_RELEASE_DIMENSION = 'cd7'; -const NODE_VERSION_DIMENSION = 'cd8'; - -let analytics: any; - -let uuid: string = null; -const sessionStarts: { [id: string]: Date } = {}; - -interface UserSettings { - uuid: string; -} - -function getUUID(): string { - if (!uuid) { - const settingspath = path.join(os.homedir(), '.cortex-debug'); - if (fs.existsSync(settingspath)) { - const data = fs.readFileSync(settingspath, 'utf8'); - const settings: UserSettings = JSON.parse(data); - uuid = settings.uuid; - } else { - uuid = uuidv4(); - const settings: UserSettings = { uuid: uuid }; - fs.writeFileSync(settingspath, JSON.stringify(settings), 'utf8'); - } - } - - return uuid; -} - -function telemetryEnabled(): boolean { - return false; // Disable telemetry for now, until we have a better understanding of what to send and how to use it. - const telemetry = vscode.workspace.getConfiguration('telemetry'); - const cortexDebug = vscode.workspace.getConfiguration('cortex-debug'); - - return telemetry.get('enableTelemetry', false) && cortexDebug.get('enableTelemetry', false); -} - -function activate(context: vscode.ExtensionContext) { - if (!telemetryEnabled()) { return; } - - analytics = ua(trackingId, getUUID()); - analytics.set(EXTENSION_VERSION_DIMENSION, extensionVersion); - analytics.set(VSCODE_VERSION_DIMENSION, vscode.version); - analytics.set(PLATFORM_TYPE_DIMENSION, os.platform()); - analytics.set(PLATFORM_RELEASE_DIMENSION, os.release()); - analytics.set(NODE_VERSION_DIMENSION, process.versions.node); -} - -function deactivate() { - if (!telemetryEnabled()) { return; } -} - -function sendEvent(category: string, action: string, label?: string, value?: number, options: { [key: string]: string } = {}) { - if (!telemetryEnabled()) { return; } - - analytics.event(category, action, label, Math.round(value), options).send(); -} - -function beginSession(id: string, opts: ConfigurationArguments) { - if (!telemetryEnabled()) { return; } - - if (opts.rtos) { analytics.set(RTOS_TYPE_DIMENSION, opts.rtos); } - if (opts.device) { analytics.set(DEVICE_ID_DIMENSION, opts.device); } - analytics.set(GDB_SERVER_TYPE_DIMENSION, opts.servertype); - - analytics.screenview('Debug Session', 'Cortex-Debug', extensionVersion, extensionId); - analytics.event('Session', 'Started', '', 0, { sessionControl: 'start' }); - - if (opts.swoConfig.enabled) { - analytics.event('SWO', 'Used'); - } - if (opts.rttConfig.enabled) { - analytics.event('RTT', 'Used'); - } - if (opts.graphConfig.length > 0) { - analytics.event('Graphing', 'Used'); - } - - sessionStarts[id] = new Date(); - - analytics.send(); -} - -function endSession(id: string) { - if (!telemetryEnabled()) { return; } - - const startTime = sessionStarts[id]; - if (startTime) { - const endTime = new Date(); - const time = (endTime.getTime() - startTime.getTime()) / 1000; - delete sessionStarts[id]; - - setTimeout(() => { - analytics.event('Session', 'Completed', '', Math.round(time), { sessionControl: 'end' }).send(); - }, 500); - } -} - -export default { - beginSession: beginSession, - endSession: endSession, - activate: activate, - deactivate: deactivate, - sendEvent: sendEvent -};