Skip to content

name() returns the wrong result with libbacktrace backend and mingw #212

Description

@prbegd

I'm building with mingw-w64 on Windows and using libbacktrace as implementation. When getting function names using name() on a frame, the wrong result as register_frame_ctor was returned.

Here is an example:

#define BOOST_STACKTRACE_USE_BACKTRACE
#include <backtrace.h>
#include <boost/stacktrace.hpp>
#include <iostream>

int main()
{
    boost::stacktrace::stacktrace trace;
    for (unsigned i = 0; i < trace.size(); ++i) {
        std::cout << i << "# " << trace[i].name() << '\n';
    }
    return 0;
}

Result:

PS C:\demo> g++ main.cpp -o main.exe -lbacktrace -std=c++20 -g
PS C:\demo> ./main
0# register_frame_ctor
1# register_frame_ctor
2# register_frame_ctor
3# register_frame_ctor
4# register_frame_ctor
5# register_frame_ctor

Environment

  • OS: Windows 11 24H2
  • Compiler: MinGW-w64 GCC 14.2.0 x86_64 posix-seh-msvcrt

I have opened a pr #224 that fixes this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions