[cfe-dev] GDB on LLVM-clang

Alexandre Ganea via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 17 14:34:55 PDT 2020


Forking is disabled on all platforms by default. The cc1 invocation will run in the calling process, unless you say -fno-integrated-cc1.

However if the clang driver creates more than one job, at the moment that disables -fintegrated-cc1, as per https://reviews.llvm.org/rG9c9e46d786d0581079e5018e550cbe187a1ec219
For example:

	> clang-cl /c a.cpp b.cpp c.cpp

This is mostly because we need to cleanup in-between jobs, but disabling "-disable-free" isn’t covered by tests. Something along the lines of LLD_IN_TEST needs probably be done for Clang, and then perhaps we could reconsider https://reviews.llvm.org/D74447


-----Message d'origine-----
De : cfe-dev <cfe-dev-bounces at lists.llvm.org> De la part de David Blaikie via cfe-dev
Envoyé : June 17, 2020 5:12 PM
À : Keane, Erich <erich.keane at intel.com>
Cc : cfe-dev at lists.llvm.org
Objet : Re: [cfe-dev] GDB on LLVM-clang

On Wed, Jun 17, 2020 at 1:39 PM Keane, Erich <erich.keane at intel.com> wrote:
>
> I don't think this is necessary anymore!  We aren't forking the cc1 in a separate process anymore I think.

I /think/ that change is only on Windows - I /think/ Clang on Linux still runs a separate driver and frontend?

>
> -----Original Message-----
> From: David Blaikie <dblaikie at gmail.com>
> Sent: Wednesday, June 17, 2020 1:38 PM
> To: Keane, Erich <erich.keane at intel.com>
> Cc: cfe-dev at lists.llvm.org
> Subject: Re: [cfe-dev] GDB on LLVM-clang
>
> yep, just like any other program/debugger
>
> You do have to be careful about debugging the clang driver versus the clang frontend - either run clang -### and run the resulting -cc1 command line under the debugger, or set "fork-follow-mode child" to have the debugger follow the frontend process from the driver process.
> (I usually do the former)
>
> On Wed, Jun 17, 2020 at 1:25 PM Keane, Erich via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> >
> > I’m not sure we have a guide anywhere, but its just like debugging any other program with GDB.  Make sure you’ve built with debug symbols, and have at it.  There are some tips (many things have a .dump method that prints some interesting info, and we also have some pretty-printers for gdb in llvm/utils/gdb-scripts/prettyprinters.py), but otherwise you just use GDB like normal.
> >
> >
> >
> > From: cfe-dev <cfe-dev-bounces at lists.llvm.org> On Behalf Of 
> > Gousemoodhin Nadaf via cfe-dev
> > Sent: Wednesday, June 17, 2020 1:22 PM
> > To: cfe-dev at lists.llvm.org
> > Subject: [cfe-dev] GDB on LLVM-clang
> >
> >
> >
> > Hello Team,
> > I would like to know that Is it possible to debug LLVM-clang with GDB?
> > If yes, please point out the steps or wiki page.
> >
> > Regards,
> > Nadaf.
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


More information about the cfe-dev mailing list