From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4888 invoked by alias); 30 May 2012 22:42:43 -0000 Received: (qmail 4880 invoked by uid 22791); 30 May 2012 22:42:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,TW_RG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sandstone.cs.wisc.edu (HELO sandstone.cs.wisc.edu) (128.105.6.39) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 May 2012 22:42:28 +0000 Received: from hank.cs.wisc.edu (hank.cs.wisc.edu [128.105.181.52]) by sandstone.cs.wisc.edu (8.14.1/8.14.1) with ESMTP id q4UMgPe4013334; Wed, 30 May 2012 17:42:25 -0500 Message-ID: <4FC6A251.3080806@cs.wisc.edu> Date: Wed, 30 May 2012 22:42:00 -0000 From: Evan Driscoll User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Keith Seitz CC: gdb@sourceware.org Subject: Re: Pythons scripting API question References: <4FC66293.5040908@cs.wisc.edu> <4FC68FD0.4060809@redhat.com> In-Reply-To: <4FC68FD0.4060809@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2012-05/txt/msg00147.txt.bz2 On 05/30/2012 04:23 PM, Keith Seitz wrote: > Frames contain blocks, blocks contain variables. Blocks in python can be > iterated Great, it's that information that I was missing. However, if I do this: > $ ./gdb -nx -q gdb -ex "break main" -ex "run" > (gdb) python import gdb > (gdb) python for n in gdb.selected_frame().block(): print n, > argc argv args > (gdb) python print n.type > struct captured_main_args > (gdb) python print n.name > args > (gdb) python print n.is_argument > False > (gdb) python print n.value(gdb.selected_frame()) > {argc = 0, argv = 0x488f80 <_start>, use_windows = -8032, interpreter_p > = 0x0} then on the last step I get this instead: (gdb) python print n.value(gdb.selected_frame()) Traceback (most recent call last): File "", line 1, in AttributeError: 'gdb.Symbol' object has no attribute 'value' Error while executing Python code. Instead, I have to use (gdb) python print gdb.selected_frame().read_var(n) {argc = 6742752, argv = 0x0, use_windows = -7696, interpreter_p = 0x0} Is this just a version difference? Evan