public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/14870] New: Missing source information for binaries compiled with clang on Linux and OS X
@ 2012-11-22  3:15 davidbalbert at gmail dot com
  2013-07-30  6:30 ` [Bug gdb/14870] " b.r.longbons at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: davidbalbert at gmail dot com @ 2012-11-22  3:15 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14870

             Bug #: 14870
           Summary: Missing source information for binaries compiled with
                    clang on Linux and OS X
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: davidbalbert@gmail.com
    Classification: Unclassified


When debugging programs compiled with clang, GDB is missing source information.
I've verified this on Linux with Clang 3.1 and GDB 7.5, and Darwin with Apple
Clang 4.1 (based on Clang 3.1) and GDB trunk and 7.5.

I've included a transcript of my debugging session on OS X. The results for
Linux were the same (I can provide them if necessary).

A few things to notice:

1) Setting a breakpoint should print line and file information, but instead
prints only the address.

2) If I were to run `next` or `step` after the breakpoint is hit, GDB responds
with "Single stepping until exit from function main, which has no line number
information." Advancing with `nexti` works fine (as do all operations that
don't deal directly with source info). After advancing five instructions, GDB
suddenly has source info and `next` and `step` start working again, however if
you re-start the program being debugged, source info is lost again.

$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

$ gdb --version
GNU gdb (GDB) 7.5.50.20121121-cvs
[snip]

$ cat hello.c
#include <stdio.h>

int main(int argc, const char *argv[])
{
        printf("Hello, world\n");
        return 0;
}

$ clang -g -O0 hello.c -o hello

$ gdb -q hello
Reading symbols from /private/tmp/gdbtest/hello...Reading symbols from
/private/tmp/gdbtest/hello.dSYM/Contents/Resources/DWARF/hello...done.
done.
(gdb) break main
Breakpoint 1 at 0x100000f14
(gdb) run
Starting program: /private/tmp/gdbtest/hello 

Breakpoint 1, 0x0000000100000f14 in main (argc=1606422622, argv=0x7fff5fbff7b0)
(gdb) nexti
0x0000000100000f18 in main (argc=1606422622, argv=0x7fff5fbff7b0)
(gdb) nexti
0x0000000100000f1f in main (argc=1606422622, argv=0x7fff5fbff7b0)
(gdb) nexti
0x0000000100000f26 in main (argc=1606422622, argv=0x7fff5fbff7b0)
(gdb) nexti
0x0000000100000f29 in main (argc=1, argv=0x7fff5fbff7b0)
(gdb) nexti
5            printf("Hello, world\n");
(gdb) next
Hello, world
6            return 0;

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/14870] Missing source information for binaries compiled with clang on Linux and OS X
  2012-11-22  3:15 [Bug gdb/14870] New: Missing source information for binaries compiled with clang on Linux and OS X davidbalbert at gmail dot com
@ 2013-07-30  6:30 ` b.r.longbons at gmail dot com
  2015-06-09  9:29 ` anton at korobeynikov dot info
  2015-06-09 17:23 ` davidbalbert at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: b.r.longbons at gmail dot com @ 2013-07-30  6:30 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14870

Ben Longbons <b.r.longbons at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b.r.longbons at gmail dot com

--- Comment #1 from Ben Longbons <b.r.longbons at gmail dot com> ---
Sounds like this clang bug: http://llvm.org/bugs/show_bug.cgi?id=13211

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/14870] Missing source information for binaries compiled with clang on Linux and OS X
  2012-11-22  3:15 [Bug gdb/14870] New: Missing source information for binaries compiled with clang on Linux and OS X davidbalbert at gmail dot com
  2013-07-30  6:30 ` [Bug gdb/14870] " b.r.longbons at gmail dot com
@ 2015-06-09  9:29 ` anton at korobeynikov dot info
  2015-06-09 17:23 ` davidbalbert at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: anton at korobeynikov dot info @ 2015-06-09  9:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=14870

Anton Korobeynikov <anton at korobeynikov dot info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anton at korobeynikov dot info

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/14870] Missing source information for binaries compiled with clang on Linux and OS X
  2012-11-22  3:15 [Bug gdb/14870] New: Missing source information for binaries compiled with clang on Linux and OS X davidbalbert at gmail dot com
  2013-07-30  6:30 ` [Bug gdb/14870] " b.r.longbons at gmail dot com
  2015-06-09  9:29 ` anton at korobeynikov dot info
@ 2015-06-09 17:23 ` davidbalbert at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: davidbalbert at gmail dot com @ 2015-06-09 17:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=14870

David Albert <davidbalbert at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from David Albert <davidbalbert at gmail dot com> ---
I believe this bug is now fixed. I just tested this on OS X 10.10.3 with Apple
Clang 6.1.0 (based on LLVM 3.6.0) and GDB 7.9.1 as well as an Ubuntu 15.04 VM
with Clang 3.6.0 and GDB 7.9 and was unable to reproduce in either instance.
I'm going to close this ticket. I've included my shell sessions below for
reference.


# OS X 10.10.3

$ clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

$ gdb --version
GNU gdb (GDB) 7.9.1
[snip]

$ cat hello.c 
#include <stdio.h>

int main(int argc, const char *argv[])
{
        printf("Hello, world\n");
        return 0;
}

$ clang -g -O0 hello.c -o hello

$ gdb -q hello
Reading symbols from hello...Reading symbols from
/private/tmp/hello/hello.dSYM/Contents/Resources/DWARF/hello...done.
done.
(gdb) break main
Breakpoint 1 at 0x100000f4d: file hello.c, line 5.
(gdb) run
Starting program: /private/tmp/hello/hello 

[snip some unrelated warnings]

Breakpoint 1, main (argc=1, argv=0x7fff5fbff368) at hello.c:5
5               printf("Hello, world\n");
(gdb) next
Hello, world
6               return 0;
(gdb) next
0x00007fff8f5b45c9 in start () from /usr/lib/system/libdyld.dylib
(gdb) next
Single stepping until exit from function start,
which has no line number information.
[Inferior 1 (process 68284) exited normally]
(gdb) 




# Ubuntu 15.04

$ clang --version
Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM
3.6.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

$ gdb --version
GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
[snip]

$ cat hello.c
#include <stdio.h>

int main(int argc, const char *argv[])
{
        printf("Hello, world\n");
        return 0;
}

$ clang -g -O0 hello.c -o hello

$ gdb -q hello
Reading symbols from hello...done.
(gdb) break main
Breakpoint 1 at 0x400510: file hello.c, line 5.
(gdb) run
Starting program: /home/vagrant/hello 

Breakpoint 1, main (argc=1, argv=0x7fffffffe618) at hello.c:5
5               printf("Hello, world\n");
(gdb) next
Hello, world
6               return 0;
(gdb) next
__libc_start_main (main=0x4004f0 <main>, argc=1, argv=0x7fffffffe618,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffe608) at libc-start.c:323
323     libc-start.c: No such file or directory.
(gdb) next
[Inferior 1 (process 5001) exited normally]
(gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-09 17:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  3:15 [Bug gdb/14870] New: Missing source information for binaries compiled with clang on Linux and OS X davidbalbert at gmail dot com
2013-07-30  6:30 ` [Bug gdb/14870] " b.r.longbons at gmail dot com
2015-06-09  9:29 ` anton at korobeynikov dot info
2015-06-09 17:23 ` davidbalbert at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).