简体   繁体   中英

Xcode 4.2 debugging on a viewDidLoad or viewDidDisappear will end on a EXC_BAD_ACCESS

Xcode 4.2 debugging on a viewDidLoad or viewDidDisappear will end on a EXC_BAD_ACCESS

It breaks on that breakpoint but when continuing ("Continue program execution") it returns a: EXC_BAD_ACCESS (code=1, address=0x....) on Thread 1 (0 start). That did not happen in earlier versions.

Someone getting the same error? Somebody knows how to deal with it?

Code for the example would be a simple:

 - (void) viewDidDisappear:(BOOL)animated {  
       [super viewDidDisappear:animated];
        NSLog(@"View did dissapear");    
    }

When debugging on breakpoint (line with NSLog) it and then hitting on continue it will end on that EXC_BAD_ACCESS. If no breakpoint then everything works fine.

I am working with Xcode 4.2 Build 4D199 (OS X Lion 10.7.2). Using LLDB debugger.

UPDATE: put a break in all exceptions and it always ends on a Thread 8: EXC_BAD_ACCESS - 0x1f43: movl (%ebx), %eax - line 0: start....

UPDATE 2: played around with Xcode and I really don´t know why but know it works. No code changed... hmmm... strange...

If you override this method, you must call super at some point in your implementation.

It's from the doc, I don't know if it's the problem that cause your BAD ACCES, but it's at least something you have to fix.

You are not helping much with that code you provided.

set an malloc_error_break and enable zombies and see if that leads to something

You must always call through to super at some point in all of the viewWill... or viewDid... methods that you override. For example,

- (void) viewDidDisappear:(BOOL)animated {
        NSLog(@"View did disapear");
        [super viewDidDisappear:animated];
}

I was recieving the same error on viewDidDisappear:animated - it turned out that I had a typo calling [ self viewDidDisappear:animated]; instead of [ super viewDidDisappear:animated];

Simple fix but not very noticeable at first. I was surprised it didn't give me a warning.

I see slightly different issue here. In my case(SnowLeopard 10.6.8, XCode 4.2, LLVM 3.0) it stops at the brake point, but XCode doesnt display any debugging info. I can see my stackrace in GDB fine, but local values are messed up. Interestingly i tried to use performSelectorOnMainThread: it can restore XCode debugging functions, but something corrupts active frame values.

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
        [self performSelectorOnMainThread:@selector(_destroyMarketBrowser) withObject:nil waitUntilDone:YES];

}

Btw: Everything works fine in simulator, the problem only occurs on real devices (5.0.1 or 5.1 Beta2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM