cloud-fan commented on a change in pull request #259: Add remote debug guidance
URL: https://github.com/apache/spark-website/pull/259#discussion_r376909243
 
 

 ##########
 File path: developer-tools.md
 ##########
 @@ -435,6 +435,46 @@ Error:(147, 9) value q is not a member of StringContext
         q"""
         ^ 
 ```
+<h4>Remote Debug Unit Test</h4>
+This part will show you how to debug unit test in SBT with the help of remote 
debug functionality which provided by IntelliJ.
+
+<h5>Set up Remote Debug Configuration</h5>
+Follow <i>Run > Edit Configurations > + > Remote</i> to open a default Remote 
Configuration template:
+<img src="/images/intellij_remote_debug_configuration.png" style="width: 75%; 
max-width: 660px;" />
+
+Normally, the default values should be good enough to use. Make sure that you 
choose <b>Listen to remote JVM</b>
+as <i>Debugger mode</i> and select the right <i>Command line arguments for 
remote JVM</i> as per your JDK version.
+
+Once you finish configuration and save it. You can follow <i>Run > Run > 
Your_Remote_Debug_Name > Debug</i> to start remote debug
+process and wait for SBT console to connect:
+
+<img src="/images/intellij_start_remote_debug.png" style="width: 75%; 
max-width: 660px;" />
+
+<h5>Debug Test in SBT</h5>
+
+Enter in SBT console
+```
+./build/sbt
+```
+Switch to project where the target test locates, e.g.:
+```
+sbt > project core
+```
+Set javaOptions by copy pasting the following:
+```
+sbt > set javaOptions in Test += 
"-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=localhost:5005"
+```
+Set breakpoints with IntelliJ and run the test with SBT, e.g.:
+```
+sbt > testOnly *SparkContextSuite -- -t "Only one SparkContext may be active 
at a time"
+```
+
+It should be successfully connected to IntelliJ when you see "Connected to the 
target VM, 
+address: 'localhost:5005', transport: 'socket'" in IntelliJ console. And then, 
you can start
+debug in IntelliJ as usual.
+ 
+To exit remote debug mode (so that you don't have to keep starting the remote 
debugger),
+type "session clear" in SBT console - while you're in a project.
 
 Review comment:
   remove `-`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to