GCC Plugin - Tracking memory accesses

Pedro Lopes pedro.fraiao@gmail.com
Mon Mar 13 10:23:00 GMT 2017


Hello,

I'm trying to detect the addresses of the instructions which performs
a memory access to a specific global variable.

The problem I get is that instructions' addresses are only available
after linkage, so I thought about generating "false" instructions
(like SIMD/NEON which I don use in my code) to, posteriorly in the
disassembly view, identify where this mem accesses occur and extract
the instructions' addresses.

To do what I said above, I think I need to go as low as the pattern
matching phase of GCC. My idea is to use a callback when RTL nodes are
matched to real load/store instructions to my specific variables. With
this callback I could inject the false instruction and log the real
one.

Does anyone has an idea on how can I achieve this or if this is
possible at all using the Plugin API? Do I get any advantage by
compiling and linking at the same time?

Thanks.



More information about the Gcc-help mailing list