“返回"从方法而踩? [英] "return" from method while stepping?
本文介绍了“返回"从方法而踩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想退出目前正在逐步使用的方法.
I would like to exit out the current method that I'm stepping through.
-(void)helloWorld {
NSLog(@"Hello");
// I would like to return here, so that "World" isn't printed.
NSLog(@"World");
}
我尝试了以下方法,但是没有运气.
I have tried the following, but without luck.
(lldb) expr return
<no result>
lldb是否可能?
推荐答案
在使用Xcode进行调试时以及程序在断点处暂停时,可以将绿色的小箭头拖动到函数中的任何其他行.例如.在以下代码中:
When you are debugging using Xcode and when your program is paused at a breakpoint, you can drag the little green arrow to any other line in the function. E.g. in the following code:
如果我想跳过NSLog(@"B")
,我可以简单地将绿色箭头从第20行拖动到第23行,这意味着该函数将简单地从我想要的任何位置返回".
if I want to skip the NSLog(@"B")
, I can simply drag the green arrow from line 20 to line 23, which means the function will simply "return" from anywhere I want.
这篇关于“返回"从方法而踩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文