[DynInst_API:] Adding raw bytes before function


Date: Mon, 29 Aug 2016 16:30:41 +0200
From: Matthias Fischer <fischmat@xxxxxxxxx>
Subject: [DynInst_API:] Adding raw bytes before function
Hi,

I'd like to write information to a binary (or process) for each function
in way that allows access from an indirect callsite with minimal overhead.

My current idea is to write raw bytes before the actual function code,
so the bytes are stored at [callsite_target - offset, callsite_target[.
Then I can access the information as a BPatch_variableExpr using
BPatch_dynamicTargetExpr to calculate the address. However, I cannot
simply write the bytes at this address without possibly overwriting
existing instructions - the code before the function would have to be
relocated.

So far, I have not found a way to write raw bytes at a specific address
with relocation of possible overwritten instructions. Is that even
possible with dyninstAPI or is there another way to achieve my initial goal?

Thanks,
Matthias


[← Prev in Thread] Current Thread [Next in Thread→]