I want to trace the mutex variables in my rust program(e.g. which mutex called lock() and unlock() methods). And I think there're static methods.
1 Answer
In instruction
instrumentation function, you can check if the instruction is indeed a call instruction. Something like -
if (INS_IsCall(ins))
{
if (INS_IsDirectCall(ins))
{
Then get the name of the routine:
if (RTN_FindNameByAddress(INS_DirectBranchOrCallTargetAddress(ins))
== "yourfavouritefun")
do something;
}
}
And you can obviously log the caller.
VOID Instruction(INS ins, VOID *v) {
ADDRINT insaddress = INS_Address(ins);
if (RTN_FindNameByAddress(insaddress))
do something more;
....
-
So how to find the callers of
instruction
(i.e., how to distinguish different callers of the sameinstruction
)?– roo jackCommented Jun 20, 2023 at 10:32
call
instruction and see if the call target is your function of choice?