eclipse-cdt-cloud/cdt-gdb-adapter

Support configuration when in `Server Mode`

Closed this issue ยท 5 comments

We have a use case running cdt-gdb-adapter in a remote containerised environment and exposing a socket to control the debug interface by running a command of the form:

node debugTargetAdapter.js --server=50000

This works well, but requires the connecting client to specify the program to be debugged (in launch mode) or the local port to attach to (in attach mode).

It would be ideal if configuration of the environment was isolated within the container via environment variables or by passing a config file location as a further switch when running debugTargetAdapter.js e.g.:

node debugTargetAdapter.js --server=50000 --config=config.json

Contents of config.json:

{
    "request": "attach",
    "port": 50000
}

or

{
    "request": "launch",
    "program": "/path/to/my/app"
}

Is this a valid addition and would there be a better/easier way to implement it?

Hi @thegecko - I am back from vacation now. I will think this over and get back to you soon.

This seems like a reasonable thing to do. I can't see another way of doing this externally, at least not a straightforward way. My guess is that you want to provide almost all the launch.json contents in the command line argument (e.g. which gdb to use, initial gdb commands, etc.)

For completeness, the journey on went down led me to the client having some special file that the client launch configuration would reference, but having it passed to the adapter up front seemed sensible.

I drafted an untested implementation to see if we are on the same page in #228 - have a look and see if that is the kind of thing you meant?

This is now available as 0.0.17 - https://www.npmjs.com/package/cdt-gdb-adapter/v/0.0.17

I haven't done an npm release in a while, so let me know if anything doesn't look right about it.