Boost logo

Boost Users :

From: Mehdi Est (mehdiesteghamat_at_[hidden])
Date: 2020-12-05 19:41:25


Hi Bill,

Thanks to your comment, I got it working for QT MinGW32
(C:\Qt_5_12\Tools\mingw730_32\bin\g++.exe) ! Interestingly enough, I didn't
need libdl and I wasn't able to find it under QT-MinGW32 folder either.
Though, I was able to see full stack trace even when linking many C and C++
objects in one build. Below is the minimum setup I needed to get things
working for the same code discussed earlier.

The other interesting experience I had, is that I could see stack trace
using -g and -O0 but any higher optimization did not work (at least for me,
it only printed the most top function in the call stack) which is more or
less acceptable because debug info is only available in debug-enabled
compilations.

I am just curious, in case I need to create a stack dump / crash report in
production (built with optimization level >= 1),

how would I be able to achieve that?

Many thanks,
Mike

c:\Users\Mike-laptop\workspace_v9_2_1\cxxlab\tmp\mixccpp>make clean all &&
stack_traces.exe
g++ -O0 -DBOOST_STACKTRACE_USE_BACKTRACE -I../../../boost_1_73_0
-Ic:\temp\libbacktrace -c main.cpp -omain.o
g++ main.o -o stack_traces.exe -L"C:\temp\libbacktrace" -lbacktrace
 0#
boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame>
>::init(unsigned int, unsigned int) in c:\Users\ Mike
-laptop\workspace_v9_2_1\cxxlab\tmp\mixccpp\stack_traces.exe
 1# add(double, double) in
c:\Users\Mike-laptop\workspace_v9_2_1\cxxlab\tmp\mixccpp\stack_traces.exe
 2# main in c:\Users\ Mike
-laptop\workspace_v9_2_1\cxxlab\tmp\mixccpp\stack_traces.exe
 3# __tmainCRTStartup in
c:\Users\Mike-laptop\workspace_v9_2_1\cxxlab\tmp\mixccpp\stack_traces.exe
 4# register_frame_ctor in C:\Windows\System32\KERNEL32.DLL
 5# register_frame_ctor in C:\Windows\SYSTEM32\ntdll.dll
 6# register_frame_ctor in C:\Windows\SYSTEM32\ntdll.dll
1 + 2 = 3

On Sat, Dec 5, 2020 at 10:36 AM Bill Somerville via Boost-users <
boost-users_at_[hidden]> wrote:

> On 05/12/2020 11:57, Mehdi Est via Boost-users wrote:
>
> Hi Everyone,
>
> I am trying to print stack-trace using boost *HEADER-ONLY. *I am using
> descriptions under Configuration and Build
> <https://www.boost.org/doc/libs/1_74_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.windows_deployment_and_symbol_fi> to
> compile a simple code using QT MinGW32 I also use the below macros to tune
> boost:
>
> -DBOOST_STACKTRACE_USE_WINDBG -DBOOST_STACKTRACE_USE_ADDR2LINE
> -DBOOST_STACKTRACE_ADDR2LINE_LOCATION
>
> I have no clue why the function names and line numbers are not showing up.
>
> Any comment is appreciated.
> Mike
>
> Hi Mike,
>
> this page:
> https://www.boost.org/doc/libs/develop/doc/html/stacktrace/configuration_and_build.html
> says that the dbgeng library can only extract symbolic information from
> 64-bit MinGW executables. It looks like you need to use the 3rd-party
> libbacktrace library with 32-bit MinGW executables to capture that
> information.
>
> Regards
> Bill Somerville.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net