How Can I Find Out Where My Pointer Is Getting Changed?

Full Problem Description: My pointer, ptr, should be pointing to a specific memory block, but it’s pointing somewhere else. How can I find out where it’s getting changed?

Set a data breakpoint on ptr. This breakpoint causes the program to halt when the address pointed to by ptr changes. If you set the breakpoint on *ptr instead, the breakpoint halts the program when data at the location pointed to by ptr changes. For more information, see Break when the location value of a pointer changes.