Question on finding the caller function in C.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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.

I am doing this for a debugger which shall run on cortex-a8 & Linux. Thanks
for your help.

All i know is that I can know the caller function address using
"__builtin__return_address(0)".
I wonder how can I use this to find out the function name as 'c' string?

Any help is highly appreciated.

--,
BR,
Ravi Sankar Guntur.
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter