Giter Site home page Giter Site logo

Comments (4)

fwcd avatar fwcd commented on May 30, 2024

The debug adapter currently does not support this. To support custom environment variables, we might have to start the debuggee process externally and connect the debug adapter to it through a socket. This is, at least, what the Java extension does: microsoft/java-debug#89

Edit: Note that you can already launch your process externally with the following JVM args:
-Xdebug -agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,quiet=y,suspend=y
...then connect the debug adapter through VSCode to port $PORT (using the "request": "attach" configuration).

from kotlin-debug-adapter.

thunderz99 avatar thunderz99 commented on May 30, 2024

Thanks for the reply. I'll have a try on the "attach" mode.

from kotlin-debug-adapter.

thunderz99 avatar thunderz99 commented on May 30, 2024

"request": "attach" configuration

I tried the attach configuration, unfortunately it didn't work.

To reproduce

% cd kotlin-quick-start

./gradlew run --debug-jvm

> Task :run
Listening for transport dt_socket at address: 5005

Run the Kotlin Attach config in vscode. But got the message below:

[INFO] main      Connected to client
[INFO] async0    Waiting for configuration done response for 10 seconds...
[INFO] async0    Waiting for configuration done response for 20 seconds...
[INFO] async0    Waiting for configuration done response for 30 seconds...
[INFO] async0    Waiting for configuration done response for 40 seconds...
[INFO] async0    Waiting for configuration done response for 50 seconds...
[INFO] async0    Waiting for configuration done response for 60 seconds...
[INFO] async0    Waiting for configuration done response for 70 seconds...
...

My launch.json is:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "kotlin",
            "request": "attach",
            "name": "Kotlin Attach",
            "projectRoot": "${workspaceFolder}",
            "hostName": "localhost",
            "port": 5005,
            "timeout": 30000
        },
        {
            "type": "kotlin",
            "request": "launch",
            "name": "Kotlin Launch",
            "projectRoot": "${workspaceFolder}",
            "mainClass": "MainKt",
            "preLaunchTask": "build"
        },
        {
            "type": "java",
            "name": "Java Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005
        }
    ]
}

The Java Debug(Attach) works. It correctly attached and showed call stack. (Of cause it doesn't recognize kotlin breakpoints though.)

A reproducing repo can be found here:
https://github.com/thunderz99/kotlin-quick-start/tree/topics/test-environment-variables

from kotlin-debug-adapter.

thunderz99 avatar thunderz99 commented on May 30, 2024

It worked when I build the kotlin-debug-adapter locally. Maybe the one in the latest-release is out of date.
Anyway thank you for your advice!

from kotlin-debug-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.