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.
Deliver gdb and inferior error messages to the client
Fixes eclipse-cdt-cloud#239
- Loading branch information
1 parent
6d71ff0
commit 756c506
Showing
5 changed files
with
88 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,63 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2023 Kichwa Coders Canada Inc. | ||
* | ||
* 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 path from 'path'; | ||
import { LaunchRequestArguments } from '../GDBDebugSession'; | ||
import { CdtDebugClient } from './debugClient'; | ||
import { | ||
fillDefaults, | ||
getScopes, | ||
isRemoteTest, | ||
standardBeforeEach, | ||
testProgramsDir, | ||
} from './utils'; | ||
|
||
describe('stderr', function () { | ||
let dc: CdtDebugClient; | ||
const program = path.join(testProgramsDir, 'stderr'); | ||
const source = path.join(testProgramsDir, 'stderr.c'); | ||
|
||
beforeEach(async function () { | ||
dc = await standardBeforeEach(); | ||
}); | ||
|
||
afterEach(async function () { | ||
await dc.stop(); | ||
}); | ||
|
||
it('receives stderr from inferior as output events', async function () { | ||
if (isRemoteTest) { | ||
// remote tests the inferior stdout/err comes out the remote end, so | ||
// no output events from the adapter | ||
this.skip(); | ||
} | ||
|
||
await dc.hitBreakpoint( | ||
fillDefaults(this.test, { | ||
program: program, | ||
} as LaunchRequestArguments), | ||
{ | ||
path: source, | ||
line: 6, | ||
} | ||
); | ||
|
||
const stderr = dc.waitForOutputEvent( | ||
'stderr', | ||
'STDERR Here I am STDERR\r\n' | ||
); | ||
|
||
const scope = await getScopes(dc); | ||
await Promise.all([ | ||
dc.continueRequest({ threadId: scope.thread.id }), | ||
stderr, | ||
]); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -18,3 +18,4 @@ MultiThreadRunControl | |
.settings/ | ||
/vars_cpp | ||
/log | ||
stderr |
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,14 @@ | ||
#include <stdio.h> | ||
#include "Sleep.h" | ||
int main() | ||
{ | ||
// Always use \r\n so that Windows doesn't reinterpret | ||
fprintf(stderr, "STDERR Here I am STDERR\r\n"); | ||
fflush(stderr); | ||
|
||
// Sleep for a while so that there is no other | ||
// noise, such as process termination, while | ||
// looking for above output | ||
SLEEP(2); | ||
return 0; | ||
} |