Need a way to periodically log the call stack/stack trace for EVERY method/procedure/function called

前端 未结 5 1355
我寻月下人不归
我寻月下人不归 2020-12-08 11:51

I\'m working on a very large application where periodically I\'d like to log the ENTIRE call stack up until the current execution point (not on an exception). The idea here

5条回答
  •  有刺的猬
    2020-12-08 12:12

    When you return from a method it is removed from the stack. So presumably your Partial call stack is every method that has not yet returned?

    e.g.

    DoSomething
    begin
        MiniSubMethod
        DomeSomethingMore
        begin
            InnerDoSomething
            begin
                ShowCallStack
            end
        end
    end
    

    I would think in this situation the call stack would be

    InnerDoSomething  
    DoSomethingMore  
    DoSomething  
    

    MiniSubMethod is no longer on the stack as it returned before DoSomethingMore was called.

    I think FastMM4 includes a Stack Trace so you could try that.

    You would definitely need some kind of logging/stack trace instead of just the call stack.

提交回复
热议问题