Foobar2000:Call tracking macros

From Hydrogenaudio Knowledgebase
Jump to: navigation, search

foobar2000 call tracking macros[edit]

Purpose[edit]

These macros enable you to store calling context information in crash reports. Such information will be primarily useful to you (the developer) when analyzing user-submitted crash reports, as well as will allow better automated tech support messages when your component or some other code that your component interfaces with crashes (telling the user what the crash cause was etc).

It is particularly useful to use these macros when interfacing with third party code, making it more clear what was being done when the problem occurred, even if it the crash itself is not your concern.

Syntax[edit]

TRACK_CODE("my_code_label", my_code)[edit]

Puts my_code inside a call path tracking scope. If my_code crashes, the last segment of logged call path will be my_code_label, eg. entry=>app_mainloop=>my_code_label.

Example:

TRACK_CODE("this is myMethod() of myClass", obj->myMethod() );


TRACK_CALL_TEXT("my_scope_label")[edit]

Typically placed at the beginning of a scope. Puts the following code in a call path tracking scope.

Example:

void myFunction() {
    TRACK_CALL_TEXT("this is myFunction()");
    //your code goes here...
    {
        TRACK_CALL_TEXT("myFunction() inner scope");
        //some more code
    }
}

In this example, if the inner scope code crashes, the call path will end with this is myFunction()=>myFunction() inner scope.