Post on 08-Jan-2016
description
transcript
Dynamic Event Generation for Runtime Checking Using the JDI
Dynamic Event Generation for Runtime Checking Using the JDI
MARK BRÖRKENSOFFIS, GERMANY
Introduction Jassda Performance Summary
Dynamic Event Generation for Runtime Checking Using the JDI
Introduction Jassda Performance Summary
• Motivation
• Runtime Checking
• Architecture
• JDI
• Modules
• Logger
• Trace Checker
• Bubblesort -
Benchmark
• Conclusion
• Future Work
overview
Dynamic Event Generation for Runtime Checking Using the JDI
motivation
Software systems are getting more complex
Introduction Jassda Performance Summary
Formal methods are being researched to prove thecorrectness of a system
Successfully applied to domain specific areas in software engineering
Often restricted to experts
Dynamic Event Generation for Runtime Checking Using the JDI
runtime checking: design by contract
Introduction Jassda Performance Summary
client supplier
• Proposed by Bertrand Meyer for Eiffel• For Java: iContract, jContractor, Runtime Checker of
JML, Jass• Code is inserted for checking of assertions• Sequence of method invocations can’t be checked
Dynamic Event Generation for Runtime Checking Using the JDI
Introduction Jassda Performance Summary
init
start
stop
destroy
Applet
• Track the execution of an application• Decide, whether the current trace is correct
runtime checking
Dynamic Event Generation for Runtime Checking Using the JDI
Jassda – Java with Assertions Debugger Architecture
Introduction Jassda Performance Summary
LoggerTrace-
Checker
GUI Broker other corecomponents
Debuggee(1)
Debuggee(n)
JDI
core
jass
da
modules
Dynamic Event Generation for Runtime Checking Using the JDI
JDI - Features
Introduction Jassda Performance Summary
• remote access
• introspective access to a running virtual machine– loaded classes and their
variables, methods– bytecode of methods
• explicit control over a virtual machine's execution– suspend and resume threads– set breakpoints and
watchpoints– notification of
• method invocation• method termination• exceptions• class loading• vm died• breakpoint reached• variable read/changed
Dynamic Event Generation for Runtime Checking Using the JDI
JDI – Problems and Solutions
Introduction Jassda Performance Summary
For full functionality code has to be compiled with debug information
Add generic debug information in class files using the Byte Code Engineering Library (BCEL)
Direct access to return values of methods missing
Write return value into local variable and set breakpoint before method termination
Solution
Solution
Dynamic Event Generation for Runtime Checking Using the JDI
Configuraion of Event Generation
Introduction Jassda Performance Summary
modulebrokerdebuggee
get event types
get all classes
listens on event?
configure events
resume
{Applet}
{begin, end}
analyse class{init, start, ....}
true
suspend
configure basic events
Dynamic Event Generation for Runtime Checking Using the JDI
Module: Logger
Introduction Jassda Performance Summary
• Writes sequence of events into a file
• The set of events can be customized in an XML-based configuration-file
Dynamic Event Generation for Runtime Checking Using the JDI
Module: Logger
Introduction Jassda Performance Summary
<?xml version="1.0" encoding="UTF-8"?><logger> <file name="sequence.log"/> <event> <template>%method%(%arguments%) = %returnvalue%</template> </event> <include> <eventset class="de.jassda.core.event.GenericSet" field="class" argument="de.jassda.examples.*"/> </include> <exclude> <eventset class="de.jassda.core.event.GenericSet" field="class" argument=“de.jassda.examples.test.*"/> </exclude></logger>
Dynamic Event Generation for Runtime Checking Using the JDI
Module: TraceChecker
Introduction Jassda Performance Summary
• Check sequence of events against CSP-like specification (CSPjassda)
Dynamic Event Generation for Runtime Checking Using the JDI
TraceChecker: CSPjassda
Introduction Jassda Performance Summary
eventset applet { instanceof="java.applet.Applet" }eventset init { method="init" } .....
applets() { ||i:[instance] @ applet.i.init.begin -> applet.i.init.end -> appletrun(i)}
appletrun(i) { ( applet.i.start.begin -> applet.i.start.end -> applet.i.stop.begin -> applet.i.stop.end -> appletrun(i) ) [] appletdestroy(i)}appletdestroy(inst) { applet.inst.destroy.begin -> applet.inst.destroy.end -> STOP}
Alphabet: {applet.init.begin, applet.init.end, applet.start.begin, applet.start.end, applet.stop.begin, applet.stop.end, applet.destroy.begin, applet.destroy,end}
Dynamic Event Generation for Runtime Checking Using the JDI
Jassda: GUI
Introduction Jassda Performance Summary
Dynamic Event Generation for Runtime Checking Using the JDI
Performance
Introduction Jassda Performance Summary
Bubblesort • sort 10000 numbers• 2 implementations:
• 1 method invocation• 10001 method invocations
Platform• Windows 2000• Pentium 1.2GHz• jdk1.3 classic• jdk1.3 hotspot • jdk1.4
Scenarios• standalone• debug-mode enabled• jassda tool attached
1
10
100
1000
10000
1 method invocation
10001 method invocations
jdk1.3classic
jdk1.3hotspot
jdk1.4
seconds
Dynamic Event Generation for Runtime Checking Using the JDI
Conclusion
Introduction Jassda Performance Summary
• Using the JDI is a viable method to trace the execution of (distributed) Java applications
• No or little modification on code is necessary
• Jassda works fine for limited number of events
• The set of events that are generated can be changed during the debug run
Dynamic Event Generation for Runtime Checking Using the JDI
Future Work
Introduction Jassda Performance Summary
• Improve jassda– performance
– usability of GUI
– add modules e.g DbC
• Improve CSPjassda
• Case studies: expressiveness of CSPjassda, scalability and overhead of debug architecture
Dynamic Event Generation for Runtime Checking Using the JDI
http://jassda.sourceforge.net
Introduction Jassda Performance Summary