From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10302 invoked by alias); 26 Jun 2008 19:04:46 -0000 Received: (qmail 10291 invoked by uid 22791); 26 Jun 2008 19:04:45 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jun 2008 19:04:25 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 93AC898366; Thu, 26 Jun 2008 19:04:22 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 2820A9835A; Thu, 26 Jun 2008 19:04:22 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KBwlZ-0008F7-Aj; Thu, 26 Jun 2008 15:04:21 -0400 Date: Thu, 26 Jun 2008 19:04:00 -0000 From: Daniel Jacobowitz To: Pavel Chernikov Cc: Michael Snyder , Joel Brobecker , gdb@sourceware.org Subject: Re: gdb / dbx / pstack question - getting function argument addresses from stack Message-ID: <20080626190421.GA31664@caradoc.them.org> Mail-Followup-To: Pavel Chernikov , Michael Snyder , Joel Brobecker , gdb@sourceware.org References: <7611a2ff0806260620k4e4f6765l6a306c7e363fa12e@mail.gmail.com> <20080626142633.GB3595@adacore.com> <7611a2ff0806260803q226a05f8s833d9907d42e589c@mail.gmail.com> <20080626162449.GF3595@adacore.com> <7611a2ff0806261108o1855655cp7705418469e8bdf5@mail.gmail.com> <1214506032.3601.1375.camel@localhost.localdomain> <7611a2ff0806261156x3b6dd54cv880129c0be194e06@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7611a2ff0806261156x3b6dd54cv880129c0be194e06@mail.gmail.com> User-Agent: Mutt/1.5.17 (2008-05-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00287.txt.bz2 On Thu, Jun 26, 2008 at 02:56:45PM -0400, Pavel Chernikov wrote: > Right, understood - thanks for pointing that out to me. I should have > mentioned that the original platform was SPARC Solaris and the new > platform is I386 Linux. > > With that said, am I absolutely-totally-100% out of luck with being > able to find function argument addresses? Or is there some way of > doing this? > > Ideally, I'd like to write the following solution in C: > * List all function calls with corresponding function argument list > for each function Basically, you can not do this in any reliable way without debug info. You might be able to approximate of it by studying the x86 ABI, since GDB does expose the stack pointer at the time of call; in normal cases (not always), arguments will be consecutive words starting at $esp in the caller. A more useful approach might be a GCC mode which generates reduced debug info, including parameters but little else. I don't remember if that's what -g1 does. -- Daniel Jacobowitz CodeSourcery