简体   繁体   English

调试使用mingw / msys2构建的Windows服务

[英]Debugging Windows service built with mingw/msys2

Having one heck of a time debugging a crash in a Windows Service that I've build with QT and Boost Logger on Windows using MSYS2 environment. 有一段时间,我使用MSYS2环境在Windows上使用QT和Boost Logger构建的Windows服务中调试崩溃。 The main issue really comes when I stop the program right before exit. 当我在退出之前立即停止程序时,真正的主要问题就出现了。 The program just doesn't exist successfully and throws one of these bad boys: 该程序只是不成功存在,并抛出以下不良男孩之一:

Windows破解信息

If I was running it in gdb it might be a different story. 如果我在gdb中运行它,则可能是另外一个故事。 I open the crash dump in windbg and get some info, but since the symbols aren't exported it's really cryptic. 我在windbg中打开故障转储,并获取了一些信息,但是由于未导出符号,因此它确实很神秘。

WinDBG映像

I see some issues when my program (called service) is calling the log. 当我的程序(称为服务)调用日志时,我看到一些问题。 But I can't do much here in the way of where or what. 但是我在这里无法做任何事情。 How can I get something useful so I could finally solve this issue? 如何获得有用的东西,以便最终解决此问题?

Thanks so much! 非常感谢!

Seems like the easiest and most natural way was to attach gdb to the running process. 似乎最简单,最自然的方法是将gdb附加到正在运行的进程。 I simply ran msys2 as Administrator, then ran the command 我只是以管理员身份运行msys2,然后运行命令

gdb service.exe -p [processID]

Task manager gave me the process ID. 任务管理器给了我进程ID。 As soon as the process was attached I just used the command 附加过程后,我就使用了命令

continue

to get it to continue running. 让它继续运行。 Then I let it crash and gdb gave me the backtrace perfectly. 然后我让它崩溃了,gdb完美地给了我回溯。

I've searched a bit for this and this was much simpler than trying to get windbg to read the symbols generated by g++ or read the assembly code. 我已经搜索了一下,这比尝试让windbg读取g ++生成的符号或读取汇编代码要简单得多。 Hope this helps somebody having the same issue. 希望这可以帮助遇到同样问题的人。

References: 参考文献:

How to attach a process in gdb 如何在gdb中附加进程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Msys2 mingw 使用 openssl 构建 libcurl,但不支持 https - Msys2 mingw built libcurl with openssl, but https unsupported 使用mingw在Linux上进行C ++程序交叉编译可在msys2中工作,但不能直接在Windows中工作 - C++ program cross compile on linux using mingw works in msys2 but not directly in windows 在 Windows 10 x64 上使用 Ninja 作为带有 MSYS2 + MinGW 的生成器 - Using Ninja as a generator with MSYS2 + MinGW on Windows 10 x64 在64位Windows 7(msys2 / mingw64)上构建GMP 6.1.0:由于mp_limb_t不是64位,配置失败 - Building GMP 6.1.0 on 64 bit Windows 7 (msys2/mingw64): configure fails due to mp_limb_t is not 64 bits MSYS2 MinGW64 在 Windows 上构建 GMP/MPFR 作为 static 库,并将它们链接到用 CL 编译的 MSVC 项目中 - MSYS2 MinGW64 to build GMP/MPFR on Windows as static library, and link them in MSVC project compiled with CL 如何使用 MSYS2 链接 windows 中的 OpenSSL? - How to link OpenSSL in windows using MSYS2? 使用MSYS2 / Mingw32编译gRPC - Compiling gRPC using MSYS2/Mingw32 迁移到 MSYS2/MinGW64 时 Header 路径不匹配 - Header paths mismatch when migrating to MSYS2/MinGW64 MSYS2 MinGW 包中缺少 Protobuf grpc_cpp_plugin - Protobuf grpc_cpp_plugin missing in MSYS2 MinGW packages 编译Lua 5.3 Mingw64 MSys2 - Compile Lua 5.3 Mingw64 MSys2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM