Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .mocharc-windows-ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"//": "This timeout should match what is in CdtDebugClient constructor",
"timeout": "25000"
"timeout": "25000",
"require": ["ts-node/register", "src/integration-tests/test/setup.ts"]
}
3 changes: 2 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"//": "This timeout should match what is in CdtDebugClient constructor",
"timeout": "5000"
"timeout": "5000",
"require": ["ts-node/register", "src/integration-tests/test/setup.ts"]
}
24 changes: 21 additions & 3 deletions src/gdb/GDBDebugSessionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2004,14 +2004,17 @@ export abstract class GDBDebugSessionBase extends LoggingDebugSession {

if (isCliCommand) {
const expressionNoPrefix = expression.slice(1).trim();
const regexCommands = new RegExp(
'^\\s*(?:comm|comma|comman|command|commands)\\s*.*$'
);
const regexDisable = new RegExp(
'^\\s*(?:dis|disa|disable)\\s*(?:(?:breakpoint|count|delete|once)\\d*)?\\s*\\d*\\s*$'
'^\\s*(?:dis|disa|disab|disabl|disable)\\s*(?:(?:breakpoint|count|delete|once)\\d*)?\\s*\\d*\\s*$'
);
const regexEnable = new RegExp(
'^\\s*(?:en|enable)\\s*(?:(?:breakpoint|count|delete|once)\\d*)?\\s*\\d*\\s*$'
'^\\s*(?:en|ena|enab|enabl|enable)\\s*(?:(?:breakpoint|count|delete|once)\\d*)?\\s*\\d*\\s*$'
);
const regexDelete = new RegExp(
'^\\s*(?:d|del|delete)\\s+(?:breakpoints\\s+)?(\\d+)?\\s*$'
'^\\s*(?:d|de|del|dele|delet|delete)\\s+(?:breakpoints\\s+)?(\\d+)?\\s*$'
);
if (
expressionNoPrefix.search(regexDisable) != -1 ||
Expand All @@ -2037,6 +2040,21 @@ export abstract class GDBDebugSessionBase extends LoggingDebugSession {
);
}
}
if (expressionNoPrefix.search(regexCommands) != -1) {
this.sendEvent(
new OutputEvent(
'warning: "commands" command is not supported via GDB/MI interface',
'stdout'
)
);
response.body = {
result: '',
variablesReference: 0,
};
this.sendResponse(response);
// Avoid sending the command to GDB
return;
}
return await this.evaluateRequestGdbCommand(
response,
expressionNoPrefix,
Expand Down
3 changes: 0 additions & 3 deletions src/integration-tests/auxiliaryGdb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ import {
import { TargetLaunchRequestArguments } from '../types/session';
import { DebugProtocol } from '@vscode/debugprotocol';
import { hexToBase64 } from '../web';
import * as chai from 'chai';
import * as chaistring from 'chai-string';
import { Runnable } from 'mocha';
chai.use(chaistring);

// This mock adapter creates a standard GDB backend and a stub auxiliary GDB backend
const auxiliaryGdbAdapter =
Expand Down
15 changes: 14 additions & 1 deletion src/integration-tests/evaluate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* SPDX-License-Identifier: EPL-2.0
*********************************************************************/

import { expect } from 'chai';
import * as path from 'path';
import { CdtDebugClient } from './debugClient';
import {
Expand All @@ -21,6 +20,7 @@ import {
standardBeforeEach,
testProgramsDir,
} from './utils';
import { expect } from 'chai';

describe('evaluate request', function () {
let dc: CdtDebugClient;
Expand Down Expand Up @@ -97,6 +97,19 @@ describe('evaluate request', function () {
await event;
});

it('should send a warning when the commands command is sent', async function () {
const event = dc.waitForOutputEvent(
'stdout',
'warning: "commands" command is not supported via GDB/MI interface'
);
await dc.evaluateRequest({
context: 'repl',
expression: '> commands',
frameId: scope.frame.id,
});
await event;
});

it('should send a warning when evaluating a delete instruction breakpoint command is sent', async function () {
// set instruction breakpoint
await dc.setInstructionBreakpointsRequest({
Expand Down
3 changes: 0 additions & 3 deletions src/integration-tests/launchRemoteUnexpectedExit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import {
} from './utils';
import { assert, expect } from 'chai';
import { DebugProtocol } from '@vscode/debugprotocol';
import * as chai from 'chai';
import * as chaistring from 'chai-string';
chai.use(chaistring);

describe('launch remote unexpected session exit', function () {
let dc: CdtDebugClient;
Expand Down
14 changes: 14 additions & 0 deletions src/integration-tests/test/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*********************************************************************
* Copyright (c) 2025 Arm Limited and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*********************************************************************/

import * as chai from 'chai';
import * as chaiString from 'chai-string';

chai.use(chaiString);
3 changes: 0 additions & 3 deletions src/integration-tests/var.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import {
verifyRegister,
fillDefaults,
} from './utils';
import * as chai from 'chai';
import * as chaistring from 'chai-string';
chai.use(chaistring);

describe('Variables Test Suite', function () {
let dc: CdtDebugClient;
Expand Down