This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/359: functions return NAN when stepped over if linked to pthread
- From: tsonicdip at cox dot net
- To: gdb-gnats at sources dot redhat dot com
- Date: 16 Feb 2002 20:47:08 -0000
- Subject: gdb/359: functions return NAN when stepped over if linked to pthread
- Reply-to: tsonicdip at cox dot net
>Number: 359
>Category: gdb
>Synopsis: functions return NAN when stepped over if linked to pthread
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Feb 16 12:48:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Davy Belk
>Release: RedHat Linux 5.1-0.71
>Organization:
>Environment:
RedHat Linux 7.1, gcc 2.96
>Description:
When a simple C++ code is linked to the pthread library,
and the code is run under gdb, functions that should return
a double return NAN when skipped over using the next command.
Single stepping through or continuing through gives the correct
return value. An additional oddity is that a string in the
argument list seems to get lost in the pthread code while single
stepping, but a continue will return and give the correct answer.
>How-To-Repeat:
// > Use the given code:
// Name this file bug.C
// execute the commands:
// > g++ -g -o bug bug.C -lpthread
// > gdb bug
// Then use next to step over the call to report
// to get a return value of NAN.
#include <string>
#include <iostream>
double report1( const double &x )
{
return 1.;
}
double report2( const double &x, const string &d )
{
return 2.;
}
double report3()
{
return 3.;
}
void main( int argc, char *argv[] )
{
double x = 5.;
double x1, x2, x3;
x1 = report1( x );
cout << "Value: " << x1 << endl;
x2 = report2( x, "Test");
cout << "Value: " << x2 << endl;
x3 = report3();
cout << "Value: " << x3 << endl;
}
>Fix:
Don't know.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.C"
Ly8gTmFtZSB0aGlzIGZpbGUgYnVnLkMKLy8gZXhlY3V0ZSB0aGUgY29tbWFuZHM6Ci8vICAgPiBn
KysgLWcgLW8gYnVnIGJ1Zy5DIC1scHRocmVhZAovLyAgID4gZ2RiIGJ1ZwovLyBUaGVuIHVzZSBu
ZXh0IHRvIHN0ZXAgb3ZlciB0aGUgY2FsbCB0byByZXBvcnQKLy8gICB0byBnZXQgYSByZXR1cm4g
dmFsdWUgb2YgTkFOLiAgCgoKI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgoK
ZG91YmxlIHJlcG9ydDEoIGNvbnN0IGRvdWJsZSAmeCApCnsKICAgIHJldHVybiAxLjsKfQoKCmRv
dWJsZSByZXBvcnQyKCBjb25zdCBkb3VibGUgJngsIGNvbnN0IHN0cmluZyAmZCApCnsKICAgIHJl
dHVybiAyLjsKfQoKZG91YmxlIHJlcG9ydDMoKQp7CiAgICByZXR1cm4gMy47Cn0KCgp2b2lkIG1h
aW4oIGludCBhcmdjLCBjaGFyICphcmd2W10gKQp7CiAgICBkb3VibGUgeCA9IDUuOwogICAgZG91
YmxlIHgxLCB4MiwgeDM7CiAgICAKICAgIHgxID0gcmVwb3J0MSggeCApOwogICAgY291dCA8PCAi
VmFsdWU6ICIgPDwgeDEgPDwgZW5kbDsKICAgIAogICAgeDIgPSByZXBvcnQyKCB4LCAiVGVzdCIp
OwogICAgY291dCA8PCAiVmFsdWU6ICIgPDwgeDIgPDwgZW5kbDsKICAgIAogICAgeDMgPSByZXBv
cnQzKCk7CiAgICBjb3V0IDw8ICJWYWx1ZTogIiA8PCB4MyA8PCBlbmRsOwogICAgCn0KCiAgICAK
CgoKCgoKCg==