delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/11/14:41:37

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=VF8ZpGG41ZoIma1vHZvTQdnwpc2gkGngSRbE7+yH9y7
E+q7xJZy9noizAmm1qzlDQfICY5cPmcylsSenoECkoZ4e2x+vz1RdFXJ8Qrcsepd
wLx60XP/IGB25szEnvu4DNyHBMDewPMQLRFxiBvJnpjKVExNsZghMjpgIAm9SJLA
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=ymo2rjF7aZ4CcH7mUnaUQOqLnuQ=; b=kbB5xDYWmIdcLcwey
Ev5HVc0d3M5h6G4gDamFNP7nLJUnR8jW9a+zeC9Km6DMVNXeExGjG7d6t3qRjGJY
35ypb5CQ4VE8NTvfjsKMu3lORUncoIvmHM/mqaPHdzwmJw8lQ13B7uY57v1JKXBE
3iv4y2DUrePyjbnCO36vSHOQ9k=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=4.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_COUK,KAM_FROM_URIBL_PCCC,KAM_STOCKGEN,SPF_PASS autolearn=no version=3.3.2
X-HELO: out.ipsmtp1nec.opaltelecom.net
X-SMTPAUTH: drstacey AT tiscali DOT co DOT uk
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A2BeAgDYiwBV/0LcRk8NT4NYWoMLwF2FJUQDAgKCBQEBAQEBAYUNAQEEIxVAEQsYAgIFFgsCAgkDAgECATcBDRMIAQGIOKx1cJslAQEBAQYBAQEBAQEBFwSBIYl2hBlfFoJSgUUFhHiJIYVrhw+DKItyg0WEEW8BAYEAgUEBAQE
X-IPAS-Result: A2BeAgDYiwBV/0LcRk8NT4NYWoMLwF2FJUQDAgKCBQEBAQEBAYUNAQEEIxVAEQsYAgIFFgsCAgkDAgECATcBDRMIAQGIOKx1cJslAQEBAQYBAQEBAQEBFwSBIYl2hBlfFoJSgUUFhHiJIYVrhw+DKItyg0WEEW8BAYEAgUEBAQE
Message-ID: <55008C41.5060105@tiscali.co.uk>
Date: Wed, 11 Mar 2015 18:41:05 +0000
From: David Stacey <drstacey AT tiscali DOT co DOT uk>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: backtrace(3) in Cygwin?
References: <550076EC DOT 40808 AT tiscali DOT co DOT uk> <20150311172244 DOT GL5732 AT calimero DOT vinschen DOT de>
In-Reply-To: <20150311172244.GL5732@calimero.vinschen.de>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019