在 Visual Studio 中调试 Qt 断言

发布于 2025-01-09 07:22:04 字数 894 浏览 1 评论 0原文

我收到一个断言,该断言会从 Qt 生成一个用于中止、重试或忽略的对话框。不幸的是,当我重试时,它总是转到 app.exec(),因此我无法看到错误来自何处,或者可能有哪些输入起作用。

当我调试时,我可以看到我的所有代码和 moc 代码,并且所有变量和指针都已正确设置。但是当我进入 Qt 代码时,我得到 Qt5Cored.pdb not returned。我似乎也无法在 Qt 安装中找到 PDB 文件。

发出信号并且所有(我的)插槽已成功完成后发生错误。

Qt 的错误是如此深层次的,它没有帮助:

Debug Error!

Program: Qt5Cored.dll
Module: 5.14.2
File: painting\qoutlinemapper.cpp
Line: 105

ASSERT: '!path.isEmpty()' in file painting\qoutlinemapper.cpp, line 105

(Press Retry to debug the process)

我检查了 错误的源代码,但这并不是很有帮助,调试器不会提供调用者。

我不知道问题是什么,因为我无法调试,所以我也无法提供最小的工作示例。我的所有代码都按预期工作,但我确信我向 Qt 提供了一些不合适的东西,但我只是不知道是什么。任何有关如何更好地调试此问题的帮助,以便我可以确定导致此问题的原因,我们将不胜感激。

有趣的是,如果我在发布版本中运行并且断言被绕过,应用程序将完全按照预期工作,没有明显的副作用(我确实意识到这可能只是运气)。

I am getting an assert that generates a dialog from Qt to abort, retry, or ignore. Unfortunately, when I retry, it always just goes to app.exec() so I cannot see where the error is coming from, or what inputs may be contributing.

When I debug, I can see all my code and moc code, and all variables and pointers are set appropriately. But when I step into Qt code, I get Qt5Cored.pdb not loaded. I cannot seem to locate the PDB files in my Qt installation either.

The error happens after emitting a signal and all (my) slots have completed successfully.

The error from Qt is so deep in the weeds, it is not helpful:

Debug Error!

Program: Qt5Cored.dll
Module: 5.14.2
File: painting\qoutlinemapper.cpp
Line: 105

ASSERT: '!path.isEmpty()' in file painting\qoutlinemapper.cpp, line 105

(Press Retry to debug the process)

I inspected the source code for the error, but that wasn't terribly helpful, and the debugger will not provide the caller.

I don't know what is the problem since I can't debug, so I can't provide a minimal working example either. All of my code is working as expected, but I am sure I am providing Qt with something inappropriate, but I just do not know what. Any help on how to better debug this issue so I can determine what is causing it would be appreciated.

Interestingly, if I run in release and the assert is bypassed, the applications works exactly as expected with no obvious side effects (I do realize that could just be luck).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文