Memory read failed for 0x0 in a game loop, need a proper debugging method

My program crashes somewhere during a game loop at variable times independent of input events. I am looking for a suitable debugging method that I can use to find the problem in my code. When I fire up my lldb debugger against the executable, run it without set breakpoints, I get the following output after some time, when the program crashes:

Process 86823 stopped
* thread #2, queue = 'com.apple.libdispatch-manager', stop reason = EXC_BAD_ACCESS (code=1, address=0x1)
    frame #0: 0x0000000000000001
error: memory read failed for 0x0
Target 0: (smoke) stopped.

This tells me, that I am trying to read something from a bad memory address. The issue is, I am not sure how to pinpoint that in my code, as this may or may not occur in a given cycle of a game loop. So just setting a breakpoint is problematic. What is the proper debugging method in this case?



Read more here: https://stackoverflow.com/questions/65713332/memory-read-failed-for-0x0-in-a-game-loop-need-a-proper-debugging-method

Content Attribution

This content was originally published by dekrypto at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: