When debugging SQLite queries from FMDB in my app, I sometimes use a command to return all the values in the current row of the result set:
(lldb) po (0..<result.columnCount()).map{result.object(forColumnIndex: $0)!}
I use the name "result" consistently throughout my app, so this command never changes, and obviously it's a little tedious to type it out every time I want to use it so I wanted to create an alias, but when I try to do so (whether through a .lldbinit file or directly in the Xcode console), I get an error:
(lldb) command alias poresult po (0..<result.columnCount()).map{result.object(forColumnIndex: $0)!}
error: Unable to create requested alias.
Looking around, I couldn't find any instances of using Swift code in an alias, but I did find several examples with Objective-C, so I assume it's possible.
What am I doing wrong?
In a Swift project, po
is an alias for expression -O -l swift --
. Try substituting it for its definition in your own alias.
command alias poresult expression -O -l swift -- (0..<result.columnCount()).map{result.object(forColumnIndex: $0)!}
More general:
command alias ALIAS_NAME expression -O -l swift -- YOUR_CODE_HERE