From owner-freebsd-questions Mon Apr 2 10: 7:28 2001 Delivered-To: freebsd-questions@freebsd.org Received: from flame.fireclick.com (flame.fireclick.com [208.45.103.18]) by hub.freebsd.org (Postfix) with ESMTP id BEF2037B71B for ; Mon, 2 Apr 2001 10:07:21 -0700 (PDT) (envelope-from tee@fireclick.com) Received: from fireclick.com (todd.fireclick.com [192.168.254.106]) by flame.fireclick.com (8.10.1/8.10.1) with ESMTP id f32H78k21705; Mon, 2 Apr 2001 10:07:08 -0700 Message-ID: <3AC8B1A1.84A9380A@fireclick.com> Date: Mon, 02 Apr 2001 10:06:42 -0700 From: Todd Enersen X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Mike Meyer Cc: questions@freebsd.org Subject: Re: problems with gdb??? References: <15045.26679.83190.709362@guru.mired.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I cannot seem to get the config straight for recompiling gdb, either 4.18 or 5.0 ... The "configure" guess fails in solib.c, due to (I think) a missing #define for SVR4_SHARED_LIBS, which allows structure definitions for elf style share libraries. I'm a newbie to FreeBSD. How does one upgrade to the latest 4-STABLE release? Todd Mike Meyer wrote: > Todd Enersen types: > > --------------DA50410AF9311B33DEC3A86F > > Content-Type: text/plain; charset=us-ascii > > Content-Transfer-Encoding: 7bit > > Please don't do this. Simply send plain text, not both plain text and > ascii. > > > 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: > > > > > > > > more test.c > > > > > > void Init(char* foo, int bar) > > > { > > > > > > } > > > > > > int main(int argc, char* argv[]) > > > { > > > Init("foo", 1234); > > > } > > > > > > > Now consider the output from gdb: > > > > > gdb mytest > > > 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 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?? > > That example works fine for me. I'm running 4-STABLE as of last sunday, > using gcc version 2.95.2 19991024 (release). > > > 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. > > > > Any suggestions? > > Try doing a single step before checking p. It's possible there's some > function startup code that needs to be run before the arguments will > show up properly, though I wouldn't expect it in C code. > > -- > Mike Meyer http://www.mired.org/home/mwm/ > Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. > > Todd Enersen > > > > > > --------------DA50410AF9311B33DEC3A86F > > Content-Type: text/html; charset=us-ascii > > Content-Transfer-Encoding: 7bit > > > > > > > > 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: > >
  > >

> >
> more test.c
> >
> > void Init(char* foo, int bar)
> > {
> >
> > }
> >
> > int main(int argc, char* argv[])
> > {
> >    Init("foo", 1234);
> > }
> >
> > > >


Now consider the output from gdb: > >

> >
gdb mytest
> > 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 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?? > >

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. > >

Any suggestions? > >

Todd Enersen > >
  > > > > --------------DA50410AF9311B33DEC3A86F-- > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-questions" in the body of the message > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message