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

extending lldb to more scripting languages
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Jonas Devlieghere, Apple

Extending LLDB to More Scripting Languages

slide-2
SLIDE 2

C++ API

slide-3
SLIDE 3

Scripting Bridge API

slide-4
SLIDE 4

Scripting Bridge API

SBDebugger SBTarget SBProcess SBThread SBFrame SBValue SBBreakpoint SBSymbol SBFunction

slide-5
SLIDE 5

Python

slide-6
SLIDE 6

#!/usr/bin/python import lldb dbg = lldb.SBDebugger.Create() target = dbg.CreateTarget("a.out") target.BreakpointCreateByName("foo") process = target.LaunchSimple(...)

$ lldb (lldb) script >>> frame = lldb.frame >>> print(frame.IsInlined()) False (lldb) command script import foo.py (lldb) foo I'm a Python script!

Python

slide-7
SLIDE 7

Another Scripting Language

slide-8
SLIDE 8

Another Scripting Language

slide-9
SLIDE 9

Script Interpreter

  • Execute a single line of code
  • Run an interactive interpreter
  • Load a module

(lldb) script >>> io.stdout:write("Hello, World!\n") Hello, World! (lldb) command script import foo.lua (lldb) foo I'm a Lua script!

slide-10
SLIDE 10

SWIG

slide-11
SLIDE 11

SWIG

  • C#
  • D
  • Go
  • Guile
  • Java
  • JavaScript
  • Lua
  • Racket
  • OCaml
  • Octave
  • Perl
  • PHP
  • Python
  • R
  • Ruby
  • Scilab
  • Tcl/Tk
slide-12
SLIDE 12

Language Bindings

slide-13
SLIDE 13

Language Bindings

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

slide-14
SLIDE 14

Future Work

  • Breakpoint/Watchpoint callbacks
  • Lua Type Summaries
slide-15
SLIDE 15

Conclusion

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