Sunday 15 April 2012

c - __builtin_return_address returns null for index >0? -



c - __builtin_return_address returns null for index >0? -

i want homecoming address of caller function. i'm using __builtin_return_address() funtion, if give index value greater 0 returning null.

please help me or tell me other function same.

see this answer related question.

__builtin_return_address gcc , processor specific (also available in some versions of clang on some processors some -lack of- optimizations), , documented as

on machines may impossible determine homecoming address of function other current one

the compiler might optimize function (e.g. when compiled -fomit-frame-pointer, or tail-calls, or function inlining) without relevant information.

so getting null because info not available!

c linux linux-kernel linux-device-driver

No comments:

Post a Comment