From owner-freebsd-questions Fri Mar 30 17:21:47 2001 Delivered-To: freebsd-questions@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id 2C11237B719 for ; Fri, 30 Mar 2001 17:21:42 -0800 (PST) (envelope-from grog@lemis.com) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id 604DC6AB60; Sat, 31 Mar 2001 10:51:29 +0930 (CST) Date: Sat, 31 Mar 2001 10:51:29 +0930 From: Greg Lehey To: Todd Enersen Cc: freebsd-questions@freebsd.org Subject: Re: problems with gdb??? Message-ID: <20010331105128.C55208@wantadilla.lemis.com> References: <3AC4E1B7.74C87C41@fireclick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3AC4E1B7.74C87C41@fireclick.com>; from tee@fireclick.com on Fri, Mar 30, 2001 at 11:42:47AM -0800 Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Friday, 30 March 2001 at 11:42:47 -0800, Todd Enersen wrote: > I've installed the 4.2 distribution of FreeBSD. While porting an > application to the FreeBSD platform, I've run into a problem with the > gdb that ships as part of the distribution. > > Consider the following small section of code: > > > >> gdb mytest >> (gdb) b main >> Breakpoint 1 at 0x804848a: file test.c, line 10. >> (gdb) r >> Starting program: /usr/home/tee/work/testproxy/mytest >> >> Breakpoint 1, main (argc=-1077937256, argv=0x80483ed) at test.c:10 >> 10 Init("foo", 1234); >> (gdb) >> (gdb) p argv[0] >> $1 = 0xff6de850 Error reading address 0xff6de850: Bad address >> (gdb) > > Now should argc and argv be defined to be valid?? Yes, of course. > This corruption of how gdb views the arguements continues, and makes it > very impossible to actually debug real programs. > > I've also tried to download and build gdb 5.0, but it fails to compile > under FreeBSD. Well, I've just tried this under 4-STABLE of 22 January, and it works fine. I can't even think what could be causing this problem, but I'd certainly recommend to recompile the entire gdb and the program. Are you using any special flags? I tried with optimization, but that just removed the call to Init() (since it didn't do anything). It didn't cause the problems you're showing. Greg -- When replying to this message, please copy the original recipients. If you don't, I may ignore the reply. For more information, see http://www.lemis.com/questions.html Finger grog@lemis.com for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message