how to kno parent function's name ?
hello friends,
Suppose I have 2 functions, fun_A() and fun_B(). Now fun_B is calling fun_A. So In fun_B how can i know tht "fun_A" has called me ? I wanna make a C prog for the same.... |
Pass the name of the caller as an argument.
|
Not so sure how much relevant this is, but looks interesting.
|
One method is to walk the call stack yet as how to do this is dependant on the system you are using. glibc gives you a backtrace, windows has StackWalk64, then there is __builtin_return_address and __builtin_frame_address.
edit: What are you trying to achieve here is this for debugging information of say the allocation point or is this something completely different? |
Pass the fun_b() as an argument the name of the calling function.
[ So it will now become - fun_b(String caller) ] Linux Archive |
All times are GMT -5. The time now is 12:51 PM. |