On 11/03/15 17:22, Corinna Vinschen wrote:
On Mar 11 17:10, David Stacey wrote:
Please could you tell me if Cygwin supports backtrace(3) and
backtrace_symbols(3) [1]? I can't find the execinfo.h header file, but
presumably Cygwin is capable of generating a backtrace because the 'bt'
command works in gdb.
GDB's `bt' implementation has nothing to do with Cygwin's capability
to walk a stack. Cygwin only has limited capabilities there which
are used to create the stackdump file, see the stack_walk class in
exceptions.cc:
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob_plain;f=winsup/cygwin/exceptions.cc
If you want to create a backtrace(3) function set for Cygwin, feel
free:https://cygwin.com/contrib.html
I'm certainly not averse to patches...
Thanks for your reply. It shouldn't be too hard to create
implementations of backtrace(3) and backtrace_symbols(3) using
CaptureStackBackTrace() [1] and SymFromAddr() [2]. There should be
enough information in a SYMBOL_INFO structure to create strings in the
same format as backtrace_symbols().
backtrace_symbols_fd(3) might be harder, because I'm not sure I can
honour the promise not to use heap memory internally. Also, note that
the Windows functions mentioned above are single-threaded, and therefore
any implementation based on them will be single-threaded also. Further,
Windows XP is limited to 63 stack frames.
I'm rather busy at the moment, but if I have time then I'll have a go.
Dave.
[1] -
https://msdn.microsoft.com/en-us/library/windows/desktop/bb204633%28v=vs.85%29.aspx
[2] -
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681323%28v=vs.85%29.aspx
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple