[LLVMdev] Problem executing code with lli...

Evan Cheng evan.cheng at apple.com
Thu Oct 30 08:59:31 PDT 2008


I bet this is due to one of the followings: 1) a bug in your code, 2)  
mismatched llvm-gcc and lli, 3) none of the above. :-)

You ought to build a debug llvm and run lli under gdb to understand  
why LoadValueFromMemory is crashing.

Evan

On Oct 29, 2008, at 7:21 PM, Karhu, Abhinav R wrote:

>
> Hi all,
> I am facing new problem with lli now. I am having a sample code in  
> which I am doing malloc for two variables. If I compile the code  
> with normal gcc the program runs without any warning of any sorts.  
> If I compile the program to convert it into a bytecode file and then  
> run it through lli it segfaults and the program aborts. This is the  
> stack trace after execution.
> lli((anonymous namespace)::PrintStackTrace()+0x1f)[0x67cc7f]
> lli((anonymous namespace)::SignalHandler(int)+0x172)[0x67cf72]
> /lib64/tls/libc.so.6[0x2a95e4b300]
> lli(llvm::ExecutionEngine::LoadValueFromMemory(llvm::GenericValue*,  
> llvm::Type const*)+0x182)[0x4be4f2]
> lli(llvm::InstVisitor<llvm::Interpreter,  
> void>::visit(llvm::Instruction&)+0x1fe)[0x4b648e]
> lli(llvm::Interpreter::run()+0x2b)[0x4b179b]
> lli(llvm::Interpreter::runFunction(llvm::Function*,  
> std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> >  
> const&)+0xac)[0x4b490c]
> lli(llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,  
> std::vector<std::basic_string<char, std::char_traits<char>,  
> std::allocator<char> >, std::allocator<std::basic_string<char,  
> std::char_traits<char>, std::allocator<char> > > > const&, char  
> const* const*)+0xa5)[0x4bf295]
> lli(main+0x170)[0x4aaac0]
> /lib64/tls/libc.so.6(__libc_start_main+0xdb)[0x2a95e3940b]
> lli(__gxx_personality_v0+0xda)[0x4aa87a]
> Segmentation fault
>
> I am also testing to see if the malloc was successful or not and it  
> shows that malloc was successful.
>
> The part where is static memory is allocated runs fine(I am putting  
> a print for that value). Why is the program failing in  
> LoadValueFromMemory?
>
> Please some light on this issue.
>
> Thanks
>
>
> -- 
> Abhinav Karhu
> MS Computer Science
> Georgia Institute of Technology
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list