Hello,

I'm working on an LLVM pass that I'm trying to debug it with LLDB, but I'm running into a few problems. I'm generally following this turtorial [1] but I run my pass with opt instead from inside clang. So I run:

$ lldb ../build/bin/opt
(lldb) break set --name MyPass::runOnModule
(lldb) run -load ../build/lib/LLVMMyPass.so -MyPass test.ll

My runOnModule is just:

bool MyPass::runOnModule(Module &M) {
 for (auto& F : M) {
    for (auto& BB : F) {
      for (auto& I : BB) {
        I.dump(); // step to here
      }
    }
  }
}

It hits the breakpoint correctly then I single step into the inner most loop. Then I try the following LLDB commands:

"e I.dump()" gives me what I expect (it prints the LLVM instruction).

"e BB.dump()" gives me:
error: no member named 'dump' in 'llvm::BasicBlock'
error: 1 errors parsing expression

...but llvm::BasicBlock definitely does have a member named dump.

"e M.dump()" gives me:
lldb: /home/carr27/dataconf-workspace2/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2883: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `D && "Cannot get layout of forward declarations!"' failed.
./lldb.sh: line 1:  6736 Aborted                 (core dumped)

I don't know exactly what is going on, but it seems like LLDB doesn't know about some of the LLVM classes. Can anyone give me a pointer as to what might be wrong? Having a good debug work flow would be a big help in writing my pass!

Thanks,
Scott Carr
PhD Student
Purdue University Computer Science

[1]http://homes.cs.washington.edu/~bholt/posts/llvm-debugging.html
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to