How do I get the name of the calling function?

后端 未结 3 504
广开言路
广开言路 2021-02-04 03:38

I am using gnu tool chain. How can I, at run time, find caller of a function? i.e for example function B() gets called by many functions using function pointers. Now, whenever B

3条回答
  •  囚心锁ツ
    2021-02-04 04:21

    If you're using GNU, you can use the backtrace functions. There's an example of the use on that man page.

提交回复
热议问题