This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How do I create entry/exit hook functions which get called at each function call/return?

I feel like there must be a way to do this.  I've not seen any reference to such a utility, but there must be some sort of debugging session tool which allows me to specify a entry function which gets called each time a new function is called and an exit function which gets called each time the function returns.  Is this possible?  Or am I wishing for too much?

 

In other words, I'd like to make my own call stack trace, since whenever my application crashes, it ends up in random memory with no available stack trace information.  Thanks in advance for any help someone can offer!

 

I'm running CCSv4 and CCSv5 (whichever one is not giving me issues that day) with DSP/BIOS 5.41 on Windows 7.

  • In CCSv5:

    Right click on Project > Properties > C/C++ Build > Settings --> C5500 Compiler | Entry/Exit Hook Options

    In the box labeled "Insert this call at exit from each function", use the name of the function to call upon exit from a function.

    In the box labeled "Insert this call at entry to each function", use the name of the function to call upon entry to a function.

     

    If you choose "address" in the dialog box(es) labeled "Pass caller's name or address to entry/exit hook", the following syntax works for entry/exit hook functions:

    void exit_hook_function(void(*fxn)());

     

    If you choose "name" in the dialog box(es):

    void exit_hook_function(const char *fxn_name);