This is the mail archive of the
mailing list for the Cygwin project.
Re: Stack traces in own program in cygwin
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Wed, 01 Aug 2007 08:50:42 -0700
- Subject: Re: Stack traces in own program in cygwin
- References: <46B07604.email@example.com>
- Reply-to: cygwin at cygwin dot com
Bas Vodde wrote:
> I'm working on some unit testing framework and was thinking of building
> in some functionality for stack traces. I checked what functionality is
> available and found glibc contains execinfo.h with backtrace which can
> be used (for linux).
Yes, that's glibc-specific functionality which is not applicable
> For Windows, I use gcc and cygwin. I cannot find the execlib.h in cygwin
> at all, so I'll need to find a different way. In Windows I can probably
> use the MS dbghelp.dll, but that would create a dependency on Win SDK,
> which I prefer not having.
There is rudimentary code in Cygwin for trying to unwind the stack, but
it's only used in fatal error conditions such as when a SEGV fault
occurs and the <foo>.exe.stackdump file is written. And this just shows
the raw memory addresses of the call chain, it does not attempt to
resolve them into symbolic functions, so it would be quite useless for a
It is possible to write code that uses the dbghelp library that does not
need anything third party tools installed, as the library is included as
part of the operating system since Win2k. However, the bundled version
may be quite old, so it might not have all the functionality of a newer
one. See e.g. <http://msdn2.microsoft.com/en-us/library/ms679294.aspx>
You could also bundle a copy of gdb, and then attach-backtrace-detach,
but that's probably not the kind of answer you're looking for.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html