RE: please help me about __builtin_return_address

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

 



Andrew,

thank you very much for your response.

I changed the lock_function as follows;

static void lock_kernel(void)
{
        int depth = current->lock_depth+1;
        if (likely(!depth)) {
                get_kernel_lock();
                kernel_lock_trace_buffer[kernel_lock_trace_index%16] = current;
                kernel_lock_addr[kernel_lock_trace_index++%16]
                    = __builtin_return_address(1);
        }
        current->lock_depth = depth;
}

Then I got following messages;

include/linux/smp_lock.h: In function `lock_kernel':
include/linux/smp_lock.h:60: warning: unsupported arg to `__builtin_return_address'

Can I use __builtin_return_address on IA64 server or not?

Thank you,

Shin

-----Original Message-----
From: Andrew Haley [mailto:aph@xxxxxxxxxx]
Sent: Friday, February 09, 2007 8:04 PM
To: Anzai, Shin
Cc: gcc-help@xxxxxxxxxxx
Subject: Re: please help me about __builtin_return_address


shin.anzai@xxxxxxxxxxxxx writes:
 > Hello,
 > 
 > I got following warning message using gcc-3.4.6-3 on IA64 server;
 > 
 > include/linux/smp_lock.h: In function `init':
 > include/linux/smp_lock.h:60: warning: unsupported arg to `__builtin_return_address'
 > 
 > 
 > The lock_kernel function referred by init is as follows;
 > 
 > static inline void lock_kernel(void)
 > {
 >         int depth = current->lock_depth+1;
 >         if (likely(!depth)) {
 >                 get_kernel_lock();
 >                 kernel_lock_trace_buffer[kernel_lock_trace_index%16] = current;
 >                 kernel_lock_addr[kernel_lock_trace_index++%16]
 >                     = __builtin_return_address(2);
 >         }
 >         current->lock_depth = depth;
 > }
 > 
 > Could you let me know how can I use __builtin_return_address?

This is once case where everything is complete in the documentation:

 -- Built-in Function: void * __builtin_return_address (unsigned int
          LEVEL)
     This function returns the return address of the current function,
     or of one of its callers.  The LEVEL argument is number of frames
     to scan up the call stack.  A value of `0' yields the return
     address of the current function, a value of `1' yields the return
     address of the caller of the current function, and so forth.  When
     inlining the expected behavior is that the function will return
     the address of the function that will be returned to.  To work
     around this behavior use the `noinline' function attribute.

     The LEVEL argument must be a constant integer.

     On some machines it may be impossible to determine the return
     address of any function other than the current one; in such cases,
     or when the top of the stack has been reached, this function will
     return `0' or a random value.  In addition,
     `__builtin_frame_address' may be used to determine if the top of
     the stack has been reached.

     This function should only be used with a nonzero argument for
     debugging purposes.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux