ブレークポイントは、Xcodeで無効ます:EXC_BAD_ACCESSをするときNSZombieEnabled == YES

StackOverflow https://stackoverflow.com/questions/1393788

質問

  それはXCodeの4+ため、それが有用考慮しないでくださいXCodeの3のために頼まれたとして、

この質問はこれまで、古いされています。 =)

<時間>

私のアプリは(一見)ランダムイベントでクラッシュします。だから、私は私のiPhoneのアプリケーションをデバッグするNSZombieEnabledを追加したいです。私は自分の目標をクローン化し、元のターゲットと同じにそのInfo.plistファイルを設定し、YESにNSZombieEnabledを設定します。

私はアプリを実行すると、

は、それは...

のスタックトレースでクラッシュ
#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
NSZombieEnabledがYESに設定されている場合、

これはのみ発生します。それが設定されていない場合、アプリはちょうど走る(と異なる時間にクラッシュする)

私は次のようにブレークポイントを追加したい「 - [_ NSZombie methodSignatureForSelector:]」と他の人が、彼らはデバッグ時に無効ます。私はそれをオン、オフ「レイジーロードシンボル」との両方の方法を試してみました。

私はまた、

に私の〜/ .gdbinitファイルを設定しようとしました
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
コンソールでこの結果を得た。

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/
なぜ私のブレークポイントが無効のですか?

役に立ちましたか?

解決

私は同じ結果とよく、このアプローチをしようとしてきました。私の理解では、NSZombieブレークポイントは、ヒョウやSnow Leopardで、もはや有効であることではありません。

いくつかの代替案ます:

1)obj_msg_sendのEAXレジスタをダンプします。私は個人的にこれを試していないが、私は、件名に、多くの記事を見つけました: どのようにiPhoneアプリのためにのみリリースのターゲット上で発生デバッグEXC_BAD_ACCESSに?する

2)使用情報のmalloc履歴。シミュレータではうまく動作しますが、私は、デバイスのオフログを取得少し運を持っていた。<のhref =「http://coderslike.us/2009/05/05/finding-freeddeallocated-instances-of-objects/」 rel = "nofollowをnoreferrer">の検索はこちら

オブジェクトの割り当て解除インスタンスを解放しました

3)はおそらく行うための最善のことは、楽器でアプリを実行しています。 NSZombieモードは、デバイス上で利用できないことに注意してください。これは助けになることがあります。 iPhoneのメモリデバッグNSZombieする

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top