From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28915 invoked by alias); 26 Nov 2001 12:16:28 -0000 Mailing-List: contact gdb-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 28871 invoked from network); 26 Nov 2001 12:16:20 -0000 Received: from unknown (HELO wiprom2mx2.wipro.com) (203.197.164.42) by sourceware.cygnus.com with SMTP; 26 Nov 2001 12:16:20 -0000 Received: from m2vwall3.wipro.com (m2vwall3.wipro.com [164.164.29.237]) by wiprom2mx2.wipro.com (8.11.3/8.11.3) with SMTP id fAQCG1f15064 for ; Mon, 26 Nov 2001 17:46:01 +0530 (IST) Received: from 192.168.2.18 by m2vwall3.wipro.com (InterScan E-Mail VirusWall NT); Mon, 26 Nov 2001 17:45:22 +0530 Received: from m2vwall3.wipro.com ([164.164.29.237]) by sarovar.mail.wipro.com (Netscape Messaging Server 4.15) with SMTP id GNE4Z200.TBJ for ; Mon, 26 Nov 2001 10:10:14 +0530 Received: from 192.168.223.18 by m2vwall3.wipro.com (InterScan E-Mail VirusWall NT); Mon, 26 Nov 2001 10:10:01 +0530 Received: from wipro.com ([127.0.0.1]) by platinum.mail.wipro.com (Netscape Messaging Server 4.15) with ESMTP id GNE4YJ00.UC4; Mon, 26 Nov 2001 10:09:55 +0530 From: "debashis mahata" To: Eli Zaretskii Cc: Dan Nicolaescu , gdb@sources.redhat.com Message-ID: <70beb6f093.6f09370beb@wipro.com> Date: Wed, 14 Nov 2001 00:50:00 -0000 X-Mailer: Netscape Webmail MIME-Version: 1.0 Content-Language: en Subject: Re: GDB 5.1 on Solaris 2.8 X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg00151.txt.bz2 Message-ID: <20011114005000.uyHecycduzXqPdhdZkuMYA2bB_NSdGWackfIA59GYS0@z> Hi all, I also hit this problem. Probably this is a problem with "Sun WorkShop 6 update 2 C 5.3" compiler. This compiler does not generate the last back slash ("/") in the first N_SO stab that represents the directory name. The second N_SO is actually represents the source file name. GDB identify the directory name using the last '/' as an indicator. For the program $pwd /h/mahatad/DBG/GDB $cat a.c int main (void) { int a = 1; } $ The N_SO stab entries are - With "Sun WorkShop 6 update 2 C 5.3" - "/h/mahatad/DBG/GDB" ,64, 0, 0, 0 "a.c" ,64, 0, 3, 0 With the old version of compiler - "/h/mahatad/DBG/GDB/" ,64, 0, 0, 0 "a.c" ,64, 0, 3, 0 It is clear that new compiler does not generate the last '/' in first N_SO stab. Because of that GDB takes "/h/mahatad/DBG/GDB" as a file name. The corresponding code is in the partial-stab.h - case N_SO: { .... p = strrchr (namestring, '/'); if (p && *(p + 1) == '\000') continue; /* Simply ignore directory name SOs */ } GDB is not ignoring the directory name. This requires a fix. Most probably another fix is required in dbxread.c (function - process_one_symbol()) for N_SO case. The corresponding code - case N_SO: ..... start_stabs (); start_symtab (name, NULL, valu); record_debugformat ("stabs"); break; Here, the 'name' is again a directory name without the last back slash. I have put some fix for these two places in my local GDB source. After the fix - $cc -V cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15 $cc -g -xs a.c $/vob/opnpde/solaris-sparc/debug/package/00.00.00.00/bin/gdb a.out GNU gdb 4.18 + 02.00.01.00 (sparc64-sun-solaris2.7), Copyright 1998 Free Software Foundation, Inc... (gdb) list 1 int 2 main (void) { 3 int a = 1; 4 } (gdb) I found another problem with this compiler. The structures are suppose to end with two consecutive ';'. GDB logic depends upon that. But this compiler generate only one ';'. Just for an example - For the structure struct node{ int i; char c; }; With "Sun WorkShop 6 update 2 C 5.3" - "node:T(0,21)=s8i:(0,3),0,32;c:(0,1),32,8;" ,80, 0, 8, 0 With the old version of compiler - "node:T(0,21)=s8i:(0,3),0,32;c:(0,1),32,8;;" ,80, 0, 8, 0 Again it is clear the new compiler does not generate the last ';' and this will break the GDB logic in read_struct_fields() function (file: stabsread.c). Thanks, debashis mahata ----- Original Message ----- From: Eli Zaretskii Date: Sunday, November 25, 2001 2:08 pm Subject: Re: GDB 5.1 on Solaris 2.8 > > On Sat, 24 Nov 2001, Dan Nicolaescu wrote: > > > > $ gdb a.out > > > gdb> list > > > /opt/src/devel/gdb-5.1: Is a directory. > > > > Well, it works for me... But it seems that you have a newer > version of > > the Sun compiler than I do: > > > > cc -V > > cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11 > > Thanks to everyone who replied; -xs seems to be what I need. > > The example above works for me as well, but I have an even older > version of the compiler. > > However, it sounds like turning on optimizations makes GDB debugging > impossible with this compiler. Is that expected? Am I spoiled by > GCC? >