X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=SEVzustschY9ha1jfbOb+5pHYIL3qzh6ArFDiL1ahRnkLci+6Q5Kq NtwZNh9oBBpBlpGPq/JRtigBZWDKEVC6WM6FjWwLGLXgn3ri53SvhSG1WXFlqGdI hId3358gseLAhC17wduOFf3A7mDtktO2HjN1oBGPMx9nW2r7Rqyu/I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=O8kK2LPCdsFDRnoMDYNfrd0EoKw=; b=ImA+FCCuoaNWDq5Al6rPmq3Ij8FF ioV/J6DNy38awaYtzaq+wO+I2xUd1NpFqn7Nt6teBthiwerVvADNMkjIA2arJF9j ry0LwnZebsISjCU5iaLVg7KvVP98ADj3a4L53H42xaRIS48mGk03dJ69/pddQdbF U8lBYm4zckLeYBE= 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Date: Wed, 11 Mar 2015 20:57:50 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: backtrace(3) in Cygwin? Message-ID: <20150311195750.GM5732@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <550076EC DOT 40808 AT tiscali DOT co DOT uk> <20150311172244 DOT GL5732 AT calimero DOT vinschen DOT de> <55008C41 DOT 5060105 AT tiscali DOT co DOT uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GwwLvQJ0l3HSwfoE" Content-Disposition: inline In-Reply-To: <55008C41.5060105@tiscali.co.uk> User-Agent: Mutt/1.5.23 (2014-03-12) --GwwLvQJ0l3HSwfoE Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mar 11 18:41, David Stacey wrote: > 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=3Dnewlib-cygwin.git;a=3Dblob_pla= in;f=3Dwinsup/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... >=20 > Thanks for your reply. It shouldn't be too hard to create implementations= of > backtrace(3) and backtrace_symbols(3) using CaptureStackBackTrace() [1] a= nd > SymFromAddr() [2]. There should be enough information in a SYMBOL_INFO > structure to create strings in the same format as backtrace_symbols(). >=20 > backtrace_symbols_fd(3) might be harder, because I'm not sure I can honour > the promise not to use heap memory internally. This is something we can analyze and discuss on the cygwin-developers mailing list if you're really interested in implementing this stuff at one point. > Also, note that the Windows > functions mentioned above are single-threaded, and therefore any > implementation based on them will be single-threaded also. What about StackWalk64? And what about the existing implementation in stack_info::walk using RtlLookupFunctionEntry and RtlVirtualUnwind on x86_64? Ideally we only have one stack walk implementation and use them in both situations, implementing backtrace(3) and creating the stackdump. The stack_info::walk code for 32 bit really needs a thorough revamp anyway. > Further, Windows > XP is limited to 63 stack frames. Meh. > I'm rather busy at the moment, but if I have time then I'll have a go. That would be cool. I'm looking forward to this. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --GwwLvQJ0l3HSwfoE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVAJ4+AAoJEPU2Bp2uRE+ge0wQAIaNErzLMejUn9PZJRMb2YOF tIvYUSIiesEuMkgZfRIDdwc9i3siwGF6EAbYHYtxs4aJNsUSUf1e7xWY6lk2qHCd nrfqXSX2DIBaKU3tvFcfMH7ZMGiZwIn/geirDDpciqECBjNNrxZ/4VN6CFOGoFA/ HloyPNysnsg9qpkbHu6e812V1f5t1VBYk55KIislDZpQWYowyGU5dT2rAO2sV0M7 m29GQfLMUVTs76QvB4+T2bixpRv5ssg4CLfpGx48EPMwG0DMrKd1+FWGNLt3ljht 2VhfJAvHHM1JhxaGJJO5GQ6y6DymrAJRYYpFnxiI4mxYKuYDHUg/vf4I/Tf5bdrm b9o/xuCBXkesKSbfLjY+6ysz7O8JyXnjlLT/sLEOUcRXX5z3wYemAimmA8g2uu8J N3t0ASKvVbydQPSdvoq2KKDW3LT/nTfdI+KZRoP02ZoMmgdHtvWdkmabPMEqn1lG cHuj2nYE41GIGzjb0l8jgYAYUtU2fdF2L0lX+qzR6xOAOnSTzBg0yTOfm3ug81zw Hs/+1mYqIhI9+Fgd5wz0S9sD8DjXzYNa9StROQkmI6K5/BmhsLARVZkXv63+KHOA NNslw0uLVW7pGanbEylxE2/VdziSn2Z8VFRgFF0kP10QIsHXSStPrIsFae/c04RD 2X5ht5CdBHSRH/F33pYM =ycPv -----END PGP SIGNATURE----- --GwwLvQJ0l3HSwfoE--