How to know what function called another

后端 未结 7 1686
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-11 17:53

I wanna know if there is any way to know where the function currently in execution was called, this is, in what file and line. I\'m using C language, and I\'m looking for so

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-11 18:32

    This is actually a bit more complicated to do. Your best bet is to get a backtrace on a debugger, or find something similar to pstack for your platform. The manual way would involve traversing the call stack and using debug symbols to translate that to files and lines.

提交回复
热议问题