Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Nov 2009 13:19:37 +0200
From:      m.boyarov@gmail.com (Max N. Boyarov)
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: strange gdb behavior
Message-ID:  <7jws274zzq.fsf@bsd.by>
In-Reply-To: <20091102155144.GU2147@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Mon, 2 Nov 2009 17:51:44 %2B0200")
References:  <87c7bb540911020552x4a602732pd2caecb17c8c4535@mail.gmail.com> <20091102155144.GU2147@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Kostik Belousov <kostikbel@gmail.com> writes:

> On Mon, Nov 02, 2009 at 03:52:33PM +0200, Max Boyarov wrote:
>> Hi,
[cut]
>
> 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.


$ cat gdbt.c 
#include <unistd.h>

int
main(int argc, char **argv)
{
        int t;

        t = getopt(argc, argv, "f:");

        return t;
}


$ cat gdbt.gdb 
b main
run
print &argc
next
print &argc
list
quit


$ cat gdbt.sh 
#!/bin/sh

uname -mr

cc -O0 -ggdb -o gdbt gdbt.c && gdb -nx -quiet -x gdbt.gdb gdbt


9.0-CURRENT i386 / r198846
Breakpoint 1 at 0x80483f0: file gdbt.c, line 5.

Breakpoint 1, main (argc=Error accessing memory address 0x2: Bad address.
) at gdbt.c:5
5       {
$1 = (int *) 0x2
main (argc=1, argv=0xbfbfe7e0) at gdbt.c:8
8               t = getopt(argc, argv, "f:");
$2 = (int *) 0xbfbfe7c0
3       int
4       main(int argc, char **argv)
5       {
6               int t;
7       
8               t = getopt(argc, argv, "f:");
9       
10              return t;
11      }


9.0-CURRENT amd64 /r198480
Breakpoint 1 at 0x40057f: file gdbt.c, line 8.

Breakpoint 1, main (argc=1, argv=0x7fffffffeac0) at gdbt.c:8
8               t = getopt(argc, argv, "f:");
$1 = (int *) 0x7fffffffea5c
10              return t;
$2 = (int *) 0x7fffffffea5c
5       {
6               int t;
7
8               t = getopt(argc, argv, "f:");
9
10              return t;
11      }


7.2-RELEASE-p1 i386
Breakpoint 1 at 0x8048400: file gdbt.c, line 5.

Breakpoint 1, main (argc=Error accessing memory address 0x2: Bad address.
) at gdbt.c:5
5       {
$1 = (int *) 0x2
main (argc=1, argv=0xbfbfeca4) at gdbt.c:8
8               t = getopt(argc, argv, "f:");
$2 = (int *) 0xbfbfec80
3       int
4       main(int argc, char **argv)
5       {
6               int t;
7
8               t = getopt(argc, argv, "f:");
9
10              return t;
11      }

7.2-RELEASE-p4 amd64
Breakpoint 1 at 0x40057f: file gdbt.c, line 8.

Breakpoint 1, main (argc=1, argv=0x7fffffffebc8) at gdbt.c:8
8               t = getopt(argc, argv, "f:");
$1 = (int *) 0x7fffffffeb5c
10              return t;
$2 = (int *) 0x7fffffffeb5c
5       {
6               int t;
7
8               t = getopt(argc, argv, "f:");
9
10              return t;
11      }


-- 
Max N. Boyarov
xmpp:zotrix@jabber.ru



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7jws274zzq.fsf>