From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10417 invoked by alias); 6 Apr 2012 12:37:24 -0000 Received: (qmail 10407 invoked by uid 22791); 6 Apr 2012 12:37:23 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Apr 2012 12:37:08 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q36CanuI010728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Apr 2012 08:36:49 -0400 Received: from host2.jankratochvil.net (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q36CagPl012958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 6 Apr 2012 08:36:45 -0400 Date: Fri, 06 Apr 2012 12:37:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Daniel Jacobowitz , iam ahal , Tom Tromey , Eli Zaretskii , palves@redhat.com, dje@google.com, pmuldoon@redhat.com, brobecker@adacore.com, asmwarrior@gmail.com Subject: Re: [commit] Handle files without DW_AT_comp_dir Message-ID: <20120406123641.GA18063@host2.jankratochvil.net> References: <20070604123615.GA22533@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070604123615.GA22533@caradoc.them.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00105.txt.bz2 http://sourceware.org/ml/gdb-patches/2007-06/msg00031.html On Mon, 04 Jun 2007 14:36:15 +0200, Daniel Jacobowitz wrote: > Joseph Myers discovered a case where GCC emits an absolute path in > DW_AT_name, no DW_AT_comp_dir, and relative pathnames in the directory > table. I see only absolute directory pathnames in .debug_line in such case. If it really was a GCC bug it should be addressed by DW_AT_producer based workaround limitation. > GDB could not handle this, and failed to locate header files > in the correct paths. > > The GCC behavior is a bug, and I think Joseph's working on a fix for > it. But it's been around for a long time, so I think it's worthwhile > to handle it in GDB. I tested the patch below on x86_64-linux and > checked it in. [...] > attr = dwarf2_attr (die, DW_AT_comp_dir, cu); > if (attr) > + comp_dir = DW_STRING (attr); > + else if (name != NULL && IS_ABSOLUTE_PATH (name)) > { > + comp_dir = ldirname (name); This is affecting the long thread of patch [patch] GDB 7.2: new feature for "backtrace" that cuts path to file (remain filename) DWARF considers the CU's DW_AT_comp_dir attribute optional. I do not see any problem with it, compilation directory is not known in such case. I do not see any testcase in this patch which would show which GCC versions under which conditions produced such buggy output. These GCC versions produce correct output, that is: cd /tmp; gcc -o ~/1 ~/1.c -g CU's DW_AT_name is absolute /root/1.c CU's DW_AT_comp_dir is not present .debug_line uses directory entry /root .debug_line uses filename entry 1.c with: GNU C 2.96 20000731 (Red Hat Linux 7.2 2.96-116.7.2) gcc (GCC) 3.3.5 gcc (GCC) 4.4.7 gcc (GCC) 4.8.0 20120406 (experimental) Without known GCC buggy versions going to revert this patch as it breaks correct DWARF. The thread "that cuts path to file (remain filename)" tries to (in some way) undo what this patch does. Thanks, Jan