I’m debugging a memory issue in C. The piece of memory I’m accessing has been accidentally free():d by somebody else’s module. Is there a way in gdb to get notified when a piece of memory is free():d?
I’m debugging a memory issue in C. The piece of memory I’m accessing has
Share
Suppose your libc’s
free‘s argument is calledmem.Then, you can print out everything that is freed:
Now, every time anyone frees anything, you will get a little printout (you can omit
cif you want it to stop every timefreeoccurs):Or, if you already know what memory address you are interested in, use
condto break when someone tries tofreethat address: