Introduction to YouDebug - Scriptable Java Debugger

18
YOUDEBUG Scriptable Java Debugger Wolfgang Schell blog.jetztgrad.net twitter.com/jetztgradnet

description

YouDebug is a Java Debugger scriptable with Groovy scripts

Transcript of Introduction to YouDebug - Scriptable Java Debugger

Page 1: Introduction to YouDebug - Scriptable Java Debugger

YOUDEBUGScriptable Java Debugger

Wolfgang Schellblog.jetztgrad.net

twitter.com/jetztgradnet

Page 2: Introduction to YouDebug - Scriptable Java Debugger

YOUDEBUGScriptable Java Debugger

Developed by Kohsuke Kawaguchi(creator of Hudson/Jenkins)

Page 3: Introduction to YouDebug - Scriptable Java Debugger

WHAT'S INSIDE

JDI*YouDebug

your debug script

* Java Debug Interface

Page 4: Introduction to YouDebug - Scriptable Java Debugger

USE CASE

Page 5: Introduction to YouDebug - Scriptable Java Debugger

DEBUGGING

IDEsource codedocumentationnetwork access

Applicationdatausersconfiguration

Page 6: Introduction to YouDebug - Scriptable Java Debugger

PRODUCTION?

Page 7: Introduction to YouDebug - Scriptable Java Debugger

PRODUCTION

IDEsource codedocumentationnetwork access

Applicationdatausersconfiguration

no installation possiblesource confidentialdocs confidentialfirewall, NAT, proxies

complianceprivacysecurity

Page 8: Introduction to YouDebug - Scriptable Java Debugger

SOLUTION

Bring your debug script to the application

Page 9: Introduction to YouDebug - Scriptable Java Debugger

PRODUCTION

YouDebugdebug script

Applicationdatausersconfiguration

Page 10: Introduction to YouDebug - Scriptable Java Debugger

BASIC RECIPE

1. Run application in debug mode

2. Create debug script

3. Run debug script using > java -jar youdebug.jar -socket

5005 yourscript.ydb

Page 11: Introduction to YouDebug - Scriptable Java Debugger

FEATURES

define breakpointsevaluate arbitrary expressions

List threads, inspect stack framesaccess/modify local variables

obtain stack traceobtain heap dump

Page 12: Introduction to YouDebug - Scriptable Java Debugger

BREAKPOINTS

Break when reaching a specific line Break when an exception is thrown

Break when a field is referenced or updatedBreak when a class is loaded/unloaded

Break when a thread is created/destroyedBreak when a method is entered/exited

Break when a monitor is waited/contended

Page 13: Introduction to YouDebug - Scriptable Java Debugger

EXAMPLES (1)

Line breakpoint

vm.breakpoint("net.jetztgrad.buggyweb.MyServlet",35) { println "at buggy position in MyServlet, line 35"}

Page 14: Introduction to YouDebug - Scriptable Java Debugger

EXAMPLES (1I)

access/modify value

vm.breakpoint("net.jetztgrad.buggyweb.MyServlet",35) { println "age=" + age String ageParam = request.getParameter("age") println "setting age to $ageParam" age = ageParam}

Page 15: Introduction to YouDebug - Scriptable Java Debugger

EXAMPLES (I1I)get thread dump and VM info

vm.suspend()println vm.virtualMachine.name()println vm.virtualMachine.description()vm.threads*.dumpThread()vm.resume()vm.close()

Page 16: Introduction to YouDebug - Scriptable Java Debugger

DEMO TIME

Page 17: Introduction to YouDebug - Scriptable Java Debugger

YOUDEBUGThank you!

Questions?