extending lldb to more scripting languages
play

Extending LLDB to More Scripting Languages Jonas Devlieghere, Apple - PowerPoint PPT Presentation

Extending LLDB to More Scripting Languages Jonas Devlieghere, Apple C++ API Scripting Bridge API Scripting Bridge API SBThread SBDebugger SBBreakpoint SBTarget SBFrame SBSymbol SBValue SBProcess SBFunction Python Python


  1. Extending LLDB to More Scripting Languages Jonas Devlieghere, Apple

  2. C++ API

  3. Scripting Bridge API

  4. Scripting Bridge API SBThread SBDebugger SBBreakpoint SBTarget SBFrame SBSymbol SBValue SBProcess SBFunction

  5. Python

  6. Python #!/usr/bin/python $ lldb (lldb) script import lldb >>> frame = lldb.frame dbg = lldb.SBDebugger.Create() >>> print(frame.IsInlined()) target = dbg.CreateTarget("a.out") False target.BreakpointCreateByName("foo") (lldb) command script import foo.py process = target.LaunchSimple(...) (lldb) foo I'm a Python script!

  7. Another Scripting Language

  8. Another Scripting Language

  9. Script Interpreter • Execute a single line of code (lldb) script >>> io.stdout:write("Hello, World!\n") Hello, World! • Run an interactive interpreter (lldb) command script import foo.lua (lldb) foo • Load a module I'm a Lua script!

  10. SWIG

  11. SWIG • • Lua • Python C# • • Racket • R D • • OCaml • Ruby Go • • Octave • Scilab Guile • • Perl • Tcl/Tk Java • • PHP JavaScript

  12. Language Bindings

  13. Language Bindings (lldb) script --language python (lldb) script --language lua >>> frame = lldb.frame >>> frame = lldb.frame >>> print(frame.IsInlined()) >>> print(frame:IsInlined()) False false

  14. Future Work • Breakpoint/Watchpoint callbacks • Lua Type Summaries

  15. Conclusion • Designed for multiple scripting languages • Stable SB API • Generated language bindings

Recommend


More recommend