I want to use the cpp GDB with the master theia(1.30.0)

Hello,Now I want to use the cpp GDB with the master theia(1.30.0),but it can’t work.I have done as follows:

  1. when i directly use the debug function ,the theia show “The debug session type"cppdbg” is not supported." error.
    2)Then I look for how to make it work on the Internet,someone say that use “@theia/cpp-debug”,also I find the example( eclipse-theia/theia-cpp-extensions: Theia CPP extension (github.com)),it have about GDB function.I can build successfully,but when I start the theia,show the error as follow:
D:\theia20111013\theia-master>yarn electron start
yarn run v1.22.19
$ yarn -s --cwd examples/electron start
native node modules are already rebuilt for electron

D:\theia20111013\theia-master\node_modules\bindings\bindings.js:121
        throw e;
        ^

Error: Module did not self-register: '\\?\D:\theia20111013\theia-master\node_modules\drivelist\build\Release\drivelist.node'.
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1800)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1170:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1800)
    at Module.load (node:internal/modules/cjs/loader:982:32)
    at Module._load (node:internal/modules/cjs/loader:823:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Module.require (node:internal/modules/cjs/loader:1006:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at bindings (D:\theia20111013\theia-master\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (D:\theia20111013\theia-master\node_modules\drivelist\js\index.js:25:27) {
  code: 'ERR_DLOPEN_FAILED'
}
[14344:1018/143346.759:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is disabled, ANGLE is

I find a problem,the version of theia is 1.30.0,but the version of @theia/cpp-debug is 1.27.0,I don’t know is this compatible ?

@James I believe all that is necessary for gdb to work is to include the appropriate extension for it:

The @theia/cpp-debug extension is not necessary but if you wanted to include it’s functionality (mainly memory inspector) then you should use @theia/memory-inspector which replaces it.

I have put the cdt-gdb-vscode into theiaPlugins(theia-master\package.json),but it also does’t work,when i debug ,the theia show “The debug session type"cppdbg” is not supported” all the same.

"theiaPlugins": {
    "eclipse-theia.builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.50.1/file/eclipse-theia.builtin-extension-pack-1.50.1.vsix",
    "vscode-builtin-cpp": "https://open-vsx.org/api/vscode/cpp/1.45.1/file/vscode.cpp-1.45.1.vsix",
    "vscode.theme-abyss": "https://open-vsx.org/api/vscode/theme-abyss/1.62.3/file/vscode.theme-abyss-1.62.3.vsix",
    "vscode.theme-defaults": "https://open-vsx.org/api/vscode/theme-defaults/1.62.3/file/vscode.theme-defaults-1.62.3.vsix",
    "vscode.theme-kimbie-dark": "https://open-vsx.org/api/vscode/theme-kimbie-dark/1.62.3/file/vscode.theme-kimbie-dark-1.62.3.vsix",
    "vscode.theme-monokai": "https://open-vsx.org/api/vscode/theme-monokai/1.62.3/file/vscode.theme-monokai-1.62.3.vsix",
    "vscode.theme-monokai-dimmed": "https://open-vsx.org/api/vscode/theme-monokai-dimmed/1.62.3/file/vscode.theme-monokai-dimmed-1.62.3.vsix",
    "vscode.theme-quietlight": "https://open-vsx.org/api/vscode/theme-quietlight/1.62.3/file/vscode.theme-quietlight-1.62.3.vsix",
    "vscode.theme-red": "https://open-vsx.org/api/vscode/theme-red/1.62.3/file/vscode.theme-red-1.62.3.vsix",
    "vscode.theme-solarized-dark": "https://open-vsx.org/api/vscode/theme-solarized-dark/1.62.3/file/vscode.theme-solarized-dark-1.62.3.vsix",
    "vscode.theme-solarized-light": "https://open-vsx.org/api/vscode/theme-solarized-light/1.62.3/file/vscode.theme-solarized-light-1.62.3.vsix",
    "vscode.theme-tomorrow-night-blue": "https://open-vsx.org/api/vscode/theme-tomorrow-night-blue/1.62.3/file/vscode.theme-tomorrow-night-blue-1.62.3.vsix",
    "vscode.typescript": "https://open-vsx.org/api/vscode/typescript/1.62.3/file/vscode.typescript-1.62.3.vsix",
    "vscode.typescript-language-features": "https://open-vsx.org/api/vscode/typescript-language-features/1.62.3/file/vscode.typescript-language-features-1.62.3.vsix",
    "EditorConfig.EditorConfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.14.4/file/EditorConfig.EditorConfig-0.14.4.vsix",
    "dbaeumer.vscode-eslint": "https://open-vsx.org/api/dbaeumer/vscode-eslint/2.1.1/file/dbaeumer.vscode-eslint-2.1.1.vsix",
    "ms-vscode.references-view": "https://open-vsx.org/api/ms-vscode/references-view/0.0.89/file/ms-vscode.references-view-0.0.89.vsix",
    "vscode-clangd": "https://open-vsx.org/api/llvm-vs-code-extensions/vscode-clangd/0.1.7/file/llvm-vs-code-extensions.vscode-clangd-0.1.7.vsix",
    "cdt-gdb-vscode": "https://open-vsx.org/api/eclipse-cdt/cdt-gdb-vscode/0.0.92/file/eclipse-cdt.cdt-gdb-vscode-0.0.92.vsix"
  },

I believe you know the plug-in of C/C++ in vscode well,but it is incompatible for theia,when i install the plug-in of C/C++ with theia,the theia always show “Activating”. the C/C++ plug-in has the Debugging function,I want the same function.

In addition,the plug-in of C/C++ in vscode has the function of IntelliSense and code browsing.but I can’t find the same funciton plug-in in “https://open-vsx.org/extension”.

I run the theia in window.

This problem has been bothering me for many days,I look forward to your reply

In addition,the plug-in of C/C++ in vscode has the function of IntelliSense and code browsing.but I can’t find the same funciton plug-in in “https://open-vsx.org/extension”.

Microsoft uses a proprietary license that forbids installation outside of official distributions of vscode. They started using that for most of their closed-source extensions, such as Pylance (Python) or C++. Consequently, in Theia we’re “stuck” using mostly open-source solutions instead.

Can you tell me the open-source solutions to replace C/C++ plug-in of vscode?Now I use vscode-builtin-cpp、vscode-clangd、cdt-gdb-vscode to replace it,but no effect

@James I’m using the following extensions (same as theia-cpp-extensions and it works fine):

Textmate Grammars

"vscode-builtin-cpp": "https://open-vsx.org/api/vscode/cpp/1.45.1/file/vscode.cpp-1.45.1.vsix",

Syntax Highligthing, Language Features

 "vscode-clangd": "https://open-vsx.org/api/llvm-vs-code-extensions/vscode-clangd/0.1.7/file/llvm-vs-code-extensions.vscode-clangd-0.1.7.vsix",

Debugging

"cdt-gdb-vscode": "https://open-vsx.org/api/eclipse-cdt/cdt-gdb-vscode/0.0.92/file/eclipse-cdt.cdt-gdb-vscode-0.0.92.vsix"

The cdt-gdb-vscode will contribute the gdb debugger type (which is likely your issue as gdbcpp is for the proprietary extension:

Do u use the source code in the path(GitHub - eclipse-theia/theia: Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.)? i use the newest master in the path.

I try again as u said,theia still does’t work( Highligthing)! :joy:

@James it works fine for me (master), please confirm you are actually loading your plugins:

You’ll see that the plugins are referenced when the application is started:

Thank you for your advice,today i use the newest master,I do as you said,now Highligthing is OK。

but the gdb debug can’t work,In fact,i want to customize using different gdb and gcc for debugging,how to config the json file of debug?Is there any relevant document to introduce this json rule?Previously, I used the vscode‘s debug configuration。the vscode configuration json file as follow:

{
    "name": "AAA testTheia on emulator-5554",
    "type": "cppdbg",
    "request": "launch",
    "program":"${ProcessPath}",
    "args": [],
    "stopAtEntry": true,
    "cwd":"c:\\Users\\username\\AAA\\testTheia",
    "targetArchitecture": "x86_64",
    "console": "integratedTerminal",
    "externalConsole": false,
    "MIMode": "gdb",
    "launchCompleteCommand": "exec-run",
    "customLaunchSetupCommands": [
        {
            "text":"-environment-cd c:\\Users\\username\\AAA\\testTheia"
        },
        {
            "description": "Loading symbol table",
            "text":"file iAutoSampleProcess",
            "ignoreFailures": false
        },
        {
            "decsription": "Connecting to AAA Linux debug",
            "text": "target remote 192.168.200.1:8000",
            "ignoreFailures": false
        },
        {
            "decsription": "Set Sysroot",
            "text": "set sysroot /install",
            "ignoreFailures": false
        },
        {
            "decsription": "Set Solib Search Path",
            "text": "set solib-search-path sdk-generic_x86_64/install/x86_64/usr/lib",
            "ignoreFailures": false
        },
        {
            "decsription": "Set Args",
            "text": "set args ",
            "ignoreFailures": false
        }
    ],
    "linux": {
        "miDebuggerPath": "${gdbPath}",
        "miDebuggerArgs": "--nh"
    },
    "miDebuggerPath": "${gdbPath}",
    "miDebuggerArgs": "--nh",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

@James you’ll need to take a look at the actual extension you’ll be using to provide gdb debugging, in this case cdt-gdb-vscode, it isn’t something the framework itself documents. You can take a look at their debuggers contribution (for example cppdbg is not the right type).

If you have questions specific to cdt-gdb-vscode itself it is likely best to ask them directly in their repo.

Thank you for your answer,now it’s working,i use the version of cdt-gdb-vscode is 0.093

Now i have developed a plug-in,want to support vscode and theia at the same time,but the implementation of debug fuction between vscode and theia is different.So i look for a extend function to get theia‘s name or vscode name on the internet as far as possible,but I can’t find a similar function.
Do you know the similar extend function?

@James what’s the difference in implementation?

i use the vscode function(export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSessionOrOptions?: DebugSession | DebugSessionOptions): Thenable;)to implemente the gdb debug directly using vscode,but
It can be realized by configuring on the interface using theia,because i have test the startDebugging function can’t realize the remote gdb debug on the theia

@James I had a hard time understanding what you meant, but startDebugging is supported by Theia as highlighted in our comparator report). In any case, I’m not sure you can code strictly for Theia in a VS Code extension to offer extended functionality.

let config33 = `{
            "version": "0.2.0",
            "configurations": [
                {
                  "name": "Attach to VDK (CDT)",
                  "type": "gdbtarget",
                  "request": "attach",
                  "program": "**excute program path**",
                  "gdb": "**gdb pathname** ",
                  "verbose": false,
                  "openGdbConsole": true,
                  "target": {
                    "host": "192.168.200.1",
                    "port": "8000",
                    }
              }
            ]
          }`;
        vscode_1.debug.startDebugging(undefined, config33);

i use and config the "startDebugging"as above,I don’t know whether the configuration is correct?Can you give me an example of how to use this function, Including how to set parameters?

@James you can simply take a look at the api:

/**
 * Start debugging by using either a named launch or named compound configuration,
 * or by directly passing a {@link DebugConfiguration}.
 * The named configurations are looked up in '.vscode/launch.json' found in the given folder.
 * Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date.
 * Folder specific variables used in the configuration (e.g. '${workspaceFolder}') are resolved against the given folder.
 * @param folder The {@link WorkspaceFolder workspace folder} for looking up named configurations and resolving variables or `undefined` for a non-folder setup.
 * @param nameOrConfiguration Either the name of a debug or compound configuration or a {@link DebugConfiguration} object.
 * @param parentSessionOrOptions Debug session options. When passed a parent {@link DebugSession debug session}, assumes options with just this parent session.
 * @return A thenable that resolves when debugging could be successfully started.
 */
export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSessionOrOptions?: DebugSession | DebugSessionOptions): Thenable<boolean>;

Where DebugConfiguration is expressed as:

/**
 * Configuration for a debug session.
 */
export interface DebugConfiguration {
	/**
	 * The type of the debug session.
	 */
	type: string;

	/**
	 * The name of the debug session.
	 */
	name: string;

	/**
	 * The request type of the debug session.
	 */
	request: string;

	/**
	 * Additional debug type specific properties.
	 */
	[key: string]: any;
}