Skip to content

Commit 043411d

Browse files
authored
Merge branch 'master' into static_variable
2 parents 38b7e59 + 7d61f09 commit 043411d

18 files changed

+345
-146
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Versioning].
1313
### Added
1414

1515
- add static vairable support ([@henryriley0])
16+
- fix gdb check error when debug beginning ([@henryriley0])
17+
- fix implicitly type error in log message when build vsix ([@henryriley0])
18+
- check for configured debugger before start to provide a nicer error message
19+
([@GitMensch])
1620

1721
## [0.27.0] - 2024-02-07
1822

@@ -21,6 +25,8 @@ Versioning].
2125
- Added registers view ([@nomtats]) #242
2226
- Enabled breakpoints inside `riscv` files ([@William-An]) #404
2327

28+
[0.27.0]: https://github.com/WebFreak001/code-debug/compare/v0.26.1...v0.27.0
29+
2430
## [0.26.1] - 2022-12-31
2531

2632
### Fixed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,10 @@ differently based on whether the remote system is a POSIX or a Windows system.
213213
You may need to experiment to find the correct escaping necessary for the command to be
214214
sent to the debugger as you intended.
215215

216+
### LogMessage
217+
218+
LogMessage will print a message in the debug console when breakpoint is hit. Expressions within {} are interpolated.
219+
220+
![LogMessage](images/logMessage.gif)
221+
216222
## [Issues](https://github.com/WebFreak001/code-debug)

images/logMessage.gif

196 KB
Loading

package-lock.json

Lines changed: 60 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"debug"
1111
],
1212
"license": "public domain",
13-
"version": "0.27.0",
13+
"version": "0.27.1",
1414
"publisher": "webfreak",
1515
"icon": "images/icon.png",
1616
"engines": {
@@ -187,7 +187,7 @@
187187
"valuesFormatting": {
188188
"type": "string",
189189
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
190-
"default": "parseText",
190+
"default": "prettyPrinters",
191191
"enum": [
192192
"disabled",
193193
"parseText",
@@ -1112,6 +1112,7 @@
11121112
"@istanbuljs/nyc-config-typescript": "^1.0.2",
11131113
"@types/mocha": "^5.2.6",
11141114
"@types/node": "^11.11.3",
1115+
"@types/ssh2": "^1.15.0",
11151116
"@types/vscode": "^1.55.0",
11161117
"@typescript-eslint/eslint-plugin": "^5.22.0",
11171118
"@typescript-eslint/parser": "^5.22.0",
@@ -1125,7 +1126,7 @@
11251126
"nyc": "^15.1.0",
11261127
"prettier": "^2.6.2",
11271128
"ts-node": "^10.8.0",
1128-
"typescript": "^3.9.3"
1129+
"typescript": "^4.3.2"
11291130
},
11301131
"__metadata": {
11311132
"id": "2fd22b8e-b3b8-4e7f-9a28-a5e2d1bdd0d4",

src/backend/backend.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { DebugProtocol } from "vscode-debugprotocol/lib/debugProtocol";
44
export type ValuesFormattingMode = "disabled" | "parseText" | "prettyPrinters";
55

66
export interface Breakpoint {
7+
id?:number;
78
file?: string;
89
line?: number;
910
raw?: string;
1011
condition: string;
1112
countCondition?: string;
13+
logMessage?: string;
1214
}
1315

1416
export interface Thread {
@@ -60,8 +62,8 @@ export interface IBackend {
6062
attach(cwd: string, executable: string, target: string, autorun: string[]): Thenable<any>;
6163
connect(cwd: string, executable: string, target: string, autorun: string[]): Thenable<any>;
6264
start(runToStart: boolean): Thenable<boolean>;
63-
stop();
64-
detach();
65+
stop(): void;
66+
detach(): void;
6567
interrupt(): Thenable<boolean>;
6668
continue(): Thenable<boolean>;
6769
next(): Thenable<boolean>;
@@ -141,29 +143,25 @@ export interface MIError extends Error {
141143
readonly source: string;
142144
}
143145
export interface MIErrorConstructor {
144-
new (message: string, source: string): MIError;
146+
new(message: string, source: string): MIError;
145147
readonly prototype: MIError;
146148
}
147149

148-
export const MIError: MIErrorConstructor = <any> class MIError {
149-
readonly name: string;
150-
readonly message: string;
151-
readonly source: string;
150+
export const MIError: MIErrorConstructor = class MIError {
151+
private readonly _message: string;
152+
private readonly _source: string;
152153
public constructor(message: string, source: string) {
153-
Object.defineProperty(this, 'name', {
154-
get: () => (this.constructor as any).name,
155-
});
156-
Object.defineProperty(this, 'message', {
157-
get: () => message,
158-
});
159-
Object.defineProperty(this, 'source', {
160-
get: () => source,
161-
});
154+
this._message = message;
155+
this._source = source;
162156
Error.captureStackTrace(this, this.constructor);
163157
}
164158

159+
get name() { return this.constructor.name; }
160+
get message() { return this._message; }
161+
get source() { return this._source; }
162+
165163
public toString() {
166-
return `${this.message} (from ${this.source})`;
164+
return `${this.message} (from ${this._source})`;
167165
}
168166
};
169167
Object.setPrototypeOf(MIError as any, Object.create(Error.prototype));

src/backend/gdb_expansion.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { VariableObject } from "./backend";
12
import { MINode } from "./mi_parse";
23

34
const resultRegex = /(static )?([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/;
@@ -29,7 +30,7 @@ export function isExpandable(value: string): number {
2930
else return 0;
3031
}
3132

32-
export function expandValue(variableCreate: Function, value: string, root: string = "", extra: any = undefined): any {
33+
export function expandValue(variableCreate: (arg: VariableObject | string, options?: any) => any, value: string, root: string = "", extra: any = undefined): any {
3334
const parseCString = () => {
3435
value = value.trim();
3536
if (value[0] != '"' && value[0] != '\'')
@@ -56,10 +57,10 @@ export function expandValue(variableCreate: Function, value: string, root: strin
5657
};
5758

5859
const stack = [root];
59-
let parseValue, parseCommaResult, parseCommaValue, parseResult, createValue;
60+
let parseValue: () => any, parseCommaResult: (pushToStack: boolean) => any, parseCommaValue: () => any, parseResult: (pushToStack: boolean) => any, createValue: (name: string, val: any) => any;
6061
let variable = "";
6162

62-
const getNamespace = (variable) => {
63+
const getNamespace = (variable: string) => {
6364
let namespace = "";
6465
let prefix = "";
6566
stack.push(variable);
@@ -209,7 +210,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
209210
return createValue(name, val);
210211
};
211212

212-
createValue = (name, val) => {
213+
createValue = (name: string, val: any) => {
213214
let ref = 0;
214215
if (typeof val == "object") {
215216
ref = variableCreate(val);
@@ -223,7 +224,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
223224
val = "Object@" + val;
224225
}
225226
} else if (typeof val == "string" && val.startsWith("@0x")) {
226-
ref = variableCreate(getNamespace("*&" + name.substr));
227+
ref = variableCreate(getNamespace("*&" + name.substring(1)));
227228
val = "Ref" + val;
228229
} else if (typeof val == "string" && val.startsWith("<...>")) {
229230
ref = variableCreate(getNamespace(name));

0 commit comments

Comments
 (0)