I am currently working on a project wherI am trying to get the virtual address information of each basic block in the object file.
My current practice is as follows:
(1) Insert a call instruction into each basic block to invoke the callback function, with the address as the instrumentation point. (This step can also be ignored.)
(2) Get the Machine Basic Block Symbol (MCSymbol) of each basic block.
(3) Now, I hope to obtain addresses of instrumentation points through the recorded basic block symbols, then allocate a memory in the generated object file and emit the addresses into the memory.
But I don’t know how to do the third step? Can anyone offer some advice?