Ok, so there is a general segfault. You can use a tool for detecting seg fault, but better try to use the "return false" statement in your pass. I assume you have your code into runOnFunction or runOnModule. So check with return false where the program crashes. identify the statement that is causing the segfault. The most common segfaults in LLVM are due<br>
1. reference a NULL pointer...put if statements that check if the structures that you have are NULL<br>2. check your boundaries or arrays, if for example the number of operands is 2 and you have getOperand(2), here it is. <br>
<br><div class="gmail_quote">On Tue, Mar 5, 2013 at 12:31 PM, Anshul Garg <span dir="ltr"><<a href="mailto:gargaa24@gmail.com" target="_blank">gargaa24@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Thanks for reply.<br>Ya i posted same question on that also.<br><span style="color:rgb(68,68,68);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;font-size:13px;line-height:17px;background-color:rgb(250,250,250)">Error at the time of running opt -load Error is: a@ubuntu:~/Desktop$ ./myscript llvm[0]: Compiling printFunc.cpp for Release+Asserts build (PIC) llvm[0]: Linking Release+Asserts Loadable Module Ass1Pri.so 0 opt 0x0854449b Stack dump: 0. Program arguments: opt -load /home/anshul/llvm/llvm-3.2/Release+Asserts/lib/Ass1Pri.so -anshul_insert 1. Running pass 'test function exist' on module '<stdin>'. ./myscript: line 6: 10726 Segmentation fault (core dumped) opt -load /home/anshul/llvm/llvm-3.2/Release+Asserts/lib/Ass1Pri.so -anshul_insert < a.bc > b1.bc 'main' function not found in module<br>
</span>this is the error</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 5, 2013 at 12:52 AM, Alexandru Ionut Diaconescu <span dir="ltr"><<a href="mailto:alexandruionutdiaconescu@gmail.com" target="_blank">alexandruionutdiaconescu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br><br>I think you have the same question on stackoverflow. Please send the error that you have.<br><br><div class="gmail_quote">
On Tue, Mar 5, 2013 at 7:02 AM, Anshul <span dir="ltr"><<a href="mailto:gargaa24@gmail.com" target="_blank">gargaa24@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">HI,<br>
I am creating a pass that will pass loaded value by load instruction to an<br>
external function.<br>
I don't know how to do it.Please Help.<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><span><font color="#888888"><br>
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><font style="color:rgb(153,153,153)">Best regards,</font><br style="color:rgb(153,153,153)"><font style="color:rgb(153,153,153)">Alexandru Ionut Diaconescu</font><br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><font style="background-color:rgb(255,255,255);color:rgb(153,153,153)">Best regards,</font><br style="background-color:rgb(255,255,255);color:rgb(153,153,153)">
<font style="background-color:rgb(255,255,255);color:rgb(153,153,153)">Alexandru Ionut Diaconescu</font><br>