Subject: gdb + print fun() doesn't work any more
To: None <tech-toolchain@netbsd.org>
From: Love <lha@stacken.kth.se>
List: tech-toolchain
Date: 01/16/2002 23:28:17
I've a problem with gdb and running functions in the `print' command.  This
used to work before. I've got no clue when it stopped to work.

It works for me with my locally compiled gdb 5.1 fetched from my local gnu
mirror.

I'm running 1.5AZ/i386, and my build finished Fri Jan 11 05:47:28 CET 2002.

Love


: lha@nutcracker ; cat foo.c
int
main(int argc, char **argv)
{
    printf(strdup("foo\n"));
    return 0;
}
: lha@nutcracker ; gcc -g -o foo foo.c
: lha@nutcracker ; ./foo
foo
: lha@nutcracker ; gdb foo
GNU gdb 5.0nb1
Copyright 2000 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--netbsdelf".
(gdb) b main
Breakpoint 1 at 0x804893a: file foo.c, line 4.
(gdb) r
Starting program: /tmp/foo 

Breakpoint 1, main (argc=1, argv=0xbfbfd6d8) at foo.c:4
4           printf(strdup("foo\n"));
(gdb) p strdup("foo")
read_register_bytes:  Couldn't update register 31.
(gdb) The program is running.  Exit anyway? (y or n) y 


Now running gdb-5.1 release from the local gdb mirror:

: lha@nutcracker ; ./gdb-5.1 -q foo
(gdb) b main
Breakpoint 1 at 0x804893a: file foo.c, line 4.
(gdb) r
Starting program: /tmp/foo 

Breakpoint 1, main (argc=1, argv=0xbfbfd6d8) at foo.c:4
4           printf(strdup("foo\n"));
(gdb) p (char *)strdup("foo")
$1 = 0x804b030 "foo"
(gdb) The program is running.  Exit anyway? (y or n) y