strange gdb behavior

Kostik Belousov kostikbel at gmail.com
Mon Nov 2 15:51:50 UTC 2009


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;
> }
> 
> 
> `--> cc -ggdb -o 1 1.c
> 
> 
> `--> gdb 1
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 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-marcel-freebsd"...
> (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

Can you check it on RELENG_7 ? It seems to be another old gdb bug.
With gdb 7.0,
(gdb) b main
Breakpoint 1 at 0x8048414: file hello.c, line 8.
(gdb) r
Starting program: /usr/home/kostik/build/bsd/6/stuff/hello1

Breakpoint 1, main (argc=1, argv=0xbfbfe53c) at hello.c:8
8               for (i = 0; i < argc; i++)

while in-tree gdb shows me the same behaviour as yours.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20091102/372b0a3d/attachment.pgp


More information about the freebsd-hackers mailing list