调试时禁用反汇编视图

Dav*_*ido 5 iphone ios6 xcode4.5

我试图弄清楚如何在调试时关闭 Xcode 中的反汇编视图。我想继续浏览我的代码,而不是分心地浏览所有汇编代码。我相信以前版本的 Xcode 的调试菜单下有一个选项,但我在 Xcode 4.5(最新版本)中找不到任何选项。有任何想法吗?

编辑:

我仔细检查以确保我实际上是在我自己的代码中而不是在库中,并且当我在我自己的代码中时它仍然会这样做。这是发生的情况的图片:

http://i1238.photobucket.com/albums/ff487/davidohyer/ScreenShot2012-10-02at35031PM.png

这是通过创建一个新项目、创建一个虚拟函数、从 viewDidLoad 调用该虚拟函数、在函数调用上设置断点并使用 F6 单步执行来实现的。有任何想法吗?没有使用外部库。我确认发生这种情况时您提到的选项已关闭。

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    [self initVals];
}

-(void)initVals
{
    self.img = [[UIImageView alloc] init];
}
Run Code Online (Sandbox Code Playgroud)

Mac*_*ade 3

Product > Debug Workflow > Show Disassembly While Debugging

在此输入图像描述

Remember you'll only be able to see your own code. Breakpoints and/or crashes that occurs inside some library or framework will just show assembly, because there's simply so source code to show.

EDIT

The disassembly you are showing in your edit is from UIViewController. You can see it in the sidebar, as well in the symbol stub comments in the disassembly.

You may break on your own code, but then, if you step from here, you'll fatally end in some framework code.

In your example, you break on the initVals call, from viewDidLoad on a UIViewController subclass.

If you step pass the end of this, you'll end in UIViewController code, as it has still a lot of stuff to do after viewDidLoad.

So to resume, pay attention of the symbol names on the sidebar. Here, it just shows you're not in your subclass, but in some superclass method implementation. Hence the assembly only output.

EDIT 2

Imagine the following code, from a library (binary only):

@interface Foo: NSObject

- ( void )test1;
- ( void )test2;
- ( void )test3;

@end
Run Code Online (Sandbox Code Playgroud)

And then you subclass it:

@interface Bar: Foo

@end
Run Code Online (Sandbox Code Playgroud)

Now, Foo does the following:

- ( void )test1
{
    [ self test2 ];
    [ self test3 ];
}
Run Code Online (Sandbox Code Playgroud)

In your subclass, let's say you only override test2:

- ( void )test2
{
    ...

    /* Breakpoint here, at the end */
}
Run Code Online (Sandbox Code Playgroud)

If you step from the breakpoint, you'll end in the test3 superclass implementation, which is called right after test2 from test1.

So you'll just jump from your own code to the superclass implementation. Here again, no human readable code to show, but only assembly.

  • 附带说明一下,一些有用的提示:不要忘记 Spotlight 非常强大,可以向您显示某些菜单项的位置。因此,您只需在 Xcode 帮助菜单中的聚光灯字段中输入“反汇编”,它就会向您显示隐藏设置的位置!:) (2认同)
  • 奇怪的。您可能会认为 XCode 中提供了一种方法来始终保留在您自己的代码中。 (2认同)