From nobody@FreeBSD.org  Thu Aug 21 21:44:18 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A69DD106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Aug 2008 21:44:18 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 90D688FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Aug 2008 21:44:18 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m7LLiI6j002191
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Aug 2008 21:44:18 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m7LLiIkF002190;
	Thu, 21 Aug 2008 21:44:18 GMT
	(envelope-from nobody)
Message-Id: <200808212144.m7LLiIkF002190@www.freebsd.org>
Date: Thu, 21 Aug 2008 21:44:18 GMT
From: Pippijn van Steenhoven <pip88nl@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Compiling, assembling and linking code with debugging results in unusable debug information
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: gerald@FreeBSD.org

>Number:         126721
>Category:       bin
>Synopsis:       gcc(1) g++(1) Compiling, assembling and linking code with debugging results in unusable debug information
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 21 21:50:01 UTC 2008
>Closed-Date:    Sun Mar 10 18:32:13 UTC 2013
>Last-Modified:  Sun Mar 10 18:32:13 UTC 2013
>Originator:     Pippijn van Steenhoven
>Release:        7.0-RELEASE-p2
>Organization:
Xinutec Research Labs
>Environment:
gryphus ~> uname -a
FreeBSD gryphus.example.net 7.0-RELEASE-p2 FreeBSD 7.0-RELEASE-p2 #0: Wed Jun 18 07:33:20 UTC 2008     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

gryphus ~> gcc -v
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719  [FreeBSD]

gryphus ~> gdb -v
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".
>Description:
gcc generates broken debugging information if the compiling and assembling step are split. This bug is absolutely critical, because I am currently fighting a bug in my code and can't resume my tracing. The bug only happens on freebsd.
>How-To-Repeat:
gryphus ~> cat test.cc
#include <cstdio>

int
main ()
{
  int volatile *vi = 0;
  std::printf ("%d\n", *vi);
  return 0;
}
gryphus ~> g++ -g -S test.cc -o test.s ; g++ -g -c test.s -o test.o ; g++ -g test.o -o test ; gdb ./test
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 46 [in module /crypt/home/pippijn/test]

(gdb) r
Starting program: /crypt/home/pippijn/test 
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x080484cb in ?? ()
(gdb) bt
#0  0x080484cb in ?? ()
#1  0x00000000 in ?? ()
#2  0x28286da0 in __tsd_lock () from /lib/libc.so.7
#3  0xbfbfec28 in ?? ()
#4  0x00000001 in ?? ()
#5  0xbfbfec68 in ?? ()
#6  0x00000000 in ?? ()
#7  0xbfbfec38 in ?? ()
#8  0x28245a19 in atexit () from /lib/libc.so.7
#9  0x08048439 in ?? ()
#10 0x00000000 in ?? ()
#11 0x00000000 in ?? ()
#12 0xbfbfec58 in ?? ()
#13 0x08048439 in ?? ()
#14 0x00000001 in ?? ()
#15 0xbfbfec60 in ?? ()
#16 0xbfbfec68 in ?? ()
#17 0x00000000 in ?? ()
#18 0xbfbfec40 in ?? ()
#19 0xbfbfec5c in ?? ()
#20 0x00000000 in ?? ()
#21 0x00000001 in ?? ()
#22 0xbfbfed50 in ?? ()
#23 0x00000000 in ?? ()
#24 0xbfbfed69 in ?? ()
#25 0xbfbfed75 in ?? ()
#26 0xbfbfed7e in ?? ()
#27 0xbfbfed8b in ?? ()
#28 0xbfbfed9b in ?? ()
#29 0xbfbfedae in ?? ()
#30 0xbfbfedc5 in ?? ()
#31 0xbfbfee33 in ?? ()
#32 0xbfbfee3d in ?? ()
#33 0xbfbfee53 in ?? ()
#34 0xbfbfee68 in ?? ()
---Type <return> to continue, or q <return> to quit---
>Fix:


>Release-Note:
>Audit-Trail:

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, pip88nl@gmail.com
Cc:  
Subject: Re: bin/126721: gcc(1) g++(1) Compiling, assembling and linking
 code with debugging results in unusable debug information
Date: Thu, 17 Feb 2011 14:56:37 +0000

 Using -gstabs (or -gstabs+) appears to produce valid debugging
 information, but the line information doesn't appear correct:
 
 (gdb) r
 Starting program: /usr/home/brucec/test
 
 Program received signal SIGSEGV, Segmentation fault.
 0x080484eb in main () at test.s:7
 7               .stabs  "complex long double:t(0,3)=R3;24;0;",128,0,0,0
 (gdb) bt
 #0  0x080484eb in main () at test.s:7
 
 -- 
 Bruce Cran
State-Changed-From-To: open->closed 
State-Changed-By: gerald 
State-Changed-When: Sun Mar 10 18:28:48 UTC 2013 
State-Changed-Why:  
Over the course of the last couple of upstream releases, GCC has 
significantly improved debug info generation and specifically the 
ability to fully and properly track variables. 

The FreeBSD project decided not to update the system version of 
GCC to a newer version than GCC 4.2.1 due to concerns about the 
GPLv3, but in the FreeBSD Ports Collection you will find all 
current version of GCC.  Specifically, lang/gcc (GCC 4.6) or 
lang/gcc47 should meet your needs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126721 
>Unformatted:
