Re: Crash during function prologue
Re: Crash during function prologue
- Subject: Re: Crash during function prologue
- From: Steve Christensen <email@hidden>
- Date: Sun, 7 Jan 2007 22:16:41 -0800
On Jan 7, 2007, at 8:30 PM, Ben Galanti wrote:
I want to thank everybody for the quick replies. I'm going to
follow up on several different responses in this email, since most
of them were of a similar theme.
On Jan 6, 2007, at 4:51 PM, Steve Christensen wrote:
On Jan 6, 2007, at 9:35 AM, Jonas Maebe wrote:
On 06 Jan 2007, at 18:27, email@hidden wrote:
0x0032cf10 <+0000> mflr r0
0x0032cf14 <+0004> stmw r29,-12(r1)
0x0032cf18 <+0008> stw r0,8(r1)
0x0032cf1c <+0012> lis r0,-9
0x0032cf20 <+0016> ori r0,r0,57648
0x0032cf24 <+0020> stwux r1,r1,r0
The crash is at the stwux, it's an EXC_BAD_ACCESS. At that point r1
(that's the stack pointer, right?) is 0xf0080230 and r0 is
0xfff7e130.
Adding those actually overflows 32 bits, and the bad access is at
0xefffe360.
Which means that you probably have declared about 0xfff7e130 bytes
worth of local variables in this function.
The stack should be allocating downward, so you'd expect a
negative value in r0, but it still means that he's allocating
0x81ed0 (532176) bytes on the stack. Seems a bit excessive in
terms of stack usage.
This is a good sized function, which is why I didn't post it
completly. There are two 256k local arrays in this function, plus a
number of other local variables, so that number looks about right.
On Sat, 2007-01-06 at 1:32, Lawrence Gold wrote:
It could be a stack overflow. If this is in a thread, you can try
giving
it a larger stack. Or look back in the stack crawl and see if
there are
any huge stack-based allocations (e.g., local arrays) that could be
allocated from the heap instead.
This is in a separate thread, but I have to admit I didn't do the
threading code and am not terribly familiar with threading in
general. I'll start digging and see how much stack is allocated for
this thread. In addition to the two large arrays I mentioned
before, this is the 20th call on the stack from the _pthread_body
call, and I haven't dug all the way back through them yet. I'll
take a look at those as well. I will try to convert those two
arrays to mallocs to get them allocated from the heap to see if
that clears things up.
Is there a limit on a the size of an individual frame on the stack
or is it more likely just a problem of not enough stack space being
allocated to the thread when it's created?
You might want to read <http://developer.apple.com/qa/qa2005/
qa1419.html>. It shows how to increase the stack size, but it seems
much safer to malloc large items so that you can test for success and
fail gracefully.
steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden