From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5741 invoked by alias); 24 Aug 2007 18:29:22 -0000 Received: (qmail 5630 invoked by uid 22791); 24 Aug 2007 18:29:20 -0000 X-Spam-Check-By: sourceware.org Received: from mail.baymicrosystems.com (HELO mail.baymicrosystems.com) (65.174.40.133) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Aug 2007 18:29:16 +0000 Received: from [192.168.1.179] (ssl-linux.baymicrosystems.com [192.168.1.179]) (authenticated bits=0) by mail.baymicrosystems.com (8.13.5/8.13.5) with ESMTP id l7OIQKUS017275; Fri, 24 Aug 2007 11:26:24 -0700 Message-ID: <46CF22CA.6090708@baymicrosystems.com> Date: Fri, 24 Aug 2007 18:29:00 -0000 From: Sheng-Liang Song User-Agent: Thunderbird 1.5.0.12 (X11/20070604) MIME-Version: 1.0 To: Eli Zaretskii , gdb@sourceware.org CC: jan.kratochvil@redhat.com, koling@kchang.net Subject: Re: reference environment variables from gdb scripts References: <12302351.post@talk.nabble.com> <20070824085740.GA11291@host0.dyn.jankratochvil.net> <46CF0945.8090901@baymicrosystems.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-08/txt/msg00200.txt.bz2 Eli Zaretskii wrote: >> Date: Fri, 24 Aug 2007 09:37:25 -0700 >> From: Sheng-Liang Song >> >> BTW, Is there a gdb script functional document? >> > > The GDB scripting commands are documented in the GDB user manual. See > the node "Sequences". > Hi, I am looking for a more detail document. (just like this vim script doc with examples): http://vimdoc.sourceforge.net/htmldoc/usr_41.html What is the different between "." and "->" operator in gdb script? (Looks like no difference to me. works the same.) What operators does gdb 6.6 support? Is a gdb script grammar like this one: http://www.nongnu.org/hcb/ $vec->_M_impl STL vector does not have the member var _M_impl. gdb) will report: There is no member or method named _M_impl. How do I check if $vec has the member _M_impl? I would like to write a script like this: if isMember($vec,_M_impl) //do something else //do something else end I have some examples that works on gdb.6.6 only. define adder if $argc == 1 print $arg0 end if $argc == 2 print $arg0 + $arg1 end if $argc == 3 print $arg0 + $arg1 + $arg2 end end define p_stl_vector64 set $vec = ($arg0) set $vec_begin = 0 set $vec_size = $vec->_M_impl->_M_finish - $vec->_M_impl->_M_start set $vec_end = $vec_size - 1 if $argc == 3 set $vec_begin = ($arg1) end if $argc == 3 set $vec_end = ($arg2) end if ($vec_size != 0) set $i = 0 while ($i <= $vec_end) printf "Vector Element %d: ", $i p *($vec->_M_impl->_M_start+$i) set $i++ end end end GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) (DOES NOT WORK!) (gdb) adder 1 2 3 Invalid type combination in equality test. GNU gdb 6.6 (works) (gdb) adder 1 2 3 $1 = 6