From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30429 invoked by alias); 20 Oct 2006 21:47:09 -0000 Received: (qmail 30421 invoked by uid 22791); 20 Oct 2006 21:47:09 -0000 X-Spam-Check-By: sourceware.org Received: from brmea-mail-4.Sun.COM (HELO brmea-mail-4.sun.com) (192.18.98.36) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 20 Oct 2006 21:47:02 +0000 Received: from sfbaymail1sca.SFBay.Sun.COM ([129.145.154.35]) by brmea-mail-4.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k9KLkxPJ024602; Fri, 20 Oct 2006 15:46:59 -0600 (MDT) Received: from vnc01.sfbay.sun.com (vnc01.SFBay.Sun.COM [129.144.80.29]) by sfbaymail1sca.SFBay.Sun.COM (8.13.6+Sun/8.13.6/ENSMAIL,v2.2) with ESMTP id k9KLkwhl020967; Fri, 20 Oct 2006 14:46:58 -0700 (PDT) Received: (from carlton@localhost) by vnc01.sfbay.sun.com (8.11.6/8.11.6) id k9KLkw723622; Fri, 20 Oct 2006 14:46:58 -0700 To: Michael Snyder Cc: Ashwin Bharambe , gdb@sourceware.org Subject: Re: Programmatic access to stack traces in C or C++ programs References: <3ef5826d0610191927n590c416fx238aa355a378d57c@mail.gmail.com> <1161373317.9942.113.camel@localhost.localdomain> From: David Carlton Date: Fri, 20 Oct 2006 21:47:00 -0000 In-Reply-To: <1161373317.9942.113.camel@localhost.localdomain> (Michael Snyder's message of "Fri, 20 Oct 2006 12:41:57 -0700") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Reasonable Discussion, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00164.txt.bz2 On Fri, 20 Oct 2006 12:41:57 -0700, Michael Snyder said: > On Thu, 2006-10-19 at 22:27 -0400, Ashwin Bharambe wrote: >> I wanted to create a "stacktrace library" which would provide a >> routine to obtain the stacktrace of the program from any point >> _programmatically_ (like Java's stacktraces, for example..) ... > I think that's pretty hopeless. But why don't you do it the easy way? > Just launch your program under gdb from the start, then use gdb > to put breakpoints at all the functions you are interested in. I've had the same wish as Ashwin. The reason why I want it is for unit testing - jUnit prints out a backtrace when an assertion fails, and I sometimes want that functionality when running C++ unit tests. And I'm not about to run GDB every single time that I run a unit test. libunwind sounds like it might be what I'm looking for, though. David Carlton david.carlton@sun.com