Thursday, June 19, 2008

Debugging .sh in eclipse using external tools

Lets say X has been using eclipse for a while. He has been working on a project and he is delivering. He has been developing and debugging using an ide called eclipse which has taken him away from the system. Now he feel the need to go closer to the system. He writes build scripts, he makes the project as configurable as possible and makes the project IDE independent and linux/unix friendly. In the process he creates shell scripts. Now with time the codes got enhanced with lesser reliability on IDE. After a while he comes back and find to his amusement well now he is to code and inevitably debug. Now he is in a fix how to debug in eclipse (the concept he is so familiar with) the shell scripts which in turn calls bits and pieces of the rest of the code base(in java). Here is the way out for him.


Create Program in external tool. select sh ,select workspace and set all
the env var in env which are required to run that shell script. Some of the changes which I did was this. These changes are specific to user requirement

change in ENV
export CATALINA_JAVA_OPTS="-Xms128m -Xmx256m -Djava.compiler=none -Xdebug -Xnoagent -Xrunjdwp:server=y,transport=dt_socket,suspend=y,address=16123"

export INDEX_JAVA_OPTS="-Xms128m -Xmx256m -Djava.compiler=none -Xdebug -Xnoagent -Xrunjdwp:server=y,transport=dt_socket,suspend=y,address=16123"

export REPORTS_JAVA_OPTS="-Xms128m -Xmx256m -Djava.compiler=none -Xdebug -Xnoagent -Xrunjdwp:server=y,transport=dt_socket,suspend=y,address=16123"

export USER_PROFILER_JAVA_OPTS="-Xms128m -Xmx256m -Djava.compiler=none -Xdebug -Xnoagent -Xrunjdwp:server=y,transport=dt_socket,suspend=y,address=16123"

and create debug for this port,localhost in remote app debug

After this set break point in your code base using which one can debug.

No comments: