[DynInst_API:] Examples for constructing instrumentation code snippets


Date: Mon, 24 Aug 2015 20:09:30 -0400
From: Shuai Wang <wangshuai901@xxxxxxxxx>
Subject: [DynInst_API:] Examples for constructing instrumentation code snippets
Dear list,


I am trying to insert some code like this to the beginning of every basic block:

  push %eax
  lahf
  inc 0x7000000
  sahf
  pop %eax

I suppose I need to construct each instruction into some BPatch_* class instance (such as BPatch_arithExpr). However, after searching into DynInst's document, I still don't knowÂ
how to represent those instructions into BPatch_* class. I can only find three class's definition, BPatch_constExpr, BPatch_FuncCallExpr and BPatch_arithExpr and related example code.

Could anyone give me some guide on how to define BPatch_* instances associated with my instrumentation code sequence? Or which document should I refer to?Â

Sincerely,
Shuai
[← Prev in Thread] Current Thread [Next in Thread→]