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
f148157
commit d7bb29e
Showing
5 changed files
with
82 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,62 @@ | ||
/********************************************************************* | ||
* 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('stdouterr', function () { | ||
let dc: CdtDebugClient; | ||
const program = path.join(testProgramsDir, 'stdouterr'); | ||
const source = path.join(testProgramsDir, 'stdouterr.c'); | ||
|
||
beforeEach(async function () { | ||
dc = await standardBeforeEach(); | ||
}); | ||
|
||
afterEach(async function () { | ||
await dc.stop(); | ||
}); | ||
|
||
it('receives stdout and 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: 4, | ||
} | ||
); | ||
|
||
const stdout = dc.waitForOutputEvent('stdout', 'STDOUT Here I am\n'); | ||
const stderr = dc.waitForOutputEvent('stderr', 'STDERR Here I am\n'); | ||
|
||
const scope = await getScopes(dc); | ||
await Promise.all([ | ||
dc.continueRequest({ threadId: scope.thread.id }), | ||
stdout, | ||
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 | ||
stdouterr |
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,9 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
fprintf(stdout, "STDOUT Here I am\n"); | ||
fflush(stdout); | ||
fprintf(stderr, "STDERR Here I am\n"); | ||
fflush(stderr); | ||
return 0; | ||
} |