0x0000000000406c01 F:\keyu_projects\asmCrashReport\build-test-Desktop_Qt_5_12_7_MinGW_64_bit-Release\release\tools\addr2line: F:\keyu_projects\asmCrashReport\build-test-Desktop_Qt_5_12_7_MinGW_64_bit-Release\release\asmCrashReportTest.exe: File format not recognized 0x0000000000406e5f F:\keyu_projects\asmCrashReport\build-test-Desktop_Qt_5_12_7_MinGW_64_bit-Release\release\tools\addr2line: F:\keyu_projects\asmCrashReport\build-test-Desktop_Qt_5_12_7_MinGW_64_bit-Release\release\asmCrashReportTest.exe: File format not recognized Everything worked fine until I checked the exported report: I just did a quick test with 64-bit mingw on your test program.
Mingw for mac code#
LONG WINAPI _winExceptionHandler( EXCEPTION_POINTERS *inExceptionInfo )Ĭonst QString cExceptionType = ( DWORD code ) LocationStr.replace( cSymbol, cFunctionName ) įrameList += QStringLiteral( " 0x%2 %3" ) QRegularExpressionMatch match = sSymbolMatching.match( locationStr ) Ĭonst QString cSymbol( match.captured( 1 ) ) Ĭonst char *cFunctionName = abi::_cxa_demangle( cSymbol.toLatin1().constData(), nullptr, nullptr, &demangleStatus) match the mangled name and demangle if we can QString locationStr = _addr2line( sProgramName, (void*) ) SymFunctionTableAccess64, SymGetModuleBase64, NULL ) #error You need to define the stack frame layout for this architecture Memset( &stackFrame, 0, sizeof( STACKFRAME64 ) )
QStringList _stackTrace( CONTEXT* context )
Mingw for mac pro#
pro file, you need to include the asmCrashreport.pri file. In addition, since I am targetting Qt applications using C++11, I took the liberty of using Qt classes and methods when putting this together. What I’ve put together uses ideas from a bunch of different sources. None of the sources I found online handled the cases quite the same way and they didn’t give the results I was looking for (name demangling for example). The code, along with example usage, may be found on the asmCrashReport GitHub page.
Mingw for mac mac#
I used many different sites in my search, but my primary sources were Catching Exceptions and Printing Stack Traces for C on Windows, Linux, & Mac by Job Vranish, Printing a Stack Trace with MinGW by Daniel Holden, and the C++ name mangling article on Wikipedia. It could also be extended to handle MSVC compiles (or maybe it already does!), but I don’t use that compiler so I can’t test it. It might work on Linux too since the code path for macOS should be POSIX compliant, though I haven’t tried it. If I wanted to get fancier I could have it automatically post the information to a web server, but for now this is simple and it works. It’s very simple – all it does is save the stack trace to a file that the user can send me – and requires some instructions to the user to work with it. So after a lot of searching and piecing things together, I’ve created something that works and fits my criteria. The reason I’m stuck with the 32-bit version is that Qt currently ships its MinGW builds of the libraries and toolchain using the 32-bit MinGW 4.9.2 compiler. Unfortunately CrashPad doesn’t handle 32-bit MinGW builds. From what I understand, Breakpad no longer works on macOS which is why they switched to CrashPad. The most promising were BreakPad (older) or CrashPad (newer) from Google.
Mingw for mac software#
In this case though it seemed like it would be easiest if I could produce a version of my software with some built-in stack tracing. I’d looked into implementing some form of crash reporting quite a while ago, but it was never a very high priority for me because I don’t get a lot of bug reports.