forked from eclipse-cdt-cloud/cdt-gdb-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure terminated event is sent to client (eclipse-cdt-cloud#234)
Consider that when no threads are running the inferior is not running. This is needed so we don't suppress sending events to client on async stopped events from gdb Fixes eclipse-cdt-cloud#233 Also-by: Jonah Graham <[email protected]>
- Loading branch information
Showing
2 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2023 Kichwa Coders Canada Inc. 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 { expect } from 'chai'; | ||
import * as path from 'path'; | ||
import { LaunchRequestArguments } from '../GDBDebugSession'; | ||
import { CdtDebugClient } from './debugClient'; | ||
import { | ||
fillDefaults, | ||
getScopes, | ||
standardBeforeEach, | ||
testProgramsDir, | ||
} from './utils'; | ||
|
||
describe('terminated', function () { | ||
let dc: CdtDebugClient; | ||
const emptyProgram = path.join(testProgramsDir, 'empty'); | ||
const emptySrc = path.join(testProgramsDir, 'empty.c'); | ||
|
||
beforeEach(async function () { | ||
dc = await standardBeforeEach(); | ||
}); | ||
|
||
afterEach(async function () { | ||
await dc.stop(); | ||
}); | ||
|
||
it('terminated event arrives after continuing after a breakpoint', async function () { | ||
await dc.hitBreakpoint( | ||
fillDefaults(this.test, { | ||
program: emptyProgram, | ||
} as LaunchRequestArguments), | ||
{ | ||
path: emptySrc, | ||
line: 3, | ||
} | ||
); | ||
|
||
await Promise.all([ | ||
dc.waitForEvent('terminated'), | ||
dc.continueRequest({ threadId: (await getScopes(dc)).thread.id }), | ||
]); | ||
}); | ||
|
||
it('terminated event arrives on a short run', async function () { | ||
await Promise.all([ | ||
dc.waitForEvent('terminated'), | ||
|
||
dc | ||
.waitForEvent('initialized') | ||
.then((_event) => dc.configurationDoneRequest()), | ||
|
||
dc.launch( | ||
fillDefaults(this.test, { | ||
program: emptyProgram, | ||
} as LaunchRequestArguments) | ||
), | ||
]); | ||
}); | ||
}); |