Here is a list of break points to put in ~/.gdbinit that are really helpful in debugging memory problems:
这是要放入~/的断点列表。在调试内存问题时非常有用的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
1 个解决方案
#1
2
The title of this indicates that you are asking how to set these in ~/.gdbinit but the first line of your detailed question indicates that you have the above in ~/.gdbinit?
这个标题表明您正在询问如何在~/中设置这些值。gdbinit但你的详细问题的第一行表明你在~/.gdbinit中有上述的?
What, exactly, is the problem, then?
那么,问题到底是什么呢?
I use something pretty similar and it works fine, but since much of this is fairly intrusive behavioral changes, I put it in a separate file (~/.gdbmem) and then source it as needed.
我使用了一些非常相似的东西,并且它工作得很好,但是由于大部分都是相当侵入性的行为更改,所以我将它放在一个单独的文件(~/.gdbmem)中,然后根据需要对其进行源代码。
My ~/.gdbinit is limited almost entirely to macro definitions that don't otherwise change the debugging session. Thus, the default behavior is minimal impact on debugging and I can source one of 2 additional files full of gdb config goop to automatically apply some relatively intrusive additional configuration to the environment.
我的~ /。gdbinit几乎完全局限于宏定义,否则不会更改调试会话。因此,默认行为对调试的影响很小,我可以从gdb配置goop的两个附加文件中找到一个,以自动地对环境应用一些相对侵入性的附加配置。
#1
2
The title of this indicates that you are asking how to set these in ~/.gdbinit but the first line of your detailed question indicates that you have the above in ~/.gdbinit?
这个标题表明您正在询问如何在~/中设置这些值。gdbinit但你的详细问题的第一行表明你在~/.gdbinit中有上述的?
What, exactly, is the problem, then?
那么,问题到底是什么呢?
I use something pretty similar and it works fine, but since much of this is fairly intrusive behavioral changes, I put it in a separate file (~/.gdbmem) and then source it as needed.
我使用了一些非常相似的东西,并且它工作得很好,但是由于大部分都是相当侵入性的行为更改,所以我将它放在一个单独的文件(~/.gdbmem)中,然后根据需要对其进行源代码。
My ~/.gdbinit is limited almost entirely to macro definitions that don't otherwise change the debugging session. Thus, the default behavior is minimal impact on debugging and I can source one of 2 additional files full of gdb config goop to automatically apply some relatively intrusive additional configuration to the environment.
我的~ /。gdbinit几乎完全局限于宏定义,否则不会更改调试会话。因此,默认行为对调试的影响很小,我可以从gdb配置goop的两个附加文件中找到一个,以自动地对环境应用一些相对侵入性的附加配置。