Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2011 23:31:48 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r218984 - head/lib/librt
Message-ID:  <4D658AD4.9020602@FreeBSD.org>
In-Reply-To: <20110224090558.E1571@besplex.bde.org>
References:  <201102232117.p1NLHcuE011679@svn.freebsd.org> <20110224084812.F1571@besplex.bde.org> <20110224090558.E1571@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2011-02-23 23:13, Bruce Evans wrote:
> Now found it easly using gcc -v.  gcc -c -v foo.c produces "... /usr/bin/as
> -o foo.o /var/tmp/whatever.s", but gcc -c -v foo.s produces "... /usr/bin/as
> -gdwarf2 -o foo.o foo.s".  gcc's generation of -gdwarf2 is inconsistent
> with itself.  Do we use a nonstandard not-gdwarf2 option for the usual case
> but forget to change this for asm files?

I don't think so, but there is simply no need to pass '-g' in the gcc
invocation that assembles and links the .s file, since the debug info is
already embedded in the .s file itself.

E.g. the following works just fine:

$ cc -g -S hello.c
$ cc -o hello hello.s
$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900033), not stripped
$ gdb ./hello
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) list
1       #include <stdio.h>
2
3       int main(void)
4       {
5               puts("Hello World!");
6
7               return 0;
8       }

Apparently, if you use --gdwarf2 with GNU as 2.15, it messes up the
already existing debug info.  It looks like 2.17.50 has no such problem,
though.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D658AD4.9020602>