本文介绍了当进入调试器时,EXC_BAD_ACCESS(code = 1,address = 0x0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序每次尝试跳过一个呼叫时都会崩溃。没有调试器它工作正常。



另外,当我在模拟器中运行该应用程序时,它可以调试器或不带调试器。



我的Mac OS X 10.8到10.9(小牛)。升级前没有问题。



什么原因导致问题,我该如何解决?



以下是后面的跟踪。我的应用程序使用ARC。我已经启用了僵尸并添加了异常断点,但没有僵尸检测到和异常断点永远不会被触发。

  *线程#1:tid = 0x2503,0x00000000,queue ='com.apple.main-thread,stop reason = EXC_BAD_ACCESS(code = 1,address = 0x0)
frame#0:0x00000000
frame#1:0x35e170c4 UIKit`- [UIApplication sendAction:to:from:forEvent:] + 72
frame#2:0x35e17076 UIKit`- [UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
frame#3:0x35e17054 UIKit`- [UIControl sendAction:to:forEvent:] + 44
框架#4:0x35e1690a UIKit`- [UIControl(Internal)_sendActionsForEvents:withEvent:] + 502
框架#5:0x35e16e00 UIKit`- [UIControl touchesEnded :withEvent:] + 488
框架#6:0x35d3f5f0 UIKit`- [UIWindow _sendTouchesForEvent:] + 524
框架#7:0x35d2c800 UIKit`- [UIApplication sendEvent:] + 380
框架# 8:0x35d2c11a UIKit`_UIApplicationHandleEvent + 6154
框架#9:0x37a1e5a2 GraphicsServices`_PurpleEventCallback + 590
框架#10:0x37a1e1d2 GraphicsServices`PurpleEventCallback + 34
框架#11:0x33ef9172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
框架#12 :0x33ef9116 CoreFoundation`__CFRunLoopDoSource1 + 138
框架#13:0x33ef7f98 CoreFoundation`__CFRunLoopRun + 1384
框架#14:0x33e6aebc CoreFoundation`CFRunLoopRunSpecific + 356
框架15:0x33e6ad48 CoreFoundation`CFRunLoopRunInMode + 104
框架#16:0x37a1d2ea GraphicsServices`GSEventRunModal + 74
框架#17:0x35d80300 UIKit`UIApplicationMain + 1120
框架#18:0x000faac8 MyApp`main(argc = 1,argv = 0x2fd0fd08)+ 116 at main.m:16

编辑:





我从头创建了新的应用程序,没有问题地运行它。然后我在 ViewController viewDidLoad 中放置一个断点,并尝试过渡。在这里我有另一个崩溃

  *线程#1:tid = 0x2503,0x3bb9d7c4 libobjc.A.dylib`objc_msgSendSuper2 + 4,队列='com.apple.main-thread,stop reason = EXC_BAD_ACCESS(code = 1,address = 0x4)
frame#0:0x3bb9d7c4 libobjc.A.dylib`objc_msgSendSuper2 + 4
frame#1:0x000b913a测试` - [ViewController viewDidLoad](self = 0x1cda5c70,_cmd = 0x361bd5db)+62在ViewController.m:19
框架#2:0x35d4b594 UIKit`- [UIViewController loadViewIfRequired] + 364
框架#3: 0x35d8bd78 UIKit`- [UIWindow addRootViewControllerViewIfPossible] + 64
框架#4:0x35d87aec UIKit`- [UIWindow _setHidden:forced:] + 364
框架#5:0x35dc91e8 UIKit`- [UIWindow makeKeyAndVisible] + 60
框架#6:0x35d8c83e UIKit`- [UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1666
框架#7:0x35d8484a UIKit`- [UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 698
框#8:0x35d2cc38 UI Kit`- [UIApplication handleEvent:withNewEvent:] + 1004
框架#9:0x35d2c6cc UIKit`- [UIApplication sendEvent:] + 72
框架#10:0x35d2c11a UIKit`_UIApplicationHandleEvent + 6154
框架#11:0x37a1e5a2 GraphicsServices`_PurpleEventCallback + 590
框架#12:0x37a1e1d2 GraphicsServices`PurpleEventCallback + 34
框架#13:0x33ef9172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
框架#14:0x33ef9116 CoreFoundation`__CFRunLoopDoSource1 + 138
框架#15:0x33ef7f98 CoreFoundation`__CFRunLoopRun + 1384
框架#16:0x33e6aebc CoreFoundation`CFRunLoopRunSpecific + 356
框架#17:0x33e6ad48 CoreFoundation`CFRunLoopRunInMode + 104
框架#18 :0x35d83484 UIKit`- [UIApplication _run] + 668
frame#19:0x35d80300 UIKit`UIApplicationMain + 1120
frame#20:0x000b93bc test`main(argc = 1,argv = 0x2fd51d30)+ 116 at main .m:16
frame#21:0x3bfd9b20 libdyld.dylib`start + 4

编辑2:



格雷格·克莱顿在建议如下

 其他人看到这个问题。 
要尝试的几件事:
1 - 重新启动设备,然后重试。理论是一个旧的开发者磁盘映像已经挂载,直到重新启动后才会被卸载。
2 - 在设备上重新安装操作系统

希望#1可以解决您的问题。其他人已经做了#2,并解决了问题,但希望它不需要重新安装操作系统。

我做了两个,没有帮助。



我尝试使用其他设备,但却有所作为。如果我在iOS 6.1中使用iPod Touch,但是使用iOS 7.0.2的iPad可以正常使用,例外情况仍然存在。



所以,看起来这个问题与iOS版本有关安装在设备上。我仍然不知道该怎么办来解决它。



编辑3:



我的命令行工具版本与我的Xcode版本匹配(我只有一个版本的Command线工具,实际上)。



这些问题可能与被调试的代码无关。它由Xcode创建的新创建的单视图应用程序崩溃。而且,当踩平凡的代码时,它会崩溃:

   - (void)viewDidLoad 
{
[super viewDidLoad ];
//加载视图后,通常从笔尖进行任何其他设置。
}

我,并得到了Jason Molenda的回应:

所以,它似乎是一个错误Xcode。

解决方案

好的,这肯定是Xcode 5.0.1中的一个错误。



这是由Jason Molenda 确认的。现在唯一的解决方法是使用和旧版本的Mac OS X,因为Xcode 5需要OS X 10.8.4。



目前还没有公布ETA来解决这个问题。关于苹果开发者论坛上的ETA的直接问题没有答案。



2013年11月11日更新:



今天,Xcode 5.0.2的预发行版本可以在。此版本修复了(以及其他)以下问题:

我已经安装了新版本,问题确实没有了。现在我可以再次调试我的6.x设备上的应用程序。



Jason Molenda在说:


My application crashes each and every time I try to step over a call. Without debugger it works fine.

Also, when I run the app in simulator it woks fine with or without debugger.

Recently I upgraded my Mac OS X 10.8 to 10.9 (Mavericks). There were no issues before the upgrade.

What causes the issue and how could I fix it?

Below is the back trace. My app uses ARC. I have enabled zombies and added exception breakpoint but no zombies where detected and exception breakpoint is never triggered.

    * thread #1: tid = 0x2503, 0x00000000, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        frame #0: 0x00000000
        frame #1: 0x35e170c4 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 72
        frame #2: 0x35e17076 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
        frame #3: 0x35e17054 UIKit`-[UIControl sendAction:to:forEvent:] + 44
        frame #4: 0x35e1690a UIKit`-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 502
        frame #5: 0x35e16e00 UIKit`-[UIControl touchesEnded:withEvent:] + 488
        frame #6: 0x35d3f5f0 UIKit`-[UIWindow _sendTouchesForEvent:] + 524
        frame #7: 0x35d2c800 UIKit`-[UIApplication sendEvent:] + 380
        frame #8: 0x35d2c11a UIKit`_UIApplicationHandleEvent + 6154
        frame #9: 0x37a1e5a2 GraphicsServices`_PurpleEventCallback + 590
        frame #10: 0x37a1e1d2 GraphicsServices`PurpleEventCallback + 34
        frame #11: 0x33ef9172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
        frame #12: 0x33ef9116 CoreFoundation`__CFRunLoopDoSource1 + 138
        frame #13: 0x33ef7f98 CoreFoundation`__CFRunLoopRun + 1384
        frame #14: 0x33e6aebc CoreFoundation`CFRunLoopRunSpecific + 356
        frame #15: 0x33e6ad48 CoreFoundation`CFRunLoopRunInMode + 104
        frame #16: 0x37a1d2ea GraphicsServices`GSEventRunModal + 74
        frame #17: 0x35d80300 UIKit`UIApplicationMain + 1120
        frame #18: 0x000faac8 MyApp`main(argc=1, argv=0x2fd0fd08) + 116 at main.m:16

EDIT:

I have latest Xcode Version 5.0.1 (5A2053).

I have created new app from scratch and ran it without issues. Then I put a breakpoint in ViewController's viewDidLoad and tried to step over. Here I got another crash

* thread #1: tid = 0x2503, 0x3bb9d7c4 libobjc.A.dylib`objc_msgSendSuper2 + 4, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x4)
    frame #0: 0x3bb9d7c4 libobjc.A.dylib`objc_msgSendSuper2 + 4
    frame #1: 0x000b913a test`-[ViewController viewDidLoad](self=0x1cda5c70, _cmd=0x361bd5db) + 62 at ViewController.m:19
    frame #2: 0x35d4b594 UIKit`-[UIViewController loadViewIfRequired] + 364
    frame #3: 0x35d8bd78 UIKit`-[UIWindow addRootViewControllerViewIfPossible] + 64
    frame #4: 0x35d87aec UIKit`-[UIWindow _setHidden:forced:] + 364
    frame #5: 0x35dc91e8 UIKit`-[UIWindow makeKeyAndVisible] + 60
    frame #6: 0x35d8c83e UIKit`-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1666
    frame #7: 0x35d8484a UIKit`-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 698
    frame #8: 0x35d2cc38 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1004
    frame #9: 0x35d2c6cc UIKit`-[UIApplication sendEvent:] + 72
    frame #10: 0x35d2c11a UIKit`_UIApplicationHandleEvent + 6154
    frame #11: 0x37a1e5a2 GraphicsServices`_PurpleEventCallback + 590
    frame #12: 0x37a1e1d2 GraphicsServices`PurpleEventCallback + 34
    frame #13: 0x33ef9172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
    frame #14: 0x33ef9116 CoreFoundation`__CFRunLoopDoSource1 + 138
    frame #15: 0x33ef7f98 CoreFoundation`__CFRunLoopRun + 1384
    frame #16: 0x33e6aebc CoreFoundation`CFRunLoopRunSpecific + 356
    frame #17: 0x33e6ad48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #18: 0x35d83484 UIKit`-[UIApplication _run] + 668
    frame #19: 0x35d80300 UIKit`UIApplicationMain + 1120
    frame #20: 0x000b93bc test`main(argc=1, argv=0x2fd51d30) + 116 at main.m:16
    frame #21: 0x3bfd9b20 libdyld.dylib`start + 4

EDIT 2:

Greg Clayton in the XCode 5 Crashes while running the app on device suggests following

Others have seen this issue.
A few things to try:
1 - Reboot your device and try again. The theory is an old developer disk image is already mounted and won't be unmounted until you reboot.
2 - Re-install the OS on the device

Hopefully #1 fixes your issue. Others have done #2 and had their issue fixed, but hopefully it doesn't require an OS re-install.

I did both and it didn't help.

I tried to use another device and it made a difference. Exceptions are still there if I use iPod Touch with iOS 6.1 but iPad with iOS 7.0.2 works fine.

So, it looks like the issue is related to the iOS version installed on the device. I am still not sure what to do to fix it.

EDIT 3:

My Command Line Tools version matches my Xcode version (I have only one version of Command Line Tools, actually).

The issues is probably not related to the code being debugged. It crashes with newly created Single View Application created by Xcode. And it crashes when stepping over trivial code:

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

I have asked on Apple Developer Forum and got following response from Jason Molenda:

So, it seems like it's a bug in Xcode.

解决方案

Ok, this is definitely a bug in Xcode 5.0.1.

This is confirmed by Jason Molenda on Apple Developer Forum. The only workaround for now is to use older version of Xcode and the older version of Mac OS X because Xcode 5 requires OS X 10.8.4.

There is no announced ETA for a fix for this issue. Direct question about ETA on Apple Developer Forum is left without answer.

UPDATE 06-Nov-2013:

Today a pre-release version of Xcode 5.0.2 became available on developer.apple.com. This version fixes (among other things) the following issue:

I have installed the new version and the issue is indeed gone. Now I am able to debug apps on my 6.x devices again.

Jason Molenda in thread on Apple Developer Forum said:

这篇关于当进入调试器时,EXC_BAD_ACCESS(code = 1,address = 0x0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 01:27