www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Configure VS Code for Debugging on Kubuntu

reply Brother Bill <brotherbill mail.com> writes:
On Kubuntu Linux, the Terminal pane is not getting stdout 
messages.
The Debugger pane will write them out only if stdout.flush().
This works on Fedora 43 Linux.

Console messages:
```
Warning: 'set target-async', an alias for the command 'set 
mi-async', is deprecated.
Use 'set mi-async'.

Running executable

This GDB supports auto-downloading debuginfo from the following 
URLs:
   <https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n]) [answered N; input 
not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' 
to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library 
"/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, D main () at source/app.d:9
9		writeln(top.id);     stdout.flush;
0
1
2
[Inferior 1 (process 40334) exited normally]

```

source/app.d
```
import std.stdio : writeln, stdout;

void main()
{
	auto top    = Point(7, 0);
	auto middle = Point(8, 0);
	auto bottom = Point(9, 0);

	writeln(top.id);     stdout.flush;
	writeln(middle.id);  stdout.flush;
	writeln(bottom.id);  stdout.flush;
}

struct Point
{
	size_t id; 		// Object id
	int    line;
	int    column;

	// The id to be used for the next object
	static size_t nextId;

	this(int line, int column)
	{
		this.line   = line;
		this.column = column;
		this.id     = makeNewId();
	}

	static size_t makeNewId()
	{
		immutable newId = nextId;

		++nextId;

		return newId;
	}
}
```

launch.json
```
{
     // Use IntelliSense to learn about possible attributes.
     // Hover to view descriptions of existing attributes.
     // For more information, visit: 
https://go.microsoft.com/fwlink/?linkid=830387
     "version": "0.2.0",
     "configurations": [
         {
             "type": "code-d",
             "request": "launch",
             "dubBuild": true,
             "name": "Build & Debug DUB project",
             "cwd": "${command:dubWorkingDirectory}",
             "program": "${command:dubTarget}"
         }
     ]
}
```

Any suggestions?
Feb 20
parent reply Brother Bill <brotherbill mail.com> writes:
On Friday, 20 February 2026 at 11:43:15 UTC, Brother Bill wrote:
 Any suggestions?
For Ubuntu 24.04-LTS, these two files with these contents got the job done. 1. It debugs 2. It properly uses the Terminal Window for stdin and stdout .vscode/launch.json ``` { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "code-d", "request": "launch", "dubBuild": true, "name": "Build & Debug DUB project", "cwd": "${command:dubWorkingDirectory}", "program": "${command:dubTarget}" } ] } ``` .vscode/tasks.json ``` { "version": "2.0.0", "tasks": [ { "label": "dub: build", "type": "shell", "command": "dub build", "group": { "kind": "build", "isDefault": true }, "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": true }, "problemMatcher": [] }, { "label": "dub: run (integratedTerminal)", "type": "shell", "command": "dub run", "presentation": { "echo": true, "reveal": "always", "focus": true, "panel": "shared" }, "problemMatcher": [] } ] } ```
Feb 20
parent Brother Bill <brotherbill mail.com> writes:
On Friday, 20 February 2026 at 19:33:45 UTC, Brother Bill wrote:
 On Friday, 20 February 2026 at 11:43:15 UTC, Brother Bill wrote:
 Any suggestions?
For Ubuntu 24.04-LTS, these two files with these contents got the job done. 1. It debugs 2. It properly uses the Terminal Window for stdin and stdout .vscode/launch.json ``` { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "code-d", "request": "launch", "dubBuild": true, "name": "Build & Debug DUB project", "cwd": "${command:dubWorkingDirectory}", "program": "${command:dubTarget}" } ] } ```
Correction, .vscode/launch.json should be: ``` { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "code-d", "request": "launch", "dubBuild": true, "name": "Build & Debug DUB project", "cwd": "${command:dubWorkingDirectory}", "program": "${command:dubTarget}", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } ] } ```
Feb 20