Win32 API堆栈步行与MinGW / MSYS? [英] Win32 API stack walk with MinGW/MSYS?

查看:119
本文介绍了Win32 API堆栈步行与MinGW / MSYS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须开发一个堆栈跟踪步骤到我们的win32 API plattform支持来捕获任何异常与JAVA堆栈跟踪的行为。实际上,我们得到了一个完整的功能实现的Linux平台。



首先,我试图使用win32 CaptureStackBackTrace API
机制实现一个堆栈。但是这个方法没有集成到mingw的实际winbase头部(使用MSYS / MinGW 5.1.x)...



所以我决定尝试使用dbgheader机制,此链接的说明:
http://sites.google .com / site / kenscode / prime-programs / boinc-with-mingw-on-win32



但是我又失败了,不解决。我想MinGW不能解决dbgheader库....



DrMinGW不是一个选项,而它是一个JIT调试器,我必须实现一个堆栈跟踪机制,对于任何异常发生在运行时有一个可定制的日志文件跟踪,就像我们从JAVA ...知道...

有任何人获得MSYS / MinGW可运行的win32 API握手?我不会改变编译器到丑陋的MVC编译器,而不是使用MSYS / MinGW ...



感谢任何提示。
最好,



Christian

解决方案

。Edd的堆栈跟踪库在以下链接。它会产生一个很好的堆栈帧列表,并有特定的代码来支持MinGW。



http://www.mr-edd.co .uk / code / stack_trace



他的库使用dbghelp.dll,所以你可能会遇到一些问题,试图编译它。据我所知,MinGW不包括这个DLL的导入库(参见旧的功能请求这里)。然而,我成功了,自己创建一个导入库。你可以做同样只是使用一个.def文件从Wine项目(检查上一个链接的附件文件),并运行MingW实用程序dlltool:

  dlltool -k -d dbghelp.def -l dbghelp.a 

然后在项目中包含生成的dbghelp.a文件。你可能不想在你的发布版本中依赖dbghelp.dll,因为DLL本身是不可再分发的。


i've to develop a stack trace walk to our win32 API plattform support to catch any exception with a behaviour of a JAVA stacktrace. Actually we got a full functional implementation for Linux plattforms.

First i've tried to implement a stackwalk using the win32 CaptureStackBackTrace API mechanism. But this method is not integrated in the actually winbase header of mingw (using MSYS/MinGW 5.1.x) ...

So i decided tried use the dbgheader mechanism follwoing the instructions of this link : http://sites.google.com/site/kenscode/prime-programs/boinc-with-mingw-on-win32

But i fail again and run into linker failures i could not solve. I think MinGW could not resolve the dbgheader library ....

DrMinGW is not an option for me, while it is a JIT Debugger, i've to implement a stack trace mechansim, for any exception occuring on runtime with a customizable log file tracebility like we know from JAVA ...

Has anyone get MSYS/MinGW runable with the win32 API in handshake? I will not change the compiler to the ugly MVC compiler instead of using MSYS/MinGW...

Thanks for any hint. Best regards,

Christian

解决方案

Check Mr. Edd's stack trace library at the following link. It will produce a nice stack frame listing and has specific code to support MinGW.

http://www.mr-edd.co.uk/code/stack_trace

His library uses dbghelp.dll, however, so you may get into some problems trying to compile it. As far as I know, MinGW doesn't include an import library for this DLL (see a old feature request here). I had success, however, creating one import library myself. You can do the same just using a .def file from the Wine project (check the previous link's attached files for one) and running the MingW utility dlltool:

dlltool -k -d dbghelp.def -l dbghelp.a

You can then include the resulting dbghelp.a file in your project. You won't probably like to have dependencies towards dbghelp.dll in your release builds, as the DLL itself is surely not redistributable.

这篇关于Win32 API堆栈步行与MinGW / MSYS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆