Skip to content

Commit

Permalink
1.add static variable support
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryRiley0 committed Aug 23, 2024
1 parent 7196ed1 commit f3ee5d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Versioning].

### Added

- add static variable support ([@henryriley0])
- fix gdb check error when debug beginning ([@henryriley0])
- fix implicitly type error in log message when build vsix ([@henryriley0])
- check for configured debugger before start to provide a nicer error message
Expand Down
4 changes: 2 additions & 2 deletions src/backend/gdb_expansion.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VariableObject } from "./backend";
import { MINode } from "./mi_parse";

const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/;
const resultRegex = /(static )?([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/;
const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/;
const errorRegex = /^\<.+?\>/;
const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
Expand Down Expand Up @@ -201,7 +201,7 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
if (!variableMatch)
return undefined;
value = value.substring(variableMatch[0].length).trim();
const name = variable = variableMatch[1];
const name = variable = variableMatch[2];
if (pushToStack)
stack.push(variable);
const val = parseValue();
Expand Down
3 changes: 2 additions & 1 deletion src/mibase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export class MI2DebugSession extends DebugSession {

protected override async variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): Promise<void> {
const variables: DebugProtocol.Variable[] = [];
const id: VariableScope | string | VariableObject | ExtendedVariable = this.variableHandles.get(args.variablesReference);
let id: VariableScope | string | VariableObject | ExtendedVariable = this.variableHandles.get(args.variablesReference);

Check failure on line 435 in src/mibase.ts

View workflow job for this annotation

GitHub Actions / lint

'id' is never reassigned. Use 'const' instead.

const createVariable = (arg: string | VariableObject, options?: any) => {
if (options)
Expand Down Expand Up @@ -531,6 +531,7 @@ export class MI2DebugSession extends DebugSession {
this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`);
}
} else if (typeof id == "string") {
id.replace(/^static /, "");
// Variable members
let variable;
try {
Expand Down

0 comments on commit f3ee5d6

Please sign in to comment.