Skip to content

Commit 480aa3c

Browse files
Merge branch 'eng/ide/ada_language_server#1634' into 'master'
Set a default debug address for GNATemulator See merge request eng/ide/ada_language_server!1984
2 parents ad0b5d2 + e1aacdf commit 480aa3c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ program using GNATemulator.
355355
<img src="doc/media/gnatemu-debug-codelens.gif" width="800" alt="Debug with GNATemulator CodeLens" />
356356

357357
The port used by the debugger launched by VS Code to connect to the running GNATemulator instance
358-
is the one specified via the `Emulator'Debug_Port` project attribute, so make sure it is set before
359-
running the dedicated GNATemulator command/CodeLens.
358+
is the one specified via the `Emulator'Debug_Port` project attribute: when not set, the extension
359+
will fallback on `localhost:1234` (GNATemulator's default debug port).
360360

361361
Note that GNATemulator is not available for all GNAT embedded toolchains. For more information about GNATemulator itself and its availabilty please refer to the [GNATemulator User's Guide](https://docs.adacore.com/gnatemulator-docs/gnatemulator.html).
362362

integration/vscode/ada/src/commands.ts

+12
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ async function buildAndDebugSpecifiedMain(
726726
const adaMain = await findAdaMain(main.fsPath);
727727
const target = await adaExtState.getTargetPrefix();
728728
const debugServerAddress = await adaExtState.getDebugServerAddress(useGNATemulator);
729+
729730
if (adaMain) {
730731
/**
731732
* The vscode API doesn't provide a way to list both automatically
@@ -762,6 +763,17 @@ async function buildAndDebugSpecifiedMain(
762763
if (matchingConfig) {
763764
logger.debug('Found matching config: ' + JSON.stringify(matchingConfig, null, 2));
764765

766+
// No debug server address specified in matching debug configuration: fallback
767+
// to 'localhost:1234' to match GNATemulator's default debug port.
768+
if (!matchingConfig.miDebuggerServerAddress && useGNATemulator) {
769+
const fallbackDebugServerAddress = 'localhost:1234';
770+
logger.debug(
771+
`No debug server address specified in debug configuration for GNATemulator:
772+
use '${fallbackDebugServerAddress}' as a fallback`,
773+
);
774+
matchingConfig.miDebuggerServerAddress = 'localhost:1234';
775+
}
776+
765777
// Trying to debug via GNATemulator: run the main via GNATemulator in debug mode
766778
// before starting the debug session
767779
if (useGNATemulator) {

0 commit comments

Comments
 (0)