Bugdel an aspect oriented debugging system
This presentation is the property of its rightful owner.
Sponsored Links
1 / 28

Bugdel: An Aspect-Oriented Debugging System PowerPoint PPT Presentation


  • 82 Views
  • Uploaded on
  • Presentation posted in: General

Bugdel: An Aspect-Oriented Debugging System. Yoshiyuki Usui* (Tokyo Tech) Shigeru Chiba (Tokyo Tech). What is debugging?. Purpose: locate bugs Rough location: found by tracing Display values of variables at many positions Program execution is not stopped

Download Presentation

Bugdel: An Aspect-Oriented Debugging System

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Bugdel an aspect oriented debugging system

Bugdel: An Aspect-Oriented Debugging System

Yoshiyuki Usui* (Tokyo Tech) Shigeru Chiba (Tokyo Tech)

Asian workshop on AODS


What is debugging

What is debugging?

  • Purpose: locate bugs

  • Rough location: found by tracing

    • Display values of variables at many positions

    • Program execution is not stopped

  • More precise location: by breakpoints

    • Set at a few locations

    • Program execution is stopped

Asian workshop on AODS


Beyond classical debugging

Beyond classical debugging

  • How to have more flexible tracing?

  • How to separate tracing code?

    • To minimize the risk of introducing bugs when adding / removing tracing code

  • How to debug with a JVM without debug mode (e.g. embedded JVMs)?

  • AOP can solve these problems

Asian workshop on AODS


Debugging using aop

Debugging using AOP

  • Developers can specify many execution points with simple description

    • By pointcut

      • Trace all assignments to a field

        • set(int Point.x) (in AspectJ)

    • No need to enumerate all of target points

  • Separates tracing code

    • Developers add and remove the code without editing the source files

    • Reduce the risk of changing around tracing code by mistakes

  • Does not require JVM debug mode (e.g. JPDA)

Asian workshop on AODS


Our contribution

Our contribution

  • Bugdel: AO system specialized for debugging

  • Solves problems found in general AOP systems when used for debugging

  • Relaxes constraints of modularization to allow useful debugging

Asian workshop on AODS


Is classical aop adapted no

Is classical AOP adapted? No!

Asian workshop on AODS


Is classical aop adapted no1

Is classical AOP adapted? No!

  • Developers must learn many things only for debugging

    • The grammar of AOP language such as AspectJ

      • How to describe pointcuts and advices

    • The kinds of primitive pointcuts

  • Bugdel

    • Easy to use interface in the form of an Eclipse plug-in

Asian workshop on AODS


Gui of bugdel

GUI of Bugdel

Bugdel editor is used to specify pointcuts

Bugdel Editor

Bugdel view shows information of advices

Bugdel View

Asian workshop on AODS


Gui based programming 1 2

GUI based programming 1/2

  • Candidate pointcuts are shown

    • Pointcuts are related to the selected class, method or field on the source file

Proposes “get” and “set” pointcut to the field x in the class Point

Asian workshop on AODS


Gui based programming 2 2

GUI based programming 2/2

  • Advice Dialog

    • Select

      • Pointcut designators

      • Before or after advice

    • Input

      • Name of the class, method and field

      • Advice body

    • Wild cards “*” are accepted in names

  • Developers need not learn the kinds of primitive pointcuts

Asian workshop on AODS


Is classical aop adapted no2

Is classical AOP adapted? No!

  • When debugging, developers consider source files

    • They want to execute tracing code at a certain line in a source file

    • These concepts are not available in classical AOPsystem’s pointcuts

  • Bugdel provides Line and AllLines pointcuts to pointcut lines in source files

    • Necessary for a debugging system

Asian workshop on AODS


Line alllines pointcuts

Line, AllLines pointcuts

  • Line pointcut

    • Selects the beginning of a line as a join point

    • Easy selection with the mouse

    • Developer can trace at that certain line

    • Useful for debugging but breaks class modularization

  • AllLines pointcut

    • Selects all the lines in a method

Asian workshop on AODS


Is classical aop adapted no3

Is classical AOP adapted? No!

  • When debugging, developers often trace the local variables

  • Not possible to access local variables in advices

  • Advice language are too limited

Asian workshop on AODS


Bugdel s advice language 1 2 access to the local variables

Bugdel’s advice language 1/2(Access to the local variables)

  • In Bugdel, the local variables around a join point are accessible from an advice body

    • Developers can trace local variables by using advices

    • Useful for debugging but breaks class modularization

Advice

class Server{ void run(){ int counter = 10; service(); … }

Pointcut : call of service() method

Advice body:

System.out.println(counter);

This is possible only in Bugdel, but not in AspectJ.

Asian workshop on AODS


Bugdel s advice language 2 2

Bugdel’s advice language 2/2

  • Provides many powerful mechanisms

    • Reflection

      • thisJoinPoint.variables

      • thisJoinPoint.line

      • thisJoinPoint.filePath

      • Etc.

    • Built-in methods

      • bugdel.Bugdel.openEditor(..)

      • bugdel.Bugdel.jump(int line)

  • These mechanisms are specific and useful for debugging

Asian workshop on AODS


Breakpoint emulation

Breakpoint emulation

  • Bugdel makes it easy to emulate breakpoints

  • Useful when the JVM has no debug mode

    • e.g. embedded JVMs

  • Let’s watch the demo and see the implementation details later

Asian workshop on AODS


Breakpoint emulation demo

Breakpoint emulation: demo

Asian workshop on AODS


Demo pointcut

Demo pointcut

Step execution using AllLines pointcut

  • Pointcuts specify breakpoint location, e.g.

    • Method entry: MethodExecution

    • Field watch: FieldSet, FieldGet

    • Line

  • Emulate step execution

    • AllLines pointcut

      • Selects beginnings of the all lines in a method as a join point

    • Suspend the thread at all lines

Asian workshop on AODS


Demo advice

Demo advice

System.err.println(thisJoinPoint.location);Object[][] vs = thisJoinPoint.variables;bugdel.Bugdel.printVariables(vs);String file = thisJoinPoint.filePath;int line = thisJoinPoint.line;bugdel.Bugdel.openEditor(“localhost”,5555,file,line);javax.swing.JOptionPane.showMessageDialog(null,“OK?”);

Asian workshop on AODS


Demo advice 1 3

  • Blocks the thread until OK button is pressed

Demo advice (1/3)

System.err.println(thisJoinPoint.location);Object[][] vs = thisJoinPoint.variables;bugdel.Bugdel.printVariables(vs);String file = thisJoinPoint.filePath;int line = thisJoinPoint.line;bugdel.Bugdel.openEditor("localhost",5555,file,line);javax.swing.JOptionPane.showMessageDialog(null,"OK?");

Asian workshop on AODS


Demo advice 2 3

Eclipse&Bugdel

2. Send “filePath” and “line”

1.The program calls openEditor(..)

3.Open the file and highlight the line

JVM

Demo advice (2/3)

  • Highlight the breaking location on the source files

  • File names and line numbers are different for every joint point

  • bugdel.Bugdel.openEditor(…)

    • Opens the source file with Bugdel editor and highlights the line

System.err.println(thisJoinPoint.location);Object[][] vs = thisJoinPoint.variables;bugdel.Bugdel.printVariables(vs);String file = thisJoinPoint.filePath;int line = thisJoinPoint.line;bugdel.Bugdel.openEditor("localhost",5555,file,line);javax.swing.JOptionPane.showMessageDialog(null,"OK?");

Asian workshop on AODS


Demo advice 3 3

Demo advice (3/3)

System.err.println(thisJoinPoint.location);Object[][] vs = thisJoinPoint.variables;bugdel.Bugdel.printVariables(vs);String file = thisJoinPoint.filePath;int line = thisJoinPoint.line;bugdel.Bugdel.openEditor("localhost",5555,file,line);javax.swing.JOptionPane.showMessageDialog(null,"OK?");

  • Print out all variables at the breakpoint

Asian workshop on AODS


Print all variables at the breakpoint

Print all variables at the breakpoint

  • thisJoinPoint.variables

    • Type is Object[][]

    • It is a list of the local variables and the fields visible at the join point

    • It includes name, value, type and modifier of each variable

Implementation of printVariables(…):

Object[][] v = thisJoinPoint.variables;for(int i=0; i<v.length; i++){ System.err.print(v[i][0]+”=“+v[i][1]+”,”);}

Asian workshop on AODS


Bugdel s weaver

Bugdel’s weaver

  • Bugdel’s weaver transforms the bytecode

    • Uses Javassist, our bytecode transformation system

  • Aspects are woven into the class files

    • Eclipse or Bugdel are not necessary to run the debugged program

    • Possible to debug in any JVM without debug mode

Asian workshop on AODS


Bugdel an aspect oriented debugging system

Related Work 1

  • General purpose AO systems

    • AspectJ, AspectWerks, JBoss AOP

    • Class modularization is important

  • Bugdel

    • Domain specific (debugging) AO system

      • Line pointcut

      • Access to local variables around the join point

    • These features break class modularization

      • They depend on the method implementation

    • If they are provided, developers can not change the method implementation easily

    • However, usefulness for debugging is more important than class modularization

Asian workshop on AODS


Related work 2

Related Work 2

  • Traditional debuggers

    • Essentially provides breakpoints mechanism

      • Program execution is stopped

    • May facilitate tracing

    • JVMs must have a debug mode

  • Bugdel

    • Same user interface and functions

      • Useful for tracing

      • Line and AllLines pointcuts for breakpoints

    • The JVM needs not have a debug mode

      • Even breakpoints can be emulated

        • However, developers must set breakpoints at weaving time

Asian workshop on AODS


Conclusion

Conclusion

  • Bugdel

    • Eclipse plug-in

      • GUI based programming

    • AO system specialized for debugging

      • Line pointcut, AllLines pointcut

      • Access to the local variables around the join point

      • thisJoinPoint.varables

      • bugdel.Bugdel.openEditor(..)

      • Etc.

    • Useful for tracing

    • Breakpoint emulation

      • On any JVM without debug mode

Asian workshop on AODS


Please give bugdel a try

Please give Bugdel a try!

  • Free software (CPL license)

  • Compatible with Eclipse 3.1.x, 3.0.x

  • Downloadable from:

    http://www.csg.is.titech.ac.jp/~usui/bugdel/

  • Or look for “Bugdel” in Google ;-)

Asian workshop on AODS


  • Login