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 test on the linux platform, it works well. but on windowsXP(
eclipse3.1+CDT3.0+mingw3.1), gdb.exe crash, when display the comlex
numbers, target request fail....

if you dont let it display the comlex nubmer,it works well.

the attached is a gif file of the screen copy, to reproduce it.

the code is following:
==========================================
#include <math.h>
#include <complex>
using namespace std;

int
main (void)
{
  complex < double >im = complex < double >(0.0, 1.0);
  return 0;
}
  
==========================================


On 9/8/05, Mikhail Khodjaiants <mikhailk@xxxxxxx> wrote:
> 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
> 
> 


-- 
Thanks and Best Regards 
Zhou Fei
Shanghai Institute of Optics and 
Fine Mechanics, Chinese Academy of Sciences 
Thanks and Best Regards 
Zhou Fei
Now:  13/28 Wattle Rd Hawthorn VIC AU
Mobile: +61-0423402709
Mail: zhoufei(at)gmail(dot)com

Attachment: eclipse.gif
Description: GIF image


Back to the top