[LLVMdev] LLVM load instruction query

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Tue Mar 5 03:39:22 PST 2013

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
1. reference a NULL pointer...put if statements that check if the
structures that you have are NULL
2. check your boundaries or arrays, if for example the number of operands
is 2 and you have getOperand(2), here it is.

On Tue, Mar 5, 2013 at 12:31 PM, Anshul Garg <gargaa24 at gmail.com> wrote:

> Thanks for reply.
> Ya i posted same question on that also.
> Error at the time of running opt -load Error is: a at 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
> this is the error
> On Tue, Mar 5, 2013 at 12:52 AM, Alexandru Ionut Diaconescu <
> alexandruionutdiaconescu at gmail.com> wrote:
>> Hi
>> I think you have the same question on stackoverflow. Please send the
>> error that you have.
>> On Tue, Mar 5, 2013 at 7:02 AM, Anshul <gargaa24 at gmail.com> wrote:
>>> HI,
>>> I am creating a pass that will pass loaded value by load instruction to
>>> an
>>> external function.
>>> I don't know how to do it.Please Help.
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> --
>> Best regards,
>> Alexandru Ionut Diaconescu

Best regards,
Alexandru Ionut Diaconescu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130305/6b9ce8ea/attachment.html>

More information about the llvm-dev mailing list