MFC c++对话框项目使用 httplib 创建静态资源服务, Debug 时每次访问都会被断下是什么原因

139 天前
 s609926202

是在 OnInitDialog 中创建的线程:

UINT CMFCDlg::HttpServerThreadProc(LPVOID lpParam)
{
    httplib::Server svr;

    svr.set_base_dir("./");
    auto ret = svr.set_mount_point("/", "./images");
    if (!ret) {
    	std::cout << "The specified base directory doesn't exist..." << std::endl;
    }

    svr.listen("0.0.0.0", 5000);
    return 0;
}

BOOL CMFCDlg::OnInitDialog()
{
	AfxBeginThread(HttpServerThreadProc, nullptr);
}

然后点击本地 windows 调试器启动后,在浏览器中访问 127.0.0.1:5000/img.jpg 就会在 vs2019 中 httplib.h 中被断下: https://imgur.com/w00YPbh

请问这个是什么原因?

1797 次点击
所在节点    C++
1 条回复
yjjemg
138 天前
栈被破坏了 先在这个函数入口下个断点 命中了 在栈上下个内存写入断点

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1126446

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX