Date: Mon, 2 Nov 2009 16:42:12 +0100 From: Alexey Shuvaev <shuvaev@physik.uni-wuerzburg.de> To: Max Boyarov <m.boyarov@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: strange gdb behavior Message-ID: <20091102154212.GA30365@wep4035.physik.uni-wuerzburg.de> In-Reply-To: <87c7bb540911020552x4a602732pd2caecb17c8c4535@mail.gmail.com> References: <87c7bb540911020552x4a602732pd2caecb17c8c4535@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 02, 2009 at 03:52:33PM +0200, Max Boyarov wrote: > Hi, > > Who could help understand this: > > `--> cat 1.c > int > main(int argc, char **argv) > { > return 0; > } > > [snip] > > (gdb) set args test > (gdb) b main > Breakpoint 1 at 0x80483d0: file 1.c, line 3. > (gdb) r > Starting program: /tmp/1 test > > Breakpoint 1, main () at 1.c:3 > 3 { > (gdb) print argc > Error accessing memory address 0x0: Bad address. > (gdb) list > 1 int > 2 main(int argc, char **argv) > 3 { > 4 return 0; > 5 } > > checked on 9.0-CURRENT, 8.0-BETA3 > On FreeBSD wep4035 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r198671: Fri Oct 30 16:12:10 CET 2009 root@wep4035:/usr/obj/usr/src/sys/GENERIC amd64 I have the following: (gdb) set args test (gdb) b main Breakpoint 1 at 0x40052b: file 1.c, line 4. (gdb) r Starting program: /home/lexx/1 test Breakpoint 1, main (argc=2, argv=0x7fffffffe790) at 1.c:4 4 return 0; (gdb) list 1 int 2 main(int argc, char **argv) 3 { 4 return 0; 5 } (gdb) print argc $1 = 2 (gdb) Note that the breakpoint is set to line 4, not line 3 as in your case. There was a series of changes to the linker recently. Update to the latest CURRENT might help. HTH, Alexey.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091102154212.GA30365>