首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

请问cygwin下用gdb调试代码的有关问题

2012-03-05 
请教cygwin下用gdb调试代码的问题下面这段代码编译和运行阶段都没有报错,但是使用gdb,在main函数前面设一

请教cygwin下用gdb调试代码的问题
下面这段代码编译和运行阶段都没有报错,但是使用gdb,在main函数前面设一个断点,run,再next就会报错,错误信息是
Program   received   signal   SIGSEGV,   Segmentation   fault.
0x610ae938   in   pthread_key_create   ()   from   /usr/bin/cygwin1.dll

源代码是:
#include   <iostream>
using   namespace   std;

template <int   v>
struct   int2type
{
enum   {value   =   v};
};

template <typename   T,   bool   isPolymorphic>
class   NiftyContainer
{
private:
void   DoSomething(T*   obj,   int2type <true> )   {
cout   < <   "True "   < <endl;
}
void   DoSomething(T*   obj,   int2type <false> )   {
cout   < <   "False "   < <   endl;
}
public:
void   DoSomething(T*   pObj)   {
DoSomething(pObj,   int2type <isPolymorphic> ());
}
};

int   main(void)
{
int   i   =   5;
int*   pi   =   &i;
NiftyContainer <int,   true>   obj;
obj.DoSomething(pi);
}

[解决办法]
> 在main函数前面设一个断点
具体在什么位置?

我在linux下没问题,没有手边cygwin,没法试

热点排行