lldb formatters
lldb supports "summary providers" which can show a summary for non-POD data types.
Some formatters are provided in Tools/lldb/lldb_webkit.py. To have these always present when debugging in lldb, include this file in your ~/.lldbinit file:
command script import {Path to WebKit Root}/Tools/lldb/lldb_webkit.py
Writing new formatters
New formatters for common types are always welcome. They are not hard to write; see <https://trac.webkit.org/changeset/234062> for an example of one being added.
Unit tests should be added in Tools/lldb/lldb_webkit_unittest.py (currently there are problems running these on the bots). You can run these tests manually with ./Tools/Scripts/test-webkitpy lldb_webkit_unittest
Tips and tricks for writing formatters
- Documentation is at https://lldb.llvm.org/varformats.html
- The lldb python bindings are documented at https://lldb.llvm.org/python_reference/
- Xcode caches the formatters between runs. If debugging your formatter in Xcode. you have to quit and relaunch Xcode after each change.
- You can just print from the formatter code and it will show up in Xcode's debugger output window