Subject: toolchain/15715: gdb cannot get return value of functions when tracing on i386
To: None <>
From: Jaromir Dolecek <>
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
>Originator:     Jaromir Dolecek
>Release:        NetBSD 1.5ZA (around Feb 10 2002, userland from Jan 2002)
System: NetBSD 1.5ZA NetBSD 1.5ZA (SARUMAN) #162: Mon Feb 11 22:42:41 CET 2002 i386
Architecture: i386
Machine: i386
	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 <>'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

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

	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

	I wish I would know :(