[llvm-dev] a stack dump in llvm pass (LLVM 3.7.0)
Q Z via llvm-dev
llvm-dev at lists.llvm.org
Wed Oct 28 20:51:53 PDT 2015
I wrote a llvm pass:
using namespace llvm;namespace{
struct CountOperands : public FunctionPass
{
std::map<std::string,int> opCounter;
static char ID;
/*Constructor*/
CountOperands() : FunctionPass(ID) {}
/*RunOnFuntion Method*/
virtual bool runOnFunction( Function &F)
{
errs() << "Function Name: " << F.getName() << "\n";
/*Reading the OpCode in the function*/
for (Function::iterator b = F.begin(), be = F.end(); b != be; ++b)
{
errs() << "##########Works fine "<<"\n";
for (BasicBlock::iterator i = b.begin(), ie = b.end(); i != ie; ++i)
{
errs()<<"##########Works fine till here "<<"\n";
if(BranchInst *pBranchInst=dyn_cast<BranchInst>(i))
{//the problem is here,there is a stack dump?why?
}
.....
whem I run the pass,the command is :
opt -load XX/XX.so <hello.bc> /dev/null
then I got a stack dump finally.why? could somebody help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151029/06e1544c/attachment.html>
More information about the llvm-dev
mailing list