Devchandra L Meetei | 3 Aug 2012 07:50
Picon

How to debug a code compiled by clang

I am unable to use gdb on code compiled by clang/clang++ with -g options enabled.
when I do break main/start, gdb says file not found.
Is it by design? If so, How to debug binaries compiled by clang.

--regards
--Dev

_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
David Blaikie | 3 Aug 2012 07:55
Picon

Re: How to debug a code compiled by clang

On Thu, Aug 2, 2012 at 10:50 PM, Devchandra L Meetei
<dlmeetei@...> wrote:
> I am unable to use gdb on code compiled by clang/clang++ with -g options
> enabled.
> when I do break main/start, gdb says file not found.
> Is it by design? If so, How to debug binaries compiled by clang.

Same way you would with files compiled by gcc. Are you sure you have
the right file name for the binary?
Devchandra L Meetei | 3 Aug 2012 08:23
Picon

Re: How to debug a code compiled by clang

The error message seen is this

[deleisha <at> deleisha pegasus]$ gdb cimserver
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/deleisha/CodeSpace/pegasus/pkg/bin/cimserver...done.
(gdb) start
Temporary breakpoint 1 at 0x4049fd: file cimserver.cpp, line 486.
Starting program: /home/deleisha/CodeSpace/pegasus/pkg/bin/cimserver
[Thread debugging using libthread_db enabled]

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdda8) at cimserver.cpp:486
486    cimserver.cpp: No such file or directory.
    in cimserver.cpp
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.3.x86_64 keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.9-33.el6.x86_64 libcom_err-1.41.12-12.el6.x86_64 libgcc-4.4.6-4.el6.x86_64 libselinux-2.0.94-5.3.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64 openssl-1.0.0-20.el6_2.5.x86_64 zlib-1.2.3-27.el6.x86_64
(gdb)


On Fri, Aug 3, 2012 at 11:25 AM, David Blaikie <dblaikie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
On Thu, Aug 2, 2012 at 10:50 PM, Devchandra L Meetei <dlmeetei <at> gmail.com> wrote:
> I am unable to use gdb on code compiled by clang/clang++ with -g options
> enabled.
> when I do break main/start, gdb says file not found.
> Is it by design? If so, How to debug binaries compiled by clang.

Same way you would with files compiled by gcc. Are you sure you have
the right file name for the binary?

_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Konstantin Tokarev | 3 Aug 2012 10:12
Picon
Favicon

Re: How to debug a code compiled by clang


> The error message seen is this
> 
> [deleisha <at> deleisha pegasus]$ gdb cimserver
> GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> 
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> 
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /home/deleisha/CodeSpace/pegasus/pkg/bin/cimserver...done.
> 
> (gdb) start
> Temporary breakpoint 1 at 0x4049fd: file cimserver.cpp, line 486.
> Starting program: /home/deleisha/CodeSpace/pegasus/pkg/bin/cimserver
> [Thread debugging using libthread_db enabled]
> 
> Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdda8) at cimserver.cpp:486
> 
> 486 cimserver.cpp: No such file or directory.
> in cimserver.cpp
> Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.3.x86_64
keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.9-33.el6.x86_64 libcom_err-1.41.12-12.el6.x86_64
libgcc-4.4.6-4.el6.x86_64 libselinux-2.0.94-5.3.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64
nss-softokn-freebl-3.12.9-11.el6.x86_64 openssl-1.0.0-20.el6_2.5.x86_64 zlib-1.2.3-27.el6.x86_64
> 
> (gdb)
> 

I've seen similar issue, however it disappeared when I updated gdb to 7.4.1

 -- 
Regards,
Konstantin

Gmane