Prerequisite

This document assumes that you already have a development environment such as Impala dev. with IntelliJ. Please refer to IntelliJ and CLion Setup for Impala Development if you would like to know about IntelliJ on Impala. You can use Eclipse or other debugger tools.

Let's debug AnalyzeStmtsTest in How to load, run, and create new Impala tests !

1. Add a new item to remote. See "Remote Debugging" step in IntelliJ and CLion Setup for Impala Development. Fill in Name, Host and Port.

2. Run the command and then maven waits for your debugger's connection. See http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html if you want to know more details.

~/Impala/fe$ mvn \
-Dmaven.surefire.debug="-Xdebug \
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 \
-Xnoagent \
-Djava.compiler=NONE" \
-fae \
-Dtest=AnalyzeStmtsTest#TestStar \
test
...
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Listening for transport dt_socket at address: 8000

Or simplify the command with the following procedure. Adds the function into your ~/.bashrc or ~/.bash_profile

function mvn-debug-front-end() {
  local target_test=${1}
  if [[ -z ${target_test} ]]; then
    echo "Error: undefined target test"
  else
    mvn \
      -Dmaven.surefire.debug="-Xdebug \
      -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 \
      -Xnoagent \
      -Djava.compiler=NONE" \
      -fae \
      -Dtest=${target_test} \
      test
  fi
}

Run as below

~/Impala/fe$ mvn-debug-front-end AnalyzeStmtsTest#TestStar
...
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Listening for transport dt_socket at address: 8000


3. Set a breakpoint where you want to debug in IntelliJ.

4. Press debug icon on the top of the right side.

5. You can look into debugging information such as call stack, inspect variables and so on.

  • No labels