-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging support #31
Comments
If debugging without daemon is too slow (it has to start jvm everytime), And thanks for the feedback! We'll investigate how to make debugging easier. |
@yigit recently contributed KSP testing support to kotlin-compile-testing here https://github.com/tschuchortdev/kotlin-compile-testing#kotlin-symbol-processing-api-support |
As you mentioned there is KSP support in kotlin-compile-testing now. Keep this issue for tracking related works like keep kotlin-compile-testing update to date with KSP or intaking more ideas. |
Did you pass the following system property while running Gradle? So that
I haven't tried to attach it in the way of the screenshot; Instead, I use [run] -> [Attach to Process...] in IntelliJ and the popup window prompts a list that contains the |
I'm not using those exactly, but the ones suggested by the remote configuration for jdk9+, that is
First difference, I see that you have some backslashes in there.. are those mandatory? Second, this is what happens on mine:
I have jdk11 default on PATH
Here a gif to better illustrate my situation Ps: without a daemon as Zac suggested works fine though (but as you said, it's too slow) |
My compilation completes before I can attach my intellij debugger ? I was able to get this to work last week on my laptop though so I am a bit confused what I'm doing different/wrong. |
@ToxicMushroom that's because |
* Update to Kotlin 1.3.60 Note that since this is using private APIs of kotlin, it's not possible to support older versions simultaneously since it's not possible to detect what version of the tools you're consuming are without some very uncomfortable reflection.
Can you please explain it step by step? I didn't get it. I just ran the commands on this page but I do not know what to do next. @ZacSweers |
after running ksp task with JDWP, you should be able to attach a debugger via |
Your screenshot looks more like general JDWP debugging issue to me. By searching the file you are stuck in I can get some existing issues like this one https://stackoverflow.com/questions/18992181/intellij-idea-breakpoints-stop-in-jars-instead-of-source-code-of-my-project I would suggest looking into the JDWP set up part. |
The debugger did not stop at the breakpoint. Commands:
env:
|
I don't understand why this is "P3". Trying to develop without a working debugger is not fun. It is possible using some combination of arguments (e.g. I think use of debugging needs to be supported and documented ASAP. This issue appears to have been open for three years. |
@mikedawson the approach I described in my OP plus the existence of compilation testing libraries means debugging works fine. You're not blocked, it's unclear what you're even asking for as I don't know what else they could do other than what I explained above. I'm actually somewhat inclined to close this issue as I don't really feel it's an issue at this point, other than maybe just adding a debugging wiki explaining the above. |
Hi @ZacSweers yes I am able to debug, which is good. My personal suggestion would be to put this in the documentation : either in the Quickstart section or the FAQ. I think anyone who is developing a non-trivial processor will likely need to use it. A debugging Wiki would also be helpful, but I think how to debug is essential info, and thus deserves to be included in the docs themselves. What I mean by "support" - I mean to add it to the official docs / Wiki and to update those docs if/when the procedure changes. |
How to attach KotlinCompileDaemon? Does anybody know. I have tried many times and I still can not debug KSP. would anyone post the screenshot of detail steps ? Thanks。 |
A page for how to debug has been added very recently. Specifically, this section shows how to pass necessary flags to |
@ting-yuan hi, thanks for answering my question. |
Looks like task named kspDebugKotlin doesn't exist for me. Where does it come from? |
This is less of a feature request and more just sharing this in case anyone else is interested.
In general, I'd recommend writing up an example of debugging/testing story, perhaps a demo or contributing support to @tschuchortdev's https://github.com/tschuchortdev/kotlin-compile-testing project.
In the meantime, I've found success attaching the debugger manually from the Gradle invocation.
Example:
./gradlew :sample:build --no-daemon -Dorg.gradle.debug=true -Pkotlin.compiler.execution.strategy=in-process
. Then connect via remote debugger in the IDE and you can hit your processor's breakpoints.The text was updated successfully, but these errors were encountered: