Frage

  

Diese Frage weit veraltet ist, wie es für XCode 3. gefragt wurde Bitte halte es nicht für sinnvoll für XCode 4+. =)


Meine app stürzt bei (scheinbar) zufällige Ereignisse. So wollte ich NSZombieEnabled debuggen mein iPhone-Anwendung hinzuzufügen. Ich geklont mein Ziel und legen Sie seinen Info.plist auf das gleiche wie das ursprüngliche Ziel und setze NSZombieEnabled auf YES.

Wenn ich die app laufen, stürzt es mit einem Stack-Trace ...

#0  0x3025db0c in ___forwarding___ ()
#1  0x30239db2 in __forwarding_prep_0___ ()
#2  0x304f5105 in NSPopAutoreleasePool ()
#3  0x308ee452 in _UIApplicationHandleEvent ()
#4  0x32031425 in PurpleEventCallback ()
#5  0x30235253 in CFRunLoopRunSpecific ()
#6  0x302343c8 in CFRunLoopRunInMode ()
#7  0x308e6209 in -[UIApplication _run] ()
#8  0x308eef81 in UIApplicationMain ()
#9  0x000023ef in main (argc=1, argv=0xbffff0bc) at /Users/tomen/Documents/MIB-Sprint4/main.m:26

Dies geschieht nur, wenn NSZombieEnabled auf YES gesetzt ist. Wenn es nicht gesetzt ist, nur die App läuft (und stürzt zu verschiedenen Zeiten)

Ich wollte Haltepunkte hinzufügen, wie „- [_ NSZombie methodSignatureForSelector:]“ und andere, aber sie bekommen während Debugging deaktiviert. Ich habe versucht, es in beiden Richtungen mit „Load Symbolen träge“ ein- und ausgeschaltet werden.

Ich habe auch versucht, meine ~ / .gdbinit-Datei

einstellen
fb -[NSException raise]
fb -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
fb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]

#define NSZombies
# this will give you help messages.  Set to NO to turn them off.
set env MallocHelp=YES
# might also be set in launch arguments.
set env NSZombieEnabled=YES
set env NSDeallocateZombies=NO
set env MallocCheckHeapEach=100000
set env MallocCheckHeapStart=100000
set env MallocScribble=YES
set env MallocGuardEdges=YES
set env MallocCheckHeapAbort=1

set env CFZombie 5

fb -[_NSZombie init]
fb -[_NSZombie retainCount]
fb -[_NSZombie retain]
fb -[_NSZombie release]
fb -[_NSZombie autorelease]
fb -[_NSZombie methodSignatureForSelector:]
fb -[_NSZombie respondsToSelector:]
fb -[_NSZombie forwardInvocation:]
fb -[_NSZombie class]
fb -[_NSZombie dealloc]

fb szone_error

, die dieses Ergebnis in der Konsole ergeben:

The Debugger has exited with status 0.
[Session started at 2009-09-08 13:48:40 +0200.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
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 "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
Pending breakpoint 1 - "-[NSException raise]" resolved
Pending breakpoint 2 - "-[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]" resolved
Pending breakpoint 3 - "-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]" resolved
Pending breakpoint 14 - "szone_error" resolved
Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/tomen/Library/Application Support/iPhone Simulator/User/Applications/F77D9D82-0B34-4B8D-9076-AE883A2714F4/MIB.app/MIB', process 279.
Re-enabling shared library breakpoint 1
Re-enabling shared library breakpoint 2
Re-enabling shared library breakpoint 3
Re-enabling shared library breakpoint 14
Re-enabling shared library breakpoint 16
Re-enabling shared library breakpoint 17
Re-enabling shared library breakpoint 18
warning: Couldn't raise load state for requested objfile: "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" for breakpoint 1/

warning: Couldn't raise load state for requested objfile: "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation" for breakpoint 2/

warning: Couldn't raise load state for requested objfile: "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation" for breakpoint 3/

Warum werden meine Haltepunkte deaktiviert werden?

War es hilfreich?

Lösung

Ich habe versucht, diesen Ansatz als auch mit den gleichen Ergebnissen. Mein Verständnis ist, dass NSZombie Haltepunkte sind nicht mehr gültig in Leopard und Snow Leopard.

Einige Alternativen:

1) Dump die EAX-Register auf obj_msg_send. Ich habe nicht persönlich diese hat man versucht, aber ich fand zu diesem Thema viele Beiträge: Wie zu debuggen EXC_BAD_ACCESS, die nur auf Release Ziel für ein iPhone app?

tritt auf

2) Verwenden Sie info malloc-Geschichte. Funktioniert gut im Simulator, aber ich habe aus der Vorrichtung etwas Glück bekommen Sie die Protokolle hat. Finding befreit deallokierten Instanzen von Objekten

3) Wahrscheinlich das Beste, was zu tun ist, Ihre Anwendung in Instruments laufen. Beachten Sie, dass NSZombie-Modus auf dem Gerät nicht verfügbar ist. Dies kann hilfreich sein: iPhone Speicher debug NSZombie

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top