From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7370 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: Execinfo.h, backtrace is needed. Date: Thu, 9 Apr 2015 20:57:57 +0300 (MSK) Message-ID: References: <20150408160507.GB31681@port70.net> <5526B6D7.9080601@safe.ca> <20150409173418.GL6817@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: ger.gmane.org 1428602296 21143 80.91.229.3 (9 Apr 2015 17:58:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Apr 2015 17:58:16 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7383-gllmg-musl=m.gmane.org@lists.openwall.com Thu Apr 09 19:58:11 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YgGiQ-0000Pn-Ec for gllmg-musl@m.gmane.org; Thu, 09 Apr 2015 19:58:10 +0200 Original-Received: (qmail 32126 invoked by uid 550); 9 Apr 2015 17:58:08 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32108 invoked from network); 9 Apr 2015 17:58:08 -0000 In-Reply-To: <20150409173418.GL6817@brightrain.aerifal.cx> User-Agent: Alpine 2.11 (LNX 23 2013-08-11) Xref: news.gmane.org gmane.linux.lib.musl.general:7370 Archived-At: On Thu, 9 Apr 2015, Rich Felker wrote: > I believe there's a third-party libbacktrace that might work with > little or no modification. One specific example would be libbacktrace from GCC, which is available under a BSD-style license: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libbacktrace Building GCC's libbacktrace separately from the rest of the compiler is not straighforward; some time ago I worked on that when importing libbacktrace for use in apitrace project; you can view the result here: https://github.com/apitrace/apitrace/tree/master/thirdparty/libbacktrace (it uses cmake simply because apitrace itself is using cmake). Please note: libbacktrace may be overkill if you don't need DWARF parsing at runtime. For example, if you can perform symbol resolution separately as post-processing, and capturing only stack frame addresses at runtime suffices, libunwind may be the tool for the job. Also, libunwind provides backtrace() as a weak alias to its own unw_backtrace(), so in simple cases it's a drop-in replacement. Hope that helps. Alexander