This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Backtrace library [1/3]


On Sep 11, 2012, at 3:53 PM, Ian Lance Taylor <iant@google.com> wrote:

> I have finished the initial implementation of the backtrace library I
> proposed at http://gcc.gnu.org/ml/gcc/2012-08/msg00317.html .  I've
> separated the work into three patches.  These patches only implement the
> backtrace library itself; actual use of the library will follow in
> separate patches.

Hi Ian,

I have no specific comment on the implementation of this library, but:
> 
> +/* Get a full stack backtrace.  SKIP is the number of frames to skip;
> +   passing 0 will start the trace with the function calling backtrace.
> +   DATA is passed to the callback routine.  If any call to CALLBACK
> +   returns a non-zero value, the stack backtrace stops, and backtrace
> +   returns that value; this may be used to limit the number of stack
> +   frames desired.  If all calls to CALLBACK return 0, backtrace
> +   returns 0.  The backtrace function will make at least one call to
> +   either CALLBACK or ERROR_CALLBACK.  This function requires debug
> +   info for the executable.  */
> +
> +extern int backtrace (int skip, backtrace_callback callback,
> +		      backtrace_error_callback error_callback, void *data);

FYI, "backtrace" is a well-known function provide by glibc (and other libc's).  It might be best to pick another name.

-Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]