Subject: toolchain/15715: gdb cannot get return value of functions when tracing on i386
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: netbsd-bugs
Date: 02/24/2002 13:40:21
>Number:         15715
>Category:       toolchain
>Synopsis:       gdb cannot get return value of functions when tracing on i386
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 24 04:38:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jaromir Dolecek
>Release:        NetBSD 1.5ZA (around Feb 10 2002, userland from Jan 2002)
>Organization:
	N/A
>Environment:
System: NetBSD saruman.ics.muni.cz 1.5ZA NetBSD 1.5ZA (SARUMAN) #162: Mon Feb 11 22:42:41 CET 2002 dolecek@saruman.ics.muni.cz:/usr/home/dolecek/soft/netbsd/sys/arch/i386/compile/SARUMAN i386
Architecture: i386
Machine: i386
>Description:
	GDB on i386 seems to be unable to get return value of any function
	when stepping through the program, or when a function is called
	from within GDB.
	I've re-built GDB with uptodate sources (as of Feb 23 2002) and
	the problem persists.

	There doesn't seem to be any PR regarding this, and no message
	on any NetBSD e-mail list besides Love <lha@stacken.kth.se>'s
	e-mail with subject "gdb + print fun() doesn't work any more"
	from 01/16/2002. So this _may_ be some problem with my local
	setup.
>How-To-Repeat:

Script started on Sun Feb 24 13:26:57 2002
saruman: /usr/home/dolecek ### 
dolecek~ > cat test.c
int
foobaz()
{
	return 1;
}

int
main()
{
	int r;

	r = foobaz();
}
saruman: /usr/home/dolecek ### 
dolecek~ > cc -g -o test test.c
saruman: /usr/home/dolecek ### 
dolecek~ > gdb test
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) break main
Breakpoint 1 at 0x804887a: file test.c, line 12.
(gdb) run
Starting program: /usr/home/dolecek/test 

Breakpoint 1, main () at test.c:12
12		r = foobaz();
(gdb) print foobaz()
read_register_bytes:  Couldn't update register 31.
(gdb) s
foobaz () at test.c:4
4		return 1;
(gdb) finish
Run till exit from #0  foobaz () at test.c:4
0x804887f in main () at test.c:12
12		r = foobaz();
read_register_bytes:  Couldn't update register 31.
(gdb) n
13	}
(gdb) print r
$1 = 1
(gdb) quit
The program is running.  Exit anyway? (y or n) y
saruman: /usr/home/dolecek ### 
dolecek~ > exit
Script done on Sun Feb 24 13:29:42 2002

>Fix:
	I wish I would know :(
>Release-Note:
>Audit-Trail:
>Unformatted: