Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-22-2011, 05:47 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default No crash log. No stack trace. How to debug crash during idle?

My app is crashing while idle about 30 seconds after starting up, and after having done no UI interaction with it at all.

There is no crash log saved, and in XCode there is no debug stack trace, and nothing at all in the debug console.

Can anybody give me any hints on the correct way to debug this crash?

(Unfortunately, I cannot figure out what I've changed that may have caused a crash, either, as I'm returning to this project after a few months off).

When I run the app in XCode (using a real device), I get the following in the console, with several seconds of nothing (after the app is up and running and before the crash), and the last line (gdb prompt) appearing at the time the app crashes.

Code:
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Fri Sep 16 06:56:50 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
sharedlibrary apply-load-rules all
target remote-mobile /tmp/.XcodeGDBRemote-39882-59
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
Re-enabling shared library breakpoint 2
Pending breakpoint 1 - "malloc_error_break" resolved
wait_fences: failed to receive reply: 10004003
(gdb)
If I try to do a (gdb) backtrace, I get:
Code:
(gdb) backtrace
No stack.
(gdb)

Last edited by Son of a Beach; 11-22-2011 at 07:00 PM.
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 06:00 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

I'm guessing it may be getting killed by the iOS for using to much RAM. I guess I can try to analyse this with Instruments. I'll give that a go.

EDIT: Nope... Instruments shows no unusual memory usage. It seems to be using about half of what Springboard is using at the time of the crash, and did not use any more than that earlier.

I'm really stuck here, and would be grateful for any suggestions.

Last edited by Son of a Beach; 11-22-2011 at 06:06 PM.
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 07:26 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Of course it's not actually completely idle. There is stuff going on on background threads. The UI is fully responsive during this time, but background threads are busy doing callbacks for things that should be drawn on the screen. But none of those things ever actually get drawn before the crash (although they used to work just fine). The actual drawInRect: methods appear to be running to completion, when debugging.

So I'm guessing it's something to do with this background activity of data gathering and drawing, but I've no idea how to narrow it down further than that in any rational organised way (apart from putting in so many random break points that the app simply can't get on with doing anything at all without me clicking "continue").
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 07:32 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Nothing like spreading a few NSLogs around to track down problems.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 11-22-2011, 07:39 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Is there any way to get XCode to give any feedback whatsoever about the crash though?

I mean, I'm getting nothing. NOTHING apart from the (gdb) prompt. It's as though XCode thinks it is still all running perfectly fine, apart from that prompt.
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 07:40 PM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Not that I know of.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 11-22-2011, 07:46 PM   #7 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Using a whole lot of NSLogs may be the only option. But that's going to be very painful indeed. For starters, I'm going to have to put them everywhere, and then I'm going to get reams of output, and trying to figure out what output is missing is going to be the issue. I'm not sure how workable that is, but I may just have to try it. :-(
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 07:47 PM   #8 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Gosh, if only someone had provided a free utility that would help.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 11-22-2011, 08:16 PM   #9 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

XCode and GDB are free utilities. I was hoping they could help. But apparently not. :-(
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 08:17 PM   #10 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

*cough* ------------------------------->vvvvvvvvvvvv
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 11-22-2011, 08:21 PM   #11 (permalink)
almostfunnydev
iPhone Dev SDK Supporter
 
rocotilos's Avatar
 
Join Date: Oct 2009
Age: 34
Posts: 3,015
rocotilos is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
*cough* ------------------------------->vvvvvvvvvvvv
Yup, you need to change the colors of those. People are not noticing them enough.
rocotilos is offline   Reply With Quote
Old 11-22-2011, 08:55 PM   #12 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Heheh... OK fair enough. :-D

You've gotta make much stronger hints than that for me to notice what you're talking about. :-)

OK, I'll have a look at it. Does it log when leaving a method by premature "return" calls that are not right at the end of a method? Your topic probably covers, that... I'll go read up.
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 10:03 PM   #13 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Well... instead of using logging, I'm having a fair bit of success in narrowing it down by using extra "return;" or "return nil;" statements at various places in suspect classes/methods.

After some initial experimenting with which class and method to start with, I've now worked through a stack of methods, isolating it down to one additional line of code in a method, and then doing the same again with the method called in that line, repeatedly through several layers of method calls.

I think I'm getting close! :-)

Still at a loss as to why XCode could not isolate this issue, nor even output anything at all in the console. Perhaps when I eventually track it down completely, I'll figure that out too.
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 11:11 PM   #14 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Well, the mystery just deepens for me...

I've isolated it down to TWO lines of code:

Code:
NSLog(@"ONE");
self.tableOffsets = [NSArray array];
NSLog(@"TWO");
self.fileHandle = [NSFileHandle fileHandleForReadingAtPath:path];
NSLog(@"THREE");
(this method gets called many, many times, but always in a @synchonized block)

The crash can occur on either the array allocation or the filehandle allocation - it is inconsistent. This implies that it may be a memory issue. However, Instruments says there are no leaks (no surprise - I'm using ARC), and that the total allocations is only 1.35 MB.

Additionally, there are no memory warnings received.

So it doesn't quite fit with high memory usage.

I'm very confused. Anybody got any other ideas?
Son of a Beach is offline   Reply With Quote
Old 11-22-2011, 11:18 PM   #15 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: Tasmania, Australia
Posts: 195
Son of a Beach is on a distinguished road
Default

Using @try/@catch doesn't catch it either:

Code:
@try
{
	NSLog(@"ONE");
	self.tableOffsets = [NSArray array];
	NSLog(@"TWO");
	self.fileHandle = [NSFileHandle fileHandleForReadingAtPath:path];
	NSLog(@"THREE");
	self.fileLength = [fileHandle seekToEndOfFile];
	[fileHandle seekToFileOffset:0];
}
@catch (NSException *e)
{
	NSLog(@"Failed to initialise reader - failed to initialise file handle:  %@", [path lastPathComponent]);
	return nil;
}
Still just crashes in either of the same two places.

This further implies that the iOS is unceremoniously killing it (which implies RAM issues?), but I'm not getting any warnings or notifications about this. No crash logs. No GDB/XCode debug output. NOTHING.

Has anybody come across anything like this?

(I may need to start a new thread on this, now that I've isolated it a bit further).
Son of a Beach is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 399
16 members and 383 guests
7twenty7, chiataytuday, Clouds, dedeys78, Duncan C, e2applets, EvilElf, iekei, ipodphone, jeroenkeij, leostc, mbadegree, Murphy, QuantumDoja, sacha1996, Sami Gh
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:35 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0