因为“未知信号”而在QT创建者中使用dgb进行调试时出错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了因为“未知信号”而在QT创建者中使用dgb进行调试时出错相关的知识,希望对你有一定的参考价值。

我正在尝试调试此代码:

#include <stdio.h>
int main()
{
    int firstNumber, secondNumber, sumOfTwoNumbers;

    printf("Enter two integers: ");

    // Two integers entered by user is stored using scanf() function
    scanf("%d %d", &firstNumber, &secondNumber);

    // sum of two numbers in stored in variable sumOfTwoNumbers
    sumOfTwoNumbers = firstNumber + secondNumber;

    // Displays sum      
    printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);

    return 0;
}

这是调试器日志(如here所述):

1show version
2show debug-file-directory
3set print object on
4set breakpoint pending on
5set print elements 10000
6set unwindonsignal on
7set width 0
8set height 0
9set substitute-path C:/work/build/qt5_workdir/w/s C:/msys64/mingw32/qt5-static
10set substitute-path Q:/qt5_workdir/w/s C:/msys64/mingw32/qt5-static
11set substitute-path c:/Users/qt/work/install C:/msys64/mingw32/qt5-static
12set substitute-path c:/users/qt/work/qt C:/msys64/mingw32/qt5-static
13python sys.path.insert(1, 'C:/msys64/mingw64/share/qtcreator/debugger/')
14python sys.path.append('C:/msys64/mingw64/bin/data-directory/python')
15python from gdbbridge import *
16python theDumper.loadDumpers({"token":16})
17-interpreter-exec console "set target-async off"
18-break-insert  -f ""main.c":12"
19attach 7444
20-exec-continue
21importPlainDumpers off
22-thread-info
23python theDumper.fetchStack({"limit":20,"nativemixed":0,"token":23})
24set disassembly-flavor att
25-interpreter-exec console "disassemble /rm 0x8ddf8"
26-stack-select-frame 0
27python theDumper.fetchVariables({"autoderef":1,"context":"","displaystringlimit":"100","dyntype":1,"expanded":["watch","return","inspect","local"],"fancy":1,"formats":{},"nativemixed":0,"partialvar":"","passexceptions":0,"qobjectnames":1,"resultvarname":"","stringcutoff":"10000","token":27,"typeformats":{},"watchers":[]})
28-interpreter-exec console "disassemble /rm 0x8dde4,0x8de5c"
<Rebuild Watchmodel 1 @ 12:59:48.782 >

(超过最大字符数限制,这就是我在pastebin发布的原因)

https://pastebin.com/rLDsWd9N

当我尝试调试代码时,当有断点时,我得到一个窗口:

The inferior stopped because it received a signal from the operating system.
Signal name: ?
Signal meaning: Unknown signal

截图:

enter image description here

另外,我遇​​到问题:

:-1: error: An exception was triggered: 
Exception at 0x4015f6, code: 0x4000001f: Win32 x86 emulation subsystem breakpoint hit, flags=0x0.

屏幕截图:enter image description here

还有一些截图:

enter image description here

构建和运行代码不会给我带来任何错误。我读过this但除了Windows Defender之外我没有防病毒软件,我禁用了它的实时保护。我使用Windows 8.1

我还使用msys2中的QT,mingw和gdb。

问题:问题是什么以及如何解决?

答案

解决了。我在这里得到了帮助:https://www.reddit.com/r/C_Programming/comments/8mrbpj/error_with_debugging_in_qt_creator_with_dgb/dzprwhq/

我使用的是qtcreator 64位,但是对于项目选择的套件mingw-w64 32位。我认为比特差异导致了错误。

现在当我使用qtcreator 64位套件mingw-w64 64位时,调试器工作正常:)

以上是关于因为“未知信号”而在QT创建者中使用dgb进行调试时出错的主要内容,如果未能解决你的问题,请参考以下文章

Qt Creator 调试

Qt第三课 搭建调试环境

Qt Creator 2.7.1 和 Qt 4.8.4 无法远程调试库

VisualStudio中添加源码QT源码进行调试

QT安装创建项目与调试,在VS中的使用:手把手教程

Qt编写气体安全管理系统27-设备调试