From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20082 invoked by alias); 12 Mar 2007 20:33:53 -0000 Received: (qmail 20072 invoked by uid 22791); 12 Mar 2007 20:33:53 -0000 X-Spam-Check-By: sourceware.org Received: from hq.tensilica.com (HELO mailapp.tensilica.com) (65.205.227.29) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 12 Mar 2007 20:33:48 +0000 Received: from localhost ([127.0.0.1]) by mailapp.tensilica.com with esmtp (Exim 4.34) id 1HQrDG-0002CD-4t; Mon, 12 Mar 2007 12:33:46 -0800 Received: from mailapp.tensilica.com ([127.0.0.1]) by localhost (mailapp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08214-02; Mon, 12 Mar 2007 12:33:45 -0800 (PST) Received: from maxim_fc5.hq.tensilica.com ([192.168.11.68]) by mailapp.tensilica.com with esmtp (Exim 4.34) id 1HQrDF-0002C6-Nt; Mon, 12 Mar 2007 12:33:45 -0800 Message-ID: <45F5B929.3050406@hq.tensilica.com> Date: Mon, 12 Mar 2007 20:33:00 -0000 From: Maxim Grigoriev User-Agent: Thunderbird 1.5.0.9 (X11/20070102) MIME-Version: 1.0 To: gdb@sourceware.org, Bob Wilson , Marc Gauthier Subject: GDB (mis)behavior depends on DWARF DW_TAG_compile_unit data Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00169.txt.bz2 Hello members, I would like to hear your opinion on whether what I see is a compiler problem or a GDB misbehavior. GDB session goes wrong, if my test case is compiled using a base name as a source file. Everything is fine, when an absolute path name is used instead. I checked several compilers ( all GCCs ). They seem to be consistent in generating DWARF DW_TAG_compile_unit information in this case. Anyway, even if GDB treats this situation as a bad DWARF data it doesn't look decent to output misleading error messages, like 'No line 6 in file "test.c".', when there actually is the line number 6, and the test case was compiled with "-g". * * * * * Here come the details: 1) The GDB version is: GNU gdb 6.6.50.20070312-cvs 2) The test program is: 001: extern int printf(const char *fmt,...); 002: 003: int main() 004: { 005: printf("Hello, World !\n"); 006: printf("Let's make DWARF consistent across all the tools !\n"); 007: } 3) It was compiled with two different command line options: gcc -g test.c -o basename_used.exe gcc -g /home/maxim/W/BadgerPass/FSF_QUESTION/test.c -o full_path_used.exe 4) Freshly build GDB was run with the command file CMD_FILE: break main break test.c:6 quit -- Good case: >>> gdb full_path_used.exe --command=CMD_FILE [ . . . . . ] Breakpoint 1 at 0x40000970: file /home/maxim/W/BadgerPass/FSF_QUESTION/test.c, line 4. Breakpoint 2 at 0x4000097c: file /home/maxim/W/BadgerPass/FSF_QUESTION/test.c, line 6. -- Bad case: >>> gdb basename_used.exe --command=CMD_FILE [ . . . . . ] Breakpoint 1 at 0x40000970: file /home/maxim/W/BadgerPass/FSF_QUESTION/test.c, line 4. CMD_FILE:2: Error in sourced command file: No line 6 in file "test.c". 5) The difference in DWARF info is : -- Good case, full_path_used.exe: [ . . . . ] <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_name : /home/maxim/W/BadgerPass/FSF_QUESTION/test.c DW_AT_comp_dir : /home/maxim/W/BadgerPass/FSF_QUESTION -- Bad case, basename_used.exe: [ . . . . ] <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_name : test.c DW_AT_comp_dir : /home/maxim/W/BadgerPass/FSF_QUESTION Thanks in advance for any input on this, -- Maxim