Conventional debuggers require programmers to work on multiple levels of abstraction at once when inspecting call stacks or data. This demands considerable cognitive overhead and deep system knowledge of all implementation technologies involved. When developing an interpreter, programmers often create a dedicated debugger to have a higher-level perspective on the client-language; the resulting use of multiple debuggers at once leads to mental context switches and needs an elaborated method.
We present an integrated debugging tool in which interpreter developers define and select the levels of abstraction on which they focus. Our debugger provides them with an abstraction-specialized view. We consider both host-language and guest-language levels, since either may be levels of interest in a debugging session. We show how this separation into host-language levels can ease the debugging of applications through filtering call stacks and specializing call stack representation on levels.
Multi-level Debugging for Interpreter Developers at LaMOD'16
1. Multi-level Debugging for Interpreter Developers
Bastian Kruck, Stefan Lehmann, Christoph Kessler, Jakob
Reschke, Tim Felgentreff, Jens Lincke, Robert Hirschfeld
Software Architecture Group, HPI Potsdam
15.03.2016, LaMOD16, Málaga
2. 1. Debugging across Languages
2. Debugging within Languages across Abstraction Barriers
3. Unification of such levels
Three Phases
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck Chart 2
3. How does debugging across languages look like?
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck Chart 3
4. How does debugging across languages look like?
Chart 4
Bastian Kruck
HPI Potsdam
Multi-level
Debugging for
Interpreter
Developers
5. Scheme embedded in Qoppa
Chart 5
Scheme
Qoppa
Embedded in
(define if (vau (b t f) env
(eval env (bool (eval env b) t f))))
(define quote (vau (x) _ x))
■ Qoppa is a Scheme without special forms: all arguments are
evaluated before entering the method
■ Vau is the only explicitly evaluating primitive (no automatic
evaluation)
■ Vau is used to implement all other special forms
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
6. Scheme embedded in Qoppa
Chart 6
Scheme
Qoppa
(define if (vau (b t f) env
(eval env (bool (eval env b) t f))))
(define quote (vau (x) _ x))
Smalltalk
Embedded in
Interpreted by
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
8. The common symbolic debugger
Chart 8Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
9. The Minimal Feature Set of a Debugger
Chart 9
Step buttons
Call Stack
Helps to zoom from
behavioral
overview into detailOverview
Detail
Source View
Helps to look at
the past and
future
Future
Past
Object Inspector
Helps to interact with
state of the current
Level of details
• Detail State
• Detail State
• Detail State
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
10. eval:in:
Call stack of QoppaS
Chart 10Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
11. Call stack of QoppaS
Chart 11
operate:on:in:
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
12. Call stack of QoppaS
Chart 12
Operative>>in:operateOn:
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
13. Call stack of QoppaS
Chart 13
wrapPrim:countingArgs:
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
14. Call stack of QoppaS
Chart 14
buildGlobalEnv
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
15. Call stack of QoppaS
Chart 15
• Recurrence Patterns
in call stacks signal
an unnoticed
abstraction level
• The varying barrier-
width makes it hard
to read
• Debugger users
should be able to:
• Filter stack frames
• Fold open levels on
demand
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
16. Higher-level information are encoded in all those
Chart 16
Step buttons
Call Stack
Various barrier-
widths are present
in the call chainOverview
Detail
Source View
Source code
implements
abstract concepts
such as events or
state machines
Future
Past
Object Inspector
Data contain
implementation specifica
such as storage
strategies
• Detail State
• Detail State
• Detail State
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
17. How to teach language abstraction barriers
to a debugger?
18. ■ Data abstraction enables modularity
□ Isolate math domain implementation
□ Isolate abstract type
□ Isolate representation details
■ Behavioral black-box abstractions to
enable modularity
■ Not present in current debugging tools
■ Interpreters form a new layer of abstractions
that is loosely coupled to the lower one
□ because of that very explicit interface
□ A program is the interpreters data
Abstraction barriers should be respected in
debuggers
Chart 18
Structure and
Interpretation
of Computer
Programs
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
19. Current debuggers that respect abstraction barriers:
■ Rails BacktraceCleaner
■ Visual studio with Show only my code
■ Eclipse with Step filters
□ AOP & COP
□ Code metrics
■ Squeak UnhandledException
■ Squeak Step through
There is no general abstraction-aware debugger so far
(Current state of abstraction barriers in
debuggers)
Chart 19Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
20. (define (fact-r n acc)
(if (<= n 1)
(begin (halt) acc)
(fact-r (- n 1) (* acc n))))
(fact (- 5 2))
Example of a Multi-level Debugger
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck Chart 20
29. Chart 29
Filter levels to
focus
e.g. Smalltalk Packages,
or
Authoring sessions
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
30. ■ By package
■ By class
■ By author
■ By creation time
■ By JIT-Optimization-State
(Identifying levels)
Chart 30Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
32. „A mediator is a software module that exploits encoded knowledge about
certain sets or subsets of data to create information for a higher layer of
applications“ [Wie92]
Mediator-Wrapper-Architecture
Chart 32
Mediator
Higher level
information
Encoded Knowledge
Data
Data
Gio Wiederhold: “Mediators in the Architecture of Future Information Systems”
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
33. Mediators enrich call frames
Chart 33
Title
Icon
Group
Source
Data State
Multi-level
Debugger
INOUT
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
35. Future Work: Debugger Primitives
Chart 35
Multi-level
Debugger
Scheme
Language
Squeak as
implementation language
Qoppa as
implementation language
Qoppa
Language
Debugger
Primitive
■ Reuse low-level debugger
for higher levels
■ Cross level functionality
comes for free
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
36. Multi-level Debugging for Interpreter Developers
Thanks for your frameworks and support:
Marcel Taeumel (VIVIDE),
Patrick Rein (OhmS)
Thanks to Mod16 and SWA Group for funding
Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
37. [1] Charles, P. et al. 2009. Accelerating the creation of customized, language-Specific IDEs in Eclipse. ACM Sigplan Notices.
44, 10 (2009), 191.
[2] Chiş, A. et al. 2015. Practical domain-specific debuggers using the Moldable Debugger framework. Computer
Languages, Systems and Structures. 44, (Dec. 2015), 89–113.
[3] Chiş, A. et al. 2015. The moldable inspector. 2015 ACM - Onward! 2015 (New York, New York, USA, Oct. 2015), 44–60.
[4] Erdweg, S. et al. 2012. Language Composition Untangled. LDTA ’12. (2012).
[5] Freudenberg, B. et al. 2014. SqueakJS A Modern and Practical Smalltalk that Runs in Any Browser. DLS ’14. (2014),
57–66.
[6] Pavletic, D. et al. 2014. Extensible Debuggers for Extensible Languages. Softwaretechnik-Trends. 33, 2 (2014), 51–52.
[7] Pavletic, D. and Raza, S.A. 2015. Multi-Level Debugging for Extensible Languages. Workshop Software-Reengineering
und -Evolution. 17 (2015), 21–23.
[8] Renggli, L. et al. 2010. Embedding Languages Without Breaking Tools. ECOOP. (2010), 380–404.
[9] Wu, H. et al. 2004. Debugging Domain-Specific Languages In Eclipse. Eclipse Technology Exchange Poster. (2004), 1–
5.
Related Work
Chart 37Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
38. Debugger Primitives
■ How to bake them into the known reflective capabilities of languages?
Challenges
Chart 38Multi-level Debugging for Intrepreter Developers, LaMOD’16, 15.03.2016, Bastian Kruck
Hinweis der Redaktion
MY NAME IS BASTIAN KRUCK
IM MASTER STUDENT IN HASSO PLATTNER INSTITUTE POTSDAM
TODAY I’M GOING TO PRESENT MY IDEA THAT IS GOING TO BE MY MASTERS THESIS
MULTILEVEL DEBUGGING FOR INTERPRETER DEVELOPERS
I IMPLEMENTED THIS WORK TOGETHER WITH SOME OTHER STUDENTS
IN THE SOFTWARE ARCHITECTURE GROUP OF PROF HIRSCHFELD
I WILL START TALKING ABOUT DEBUGGING ACROSS LANGUAGES
I WILL PROCEED BY REPORTING ON OUR FINDINGS ABOUT ABSTRACTION BARRIERS
AND FINALLY TELL YOU HOW WE UNIFY THEM
WE BUILT AN INTERPRETER
Click
WE BUILT AN INTERPRETER IN ORDER TO FIND OUT HOW DEBUGGING ACROSS LANGUAGES COULD LOOK ALIKE
WE HAVE CREATED AN INTERPRETER
AND GREW A DEBUGGER THAT WOULD EASE THE CREATION OF SUCH
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
WE BUILT AN INTERPRETER
Click
WE BUILT AN INTERPRETER IN ORDER TO FIND OUT HOW DEBUGGING ACROSS LANGUAGES COULD LOOK ALIKE
WE HAVE CREATED AN INTERPRETER
AND GREW A DEBUGGER THAT WOULD EASE THE CREATION OF SUCH
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
THAT’S WHY WE IMPLEMENTED A SCHEME
EMBEDDED IN THE QOPPA LANGUAGE
Click
stichpunkte
Click
FOR EXAMPLE
THE IF IS DEFINED IN QOPPA USERLAND USING THE BOOL AND EVAL PRIMITIVES
IT EVALUATES THE CONDITIONAL STATEMENT…
USES THE BOOL PRIMITIVE TO SELECT THE TO-BE-EXECUTED BODY…
AND EVALUATES THE BODY.
THAT’S HOW SCHEME IS IMPLEMENTED IN QOPPA WITH JUST SOME LIBRARY CODE THAT IS LOADED ON STARTUP
AND FOR THAT QOPPA LANGUAGE…
click
WE BUILD AN INTERPRETER USING SQUEAK SMALLTALK AND THE OHM PARSER FRAMEWORK
SO OUR RESEARCH QUESTION WAS FIRST:
HOW TO TEACH LANGUAGE-BARRIERS TO A DEBUGGER?
LET’S LOOK AT THE COMMON SYMBOLIC DEBUGGER
WITH COMMON, I MEAN…
Click
THE OBJECT INSPECTOR THAT HELPS TO INSPECT THE CURRENT STATE OF A HALTED PROGRAM…
Click
THE SOURCE VIEW THAT HELPS US TO SEE WHAT WAS EXECUTED BEFORE AND WILL BE EXECUTED IN THE NEXT LINE…
Click
THE STEP BUTTONS THAT MAY INTERACT WITH THE PROGRAM, AND…
Click
THE CALL STACK THAT HELPS US TO ZOOM FROM BEHAVIORAL OVERVIEW INTO THE DETAILED EXECUTION OF AN ABSTRACTION
UP TO THE SEEING ALL THE PRIMITIVE CALLS THAT IMPLEMENT AN ABSTRACTION
LET’S LOOK AT …
Click
…HOW THE CALL STACK LOOKS LIKE WHEN WE HALT OUR INTERPRETER SOMEWHERE
CONFORMING TO THE SICP-BOOKS EVAL-AND-APPLY-MODEL, WE HAVE AN EVAL METHOD
IT IS RUN WHEN OUR INTERPRETER IS EVALUATING AN EXPRESSION
THIS IS THE STACK AND …Click… THOSE ARE THE EVAL CALLS
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
OFTEN, IT CALLS THE OPERATE METHOD (CALLED APPLY IN SICP) TO APPLY A PRIMITIVE OR INVOKE A FUNCTION
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
IT DISPATCHES TO THE IN-OPERATE-ON METHOD OF OUR APPLIED OPERATIVE
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
WHICH OFTEN HAPPENS TO BE A PRIMITIVE WITH A FIXED NUMBER OF EVALUATED ARGS
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
AND OFTEN, THE ARGUMENTS EVALUATION CONTAINS ANOTHER CALL THAT AGAIN IS LOOKED UP AND OPERATED
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
SO WE CAN SEE THAT THERE IS SOME RECURRENCES ON OUR STACK.
WE REALIZED THAT THEY SIGNAL A LEVEL OF ABSTRACTION THAT US DEVELOPERS MIGHT HAVE IN MIND
BUT THE DEBUGGER DOES NOT.
Click
HERE IS THE SEMANTICS OF THE INTERPRETED LANGUAGE QOPPA THAT WE THINK OF
AND DECODE THE QOPPA LANGUAGE STACK OUT OF THE ENCODED REPRESENTATION HERE
Click
USUALLY, WE MENTALLY FILTER OUT ALL EVAL FRAMES FOR A WHILE AND TRY TO FIND THE RIGHT ONE, AND ONLY THEN …
Click
LOOK AT THE QOPPA FRAME OF INTEREST TO INSPECT THE CONTAINED SMALLTALK FRAMES
We present our MLD
Frames are grouped to conceptual groups (here: squeak packages)
Filter groups to show only conceptual levels of interest
Expand a group frame to zoom into the implementation of the used level
Walk up the list to zoom into the abstractions within the selected level
Frame representation is specialized to the selected context <…>
SUCH HIGHER LEVEL INFORMATION ARE NOT ONLY ENCODED IN THE STACK, BUT
Click
ALSO AT THE OTHER VIEWS THAT A SYMBOLIC DEBUGGER HAS
SO WE REFINED OUR RESEARCH QUESTION TO INCLUDE ABSTRACTION BARRIERS THAT ARE WITHIN ONE SINGLE LANGUAGE:
HOW TO TEACH ABSTRACTION-BARRIERS TO A DEBUGGER?
YOU MIGHT THINK THAT ABSTRACTION BARRIERS WERE THERE FOR A WHILE.
ALREADY SICP DESCRIBED THEM.
HOWEVER IF WE THINK ABOUT IT, THE CONCEPT DIDN’T REALLY MOVE INTO THE PRESENT DEBUGGING TOOLS
AND WE HAVE AN EXTREME CASE HERE, AS
INTERPRETERS BUILD EXTREME ABSTRACTION BARRIERS BY HAVING A WHOLE PROGRAM ENCODED IN THE INTERPRETERS DATA
TODO
SO LETS LOOK AT AN EXAMPLE AND GROW OUR DEBUGGER ITERATIVELY
I STARTED THE COMPUTATION OF A FACTORIAL AND …CLICK… HALTED THE EXECUTION AT THE BASE CASE OF THE RECURSION
IN A USUAL DEBUGGER, I SEE THE DESCRIBED PATTERNED CALL STACK
GROUPING THE FRAMES TO THE OPERATE CALLS WILL SAVE SPACE…
…, BUT REQUIRES ME TO INSPECT THE INTERPRETERS DATA TO FIND THE RIGHT FRAME
TODO
THAT’S WHY WE NEED TO DISPLAY SOME MORE DATA IN THE FRAME TITLES
Click
NOW WE CAN SEE THE QOPPA LANGUAGE STACK WITHIN OUR SMALLTALK DEBUGGER
AND EVEN SPECIALIZE THE OTHER VIEWS TOO TO SHOW THE QOPPA LANGUAGE STATE AND THE CURRENT LEXICAL SCOPE
WOW THATS EVEN ALL THE FEATURES THAT A QOPPA DEBUGGER WOULD PROVIDE
NOW WE CAN SEE ABSTRACTIONS AND FOLD OPEN THEM TO UNDERSTAND THEIR IMPLEMENTATION DETAILS
Click
BUT WE DON’T SEE YET, WHICH OF SUCH GROUPS BELONG TOGETHER
SO WE GO AHEAD AND FOR EACH FRAME IDENTIFY THE ABSTRACTION LEVEL IT IS ENTERING
WE ADD A COLOR TO SEE SIMILAR ABSTRACTION LEVELS
Click
AND SHOW A KEY TO KNOW THEIR NAMES…
WHEN CAN FILTER OUT UNINTERESTING FRAMES WHEN CLICKING SUCH A LEVEL
Click
IN SQUEAK, WE FOUND …Click…PACKAGES TO BE A GOOD DATA SOURCE FOR IDENTIFYING SUCH
SO FAR, I’VE BEEN TELLING YOU ABOUT …Click… THE ABSTRACTION LEVELS THAT ARE DESCRIBED BY LANGUAGES
AND ABOUT …Click… THE ABSTRACTION LEVELS THAT WE FACE WITHIN ONE LANGUAGE
LET ME GIVE ANOTHER WORD ON HOW TO GRAB THEM TOGETHER IN A UNIFIED API
GIO WIEDERHOLD DESCRIBED THE MEDIATOR-WRAPPER-ARCHITECTURE WHEN WRITING ABOUT DATA INTEGRATION
IT CONSISTS OF …Click… A MEDIATOR (BY THE WAY NOT THE ONE FROM GANG OF FOUR)
Click… HIS DATA SOURCES
Click… SOME ENCODED KNOWLEDGE ABOUT THEM
Click… AND OUTPUTS A SET OF DATA THAT EMERGED OUT OF INTERPRETING THE INPUTS
THE GOOD THING IN THAT IS THAT SUCH MEDIATORS ARE DECOUPLED FROM THE APPLICATIONS AND FROM THE DATA BASES SO THAT THEY CAN BE MAINTAINED INDEPENDENTLY
OUR MEDIATORS RECEIVES A NUMBER OF STACK FRAMES AND ADD THE REPRESENTATION INFORMATION TO IT
SUCH AS THE FRAME TITLE, THE LEVEL A FRAME IS IN, HOW IT IS GROUPED WITH SOME STACK NEIGHBORS, AND OF COURSE THE LEXICAL REPRESENTATION AS WELL AS THE DATA CONTENTS
SO IN OUR SETUP WE HAVE A QOPPA MEDIATOR THAT DESCRIBES LANGUAGE SPECIFICA SUCH AS SYNTAX HIGHLIGHTING
HE GATHERED THE QOPPA FRAMES FROM …CLICK… THE IMPLEMENTATIONSPECIFIC QOPPAS MEDIATOR
…Click…
WHICH USES SQUEAK CONTEXTS AS A DATA SOURCE
WE ALREADY HAVE OTHER LEVELS SUCH AS …CLICK… THE VIVIDE LIVE PROGRAMMING FRAMEWORK
WE CAN THINK OF EXTERNAL DATA SOURCES SUCH AS THE VM EXPOSING SOURCE CODE OF SMALLTALK PRIMITIVES TO US
Click…AND ALL THAT …Click… IS STILL WORK IN PROGRESS
SO FAR, WE HAD ONLY SQUEAK AS IMPLEMENTATION LANGUAGE
IF WE WOULD EXPOSE OUR MEDIATOR API TO THE QOPPA LANGUAGE
WE COULD IMPLEMENT A SCHEME LANGUAGE MEDIATOR THAT WOULD FILTER OUT THE EXECUTION OF THAT QOPPA-LEVEL PRIMITIVES OUT OF THE CALL STACK
IF WE WOULD EXPOSE SUCH PRIMITIVES IN ALL OUR INTERPRETERS, WE MIGHT BE ABLE TO USE THE GROUND LEVEL DEBUGGER FOR ALL OF THEM AND THE CROSS LEVEL FUNTIONALITY WOULD COME FOR FREE
WE WOULD NEVER HAVE TO BUILD A DEBUGGER AGAIN
THANKS TO MODULARITY CONFERENCE AND TO THE SOFTWARE ARCHITECTURE GROUP FOR FUNDING MY TRIP HERE