[LLVMdev] Segmentation fault 'cause of accessing function arguments
Xiaolong Tang
xiaolong.snake at gmail.com
Wed Jun 9 08:02:33 PDT 2010
> Hi all,
>
> I am experimenting to run a pass inherited from CallGraphSCCPass. In
> the pass, I iterate all functions in a SCC. In each iteration, I
> access all arguments of a function in the following way:
>
> Function::arg_iterator PI = fun->arg_begin(), PE = fun->arg_end();
> ...
>
> I have no trouble with building. However, I am troubled with
> "segmentation fault" when I run the pass via:
>
> opt -load ../../build-llvm/Debug/lib/LLVMRCI.dylib -rci < a.out.bc
>
> The error message is attached later.
>
> So, am I wrong with accessing function arguments?
> What are the possible causes?
Uh, I think the reason is the presence of a special node in the
callgraph. The special node has a null address, and is printed out as
an "Indirect CallGraph node".
Does anyone have the same issue? Again, I am very curious about the
presence of the special node in the callgraph. Any hint?
Thanks,
Xiaolong
> PS: ERROR MESSAGE
>
> Identify an SCC. The number of function: 1
> 0 opt 0x0000000100426a32 PrintStackTrace(void*) + 38
> 1 opt 0x0000000100426e8c SignalHandler(int) + 254
> 2 libSystem.B.dylib 0x00007fff82a9880a _sigtramp + 26
> 3 LLVMRCI.dylib 0x000000010148e6ae (anonymous namespace)::RCI::ID + 16462
> 4 opt 0x0000000100010e89 llvm::Function::hasLazyArguments() const + 21
> 5 opt 0x00000001000114e3 llvm::Function::CheckLazyArguments() const + 21
> 6 opt 0x000000010013a421 llvm::Function::arg_begin() + 21
> 7 LLVMRCI.dylib 0x0000000101483e02 (anonymous namespace)::RCI::runOnSCC(llvm::CallGraphSCC&) + 184
> 8 opt 0x0000000100205686 (anonymous namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&, llvm::CallGraph&, bool&, bool&) + 230
> 9 opt 0x0000000100205abe (anonymous namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&, llvm::CallGraph&, bool&) + 488
> 10 opt 0x0000000100205d60 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) + 352
> 11 opt 0x00000001003bc064 llvm::MPPassManager::runOnModule(llvm::Module&) + 384
> 12 opt 0x00000001003bd80d llvm::PassManagerImpl::run(llvm::Module&) + 111
> 13 opt 0x00000001003bd86f llvm::PassManager::run(llvm::Module&) + 33
> 14 opt 0x0000000100066d3b main + 3420
> 15 opt 0x000000010005c1c4 start + 52
> 16 opt 0x0000000000000004 start + 4294590068
> Stack dump:
> 0. Program arguments: opt -load ../../build-llvm/Debug/lib/LLVMRCI.dylib -rci
> 1. Running pass 'CallGraph Pass Manager' on module '<stdin>'.
> Segmentation fault
More information about the llvm-dev
mailing list