Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CDT+GDB crash when Debug programs include "complex number"

I tried your program and it didn't crash. Can you specify how to reproduce the problem?

----- Original Message ----- From: "Zhou Fei" <zhoufei@xxxxxxxxx>
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Sent: Tuesday, September 06, 2005 9:23 PM
Subject: [cdt-dev] CDT+GDB crash when Debug programs include "complex number"


Hello everyone,

I m using cdt3.0 + MinGW on a WindowXP, When display the varable of
complex number while debuging. gdb.exe encountered a problem causing
gdb crash.

anybody know how to make it work?

thank you!

the sample code is here:
========================================
#include <stdio.h>
#include <math.h>
#include <complex>
#include <iostream>
#include <stdlib.h>

using namespace std;

double angle2pi (complex < double >temp); // 0-2pi version of function
angle

int main (void)
{
 complex < double >im = complex < double >(0.0, 1.0);
 double angle;
 angle = angle2pi (im);
 std::cout << angle << std::endl;
 return 0;
}

double angle2pi (complex < double >temp)
 {
   double MOD = abs (temp) + 1e-20;
   double Angle = 0, Angle1 = real (temp) / MOD, Angle2 = imag (temp) /

MOD;
   double pi = 3.1415926535897932384626433832795;
   if ((Angle1 >= 0) && (Angle2 >= 0))
     Angle = acos (Angle1);
   if ((Angle1 < 0) && (Angle2 >= 0) & (Angle2 <= 1))
     Angle = pi - acos (-Angle1);
   if ((Angle1 <= 0) && (Angle2 < 0))
     Angle = acos (-Angle1) + pi;
   if ((Angle1 > 0) && (Angle2 < 0))
     Angle = 2 * pi - acos (Angle1);

   return Angle / pi * 180;
 }

========================================
the makefile here
------------------------
test : test.o
g++ -o test test.o -L -lstdc++
test.o : test.cpp
g++ -g -ggdb -c test.cpp
------------------------
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top