backtrace_symbols_fd man page on MacOSX

Man page or keyword search:  
man Server   23457 pages
apropos Keyword Search (all sections)
Output format
MacOSX logo
[printable version]

backtrace(3)		 BSD Library Functions Manual		  backtrace(3)

     backtrace, backtrace_symbols, backtrace_symbols_fd — call stack backtrace
     and display functions

     #include <execinfo.h>

     backtrace(void** array, int size);

     backtrace_symbols(void* const* array, int size);

     backtrace_symbols_fd(void* const* array, int size, int fd);

     These routines provide a mechanism to examine the current thread's call

     backtrace() writes the function return addresses of the current call
     stack to the array of pointers referenced by array.  At most, size point‐
     ers are written.  The number of pointers actually written to array is

     backtrace_symbols() attempts to transform a call stack obtained by
     backtrace() into an array of human-readable strings using dladdr().  The
     array of strings returned has size elements.  It is allocated using
     malloc() and should be released using free().  There is no need to free
     the individual strings in the array.

     backtrace_symbols_fd() performs the same operation as
     backtrace_symbols(), but the resulting strings are immediately written to
     the file descriptor fd, and are not returned.

	 #include <execinfo.h>
	 #include <stdio.h>
	 void* callstack[128];
	 int i, frames = backtrace(callstack, 128);
	 char** strs = backtrace_symbols(callstack, frames);
	 for (i = 0; i < frames; ++i) {
	     printf("%s\n", strs[i]);

     These functions first appeared in Mac OS X 10.5.

     dladdr(3), malloc(3)

Mac OS X		       February 15, 2007		      Mac OS X

List of man pages available for MacOSX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net