<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hi,<br>       I 've already added you in my QQ list.<br>       <br>       I'm wondering how you wrapped your self-written function in llvm-like language so it can be recognized when<br>you call it in the pass?<br><br>        Best regards!<br><br><div>--<br><div>
<div>
<div><font color="#c0c0c0" size="2">
<div><font color="#c0c0c0"><font size="3">  <span style="COLOR: #000000">          ×£ºÃ£¡</span></font></font></div><span style="COLOR: #000000">
<div> </div>
<div><font size="3">  Õç¿­</font></div>
<div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div></div>
<div><font color="#c0c0c0"><font size="3">2012-04-09</font></font></div></span></font></div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div>
<div><font color="#c0c0c0"><font size="3">Name: Õç¿­(ZhenKai)<br>Homepage:http://www.renren.com/262729393</font></font></div>
<div><font color="#c0c0c0"><font size="3">Email: </font><a href="mailto:zhenkaixd@126.com" target="_blank" _listener="1901"><font color="#0066cc" size="3">zhenkaixd@126.com</font></a><font size="3"> or <a href="mailto:846227103@qq.com">846227103@qq.com</a></font></font></div>
<div><font color="#c0c0c0" size="3">TEL: 15810729006(Beijing)<br>Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084.</font></div></div></div></div><div id="divNeteaseMailCard"></div><br>At 2012-04-09 12:45:23,15102925731 <zhenkaixd@126.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"> Hi, <br>I also want to insert a function call at the interested area, and do something in the called function which is written by myself.<br><br>First you need to determine the  INSTRUCTION where you want to insert your function to. you can do this by writing some code like,<br>for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI)<br>                                for(BasicBlock::iterator II = BI->begin(),IE = BI->end();II != IE; ++II)<br>                                 <br>then use the insertBefore or insertAfter function.<br><br>I wonder how is your "instrumented code" like. Because I can insert a function that is wrapped in the module, but<br>the function may be wrapped so poorly that when I run the pass, the programme broke down.<br><br><br><div><br></div><br><br><div>--<br><div>
<div>
<div><font color="#c0c0c0" size="2">
<div><font color="#c0c0c0"><font size="3">  <span style="COLOR: #000000">          ×£ºÃ£¡</span></font></font></div><span style="COLOR: #000000">
<div> </div>
<div><font size="3">  Õç¿­</font></div>
<div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div></div>
<div><font color="#c0c0c0"><font size="3">2012-04-09</font></font></div></span></font></div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div>
<div><font color="#c0c0c0"><font size="3">Name: Õç¿­(ZhenKai)<br>Homepage:http://www.renren.com/262729393</font></font></div>
<div><font color="#c0c0c0"><font size="3">Email: </font><a href="mailto:zhenkaixd@126.com" target="_blank" _listener="1901"><font color="#0066cc" size="3">zhenkaixd@126.com</font></a><font size="3"> or <a href="mailto:846227103@qq.com">846227103@qq.com</a></font></font></div>
<div><font color="#c0c0c0" size="3">TEL: 15810729006(Beijing)<br>Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084.</font></div></div></div></div><div></div><br>At 2012-04-09 11:27:26,Zhoujinguo <<a href="mailto:zhoujinguo1988@yahoo.cn">zhoujinguo1988@yahoo.cn</a>> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">Hi,<div><br></div><div>I am instrumenting a piece of code. I want to insert a function call at the interested area, and do something in the called function which is written by myself.</div><div><br></div><div>I have succeed on implementing the pass, and getting the instrmented code. However, I am not sure where to put this function, and what kind of linkage I should use for this function.</div><div><br></div><div>Currently I use External linkage which is implemented as following:</div><div><br></div><div>LLVMContext& context=M.getContext();</div><div>FunctionType* FT=FunctionType::get(Type::getInt32Ty(context),false);</div><div>Function* F=Function::Create(FT,Function::ExternalLinkage,"myFunctionCall",&M);</div><div><br></div><div>Is it OK? And also, where should I put the function "int myFunctionCall()"?</div><div><br></div><div>Thank you very much. I
 am expecting for your reply.</div><div><br></div><div>Regards</div><div>Andy</div></td></tr></tbody></table></blockquote></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>