Date: Fri, 30 Mar 2001 11:42:47 -0800 From: Todd Enersen <tee@fireclick.com> To: freebsd-questions@freebsd.org Cc: Todd <tee@fireclick.com> Subject: problems with gdb??? Message-ID: <3AC4E1B7.74C87C41@fireclick.com>
next in thread | raw e-mail | index | archive | help
--------------DA50410AF9311B33DEC3A86F Content-Type: text/plain; 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 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> 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. <p>Consider the following small section of code: <br> <blockquote TYPE=CITE> <pre>> more test.c void Init(char* foo, int bar) { } int main(int argc, char* argv[]) { Init("foo", 1234); }</pre> </blockquote> <p><br>Now consider the output from gdb: <blockquote TYPE=CITE> <pre>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)</pre> </blockquote> <p><br>Now should argc and argv be defined to be valid?? <p>This corruption of how gdb views the arguements continues, and makes it very impossible to actually debug real programs. <p>I've also tried to download and build gdb 5.0, but it fails to compile under FreeBSD. <p>Any suggestions? <p>Todd Enersen <br> </html> --------------DA50410AF9311B33DEC3A86F-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3AC4E1B7.74C87C41>