How to get callstack .



  • Hi
    Anyone knows how to get callstack in QT application in the manner of GDB backtrace ?

    Use model :

    code :
    @int main {
    f1() ;
    }

    int f1 () {
    f2();
    }

    int f2 () {
    printStack() ;
    }
    @

    output :
    main
    f1
    f2

    Thanks.



  • I don't think there's a way of doing this with the public API of Qt, so you have to fall back to platform-specific code like <code>backtrace()</code> on glibc and <code>CaptureStackBackTrace()</code> / <code>StackWalk64()</code>on msvc.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.