<snip>
BACKTRACE(3) Linux Programmer’s Manual BACKTRACE(3)
NAME
backtrace, backtrace_symbols, backtrace_symbols_fd - support for appli‐
cation self-debugging
</snip>
Thanks
Sri
On Sat, Aug 22, 2009 at 12:41 AM, vinit dhatrak <vinit.dhatrak@xxxxxxxxx> wrote:
Actually there is one pretty common method to achieve this. Just define a macro
#define bar() debug_bar(__func__)
and then write a small function debug_bar(char *funct_name) which will use this string as you want and will call original bar() function.
-VinitOn Thu, Mar 5, 2009 at 12:49 PM, Ravi Sankar <ravisankar.g@xxxxxxxxx> wrote:Hi,
I would like to know how can I get the function name of the caller in c?.
Like
// c code
void foo(void)
{
bar();
}
void bar(void)
{
// who is my caller?
}
I don't want to change the caller function code to add arguments etc. Even I don't have access to the caller function source code.
Thanks for your help.
--
--,
BR,
Ravi Sankar Guntur.
--
SK Malik