Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using boost::stacktrace with MinGW 5.3.0 bundled with Qt 5.8 #16

Closed
abelharisov opened this issue Apr 24, 2017 · 3 comments
Closed

Using boost::stacktrace with MinGW 5.3.0 bundled with Qt 5.8 #16

abelharisov opened this issue Apr 24, 2017 · 3 comments

Comments

@abelharisov
Copy link

Hello! I have small example with boost::stacktrace: just setup handler, crash and write trace.
Everything is ok, but stacktrace doesn't contains source file names and lines numbers:

Crashed:
 0# 0x0040166D in C:\workspace\build-botsapp-Desktop_Qt_5_8_0_MinGW_32bit-Debug\booststacktracetest\debug\booststacktracetest.exe
 1# 0x75D97790 in C:\Windows\System32\msvcrt.dll

How to fix this issue? I tried several configurations: BOOST_STACKTRACE_USE_WINDBG, BOOST_STACKTRACE_USE_BACKTRACE, BOOST_STACKTRACE_USE_LIBUNWIND. Last one even doesn't write stacktrace.

Code:

#include <signal.h>
#include <cstdlib>
#include <iostream>

#define BOOST_STACKTRACE_USE_BACKTRACE
#include <boost/stacktrace.hpp>

void my_signal_handler(int signum)
{
    ::signal(signum, SIG_DFL);
    boost::stacktrace::stacktrace st;
    std::cout << "Crashed:\n" << st << std::endl;
    std::_Exit(-1);
}

void crash()
{
    throw std::runtime_error("test");
}

int main(int argc, char *argv[])
{
    ::signal(SIGSEGV, &my_signal_handler);
    ::signal(SIGABRT, &my_signal_handler);

    crash();
}

@apolukhin
Copy link
Member

That's a known problem. I'll try to come up with a solution soon.

@abelharisov
Copy link
Author

Thank you! I will be waiting for it.
There is another project, drmingw. It can print stack trace for mingw. I hope, it can help you in some way.

@apolukhin
Copy link
Member

Dup of #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants