[英]LLDB alias for Swift command
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:在我的应用程序中从FMDB调试 SQLite 查询时,我有时会使用命令返回结果集当前行中的所有值:
(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:我在整个应用程序中始终使用名称“result”,所以这个命令永远不会改变,显然每次我想使用它时都输入它有点乏味,所以我想创建一个别名,但是当我尝试这样做时(无论是通过 .lldbinit 文件还是直接在 Xcode 控制台中),我都会收到错误消息:
(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.环顾四周,我找不到任何在别名中使用 Swift 代码的实例,但我确实找到了几个使用 Objective-C 的例子,所以我认为这是可能的。
What am I doing wrong?我究竟做错了什么?
In a Swift project, po
is an alias for expression -O -l swift --
.在 Swift 项目中,
po
是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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.