From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7554 invoked by alias); 26 May 2004 17:31:13 -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 7546 invoked from network); 26 May 2004 17:31:12 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 26 May 2004 17:31:12 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1BT2F2-0004pk-MG; Wed, 26 May 2004 13:31:00 -0400 Date: Wed, 26 May 2004 17:31:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: Bob Rossi , Paul Dubuc , GDB Mailing List Subject: Re: Taking the address of a convenience variable value Message-ID: <20040526173100.GA18211@nevyn.them.org> Mail-Followup-To: Andrew Cagney , Bob Rossi , Paul Dubuc , GDB Mailing List References: <40B37A92.6020106@cas.org> <20040525235958.GA30063@white> <40B4D2D2.3000700@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40B4D2D2.3000700@gnu.org> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-05/txt/msg00180.txt.bz2 On Wed, May 26, 2004 at 01:24:34PM -0400, Andrew Cagney wrote: > >On Tue, May 25, 2004 at 12:55:46PM -0400, Paul Dubuc wrote: > > > >>>In the June 2004 issue of the C/C++ User's Journal (p. 24) there is an > >>>article on how to write user-defined commands for gdb to examine the > >>>contents of STL vectors, sets and maps. It looks extremely useful, so I > >>>decided to try it modifying the commands for use with the GCC STL, but I > >>>can't get some of the commands for sets and maps to work. It relies on > >>>a tecnique that involves being able to take the address of a convenience > >>>variable value, for example: > >>> > >>> set $maptype = &$arg0._M_t._M_header->_M_value_field > >>> set $maptypep = &$maptype > >>> > >>>When I try this the 2nd statement gives me the error message > >>> > >>> Attempt to take address of value not located in memory. > > As you note, its trying to take the address of a convenience variable - > since convenience variables do not live in the inferior they don't have > an address. > > Does: > > set $maptype = &$arg0._M_t._M_header->_M_value_field > set $maptypep = &&$arg0._M_t._M_header->_M_value_field > > or: > > set $maptype = $arg0._M_t._M_header->_M_value_field > set $maptypep = &$arg0._M_t._M_header->_M_value_field > > make sense? > > The other, sigh, possability is that this was a ``feature'' and there's > been a regression :-/ Or that it never worked in the FSF tree at all. There's a reference below to HP-UX - could this be HP's hacked GDB sources? > What does: > > (gdb) paddr &$arg0._M_t._M_header->_M_value_field > > display? I don't think GDB has a paddr command? -- Daniel Jacobowitz