[ovs-dev] [PATCH 02/18] deal with platforms where backtrace() is in a different library than libc.

Ben Pfaff blp at nicira.com
Thu Jan 31 16:54:36 UTC 2013


On Thu, Jan 31, 2013 at 07:49:36PM +0900, YAMAMOTO Takashi wrote:
> From: YAMAMOTO Takashi <yamt at mwd.biglobe.ne.jp>
> 
> execinfo for NetBSD and ubacktrace for uClibc.
> i don't know if the latter is relevant to Open vSwitch, though.
> 
> Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>

I didn't know that backtrace() was more widely available than glibc.
Does this patch mean that NetBSD makes a backtrace function matching the
following description available via libbacktrace?  (I can see from the
web that this is true for uclibc via libubacktrace.)

 -- Function: int backtrace (void **BUFFER, int SIZE)
     The `backtrace' function obtains a backtrace for the current
     thread, as a list of pointers, and places the information into
     BUFFER.  The argument SIZE should be the number of `void *'
     elements that will fit into BUFFER.  The return value is the
     actual number of entries of BUFFER that are obtained, and is at
     most SIZE.

     The pointers placed in BUFFER are actually return addresses
     obtained by inspecting the stack, one return address per stack
     frame.

     Note that certain compiler optimizations may interfere with
     obtaining a valid backtrace.  Function inlining causes the inlined
     function to not have a stack frame; tail call optimization
     replaces one stack frame with another; frame pointer elimination
     will stop `backtrace' from interpreting the stack contents
     correctly.

Thanks,

Ben.



More information about the dev mailing list