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

46bdaded3636a5f4d544af448aeee7df?s=128

Jacob Kreindl

September 13, 2018
Tweet

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
  2. MOTIVATION 13.09.2018 Jacob Kreindl, ManLang’18 2 Native Extensions

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

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

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

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

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

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

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

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

    Execute & Debug Execute Native Extensions
  11. GRAALVM FOR DYNAMIC LANGUAGES 13.09.2018 Jacob Kreindl, ManLang’18 4

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

    Front-End Language Front-End Language Front-End
  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
  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
  15. GRAALVM FOR NATIVE EXTENSIONS 13.09.2018 Jacob Kreindl, ManLang’18 5

  16. GRAALVM FOR NATIVE EXTENSIONS 13.09.2018 Jacob Kreindl, ManLang’18 5 LLVM-IR

    LLVM Front-End (Clang, Dragonegg, …)
  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
  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
  19. Debugging a C-Extension for a Ruby Program DEMO

  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; }
  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); }
  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
  23. Live Demonstration DEMO

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

    Native Extensions
  25. IN CONCLUSION  Same Debugger Front-End for all Languages 13.09.2018

    Jacob Kreindl, ManLang’18 12 Execute & Debug Native Extensions
  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
  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
  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
  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