Introduction to YouDebug - Scriptable Java Debugger
-
Upload
wolfgang-schell -
Category
Technology
-
view
2.466 -
download
0
description
Transcript of Introduction to YouDebug - Scriptable Java Debugger
![Page 1: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/1.jpg)
YOUDEBUGScriptable Java Debugger
Wolfgang Schellblog.jetztgrad.net
twitter.com/jetztgradnet
![Page 2: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/2.jpg)
YOUDEBUGScriptable Java Debugger
Developed by Kohsuke Kawaguchi(creator of Hudson/Jenkins)
![Page 3: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/3.jpg)
WHAT'S INSIDE
JDI*YouDebug
your debug script
* Java Debug Interface
![Page 4: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/4.jpg)
USE CASE
![Page 5: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/5.jpg)
DEBUGGING
IDEsource codedocumentationnetwork access
Applicationdatausersconfiguration
![Page 6: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/6.jpg)
PRODUCTION?
![Page 7: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/7.jpg)
PRODUCTION
IDEsource codedocumentationnetwork access
Applicationdatausersconfiguration
no installation possiblesource confidentialdocs confidentialfirewall, NAT, proxies
complianceprivacysecurity
![Page 8: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/8.jpg)
SOLUTION
Bring your debug script to the application
![Page 9: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/9.jpg)
PRODUCTION
YouDebugdebug script
Applicationdatausersconfiguration
![Page 10: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/10.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/11.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/12.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/14.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/15.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/16.jpg)
DEMO TIME
![Page 17: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/17.jpg)
YOUDEBUGThank you!
Questions?
![Page 18: Introduction to YouDebug - Scriptable Java Debugger](https://reader034.fdocuments.us/reader034/viewer/2022051314/553891325503464e418b47f7/html5/thumbnails/18.jpg)
LINKS
Userguide http://youdebug.kenai.com/user-guide.html
Introduction http://youdebug.kenai.com/
JDI http://docs.oracle.com/javase/6/docs/jdk/api/jpda/jdi/index.html
Download http://repo1.maven.org/maven2/org/kohsuke/youdebug/1.3/
Source Code
https://github.com/kohsuke/youdebug
Example Code
https://github.com/jetztgradnet/2012-04-youdebug