On 2017-03-13 11:23 +0100, Pedro Lopes wrote: > I'm trying to detect the addresses of the instructions which performs > a memory access to a specific global variable. I think we can just $ cat test.c int x, y; int foo() { int t = x; x = y; y = t; return 0; } int main() {} $ cc test.c $ objdump -d | grep "\<[xy]\>" 40047a: 8b 05 2c 04 20 00 mov 0x20042c(%rip),%eax # 6008ac <x> 400483: 8b 05 27 04 20 00 mov 0x200427(%rip),%eax # 6008b0 <y> 400489: 89 05 1d 04 20 00 mov %eax,0x20041d(%rip) # 6008ac <x> 400492: 89 05 18 04 20 00 mov %eax,0x200418(%rip) # 6008b0 <y> Inserting instructions seems overkill. It's even enough to implement hooks. -- Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University