LLDB features and WWDC sessions
Let's check interesting LLDB (Xcode debugger) features maybe you don't know until yet.
Please find full documentation about LLDB from here.
- Alias
- You can make a few alias for commonly used commands. for example,
- (lldb) command alias bfl breakpoint set -f %1 -l %2
- (lldb) bfl Test.m 15
- You can store all aliases to ~/.lldbinit file. LLDB will read this file at startup.
- Regular expression alias
- You can use regex to make alias
- (lldb) command regex f "s/^([0-9]+)/frame select %1/"
- (lldb) f 12 --> frame select 12
- Type summary
- If you want to display summary for custom classes or structures, you can add type summary
- (lldb) type summary add --summary-string "x=${var.x} y=${var.y}" MyPoint
- You also can write a Python script that returns the string to be used as summary. Please see LLDB documentation
- Expression
- Evaluating generalized expression in the current frame
- (lldb) expr (int) printf("Print nine: %d", 5 + 4)
- Python script
- lldb has a built-in Python interpreter. you can define "commands" by writing Python functions using lldb-Python library
- See examples under Xcode.app/Contents/SharedFrameworks/LLDB.framework
- Resources/Python/lldb/formatters/cpp
- Resources/Python/lldb/formatters/objc
- Resources/Python/lldb/utils/symbolication.py
- ...
There are lots more helpful features. Please see these WWDC videos for LLDB debugger.
댓글
댓글 쓰기