kotlin: Debugging SpringBoot with jdb

If you start the gradle application with a special flag, --debug-jvm, then jdb can connect.

# Start JVM task via gradle, expecting debugger
./gradlew bootRun --debug-jvm
# ... blocks, waiting for debugger to attach

# In another session, attach
jdb -attach 5005 -sourcepath src/main/kotlin/
# OR even better, use rlwrap to improve the jdb prompt
rlwrap jdb -attach 5005 -sourcepath src/main/kotlin/

Note that the -sourcepath command specifies where the convention based class naming convention starts.

Using jdb

Gotchas

Published on: 14 Nov 2022