• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Zombies don't get enabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zombies don't get enabled


  • Subject: Re: Zombies don't get enabled
  • From: Chris Suter <email@hidden>
  • Date: Fri, 6 Jul 2007 18:59:31 +1000


On 06/07/2007, at 6:06 PM, Timothy J. Wood wrote:


On Jul 5, 2007, at 12:28 PM, Giovanni Donelli wrote:

I was using 5... because the venerable Aaron Hillegass said so in
http://www.mactech.com/articles/mactech/Vol.21/21.04/DebuggingBugs/ index.html


Anyway I have now set CFZombieLevel to 65553 and the app crashes.

However the stack is contains only:
0 objc_msgSend

That's all, not very usable. Any idea on how having a better backtrace?

This can be due to crashing in the middle of message dispatch while objc_msgSend
has extra stuff pushed on the stack. For example, objc_msgSend looks like this:


(gdb) x/55i objc_msgSend
0x90a594b0 <objc_msgSend>:      mov    4(%esp),êx
0x90a594b4 <objc_msgSend+4>:    test   êx,êx
0x90a594b6 <objc_msgSend+6>:    je     0x90a59510 <objc_msgSend+96>
0x90a594b8 <objc_msgSend+8>:    mov    0(êx),êx
0x90a594bb <objc_msgSend+11>:   mov    8(%esp),ìx
0x90a594bf <objc_msgSend+15>:   push   íi
0x90a594c0 <objc_msgSend+16>:   mov    32(êx),êx
0x90a594c3 <objc_msgSend+19>:   push   %esi
....

This is grabbing out the isa, looking into the method cache, etc. With a zombie,
the 'mov's can end up crashing.


If you set a breakpoint on this and single step through it with instruction display
turned on:


disp/i $pc
b *0x90a594b0
c
... wait for breakpoint ...
si
si
... and do on ...

Then you can get a backtrace before executing the first 'push', but after it, you'll get:

(gdb) bt
#0  0x90a594c0 in objc_msgSend ()

It used to be possible to then adjust the stack pointer in gdb to counteract this
offset so the debugger could get a backtrace. Sadly, this is (sometimes) busted
in the 10.4 version of gdb and you'll get:


(gdb) set $pc = 0xb03a3da8+4
Value being assigned to is no longer active.

Strangely, I just had this *work* once while typing this up and haven't gotten it
to work again since...


If you can get it to work, you just have to figure out how many extra words are
are on the stack and add for for each to get them off. An alternative is to write
your own stack walker (pretty easy on x86) that takes an address as input (avoiding
the bug with setting $sp).


Luckily, this isn't something one has to do every day since this is fiddly. Of course,
if zombies worked as normal on CF objects, this wouldn't even be necessary =(



-tim

This happened to me recently.

I wasn't bothered about the immediate caller, but I easily got the preceding callers by doing the following (on x86):

p ((void **)$ebp)[1]

and then further back:

p (*(void ***)$ebp)[1]
p (**(void ****)$ebp)[1]

and so on. You won't necessarily see every caller in the backtrace (depends whether the frame pointer is set) but it was sufficient for me.

- Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Zombies don't get enabled (From: "Giovanni Donelli" <email@hidden>)
 >Re: Zombies don't get enabled (From: "Sean McBride" <email@hidden>)
 >Re: Zombies don't get enabled (From: "Giovanni Donelli" <email@hidden>)
 >Re: Zombies don't get enabled (From: "Timothy J. Wood" <email@hidden>)

  • Prev by Date: Re: How to support an Application with International languages.
  • Next by Date: C++ Mac UI Developer - Cocoa & PowerPlant, Contract Job
  • Previous by thread: Re: Zombies don't get enabled
  • Next by thread: Custom NSMenuItems on the fly?
  • Index(es):
    • Date
    • Thread