X-Spam-Check-By: sourceware.org X-pair-Authenticated: 60.186.249.29 Message-ID: <46B10CFE.1040708@odd-e.com> Date: Thu, 02 Aug 2007 06:45:18 +0800 From: Bas Vodde User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Stack traces in own program in cygwin References: <46B07604 DOT 9000605 AT odd-e DOT com> <46B0ABD2 DOT E4F926E9 AT dessent DOT net> In-Reply-To: <46B0ABD2.E4F926E9@dessent.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi Brian, Thanks for the reply. Where can I find the cygwin code that unwinds the stack? I might have a look at it anyway :) The problem I have with dbghelp is not whether the DLL is available, but whether the WinSDK is... It would require a header file (which is possible to fake) and a .lib. I'm not sure how to call the dbghelp calls without linking to the library. (though this should be possible, I just don't know how and where to find info about how to do it). If you for an idea about this, then that also could help me forward :) Thanks! Bas Brian Dessent wrote: > 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 > elsewhere. > >> 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 .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 > user. > > 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. > > 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. > > Brian > > -- > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > Problem reports: http://cygwin.com/problems.html > Documentation: http://cygwin.com/docs.html > FAQ: http://cygwin.com/faq/ > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/