From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11989 invoked by alias); 23 Nov 2004 16:24:06 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 11908 invoked from network); 23 Nov 2004 16:23:55 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 23 Nov 2004 16:23:55 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iANGNoTX008177 for ; Tue, 23 Nov 2004 11:23:55 -0500 Received: from localhost.redhat.com (vpn50-87.rdu.redhat.com [172.16.50.87]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iANGNor00599; Tue, 23 Nov 2004 11:23:50 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 0C687129D8C; Tue, 23 Nov 2004 11:23:31 -0500 (EST) Message-ID: <41A363FE.9060307@redhat.com> Date: Tue, 23 Nov 2004 16:34:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: Eli Zaretskii Cc: gdb@sources.redhat.com Subject: Re: new option --readnever & script gstack? References: <41A24D4E.6090301@redhat.com> <01c4d151$Blat.v2.2.2$ca52d9c0@zahav.net.il> In-Reply-To: <01c4d151$Blat.v2.2.2$ca52d9c0@zahav.net.il> Content-Type: multipart/mixed; boundary="------------090702060109050309090306" X-SW-Source: 2004-11/txt/msg00223.txt.bz2 This is a multi-part message in MIME format. --------------090702060109050309090306 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2432 Eli Zaretskii wrote: >>Date: Mon, 22 Nov 2004 15:34:22 -0500 >>From: Andrew Cagney >> >>As the oposite to --readnow, I'd like to propose a new option >>--readnever (i.e., don't read in the symbolic debug inf). That and a >>few lines of script should let GDB implemement a direct equivalent to >>pstack (called gstack say). > > > An alternative to this would be to have a --read=WHEN switch, which > could accept 3 arguments: `now', `asneeded' (the default), and > `never'. > > However, I must admit that, like Mark, I don't see the situation where > this would be useful. Could you perhaps describe such a situation, > and explain how the existance of the new option would help, including > the auxiliary script and the relation to `pstack'? Lets focus on "pstack", or a potential GDB alternative, "gstack". The pstack program attaches to a running process, dumps out a minimal backtrace (i.e., no symbolic information such as parameter names) of all threads, and then detaches. It's useful when tying to quickly capture information from a live system. The top three google hits for "pstack" are: http://packages.debian.org/unstable/devel/pstack The existing pstack port. Last time I checked it didn't work with threads, didn't work when there was no unwind information, and didn't work on most architectures (i386 specific)? http://oss.oracle.com/projects/pstack-gdb/ An existing wrapper to GDB. It works as well as GDB (i.e., threads, when there's no unwind information, and across architectures). http://docs.sun.com/doc/816-0210/6m6nb7mih?a=view For reference, doco on the entire p* family of commands. Now to get a more functional pstack, I can think of two strategies: - throw new code at pstack (or similar) until it supports threads, non-debug-info frames and multiple architectures, ... - modify the existing GDB, which already handles threads and non-debug-info frames, and multiple architectures, so that it can implement pstack. I've attached a prototype GDB wrapper that implements the second alternative. The only missing piece is the suppression of symbolic info in the backtrace - pstack, which is trying to be quick, doesn't include that more detailed information. So, to my questions: - what of an option to suppress symbolic debug info (--readnever, --read=never, --symtab-read=never, ...)? - what of a new script called gstack, bundled with GDB? Andrew --------------090702060109050309090306 Content-Type: application/x-shellscript; name="gstack.sh" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="gstack.sh" Content-length: 688 IyEvYmluL3NoCgppZiB0ZXN0ICQjIC1uZSAxOyB0aGVuCiAgICBlY2hvICJV c2FnZTogYGJhc2VuYW1lICQwYCA8cHJvY2Vzcy1pZD4iIDE+JjIKICAgIGV4 aXQgMQpmaQoKaWYgdGVzdCAhIC1yIC9wcm9jLyQxOyB0aGVuCiAgICBlY2hv ICJQcm9jZXNzICQxIG5vdCBmb3VuZC4iIDE+JjIKICAgIGV4aXQgMQpmaQoK IyBUd28gYWx0ZXJuYXRpdmVzIGFzIHRocmVhZCBhcHBseSBhbGwgZG9lc24n dCB3b3JrIHdoZW4gbm8gdGhyZWFkcy4KaWYgdGVzdCBgbHMgL3Byb2MvJDEv dGFzayB8IHdjIC1sYCAtZ3QgMTsgdGhlbgogICAgYmFja3RyYWNlPSJ0aHJl YWQgYXBwbHkgYWxsIGJ0IgplbHNlCiAgICBiYWNrdHJhY2U9ImJ0IgpmaQoK IyBSdW4gR0RCLCBzdHJpcCBvdXQgdW53YW50ZWQgbm9pc2UuCmdkYiAtLXF1 aWV0IC1ueCAvcHJvYy8kMS9leGUgJDEgPDxFT0YgMj4mMSB8IAokYmFja3Ry YWNlCkVPRgpzZWQgXAogICAgLWUgJ3MvXihnZGIpIC8vJyBcCiAgICAtZSAn L15bXiNdL2QnCg== --------------090702060109050309090306--