From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21987 invoked by alias); 18 Jun 2007 12:27:21 -0000 Received: (qmail 21977 invoked by uid 22791); 18 Jun 2007 12:27:19 -0000 X-Spam-Check-By: sourceware.org Received: from mail.gmx.net (HELO mail.gmx.net) (213.165.64.20) by sourceware.org (qpsmtpd/0.31) with SMTP; Mon, 18 Jun 2007 12:27:14 +0000 Received: (qmail invoked by alias); 18 Jun 2007 12:27:11 -0000 Received: from port-83-236-52-166.dynamic.qsc.de (EHLO port-83-236-52-166.dynamic.qsc.de) [83.236.52.166] by mail.gmx.net (mp046) with SMTP; 18 Jun 2007 14:27:11 +0200 X-Authenticated: #9832049 From: Maik Beckmann To: gdb@sourceware.org Subject: Re: how to view content in stl vector Date: Mon, 18 Jun 2007 12:27:00 -0000 User-Agent: KMail/1.9.7 References: <200706181314.44405.maikbeckmann@gmx.de> <20070618112721.GA2559@caradoc.them.org> In-Reply-To: <20070618112721.GA2559@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706181426.36383.maikbeckmann@gmx.de> X-Y-GMX-Trusted: 0 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: 2007-06/txt/msg00139.txt.bz2 Am Montag, 18. Juni 2007 13:27:21 schrieb Daniel Jacobowitz: > > define dump_vector_simple > > FYI: I'm planning for a future version of GDB to be able to do this > automatically in the "print" command. No promises on when it will be > ready, though. Might be another two years. Hello Daniel, First of all, I'm new to gdb (don't ask me why I didn't used a debugger until last weok, there is no rational reason). Native c++/stl support for gdb would be nice. Until then using user defined gdb-functions is a good workarround. Regarding user defined functions, doing this for std::vector is easy. It took only one day to write the scripts I posted (enforced by google and gmane). But there are others like std::map where one has to cast to get the content of a node i.e. for std::map you have to do set $h = $map_instance_name._M_t._M_impl._M_header p (('std::_Rb_tree_node >' *) $h)->_M_value_field I tried to do this more generic: set $h = $map_instance_name._M_t._M_impl._M_header set $key_type = 'int' set $mapped_type = 'char' set $node_type = 'std::_Rb_tree_node >' p (( $node_type *) $h)->_M_value_field which would make things like dump_std_map mymap int char possible. But it didn't work :( Is storing of typenames possible at all? i.e. set $type = int // syntax error! set $type = 'int' // syntax error! A workaround for this would be a native c++ map-dump function, which naturally would be implemented as function template, but I didn't find out how to call an instantiated function template :( It would be nice if you could give me a hint towards function templates and the typename storing issue. MfG, Maik Beckmann