Debugging my pass with llvm

Hi,

I have a pass named MyAna in directory /llvm-obj/lib/myana
When i do make it compiles succesfully but when I try to load it I get a segmentation fault, ie when I run

opt -load ../llvm-obj/Release/lib/MyAna.so -my-ana t.bc

I get segmentation fault.
I used bugpoint as :

bugpoint opt -load ../llvm-obj/Release/lib/MyAna.so -my-ana t.bc

I found out that some condition is failing in a file. But I am not able to determine the flow. ie I want to backtrace from this point.
How can I do it?

I tried using gdb but I am not able to compile my program with -g option.

It will be great if someone can help.

regards,
Ambika

ambika wrote:

Hi,

I have a pass named MyAna in directory /llvm-obj/lib/myana
When i do make it compiles succesfully but when I try to load it I get a segmentation fault, ie when I run

opt -load ../llvm-obj/Release/lib/MyAna.so -my-ana t.bc

I get segmentation fault.
I used bugpoint as :

bugpoint opt -load ../llvm-obj/Release/lib/MyAna.so -my-ana t.bc

I found out that some condition is failing in a file. But I am not able to determine the flow. ie I want to backtrace from this point.
How can I do it?

I tried using gdb but I am not able to compile my program with -g option.
  

I believe if you compile your pass using "make ENABLE_OPTIMIZED=0", the LLVM build system will build your pass with debugging symbols. You should then be able to run opt with gdb and see where your pass is crashing.

-- John T.