Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Debugging Native Extensions of Dynamic Languages

Debugging Native Extensions of Dynamic Languages

Presentation of the paper "Debugging Native Extensions of Dynamic Languages" at ManLang'18.

Check out the screen recording of the demo at https://youtu.be/6znqkxvZhsI

Jacob Kreindl

September 13, 2018
Tweet

Other Decks in Programming

Transcript

  1. DEBUGGING NATIVE
    EXTENSIONS OF DYNAMIC
    LANGUAGES
    Jacob Kreindl, Manuel Rigger, Hanspeter Mössenböck
    15th International Conference on Managed Languages & Runtimes, September 13, 2018

    View Slide

  2. MOTIVATION
    13.09.2018 Jacob Kreindl, ManLang’18 2
    Native
    Extensions

    View Slide

  3. MOTIVATION
    13.09.2018 Jacob Kreindl, ManLang’18 2
    Debuggers for
    Dynamic Languages
    Native
    Extensions

    View Slide

  4. MOTIVATION
    13.09.2018 Jacob Kreindl, ManLang’18 2
    Debuggers for
    Dynamic Languages
    Native
    Extensions

    View Slide

  5. MOTIVATION
    13.09.2018 Jacob Kreindl, ManLang’18 2
    Debuggers for
    Dynamic Languages
    Debuggers for
    Native Code
    Native
    Extensions

    View Slide

  6. MOTIVATION
    13.09.2018 Jacob Kreindl, ManLang’18 2
    Debuggers for
    Dynamic Languages
    Debuggers for
    Native Code
    Native
    Extensions

    View Slide

  7. GRAALVM
    13.09.2018 Jacob Kreindl, ManLang’18 3
    Native
    Extensions

    View Slide

  8. GRAALVM
    13.09.2018 Jacob Kreindl, ManLang’18 3
    Execute & Debug
    Native
    Extensions

    View Slide

  9. GRAALVM
    13.09.2018 Jacob Kreindl, ManLang’18 3
    Execute & Debug
    Execute
    Native
    Extensions

    View Slide

  10. GRAALVM
    13.09.2018 Jacob Kreindl, ManLang’18 3
    & Debug
    Our Contribution
    Execute & Debug
    Execute
    Native
    Extensions

    View Slide

  11. GRAALVM FOR DYNAMIC LANGUAGES
    13.09.2018 Jacob Kreindl, ManLang’18 4

    View Slide

  12. GRAALVM FOR DYNAMIC LANGUAGES
    13.09.2018 Jacob Kreindl, ManLang’18 4
    Language
    Front-End
    Language
    Front-End
    Language
    Front-End

    View Slide

  13. GRAALVM FOR DYNAMIC LANGUAGES
    13.09.2018 Jacob Kreindl, ManLang’18 4
    Language
    Front-End
    Language
    Front-End
    Language
    Front-End
    Language-Agnostic
    Program Representation
    op1
    op2 if
    else
    then
    op3 op4
    Source
    Location

    View Slide

  14. GRAALVM FOR DYNAMIC LANGUAGES
    13.09.2018 Jacob Kreindl, ManLang’18 4
    Debugger
    Back-End
    Chrome
    Debugger
    Netbeans
    Debugger
    Other
    Front-Ends
    Language
    Front-End
    Language
    Front-End
    Language
    Front-End
    Language-Agnostic
    Program Representation
    op1
    op2 if
    else
    then
    op3 op4
    Source
    Location

    View Slide

  15. GRAALVM FOR NATIVE EXTENSIONS
    13.09.2018 Jacob Kreindl, ManLang’18 5

    View Slide

  16. GRAALVM FOR NATIVE EXTENSIONS
    13.09.2018 Jacob Kreindl, ManLang’18 5
    LLVM-IR
    LLVM Front-End
    (Clang, Dragonegg, …)

    View Slide

  17. GRAALVM FOR NATIVE EXTENSIONS
    13.09.2018 Jacob Kreindl, ManLang’18 5
    LLVM-IR
    LLVM Front-End
    (Clang, Dragonegg, …)
    Sulong
    Language-Agnostic
    Program Representation
    op1
    op2 if
    else
    then
    op3 op4
    Debugger
    Back-End

    View Slide

  18. OUR CONTRIBUTIONS
    13.09.2018 Jacob Kreindl, ManLang’18 6
    LLVM-IR Sulong
    Language-Agnostic
    Program Representation
    + Run-Time Debug Information
    LLVM Front-End
    (Clang, Dragonegg, …)
    Debugger
    Back-End
    with Debug
    Information
    + DI Parser
    op1
    op2 if
    else
    then
    op3 op4
    Scope &
    Location
    Value
    Tracking
    Abstraction to
    Source-Level

    View Slide

  19. Debugging a C-Extension for a Ruby Program
    DEMO

    View Slide

  20. EXAMPLE
    13.09.2018 Jacob Kreindl, ManLang’18 8
    int fact(int n) {
    int result = 1;
    if (n > 0)
    result = n * fact(n - 1);
    return result;
    }

    View Slide

  21. EXAMPLE
    13.09.2018 Jacob Kreindl, ManLang’18 9
    #include "ruby.h"
    int fact(int n) {…}
    VALUE callFact(VALUE self, VALUE num) {
    int n = NUM2INT(num);
    int result = fact(n);
    return INT2NUM(result);
    }
    void Init_FactExt() {
    VALUE FactExt = rb_define_module("FactExt");
    rb_define_method(FactExt, "fact", &callFact, 1);
    }

    View Slide

  22. EXAMPLE
    13.09.2018 Jacob Kreindl, ManLang’18 10
    require("./FactExt.su")
    include FactExt
    (0..12).each do |n|
    f = FactExt::fact(n)
    puts "fact(" + n.to_s + ") = " + f.to_s
    end

    View Slide

  23. Live Demonstration
    DEMO

    View Slide

  24. IN CONCLUSION
    13.09.2018 Jacob Kreindl, ManLang’18 12
    Execute & Debug
    Native
    Extensions

    View Slide

  25. IN CONCLUSION
     Same Debugger Front-End
    for all Languages
    13.09.2018 Jacob Kreindl, ManLang’18 12
    Execute & Debug
    Native
    Extensions

    View Slide

  26. IN CONCLUSION
     Same Debugger Front-End
    for all Languages
     Single Run-Time Environment
    13.09.2018 Jacob Kreindl, ManLang’18 12
    Execute & Debug
    Native
    Extensions

    View Slide

  27. IN CONCLUSION
     Same Debugger Front-End
    for all Languages
     Single Run-Time Environment
     Source-Level Stepping & Breakpoints
    13.09.2018 Jacob Kreindl, ManLang’18 12
    Execute & Debug
    Native
    Extensions

    View Slide

  28. IN CONCLUSION
     Same Debugger Front-End
    for all Languages
     Single Run-Time Environment
     Source-Level Stepping & Breakpoints
     Cross-Language Symbol Inspection
    13.09.2018 Jacob Kreindl, ManLang’18 12
    Execute & Debug
    Native
    Extensions

    View Slide

  29. JOHANNES KEPLER
    UNIVERSITY LINZ
    Altenberger Str. 69
    4040 Linz, Austria
    www.jku.at
    Thank you for your attention!
    QUESTIONS? Read the Paper
    Watch the Demo

    View Slide