From owner-freebsd-current Wed Oct 31 13:47: 3 2001 Delivered-To: freebsd-current@freebsd.org Received: from owa-sj-1.digisle.com (owa-sj-1.digisle.com [167.216.153.124]) by hub.freebsd.org (Postfix) with ESMTP id C88A637B414 for ; Wed, 31 Oct 2001 13:46:54 -0800 (PST) Received: from VWALL-SJ-1.digisle.com ([167.216.153.118]) by owa-sj-1.digisle.com with Microsoft SMTPSVC(5.0.2195.2966); Wed, 31 Oct 2001 13:48:22 -0800 Received: from 206.220.227.145 by VWALL-SJ-1.digisle.com (InterScan E-Mail VirusWall NT); Wed, 31 Oct 2001 16:46:46 -0500 Message-ID: <3BE0714D.9A7592EE@digisle.net> Date: Wed, 31 Oct 2001 13:46:53 -0800 From: Maksim Yevmenkin Organization: Digital Island X-Mailer: Mozilla 4.78 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Joerg Wunsch Cc: freebsd-current@FreeBSD.ORG Subject: Re: weird -current gdb/gcc(?) problem References: <3BE03AF5.C0776836@digisle.net> <200110312111.f9VLBgM19567@uriah.heep.sax.de> Content-Type: multipart/mixed; boundary="------------230A6E07BFC2234F7974A4F6" X-OriginalArrivalTime: 31 Oct 2001 21:48:22.0800 (UTC) FILETIME=[C318A900:01C16255] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------230A6E07BFC2234F7974A4F6 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Joerg, > > i have some weird problem. > > Well, it would have been nice if you had told what you deemed to > be the problem. ;-) I can't find any problem at all... > > > Breakpoint 1, main () at prog1.c:8 > > 8 return (foo(1, 2, '3', "test")); > > (gdb) s > > foo (i=1, s=10244, c=-54 'Ê', str=0x804855b "test") at prog1.c:13 > > If you mean it should look like: > > foo (i=1, s=2, c=51 '3', str=0x804855b "test") at prog1.c:13 > > here, erm, no. Your breakpoint simply hit before the function stack > frame initialization was complete, so gdb displays the wrong values at > that point. Just type a single `s', followed by a `where', and you'll > see it will eventually get the argument list right then. first of all i want to apoligize. i sent the wrong output. yes, it does the right thing if you use "-g" switch, however it does not work for me if i use "-ggdb" switch. thanks, max --------------230A6E07BFC2234F7974A4F6 Content-Type: text/plain; charset=us-ascii; name="out1.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="out1.txt" Script started on Wed Oct 31 13:46:09 2001 beetle% uname -a FreeBSD beetle 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Oct 30 13:23:19 PST 2001 root@beetle:/usr/obj/usr/src/sys/BEETLE i386 beetle% cat c1.sh #!/bin/sh -x gcc -v ld -v rm a.out cat prog1.c gcc -Wall -ggdb prog1.c ./a.out gdb a.out beetle% ./c1.sh + gcc -v Using builtin specs. gcc version 2.95.3 20010315 (release) + ld -v GNU ld version 2.11.2 20010719 [FreeBSD] (with BFD 2.11.2 20010719 [FreeBSD]) + rm a.out + cat prog1.c #include int foo (int, short, char, char *); int main(void) { return (foo(1, 2, '3', "test")); } int foo(int i, short s, char c, char *str) { printf("%d, %d, %d, %s\n", i, s, c, str); return (0); } + gcc -Wall -ggdb prog1.c + ./a.out 1, 2, 51, test + gdb a.out GNU gdb 4.18 Copyright 1998 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-unknown-freebsd"... (gdb) b main Breakpoint 1 at 0x80484c6: file prog1.c, line 8. (gdb) run Starting program: /usr/home/max/test/a.out Breakpoint 1, main () at prog1.c:8 8 return (foo(1, 2, '3', "test")); (gdb) s foo (i=671494208, s=10246, c=16 '\020', str=0x2804ca2b "\203~T") at prog1.c:13 13 { (gdb) s 14 printf("%d, %d, %d, %s\n", i, s, c, str); (gdb) where #0 foo (i=671494208, s=10246, c=16 '\020', str=0x2332b ) at prog1.c:14 #1 0x80484d6 in main () at prog1.c:8 (gdb) p i $1 = 671494208 (gdb) p s $2 = 10246 (gdb) p c $3 = 16 '\020' (gdb) p str $4 = 0x2332b (gdb) q The program is running. Exit anyway? (y or n) y beetle% exit Script done on Wed Oct 31 13:46:46 2001 --------------230A6E07BFC2234F7974A4F6-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message