Skip to content

Commit

Permalink
fix variables for lldb-mi
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm authored and WebFreak001 committed Mar 13, 2024
1 parent 6942703 commit 86b6678
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/backend/mi2/mi2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ export class MI2 extends EventEmitter implements IBackend {
const result = await this.sendCommand(command);
const threads = result.result("threads");
const ret: Thread[] = [];
if (!Array.isArray(threads)) { // workaround for lldb-mi bug: `'^done,threads="[]"'`
return ret;
}
return threads.map(element => {
const ret: Thread = {
id: parseInt(MINode.valueOf(element, "id")),
Expand Down
2 changes: 1 addition & 1 deletion src/mibase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export class MI2DebugSession extends DebugSession {
const varId = this.variableHandlesReverse[varObjName];
varObj = this.variableHandles.get(varId) as any;
} catch (err) {
if (err instanceof MIError && err.message == "Variable object not found") {
if (err instanceof MIError && (err.message == "Variable object not found" || err.message.endsWith("does not exist"))) {
varObj = await this.miDebugger.varCreate(id.threadId, id.level, variable.name, varObjName);
const varId = findOrCreateVariable(varObj);
varObj.exp = variable.name;
Expand Down

0 comments on commit 86b6678

Please sign in to comment.