On Saturday, 9 January 2016 at 21:09:05 UTC, Jason Jeffory wrote:
It might, which is why I asked, seems like it would be
something trivial to do if the address of the function and
relative address of the "variable" can be gotten at "compile
time"(not sure it is possible by maybe one could write an
object parser).
There is debug line info, but good luck with most of that after
the optimizer gets through with the code.
This project provides an api for code patching. Maybe it will
help, or at least give you ideas.
http://www.dyninst.org/dyninst
I also have some interest in the ability to add arbitrary named
markers to code at compile time that could be accessed from
symbol info. I'm not interested in modifying the code, but in
using the addresses to create windows for code measurement. Our
hardware supports performance analysis limited to a specified
address range without instrumenting the code, but with optimized
code it is difficult to use.