Permalink
Browse files

Updated for GR8Conf 2015 in Copenhagen

  • Loading branch information...
1 parent e3a4d4e commit ef06b834e819a07f3d69440e1c559849a019ef2d @jetztgradnet committed Nov 22, 2015
View
72 README.md
@@ -1,68 +1,58 @@
-h1. YouDebug demo
+# YouDebug demo
-h2. Build demo app
+## Build demo app
-./gradlew war
+ ./gradlew --offline war
-h2. run demo app in Eclipse debugger
+## run demo app in Eclipse debugger
start web application "buggyweb" on a servlet runtime
-browse to "http://localhost:8080/buggyweb/MyServlet":http://localhost:8080/buggyweb/MyServlet
+browse to [http://localhost:8080/buggyweb/MyServlet](http://localhost:8080/buggyweb/MyServlet)
-h2. run demo app in Tomcat
+## run demo app in Tomcat
-bc.
-cd $CATALINA_HOME
-bin/catalina.sh jpda start
+ cd $CATALINA_HOME
+ # 8000 is Tomcat's default debug port
+ export DEBUG_PORT=8000
+ bin/catalina.sh jpda start
-browse to "http://localhost:8080/buggyweb/MyServlet":http://localhost:8080/buggyweb/MyServlet
+browse to [http://localhost:8080/buggyweb/MyServlet](http://localhost:8080/buggyweb/MyServlet)
-h3. show Tomcat log file
+### show Tomcat log file
-bc.
-tail -30f logs/localhost.`date +%Y-%m-%d`.log
+ tail -30f logs/localhost.`date +%Y-%m-%d`.log
-h2. Run demo app in Jetty
+## Run demo app in Jetty
-export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001"
-./gradlew jettyRun
+ export DEBUG_PORT=8001
+ export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$DEBUG_PORT"
+ ./gradlew --offline jettyRun
-browse to "http://localhost:8081/buggyweb/MyServlet":http://localhost:8081/buggyweb/MyServlet
+browse to [http://localhost:8081/buggyweb/MyServlet](http://localhost:8081/buggyweb/MyServlet)
-h3. line break
-bc.
-./youdebug -socket 8000 linebreak.ydb
-./youdebug -socket 8001 linebreak.ydb
+### line break
-h3. diagnostics: exception
+ ./youdebug -socket $DEBUG_PORT linebreak.ydb
-bc.
-./youdebug -socket 8000 exception.ydb
-./youdebug -socket 8001 exception.ydb
+### diagnostics: exception
+ ./youdebug -socket $DEBUG_PORT exception.ydb
-h3. diagnostics: parameter check
-bc.
-./youdebug -socket 8000 diagnose.ydb
-./youdebug -socket 8001 diagnose.ydb
+### diagnostics: parameter check
-h3. First fix
+ ./youdebug -socket $DEBUG_PORT diagnose.ydb
-bc.
-./youdebug -socket 8000 firstbugfix.ydb
-./youdebug -socket 8001 firstbugfix.ydb
+### First fix
-h3. Final fix
+ ./youdebug -socket $DEBUG_PORT firstbugfix.ydb
-bc.
-./youdebug -socket 8000 finalbugfix.ydb
-./youdebug -socket 8001 finalbugfix.ydb
+### Final fix
-h3. threaddump
+ ./youdebug -socket $DEBUG_PORT finalbugfix.ydb
-bc.
-./youdebug -socket 8000 threaddump.ydb
-./youdebug -socket 8001 threaddump.ydb
+### threaddump
+
+ ./youdebug -socket $DEBUG_PORT threaddump.ydb
View
BIN YouDebug GR8Conf 2015.key
Binary file not shown.
View
BIN YouDebug GR8Conf 2015.pdf
Binary file not shown.
View
7 buggyweb/.classpath
@@ -3,5 +3,10 @@
<classpathentry kind="output" path="bin"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
- <classpathentry sourcepath="/Users/wolfgang/.gradle/caches/artifacts-8/filestore/javax.servlet/servlet-api/2.5/source/21599814ad9a605b86f3e6381571beccd861a32/servlet-api-2.5-sources.jar" kind="lib" path="/Users/wolfgang/.gradle/caches/artifacts-8/filestore/javax.servlet/servlet-api/2.5/jar/5959582d97d8b61f4d154ca9e495aafd16726e34/servlet-api-2.5.jar" exported="true"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container" exported="true"/>
+ <classpathentry sourcepath="/Users/wschell/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.5/21599814ad9a605b86f3e6381571beccd861a32/servlet-api-2.5-sources.jar" kind="lib" path="/Users/wschell/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.5/5959582d97d8b61f4d154ca9e495aafd16726e34/servlet-api-2.5.jar" exported="true">
+ <attributes>
+ <attribute name="org.eclipse.jst.component.nondependency" value=""/>
+ </attributes>
+ </classpathentry>
</classpath>
View
8 buggyweb/.settings/org.eclipse.jdt.core.prefs
@@ -1,13 +1,13 @@
#
-#Wed Apr 25 02:43:51 CEST 2012
+#Mon Jun 01 14:33:53 CEST 2015
org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
View
2 buggyweb/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -3,5 +3,5 @@
<fixed facet="jst.java"/>
<fixed facet="jst.web"/>
<installed facet="jst.web" version="2.4"/>
- <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.java" version="1.8"/>
</faceted-project>
View
78 buggyweb/README.md
@@ -1,68 +1,64 @@
-h1. YouDebug demo
+# YouDebug demo
-h2. Build demo app
+## Create Eclipse project
-./gradlew war
+ ./gradlew --offline eclipse
-h2. run demo app in Eclipse debugger
+The project can now be imported using the "Existing Projects into Workspace" Import wizard.
+
+## Build demo app
+
+ ./gradlew --offline war
+
+## run demo app in Eclipse debugger
start web application "buggyweb" on a servlet runtime
-browse to "http://localhost:8080/buggyweb/MyServlet":http://localhost:8080/buggyweb/MyServlet
+browse to [http://localhost:8080/buggyweb/MyServlet](http://localhost:8080/buggyweb/MyServlet)
+
+## run demo app in Tomcat
-h2. run demo app in Tomcat
+ cd $CATALINA_HOME
+ # 8000 is Tomcat's default debug port
+ export DEBUG_PORT=8000
+ bin/catalina.sh jpda start
-bc.
-cd $CATALINA_HOME
-bin/catalina.sh jpda start
+browse to [http://localhost:8080/buggyweb/MyServlet](http://localhost:8080/buggyweb/MyServlet)
-browse to "http://localhost:8080/buggyweb/MyServlet":http://localhost:8080/buggyweb/MyServlet
+### show Tomcat log file
-h3. show Tomcat log file
+ tail -30f logs/localhost.`date +%Y-%m-%d`.log
-bc.
-tail -30f logs/localhost.`date +%Y-%m-%d`.log
+## Run demo app in Jetty
-h2. Run demo app in Jetty
+ export DEBUG_PORT=8001
+ export GRADLE_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$DEBUG_PORT"
+ ./gradlew --offline jettyRun
-export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001"
-./gradlew jettyRun
-browse to "http://localhost:8081/buggyweb/MyServlet":http://localhost:8081/buggyweb/MyServlet
+browse to [http://localhost:8081/buggyweb/MyServlet](http://localhost:8081/buggyweb/MyServlet)
-h3. line break
+### line break
-bc.
-./youdebug -socket 8000 linebreak.ydb
-./youdebug -socket 8001 linebreak.ydb
+ ./youdebug -socket $DEBUG_PORT linebreak.ydb
-h3. diagnostics: exception
+### diagnostics: exception
-bc.
-./youdebug -socket 8000 exception.ydb
-./youdebug -socket 8001 exception.ydb
+ ./youdebug -socket $DEBUG_PORT exception.ydb
-h3. diagnostics: parameter check
+### diagnostics: parameter check
-bc.
-./youdebug -socket 8000 diagnose.ydb
-./youdebug -socket 8001 diagnose.ydb
+ ./youdebug -socket $DEBUG_PORT diagnose.ydb
-h3. First fix
+### First fix
-bc.
-./youdebug -socket 8000 firstbugfix.ydb
-./youdebug -socket 8001 firstbugfix.ydb
+ ./youdebug -socket $DEBUG_PORT firstbugfix.ydb
-h3. Final fix
+### Final fix
-bc.
-./youdebug -socket 8000 finalbugfix.ydb
-./youdebug -socket 8001 finalbugfix.ydb
+ ./youdebug -socket $DEBUG_PORT finalbugfix.ydb
-h3. threaddump
+### threaddump
-bc.
-./youdebug -socket 8000 threaddump.ydb
-./youdebug -socket 8001 threaddump.ydb
+ ./youdebug -socket $DEBUG_PORT threaddump.ydb
View
BIN buggyweb/bin/net/jetztgrad/buggyweb/MyServlet.class
Binary file not shown.
View
4 buggyweb/build.gradle
@@ -18,7 +18,7 @@ dependencies {
httpPort = 8081
task wrapper(type: Wrapper) {
- //gradleVersion = '1.0'
- gradleVersion = '1.0-milestone-8'
+ gradleVersion = '2.4'
+ //gradleVersion = '1.0-milestone-8'
}
View
BIN buggyweb/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
View
4 buggyweb/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 25 02:35:27 CEST 2012
+#Mon Jun 01 13:37:18 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-8-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip
View
114 buggyweb/gradlew
@@ -1,16 +1,16 @@
-#!/bin/bash
-
+#!/usr/bin/env bash
+
##############################################################################
-## ##
-## Gradle wrapper script for UN*X ##
-## ##
+##
+## Gradle start up script for UN*X
+##
##############################################################################
-# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
-# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
-# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
-GRADLE_APP_NAME=Gradle
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -42,54 +42,51 @@ case "`uname`" in
;;
esac
-# Attempt to set JAVA_HOME if it's not already set.
-if [ -z "$JAVA_HOME" ] ; then
- if $darwin ; then
- [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
- [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
- else
- javaExecutable="`which javac`"
- [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- export JAVA_HOME="$javaHome"
- fi
-fi
-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
- [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
-STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
-CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar
-WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
else
- JAVACMD="java"
+ JAVACMD="$JAVA_HOME/bin/java"
fi
-fi
-if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
-fi
-if [ -z "$JAVA_HOME" ] ; then
- warn "JAVA_HOME environment variable is not set"
fi
# Increase the maximum file descriptors if we can.
@@ -104,19 +101,18 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
- warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT"
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
-# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name
+# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
- JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME"
-# we may also want to set -Xdock:image
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
- JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"`
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
@@ -143,7 +139,7 @@ if $cygwin ; then
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
- done
+ done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
@@ -158,11 +154,11 @@ if $cygwin ; then
esac
fi
-GRADLE_APP_BASE_NAME=`basename "$0"`
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-exec "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
- -classpath "$CLASSPATH" \
- -Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
- -Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
- $STARTER_MAIN_CLASS \
- "$@"
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
View
52 buggyweb/gradlew.bat
@@ -1,24 +1,37 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
-@rem ##
-@rem Gradle startup script for Windows ##
-@rem ##
+@rem
+@rem Gradle startup script for Windows
+@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
-@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m
-@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.\
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
set JAVA_EXE=java.exe
-if not defined JAVA_HOME goto init
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+goto fail
+
+:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
@@ -29,14 +42,14 @@ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
-echo.
-goto end
+
+goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%eval[2+2]" == "4" goto 4NT_args
+if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -56,27 +69,22 @@ set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
-set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
-set CLASSPATH=%DIRNAME%\gradle\wrapper\gradle-wrapper.jar
-set WRAPPER_PROPERTIES=%DIRNAME%\gradle\wrapper\gradle-wrapper.properties
-
-set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%"
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
-"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
-if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1
-
+:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%"
-exit /b "%ERRORLEVEL%"
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
-:omega
+:omega
View
7 buggyweb/src/main/java/net/jetztgrad/buggyweb/MyServlet.java
@@ -41,6 +41,13 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
out.println("</form></p>");
out.println("</body></html>");
}
+ catch (Exception e) {
+ out.println("<h3>An error occured:</h3>");
+ out.println("<p><pre>");
+ out.println(e.getClass().getSimpleName() + " " + e.getMessage());
+// e.printStackTrace(out);
+ out.println("</pre></p>");
+ }
finally {
try {
out.close();
View
5 buggyweb/src/main/webapp/WEB-INF/web.xml
@@ -3,11 +3,6 @@
<display-name>buggyweb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>default.html</welcome-file>
- <welcome-file>default.htm</welcome-file>
- <welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
View
3 buggyweb/src/main/webapp/index.html
@@ -0,0 +1,3 @@
+<h1>Welcome to buggyweb!</h1>
+
+<a href="MyServlet">Calculate years until you are one hundred!</a>
View
BIN groovy_logo_big.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
80 youdebug-cli/README.md
@@ -1,68 +1,66 @@
-h1. YouDebug demo
+# YouDebug demo
-h2. Build demo app
+## Build demo app
-./gradlew war
+ ./gradlew --offline war
-h2. run demo app in Eclipse debugger
+## run demo app in Eclipse debugger
start web application "buggyweb" on a servlet runtime
-browse to "http://localhost:8080/buggyweb/MyServlet":http://localhost:8080/buggyweb/MyServlet
+browse to [http://localhost:8080/buggyweb/MyServlet](http://localhost:8080/buggyweb/MyServlet)
-h2. run demo app in Tomcat
+## run demo app in Tomcat
-bc.
-cd $CATALINA_HOME
-bin/catalina.sh jpda start
+ cd $CATALINA_HOME
+ # 8000 is Tomcat's default debug port
+ export DEBUG_PORT=8000
+ bin/catalina.sh jpda start
-browse to "http://localhost:8080/buggyweb/MyServlet":http://localhost:8080/buggyweb/MyServlet
+browse to [http://localhost:8080/buggyweb/MyServlet](http://localhost:8080/buggyweb/MyServlet)
-h3. show Tomcat log file
+### show Tomcat log file
-bc.
-tail -30f logs/localhost.`date +%Y-%m-%d`.log
+ tail -30f logs/localhost.`date +%Y-%m-%d`.log
-h2. Run demo app in Jetty
+## Run demo app in Jetty
-export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001"
-./gradlew jettyRun
+ export DEBUG_PORT=8001
+ export GRADLE_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001"
+ ./gradlew --offline jettyRun
-browse to "http://localhost:8081/buggyweb/MyServlet":http://localhost:8081/buggyweb/MyServlet
+browse to [http://localhost:8081/buggyweb/MyServlet](http://localhost:8081/buggyweb/MyServlet)
-h3. line break
+## Exploring YouDebug
-bc.
-./youdebug -socket 8000 linebreak.ydb
-./youdebug -socket 8001 linebreak.ydb
+### threaddump
-h3. diagnostics: exception
+ ./youdebug -socket $DEBUG_PORT threaddump.ydb | more
+
+### VM Information
-bc.
-./youdebug -socket 8000 exception.ydb
-./youdebug -socket 8001 exception.ydb
+ ./youdebug -socket $DEBUG_PORT vminfo.ydb
+## Diagnosing the bug
-h3. diagnostics: parameter check
+### diagnostics: get exception stacktrace
-bc.
-./youdebug -socket 8000 diagnose.ydb
-./youdebug -socket 8001 diagnose.ydb
+ ./youdebug -socket $DEBUG_PORT exception.ydb
-h3. First fix
+### set line break
-bc.
-./youdebug -socket 8000 firstbugfix.ydb
-./youdebug -socket 8001 firstbugfix.ydb
+ ./youdebug -socket $DEBUG_PORT linebreak.ydb
-h3. Final fix
-bc.
-./youdebug -socket 8000 finalbugfix.ydb
-./youdebug -socket 8001 finalbugfix.ydb
+### diagnostics: check parameter value
-h3. threaddump
+ ./youdebug -socket $DEBUG_PORT diagnose.ydb
+
+### First fix
+
+ ./youdebug -socket $DEBUG_PORT firstbugfix.ydb
+
+### Final fix
+
+ ./youdebug -socket $DEBUG_PORT finalbugfix.ydb
-bc.
-./youdebug -socket 8000 threaddump.ydb
-./youdebug -socket 8001 threaddump.ydb
View
BIN youdebug-cli/_lib/youdebug-1.3-jar-with-dependencies.jar
Binary file not shown.
View
11 youdebug-cli/classloading.ydb
@@ -0,0 +1,11 @@
+
+vm.classPrepare("*") { type ->
+ String name = type.name();
+
+ // filter classes
+ if (name.startsWith('org.gradle')) return
+
+ println "loaded class $name"
+}
+
+vm.resume()
View
6 youdebug-cli/exception.ydb
@@ -1,4 +1,4 @@
-vm.exceptionBreakpoint("java.lang.NumberFormatException") { e ->
- println "caught number format exception"
+vm.exceptionBreakpoint("java.lang.Exception") { e ->
+ println "caught exception:"
e.dumpStackTrace(System.out);
-}
+}
View
BIN youdebug-cli/lib/groovy-all-1.8.6.jar
Binary file not shown.
View
BIN youdebug-cli/lib/groovy-all-2.4.3.jar
Binary file not shown.
View
BIN youdebug-cli/lib/youdebug-1.3.jar
Binary file not shown.
View
BIN youdebug-cli/lib/youdebug-1.5.jar
Binary file not shown.
View
9 youdebug-cli/mydebug.ydb
@@ -0,0 +1,9 @@
+println vm.virtualMachine.name()
+println vm.virtualMachine.description()
+println "#String instances: " + vm.virtualMachine.instanceCounts([vm.ref(String)])[0]
+def firstSuspendedThread = vm.virtualMachine.allThreads().find { thread -> thread.isSuspended() }
+println "JVM is ${firstSuspendedThread ? 'suspended' : 'NOT suspended'}"
+vm.close()vm.exceptionBreakpoint("java.lang.Exception") { e ->
+ println "caught exception:"
+ e.dumpStackTrace(System.out);
+}
View
2 youdebug-cli/resume.ydb
@@ -0,0 +1,2 @@
+vm.resume()
+
View
7 youdebug-cli/servlet.ydb
@@ -0,0 +1,7 @@
+println "tracing web requests"
+vm.methodEntryBreakpoint("javax.servlet.http.HttpServlet","service") { method ->
+ def request = thread.frame(0).'0'
+
+ println method
+ println request.getMethod() + " " + request.getRequestURI()
+}
View
4 youdebug-cli/suspend-and-error.ydb
@@ -0,0 +1,4 @@
+vm.suspend()
+
+// provoke error
+throw new RuntimeException("got you!")
View
3 youdebug-cli/suspend.ydb
@@ -0,0 +1,3 @@
+vm.suspend()
+vm.close()
+
View
2 youdebug-cli/threaddump.ydb
@@ -1,5 +1,5 @@
vm.suspend()
vm.threads*.dumpThread()
vm.resume()
-vm.close()
+vm.close()
View
5 youdebug-cli/vminfo.ydb
@@ -1,3 +1,6 @@
println vm.virtualMachine.name()
println vm.virtualMachine.description()
-vm.close()
+println "#String instances: " + vm.virtualMachine.instanceCounts([vm.ref(String)])[0]
+def firstSuspendedThread = vm.virtualMachine.allThreads().find { thread -> thread.isSuspended() }
+println "JVM is ${firstSuspendedThread ? 'suspended' : 'NOT suspended'}"
+vm.close()
View
36 youdebug-cli/yconsole.groovy
@@ -0,0 +1,36 @@
+// this script is meant to be used from with GroovyConsole
+//
+// How to use:
+// 1. put youdebug.jar, args4.jar and tools.jar (from the JDK) on the classpath (Script menu)
+// 2. simply put your debug script into the closure below
+// 3. execute the script from within GroovyConsole
+// 4. interrupt script execution when no longer needed
+// 5. rinse and repeat
+
+import org.kohsuke.youdebug.*
+
+// connect to JVM and run debug script
+VM vm = VMFactory.connectRemote("localhost", 8001);
+
+
+
+def debug = {
+ // TODO put your debug script here
+ println vm.virtualMachine.description()
+
+
+}
+
+
+
+
+// run debug script
+try {
+ use (org.kohsuke.youdebug.JDICategory) {
+ debug.run()
+ vm.dispatchEvents()
+ }
+}
+finally {
+ vm.close()
+}
View
38 youdebug-cli/yconsole2.groovy
@@ -0,0 +1,38 @@
+// this script is meant to be used from with GroovyConsole
+//
+// How to use:
+// 1. put youdebug.jar, args4.jar and tools.jar (from the JDK) on the classpath (Script menu)
+// 2. simply put your debug script into the closure below
+// 3. execute the script from within GroovyConsole
+// 4. interrupt script execution when no longer needed
+// 5. rinse and repeat
+
+import org.kohsuke.youdebug.*
+
+try {
+ use (JDICategory) {
+ // connect to JVM and run debug script
+vm = VMFactory.connectRemote("localhost", 8001);
+// run debug script
+ def debug = {
+ use (JDICategory) {
+ // TODO put your debug script here
+ vm.resume()
+ println "tracing web requests"
+ vm.methodEntryBreakpoint("javax.servlet.http.HttpServlet","service") { method ->
+ def request = JDICategory.propertyMissing(thread.frame(0),'0')
+
+ println method
+ println request.getMethod() + " " + request.getRequestURI()
+ }
+ }
+ }
+
+
+ debug.call()
+ vm.dispatchEvents()
+ }
+}
+finally {
+ vm.close()
+}
View
5 youdebug-cli/youdebug
@@ -6,6 +6,9 @@ LIBDIRS="$BASEDIR/lib"
CLASSPATH=
MAIN="org.kohsuke.youdebug.YouDebug"
OS=`uname -o 2>/dev/null`
+if [ -z "$JAVA" ]; then
+ JAVA=java
+fi
for dir in $LIBDIRS; do
for jar in $dir/*.jar; do
@@ -20,4 +23,4 @@ for dir in $LIBDIRS; do
done
done
-java $JAVA_OPTS -cp $CLASSPATH $MAIN "$@"
+"$JAVA" $JAVA_OPTS -cp $CLASSPATH $MAIN "$@"

0 comments on commit ef06b83

Please sign in to comment.