tags:

views:

210

answers:

1

Is it possible to debug an llvm pass using gdb? I couldn't find any docs on the llvm site.

+2  A: 

Yes. Build LLVM in non-release mode (the default). It takes a bit longer than a release build, but you can use gdb to debug the resulting object file.

One note of caution: I had to upgrade my Linux box to 3GB of memory to make LLVM debug mode link times reasonable.

Richard Pennington
But can I debug an llvm pass? LLVM passes are usually run using opt so I don't know how to use gdb to run it. Can you tell me the command?
You can run e.g. "gdb /usr/local/bin/opt" and type "run <your command line>".
Richard Pennington
http://llvm.org/docs/WritingAnLLVMPass.html#debughints
name