On 2011-02-23 23:04, Bruce Evans wrote:
Hard-coded -g is a style bug, but I wonder if this works even with -g in DEBUG_FLAGS.
Yes, it works, I tested it. The issue is that bsd.lib.mk contains this fragment: .if defined(WITH_CTF) .undef NO_CTF .endif .if defined(DEBUG_FLAGS) CFLAGS+= ${DEBUG_FLAGS} .if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "") CTFFLAGS+= -g .endif .endif E.g. if you put '-g' in CFLAGS, this fragment will fail to add the required '-g to CTFFLAGS. On the other hand, if you add '-g' to DEBUG_FLAGS, '-g' will be added to both CFLAGS and CTFFLAGS.
This may be related to the bug that -g is broken if the compilation is via an intermediate asm file: "cc -g -o foo foo.c" != "cc -g -S foo.c; cc -g -o foo foo.s" The former works, but the latter gives: % Script started on Wed Feb 23 21:47:19 2011 % % pts/0:bde@ref9-i386:~/r> gdb foo % 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"...Dwarf Error: Could not find abbrev number 47 [in module /dumpster/home/bde/r/foo] % % (gdb) q % pts/0:bde@ref9-i386:~/r> exit
Seems to work fine here (tree as of r218915, so with binutils 2.17.50): $ cc -g -S hello.c $ cc -g hello.s -o hello $ 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 } (gdb)
Perhaps you already fixed this by importing newer binutils.
Apparently, yes. Maybe ref9-i386 should be updated again. :) _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"