On 09/25/2015 08:03 PM, Mohamed
Elsabagh wrote:
Was this question ever answered? Would you please
share/repost the answer, if any? In addition, is there a way to
use an InstructionAPI::_expression_ in a BPatch_snippet without
manually building the snippet(s) from the _expression_?
I think I remember answering this one; I can recap, regardless.
Generally, it will be better to let Dyninst generate the
(automatically-determined) minimum necessary code to save and
restore state, and to specify your instrumentation in higher-level
terms. This assembly sample, for instance, could be implemented with
a simple "variable = variable + 1" AST, possibly with a
BPatch_malloc to create the variable if it doesn't already exist. As
a side benefit, Dyninst would only save the flags if they were live,
reducing this to a single increment wherever possible.
There is not a way to use an InstructionAPI _expression_ directly;
depending on your use case, register snippets, effective address
snippets, and/or byte count snippets may do what you need, though.
We don't want to force Dyninst users to consider all the
assembly-level details of our instrumentation, and going through a
higher-level abstraction wherever possible will make your
development life easier.
--bw
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
_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
|
|