[DynInst_API:] modify register contents in dyninst


Date: Sat, 30 Dec 2017 19:48:45 -0500
From: Rohit Poduri <poduri.rohit@xxxxxxxxx>
Subject: [DynInst_API:] modify register contents in dyninst
Hi everyone,
I am using dyninst to do some static instrumentation by patching instructions and inserting function call instrumentation snippets on x86_64 . The task I am currently trying to do requires manipulation of a register. The sequence of my task is as follows-

1) Search for the appropriate point in the binary
2) Make a function call which returns some value
3) Put this value into a particular register (like rax)

I am currently implementing it using some wrapper function which calls the fucntion in step 2 and then has an assembly statement to put that value into the register. However I am not getting the value as I am expecting, as the next instruction after my point can see the value I moved into rax. I suspect this may be due to the save/restore register process of dyninst.

Is there any way I can get my task done. I am searching for 2 methods-

1) A high level API in dyninst which can do this task
2) Alter the save restore code so that it dosen't modify the contents of the register I am altering in step 3

If method 2 is feasible, I would like to know which section of the source code saves and restores the registers.

Any help would be appreciated.

Thanks,
Rohit
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] modify register contents in dyninst, Rohit Poduri <=