From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16862 invoked by alias); 29 Oct 2011 17:47:05 -0000 Received: (qmail 16854 invoked by uid 22791); 29 Oct 2011 17:47:04 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Oct 2011 17:46:45 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9THkgV4022414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 29 Oct 2011 13:46:42 -0400 Received: from host1.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9THke35002883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Oct 2011 13:46:41 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9THkdIt028344; Sat, 29 Oct 2011 19:46:39 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9THkc6D028340; Sat, 29 Oct 2011 19:46:38 +0200 Date: Sat, 29 Oct 2011 18:03:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: gdb@sourceware.org Subject: Re: Specify frame by address Message-ID: <20111029174638.GA27749@host1.jankratochvil.net> References: <83k47n90xn.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83k47n90xn.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-10/txt/msg00217.txt.bz2 Hi Eli, On Sat, 29 Oct 2011 19:12:36 +0200, Eli Zaretskii wrote: > An argument specifies the frame to select. > It can be a stack frame number or the address of the frame. <<<<<<<<<< > With argument, nothing is printed if input is coming from > a command file or a user-defined command. > > But what is "the address of the frame"? I thought that using an > address of a function (the one shown by "info address") or some > address shown by the "backtrace" command would do, but none of them > seems to work. See the bottom of parse_frame_specification_1. "address of the frame" is frame_id.stack_addr. For DWARF it is CFA (dwarf2_frame_cfa), which is for most arches just unwound SP (not PC!), that is SP as shown by GDB in the caller. (gdb) info frame Stack level 5, frame at 0x7fffffffd880: [...] (gdb) up #6 0x0000000000486e82 in captured_command_loop (data=0x0) at ./main.c:234 (gdb) p/x $sp $1 = 0x7fffffffd880 (gdb) frame 0 (gdb) frame 0x7fffffffd880 #5 0x00000000006f1421 in current_interp_command_loop () at interps.c:309 > The context of this is that I would like to write a command that > automatically goes to a frame within a call to a specific function, > because that command needs to access variables local to that function. Such command really needs to iterate the frames and compare PC there. Regards, Jan