jrfonseca / drmingw

Postmortem debugging tools for MinGW.
GNU Lesser General Public License v2.1
273 stars 53 forks source link

mgwhelp.dll not providing any symbols #4

Closed CyberShadow closed 9 years ago

CyberShadow commented 9 years ago

Hi,

I've tried to use mgwhelp.dll as a drop-in replacement for Very Sleepy. Currently we use Wine's DbgHelp which is occasionally buggy, not very portable, uses its own DWARF parser, and doesn't understand DWARF-4.

However, I couldn't get any symbols out of it at all. I've tried with 32-bit Cygwin and MSys64 with -gdwarf-2, which Wine's DbgHelp manages.

jrfonseca commented 9 years ago

I'm not sure if mgwhelp.dll intercepts all the entrypoints that Very Sleepy uses.

To be perfectly clear, mgwhelp.dll exports all symbols, but some are straight jumps to dbghelp.dll

How exacly did you integrate mgwhelp.dll with Very Sleepy?

CyberShadow commented 9 years ago

Well, I simply made it load mgwhelp.dll instead of Wine's dbghelp.dll.

Here are the functions Very Sleepy uses:

https://github.com/VerySleepy/verysleepy/blob/master/src/utils/dbginterface.h

jrfonseca commented 9 years ago

Thanks. You can see the functions MgwHelp handles in https://github.com/jrfonseca/drmingw/blob/master/src/mgwhelp32.def

But many funtions (e.g. StackWalk64) don't deal with symbols so passing-trhough is fine

I think the problem is fundamentally that Very Sleepy uses the Unicode functions, where as MgwHelp only intercepts the ASCIII functions.

I suspect that if we implement

by using their ASCII counterparts as starting point, then things might start working.

jrfonseca commented 9 years ago

I only work on DrMingw in spare time, and there's not much of that lately, so I'm afraid I can't give any ETA.

@CyberShadow, by any chance, is implementing the Unicode entry-points mentioned above something you could help with?

CyberShadow commented 9 years ago

I am still unable to build this project.

Which exact version of MSYS and MinGW are needed? There are dozens of implementations/distributions of the above for Windows.

jrfonseca commented 9 years ago

Which exact version of MSYS and MinGW are needed? There are dozens of implementations/distributions of the above for Windows.

No MSYS needed. MinGW-W64 is needed. I updated BUILD.md with URLs to make it crystal clear -- https://github.com/jrfonseca/drmingw/commit/138ab9d5f5ff2eb7d479047103b8aa982585c61b

CyberShadow commented 9 years ago

MinGW-W64 does not come with a make program, thus I can't use the Makefile that CMake generates.

CyberShadow commented 9 years ago

Can you clarify which MinGW-W64 flavor, in particular? The project provides multiple Windows downloads (cygwin, Mingw-builds, and Win-Builds). Mingw-builds is the one without the Make program. I couldn't get Win-Builds to work. The Mingw-builds installer also provides multiple options as to which flavor to install. (POSIX/native threads, sjlj/SEH exception handling, ...)

jrfonseca commented 9 years ago

Any MinGW-W64 flavour should work. Thought a native mingw make (any ) is indeed necessary.

The thing is I always build with cross-compilers. I once built with native mingw-w64 and updated the instructions, but indeed mingw-w64 website nowadays is quite confusing regarding binaries/downloads.

I'm now attempting to build with native mingw from scratch, and will update the instructions.

jrfonseca commented 9 years ago

I'm now attempting to build with native mingw from scratch, and will update the instructions.

Done. @CyberShadow , see https://github.com/jrfonseca/drmingw/blob/master/BUILD.md#native-toolchain

CyberShadow commented 9 years ago

Ahh, thanks. Wasn't aware of mingw32-make. It works now.

I'm going to attempt a 64-bit build as well (as the situation is more dire with 64 bits with Very Sleepy). Will let you know.

CyberShadow commented 9 years ago

Yep, worked with the same MinGW version but s/x32/x64/ s/dwarf/seh/ :

http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-win32/seh/x64-4.8.1-release-win32-seh-rev5.7z/download