I'm writing a code in which the parent process shares a shared memory with a child process.
- I would like to be able to let the father replace the content of the shared memory, right before the child reads a value.
I know that I can set a hardware breakpoint like in the example below, but this is not working, I guess because there some permission errors, but even with sudo I can't make it work. In any case, the system is limited in the number of breakpoints, so I can't set a breakpoint for every single address.
- Also, I know that after a breakpoint is triggered, it disappears. I would like to keep it permanent.
What can I do?
A hardware breakpoint is what I would need, however, hardware breakpoints are limited in number (usually 4 in total), then it is not possible to cover a large range of addresses. The alternative is to use a watchpoint like in GDB, which performs single steps in the code until it finds the correct addresses.