GDB on LLVM-clang

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

GDB on LLVM-clang

Vassil Vassilev via cfe-dev
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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDB on LLVM-clang

Vassil Vassilev via cfe-dev

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 <[hidden email]> On Behalf Of Gousemoodhin Nadaf via cfe-dev
Sent: Wednesday, June 17, 2020 1:22 PM
To: [hidden email]
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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDB on LLVM-clang

Vassil Vassilev via cfe-dev
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
<[hidden email]> 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 <[hidden email]> On Behalf Of Gousemoodhin Nadaf via cfe-dev
> Sent: Wednesday, June 17, 2020 1:22 PM
> To: [hidden email]
> 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
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDB on LLVM-clang

Vassil Vassilev via cfe-dev
I don't think this is necessary anymore!  We aren't forking the cc1 in a separate process anymore I think.

-----Original Message-----
From: David Blaikie <[hidden email]>
Sent: Wednesday, June 17, 2020 1:38 PM
To: Keane, Erich <[hidden email]>
Cc: [hidden email]
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 <[hidden email]> 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 <[hidden email]> On Behalf Of
> Gousemoodhin Nadaf via cfe-dev
> Sent: Wednesday, June 17, 2020 1:22 PM
> To: [hidden email]
> 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
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDB on LLVM-clang

Vassil Vassilev via cfe-dev
On Wed, Jun 17, 2020 at 1:39 PM Keane, Erich <[hidden email]> 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 <[hidden email]>
> Sent: Wednesday, June 17, 2020 1:38 PM
> To: Keane, Erich <[hidden email]>
> Cc: [hidden email]
> 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 <[hidden email]> 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 <[hidden email]> On Behalf Of
> > Gousemoodhin Nadaf via cfe-dev
> > Sent: Wednesday, June 17, 2020 1:22 PM
> > To: [hidden email]
> > 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
> > [hidden email]
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDB on LLVM-clang

Vassil Vassilev via cfe-dev
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 <[hidden email]> De la part de David Blaikie via cfe-dev
Envoyé : June 17, 2020 5:12 PM
À : Keane, Erich <[hidden email]>
Cc : [hidden email]
Objet : Re: [cfe-dev] GDB on LLVM-clang

On Wed, Jun 17, 2020 at 1:39 PM Keane, Erich <[hidden email]> 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 <[hidden email]>
> Sent: Wednesday, June 17, 2020 1:38 PM
> To: Keane, Erich <[hidden email]>
> Cc: [hidden email]
> 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 <[hidden email]> 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 <[hidden email]> On Behalf Of
> > Gousemoodhin Nadaf via cfe-dev
> > Sent: Wednesday, June 17, 2020 1:22 PM
> > To: [hidden email]
> > 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
> > [hidden email]
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDB on LLVM-clang

Vassil Vassilev via cfe-dev
Huh, neat - didn't realize. Saves me some steps when debugging from
now on, then. Thanks for letting me know!

On Wed, Jun 17, 2020 at 2:34 PM Alexandre Ganea
<[hidden email]> wrote:

>
> 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 <[hidden email]> De la part de David Blaikie via cfe-dev
> Envoyé : June 17, 2020 5:12 PM
> À : Keane, Erich <[hidden email]>
> Cc : [hidden email]
> Objet : Re: [cfe-dev] GDB on LLVM-clang
>
> On Wed, Jun 17, 2020 at 1:39 PM Keane, Erich <[hidden email]> 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 <[hidden email]>
> > Sent: Wednesday, June 17, 2020 1:38 PM
> > To: Keane, Erich <[hidden email]>
> > Cc: [hidden email]
> > 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 <[hidden email]> 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 <[hidden email]> On Behalf Of
> > > Gousemoodhin Nadaf via cfe-dev
> > > Sent: Wednesday, June 17, 2020 1:22 PM
> > > To: [hidden email]
> > > 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
> > > [hidden email]
> > > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev