I have gotten it. After going through the previous disccusion, 
Mono.cecil.rock has sovled the problem.Please see
http://stackoverflow.com/questions/7267480/does-mono-cecil-take-care-of-branches-etc-location,
 
it works for me, THANKS.

在 2016年2月26日星期五 UTC+8上午12:02:20,[email protected]写道:
>
> Recently, I used the Mono.cecil to modify another assembly, exactly my aim 
> is to instrumentate that program. So I use the ILProcessor.InsertBefore to 
> add some new instructions before each ot instructions of objected assembly 
> to show its execution trace. At begining, it works well, BUT, when the 
> program contains the instruction, br.s, it goes wrong. I dump the original 
> and modified IL codes, and find the modified IL codes gived a wrong 
> destination or miss the destination. For example, there is an instruction 
> like this:
> IL_000c: brtrue.s IL_001b
> Obviously, its destination is IL_001b
> after modified the assembly, its destination should be IL_01c4 since I add 
> new instructions, but actually, the program missed it or sometimes it gives 
> a wrong place(I haven't figured out which code leads to the different 
> situations, but usually it will miss the destination.)
> I don't know if it is a bug of the ILProcessor.InsertBefore or I have made 
> some mistake?
> Really appreciate your precious advice or discussion. Thank you.
>

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to