[LLVMdev] clang with -emit-llvm
dmitry at kernelgen.org
Tue Jan 1 12:19:33 PST 2013
Are you attaching debugger to clang? In this case - clang is just a driver,
that invokes other executables for each individual step of compilation.
Most likely you should debug clang's cc1:
marcusmae at M17xR4:~/rpmbuild/BUILD/llvm/build$ gdb clang
(gdb) b llvm::BasicBlock::Create
Breakpoint 1 at 0x9f0965: file
(gdb) r *-cc1* -S test.c -emit-llvm -o -
Starting program: /home/marcusmae/rpmbuild/CHROOT/opt/kernelgen/bin/clang
-cc1 -S test.c -emit-llvm -o -
[Thread debugging using libthread_db enabled]
Using host libthread_db library
Breakpoint 1, llvm::BasicBlock::Create (Context=..., Name=...,
104 return new BasicBlock(Context, Name, Parent, InsertBefore);
2013/1/1 Somenath Chakraborty <some.chak at gmail.com>
> I have just started using llvm. I was trying to debug how *clang*generates IR for very simple C testcases (few assignments
> and if-condsitions).
> To get a hold on the basic functions, I put some break points on following
> functions but debugger *didn't stop*:
> llvm::BinaryOperator::CreateAdd (design has binary op)
> llvm::BranchInst::Create (design has if/else)
> and quite a few
> The command line I used :
> *clang -S test.c -emit-llvm -o - *
> Here I could see the entire LLVM code generated and shown in stdout. I am
> almost sure that I have missed something very basic. Can anyone please help
> me in setting *proper breakpoints* so that I can debug through the entire
> IR generation phase.
> Sorry for asking this basic question.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev