Hi all, I currently have a problem setting up gdb with clang/llvm. I configured llvm/clang (trunk) with: ../llvm/configure --prefix=PROJECT_DIR/install_debug --enable-expensive-checks --enable-targets=host --enable-debug-runtime --enable-shared Now, when I invoke gdb with the freshly built clang it basically works. I can look at backtraces, set breakpoints and so on but breakpoints are never triggered. For instance: I put the line llvm::errs() << "hello\n"; in - let's say - Foo.cpp, line 1234 Now, I do in gdb b Foo.cpp:1234 r Then clang is run, I can see the output of "hello" but the execution doesn't break at this line. Any ideas? -- Roland
Hi Roland, Is Foo.cpp a Clang source file? If so, make sure you run the compiler itself with "clang -cc1", not the compiler *driver* with bare "clang". See here ( http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-March/020275.html ) for a similar question. -Matt On 04/13/2012 04:19 PM, Roland Leißa wrote:> Hi all, > > I currently have a problem setting up gdb with clang/llvm. > > I configured llvm/clang (trunk) with: > ../llvm/configure --prefix=PROJECT_DIR/install_debug --enable-expensive-checks --enable-targets=host --enable-debug-runtime --enable-shared > > Now, when I invoke gdb with the freshly built clang it basically works. I can look at backtraces, set breakpoints and so on but breakpoints are never triggered. > For instance: > > I put the line > llvm::errs()<< "hello\n"; > in - let's say - Foo.cpp, line 1234 > > Now, I do in gdb > b Foo.cpp:1234 > r > > Then clang is run, I can see the output of "hello" but the execution doesn't break at this line. > > Any ideas? >
On Apr 13, 2012, at 2:19 PM, Roland Leißa <leissa at cs.uni-saarland.de> wrote:> Hi all, > > I currently have a problem setting up gdb with clang/llvm. > > I configured llvm/clang (trunk) with: > ../llvm/configure --prefix=PROJECT_DIR/install_debug --enable-expensive-checks --enable-targets=host --enable-debug-runtime --enable-shared > > Now, when I invoke gdb with the freshly built clang it basically works. I can look at backtraces, set breakpoints and so on but breakpoints are never triggered. > For instance: > > I put the line > llvm::errs() << "hello\n"; > in - let's say - Foo.cpp, line 1234 > > Now, I do in gdb > b Foo.cpp:1234 > r > > Then clang is run, I can see the output of "hello" but the execution doesn't break at this line. > > Any ideas?What host compiler are you using? This looks like you're trying to build llvm and debug it and it works just fine for me with a host compiler of either gcc or clang. Also, what's your make command? -eric
thanks, that did the trick. -- Roland ----- Original Message -----> From: "Matt Johnson" <johnso87 at crhc.illinois.edu> > To: "Roland Leißa" <leissa at cs.uni-saarland.de> > Cc: LLVMdev at cs.uiuc.edu > Sent: Freitag, 13. April 2012 14:34:05 > Subject: Re: [LLVMdev] gdb + clang/llvm > > Hi Roland, > Is Foo.cpp a Clang source file? If so, make sure you run the > compiler > itself with "clang -cc1", not the compiler *driver* with bare > "clang". > See here ( > http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-March/020275.html ) > for > a similar question. > -Matt > > On 04/13/2012 04:19 PM, Roland Leißa wrote: > > Hi all, > > > > I currently have a problem setting up gdb with clang/llvm. > > > > I configured llvm/clang (trunk) with: > > ../llvm/configure --prefix=PROJECT_DIR/install_debug > > --enable-expensive-checks --enable-targets=host > > --enable-debug-runtime --enable-shared > > > > Now, when I invoke gdb with the freshly built clang it basically > > works. I can look at backtraces, set breakpoints and so on but > > breakpoints are never triggered. > > For instance: > > > > I put the line > > llvm::errs()<< "hello\n"; > > in - let's say - Foo.cpp, line 1234 > > > > Now, I do in gdb > > b Foo.cpp:1234 > > r > > > > Then clang is run, I can see the output of "hello" but the > > execution doesn't break at this line. > > > > Any ideas? > > >
Hi Eric, I'm using gcc. My make command is make -j9 as mentioned earlier, the -cc1 switch did the trick for me. Thanks for helping out. -- Roland ----- Original Message -----> From: "Eric Christopher" <echristo at apple.com> > To: "Roland Leißa" <leissa at cs.uni-saarland.de> > Cc: LLVMdev at cs.uiuc.edu > Sent: Freitag, 13. April 2012 14:39:53 > Subject: Re: [LLVMdev] gdb + clang/llvm > > > On Apr 13, 2012, at 2:19 PM, Roland Leißa <leissa at cs.uni-saarland.de> > wrote: > > > Hi all, > > > > I currently have a problem setting up gdb with clang/llvm. > > > > I configured llvm/clang (trunk) with: > > ../llvm/configure --prefix=PROJECT_DIR/install_debug > > --enable-expensive-checks --enable-targets=host > > --enable-debug-runtime --enable-shared > > > > Now, when I invoke gdb with the freshly built clang it basically > > works. I can look at backtraces, set breakpoints and so on but > > breakpoints are never triggered. > > For instance: > > > > I put the line > > llvm::errs() << "hello\n"; > > in - let's say - Foo.cpp, line 1234 > > > > Now, I do in gdb > > b Foo.cpp:1234 > > r > > > > Then clang is run, I can see the output of "hello" but the > > execution doesn't break at this line. > > > > Any ideas? > > What host compiler are you using? This looks like you're trying to > build llvm and debug it and it works just fine for me with a host > compiler of either gcc or clang. > > Also, what's your make command? > > -eric