Remix.run Logo
gabriela_c an hour ago

This doesn't sound like a particularly difficult problem for some scenarios.

It's definitely convoluted as it comes to memory obtained from the stack, but for heap allocations, a debugger could trace the returns of the allocator APIs, use that as a beginning point of some data's lifetime, and then trace any access to that address, and then gather the high-level info on the address of the reader/writer.

Global variables should also be trivial (fairly so) as you'll just need to track memory accesses to their address.

(Of course, further work is required to actually apply this.)

For variables on the stack, or registers, though, you'll possibly need heuristics which account for reusage of memory/variables, and maybe maintain a strong association with the thread this is happening in (for both the thread's allocated stack and the thread context), etc.