[英]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:
该程序只是不成功存在,并抛出以下不良男孩之一:
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中打开故障转储,并获取了一些信息,但是由于未导出符号,因此它确实很神秘。
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: 参考文献:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.