std::thread 使用 Netbeans/Cygwin 在调试模式下崩溃(在 运行 中工作)
std::thread crash in Debug mode (Work in run) with Netbeans/Cygwin
我正在尝试调试 (GDB) 我在 Windows 下使用 Cygwin 开发的应用程序。
当我调试它时,我在线程创建和程序停止时得到 "Signal received: ? (Unknown signal)"。
#include <iostream>
#include <thread>
using namespace std;
void ConnectionTimer()
{
}
int main(int argc, char** argv) {
cout<<"Before thread creation"<<endl;
std::thread t( ConnectionTimer);
cout<<"After thread creation"<<endl;
t.join();
cout<<"After join"<<endl;
return 0;
}
调试器停在该行
status = NtCreateMutant (&mtx, MUTEX_ALL_ACCESS, &attr, bInitialOwner);
在 kernel32.cc.
它在 运行 模式下按预期工作,但在调试时崩溃。
结果 运行 模式:
Before thread creation
After thread creation
After join
调试模式下的结果(崩溃前):
Before thread creation
知道我遗漏了什么吗?
编辑
如果我评论线程相关行,它可以正常工作。
Call Stack
Signal caught which cause crash
Discard
配置:
GDB 8.2.1-1 下 W10 上的 Cygwin 3.1.4-1,使用 g++ (GCC) 9.2.0-3
编译
我找到了崩溃的原因。
我的防病毒软件 (Trend) 阻止了该程序,我不得不为 exe 创建一个例外,现在一切正常。
我正在尝试调试 (GDB) 我在 Windows 下使用 Cygwin 开发的应用程序。 当我调试它时,我在线程创建和程序停止时得到 "Signal received: ? (Unknown signal)"。
#include <iostream>
#include <thread>
using namespace std;
void ConnectionTimer()
{
}
int main(int argc, char** argv) {
cout<<"Before thread creation"<<endl;
std::thread t( ConnectionTimer);
cout<<"After thread creation"<<endl;
t.join();
cout<<"After join"<<endl;
return 0;
}
调试器停在该行
status = NtCreateMutant (&mtx, MUTEX_ALL_ACCESS, &attr, bInitialOwner);
在 kernel32.cc.
它在 运行 模式下按预期工作,但在调试时崩溃。 结果 运行 模式:
Before thread creation
After thread creation
After join
调试模式下的结果(崩溃前):
Before thread creation
知道我遗漏了什么吗?
编辑
如果我评论线程相关行,它可以正常工作。
Call Stack
Signal caught which cause crash
Discard
配置: GDB 8.2.1-1 下 W10 上的 Cygwin 3.1.4-1,使用 g++ (GCC) 9.2.0-3
编译我找到了崩溃的原因。
我的防病毒软件 (Trend) 阻止了该程序,我不得不为 exe 创建一个例外,现在一切正常。