From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9165 invoked by alias); 26 May 2004 00:00:01 -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 9109 invoked from network); 25 May 2004 23:59:59 -0000 Received: from unknown (HELO lakermmtao05.cox.net) (68.230.240.34) by sourceware.org with SMTP; 25 May 2004 23:59:59 -0000 Received: from white ([68.9.64.121]) by lakermmtao05.cox.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20040525235959.EYUV10019.lakermmtao05.cox.net@white>; Tue, 25 May 2004 19:59:59 -0400 Received: from bob by white with local (Exim 3.35 #1 (Debian)) id 1BSlpu-0007p2-00; Tue, 25 May 2004 19:59:58 -0400 Date: Wed, 26 May 2004 00:00:00 -0000 From: Bob Rossi To: Paul Dubuc Cc: GDB Mailing List Subject: Re: Taking the address of a convenience variable value Message-ID: <20040525235958.GA30063@white> Mail-Followup-To: Paul Dubuc , GDB Mailing List References: <40B37A92.6020106@cas.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40B37A92.6020106@cas.org> User-Agent: Mutt/1.3.28i X-SW-Source: 2004-05/txt/msg00171.txt.bz2 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. > > It doesn't work with gdb 5.3 or 6.1 on Solaris. The author claims that it > works on HP-UX, but I don't know why it would be any different. > > Is there a way around this? Or is there another source of user-defined > commands that can be used to print the contents of STL containers in gdb? > Any help would be very much appreciated. I read that article and was wondering if it was necessary to compile the STL with -g and not with -O2. I don't think the author mentioned it, but how else could all of the symbols in the STL work properly with GDB? Bob Rossi