From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2185 invoked by alias); 26 Jun 2008 18:50:28 -0000 Received: (qmail 2176 invoked by uid 22791); 26 Jun 2008 18:50:27 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jun 2008 18:50:10 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 85BB12A96A6; Thu, 26 Jun 2008 14:50:08 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QV6s3GUBGwfP; Thu, 26 Jun 2008 14:50:08 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 647532A96A2; Thu, 26 Jun 2008 14:50:08 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 3856CE7ACD; Thu, 26 Jun 2008 14:50:08 -0400 (EDT) Date: Thu, 26 Jun 2008 18:50:00 -0000 From: Joel Brobecker To: Pavel Chernikov Cc: gdb@sourceware.org Subject: Re: gdb / dbx / pstack question - getting function argument addresses from stack Message-ID: <20080626185008.GC8971@adacore.com> References: <7611a2ff0806260620k4e4f6765l6a306c7e363fa12e@mail.gmail.com> <20080626142633.GB3595@adacore.com> <7611a2ff0806260803q226a05f8s833d9907d42e589c@mail.gmail.com> <20080626162449.GF3595@adacore.com> <7611a2ff0806261108o1855655cp7705418469e8bdf5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7611a2ff0806261108o1855655cp7705418469e8bdf5@mail.gmail.com> User-Agent: Mutt/1.4.2.2i 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/msg00284.txt.bz2 > As you've mentioned previously, this only works on Solaris. Am I > totally out of luck on Linux? The Operating System is actually not the most important factor in this case. The reason why this "works" on Sparc is because the Sparc ABI says that the first few parameters should be passed through the output/input registers. There can be up to 6 registers passed this way. So when dbx prints the "parameters" when there is no debugging info, it is actually printing the contents of these registers. You didn't say which CPU your Linux was running on, but I'll guess it's x86. I don't know x86 all that well, but I remember that the arguments are passed through the stack at an offset to the function frame base. So the idea that works on Sparc doesn't work for x86, and I don't see another simple scheme that would work on x86 either. -- Joel