Set malloc_error_break in Xcode 4

后端 未结 3 1911
独厮守ぢ
独厮守ぢ 2021-01-03 22:17

How do I set a malloc_error_break in Xcode4? Also, I seem to be getting this error malloc: *** error for object 0x4d80814: incorrect checksum for freed object - object

相关标签:
3条回答
  • 2021-01-03 22:24

    This is what the breakpoints button looks like:

    enter image description here

    And this is the plus sign at the bottom left hand corner:

    enter image description here

    Man, it took me a while to find both of them!

    0 讨论(0)
  • 2021-01-03 22:27

    I think this is how its done.

    • Click on the breakpoints navigator (looks like a sign post) on the top of the left bar on XCode 4.
    • On the bottom left hand corner there is a plus sign. Click on it.
    • Add Symbolic Breakpoint and set malloc_error_break as the symbol.
    • Click the next breakpoint button ( it looks like |> ) and is on the bottom panel. It will take you to the line that is causing the error.

    Usually it is caused by objects being created as subobjects of other objects that don't exist yet (ie SKPhysicsBody being created before its spritenode exists)

    0 讨论(0)
  • 2021-01-03 22:27

    You can also do it directly through the gdb command window.

    break malloc_error_break
    

    or in lldb:

    breakpoint set -n malloc_error_break
    

    To open the debugger command window in XCode 4, click the middle button above "View" in the top right corner, then click the middle button in the top right corner of the bottom debugging pane that just opened. See also Input to console in Xcode 4

    0 讨论(0)
提交回复
热议问题