Date: Wed, 31 Oct 2001 13:46:53 -0800 From: Maksim Yevmenkin <myevmenk@digisle.net> To: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de> Cc: freebsd-current@FreeBSD.ORG Subject: Re: weird -current gdb/gcc(?) problem Message-ID: <3BE0714D.9A7592EE@digisle.net> References: <3BE03AF5.C0776836@digisle.net> <200110312111.f9VLBgM19567@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h> 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 <Error reading address 0x2332b: Bad address>) 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 <Error reading address 0x2332b: Bad address> (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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BE0714D.9A7592EE>