You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Qt Creator中gdb调试出现Unknown signal问题的排查与解决

What’s Causing This Debugging Error & How to Fix It

Hey, I’ve dealt with this exact problem on Windows 8.1 using MSYS2’s Qt Creator/MinGW/gdb stack, so let’s break down the root causes first:

Root Causes

That error code 0x4000001f translates to a conflict between Windows’ x86 emulation subsystem (WoW64) and the MSYS2 debugging toolchain. Here’s why it’s happening for you:

  • Toolchain Version Incompatibility: Newer MSYS2 gdb/MinGW builds drop official support for Windows 8.1, relying on debugging APIs that only exist in Windows 10+. Win8.1’s older debug subsystem can’t handle these calls, triggering the "unknown signal" popup.
  • Mismatched Architecture: If you’re compiling 32-bit code on a 64-bit Win8.1 system, WoW64’s emulation can clash with MSYS2’s gdb when trying to set breakpoints. The emulation subsystem intercepts the breakpoint signal incorrectly.
  • Misconfigured Qt Creator Debugger: You might be accidentally using Windows’ built-in gdb (or a mismatched version) instead of the one bundled with MSYS2. Different gdb versions speak different debug protocols, causing this failure.
  • Disabled System Services: Win8.1 relies on services like RPC and Windows Error Reporting to handle debugger-process communication. If these are off, debugging breaks.

Step-by-Step Fixes

Let’s go through the solutions in order—start with the easiest ones first:

1. Downgrade MSYS2 Toolchain to Win8.1-Compatible Versions

Newer MSYS2 packages don’t support Win8.1 anymore, so roll back to a working set:

  • Open the correct MSYS2 terminal (either MinGW 32-bit or 64-bit, matching your target architecture) and run these commands:
    # Roll back keyring and pacman first to avoid package signature errors
    pacman -U https://repo.msys2.org/msys/x86_64/msys2-keyring-1~20230214-1-any.pkg.tar.zst
    pacman -U https://repo.msys2.org/msys/x86_64/pacman-6.0.2-8-x86_64.pkg.tar.zst
    # Install Win8.1-compatible gcc, gdb, and CRT
    pacman -S mingw-w64-x86_64-gcc=12.2.0-1 mingw-w64-x86_64-gdb=12.1-1 mingw-w64-x86_64-crt=10.0.0-1
    
  • Restart MSYS2 and Qt Creator after installing to ensure the old toolchain is used.

2. Match Build Architecture to Your System

  • If you’re on 64-bit Win8.1: In Qt Creator, switch your Kit to MinGW 64-bit, and add -m64 to your compiler flags (under Projects > Build Settings > Compiler > Additional Arguments). This avoids WoW64 emulation entirely.
  • If you’re on 32-bit Win8.1: Use MinGW 32-bit Kit and add -m32 to compiler flags. Make sure you installed the 32-bit MSYS2 toolchain.

3. Fix Qt Creator’s Debugger Configuration

  • Go to Tools > Options > Build & Run > Debuggers
  • Add the MSYS2 gdb path (e.g., C:\msys64\mingw64\bin\gdb.exe for 64-bit) and set it as the default debugger for your Kit.
  • Disable any "Use Native Windows Debugger" option if it’s enabled—force Qt Creator to use MSYS2’s gdb.

4. Enable Required Windows Services

  • Press Win+R, type services.msc, and hit Enter.
  • Find Remote Procedure Call (RPC) and make sure it’s running (set startup type to Automatic if it’s not).
  • Do the same for Windows Error Reporting Service.
  • Reboot your PC after making changes.

5. Disable GDB’s Shell Startup

  • In Qt Creator’s Debugger settings (for your Kit), add -ex "set startup-with-shell off" to the "Additional Debugger Commands" field. This prevents gdb from spawning an MSYS2 shell on startup, which can cause conflicts with Win8.1’s subsystem.

Verify the Fix

After trying these steps, recompile your sum code, set a breakpoint, and start debugging. If the breakpoint hits normally without the unknown signal popup, you’re good to go. If not, test with a super simple C program (just a main function adding two numbers) to rule out any code-specific issues.

内容的提问来源于stack exchange,提问作者vasili111

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:41:48