Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2002 06:25:11 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        iedowse@FreeBSD.org
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: gnu/13427: gdb reports wrong info
Message-ID:  <20020122042510.GD5095@hades.hell.gr>
In-Reply-To: <20020122041503.GC5095@hades.hell.gr>
References:  <200201212116.g0LLGfa29560@freefall.freebsd.org> <20020122041503.GC5095@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
Following up to my own post, with one of the tests I did today:

I compiled the following small program:

    #include <stdio.h>

    int hello (char *s)
    {
            printf("%s:%d:%s() s=%p \"%s\"\n",
                __FILE__, __LINE__, __FUNCTION__,
                s, s);
            return 0;
    }

    int main (void)
    {
            printf("%s:%d:%s() just before the call to hello()\n",
                __FILE__, __LINE__, __FUNCTION__);

            hello("hello world");

            printf("%s:%d:%s() just after the call to hello()\n",
                __FILE__, __LINE__, __FUNCTION__);

            return 0;
    }

And here's what happens when I try to debug it:

    Script started on Tue Jan 22 06:22:42 2002
    % env | grep CFLAGS
    % cc -ggdb hello.c
    % gdb a.out
    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 hello
    Breakpoint 1 at 0x80484e2: file hello.c, line 5.
    (gdb) r
    Starting program: /tmp/a.out
    hello.c:14:main() just before the call to hello()

    Breakpoint 1, hello (s=0xbfbff6f0 "<÷żż\a\204\004\b\001") at hello.c:5
    5		printf("%s:%d:%s() s=%p \"%s\"\n",
    (gdb) c
    Continuing.
    hello.c:6:hello() s=0x804862c "hello world"
    hello.c:19:main() just after the call to hello()

    Program exited normally.
    (gdb) q
    % exit

    Script done on Tue Jan 22 06:23:19 2002

-- 
Giorgos Keramidas . . . . . . . . . keramida@{ceid.upatras.gr,freebsd.org}
FreeBSD Documentation Project . . . http://www.freebsd.org/docproj/
FreeBSD: The power to serve . . . . http://www.freebsd.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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