Thanks for your response,
Quote:> ijust tested it on my Suse 8.0 system with gdb 5.1.1, and I cannot
> reproduce your problem. Do you get "nan" as output from the debugged
> program or as output from the de*?
if I compile this code...
============================
#include <iostream>
int main()
{
double d=10.0;
cout << d << endl;
return 0;
Quote:}
============================
with
g++ -g -pthread -o test test.cc
then ./test at the command prompt yields:
============================
10
============================
seems to be fine, but when viewed with gdb...
============================
GNU gdb 5.1.1
Copyright 2002 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-suse-linux"...
(gdb) l
1 #include <iostream>
2
3 int main()
4 {
5 double d=10.0;
6
7 cout << d << endl;
8
9 return 0;
10 }
(gdb) b 7
Breakpoint 1 at 0x804867f: file test.cc, line 7.
(gdb) run
Starting program: /home/sven/Documents/C++/test/test
[New Thread 1024 (LWP 1713)]
[Switching to Thread 1024 (LWP 1713)]
Breakpoint 1, main () at test.cc:7
7 cout << d << endl;
(gdb) print d
$1 = -nan(0x8000000000000)
(gdb) cont
Continuing.
nan
Program exited normally.
(gdb)
=====================================
But if I am compiling the same code without the -pthread option,
everything works out fine...
=====================================
10
GNU gdb 5.1.1
Copyright 2002 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-suse-linux"...
(gdb) l
1 #include <iostream>
2
3 int main()
4 {
5 double d=10.0;
6
7 cout << d << endl;
8
9 return 0;
10 }
(gdb) b 7
Breakpoint 1 at 0x804866f: file test.cc, line 7.
(gdb) run
Starting program: /home/sven/Documents/C++/test/test
Breakpoint 1, main () at test.cc:7
7 cout << d << endl;
(gdb) print d
$1 = 10
(gdb) cont
Continuing.
10
Program exited normally.
(gdb)
==============================
I have no clue about what is going on here... At least it does not seem
to be a failure of the Linux distribution. Is it my Dual-Celeron-System
that causes troubles when I am linking against libpthread ? But why ?
I have a bad feeling about that strange behaviour and I am thankful to
anybody who can give me some advice.
Regards
Sven