From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24499 invoked by alias); 11 Mar 2010 01:49:30 -0000 Received: (qmail 24468 invoked by uid 22791); 11 Mar 2010 01:49:29 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from outbound.icp-qv1-irony-out6.iinet.net.au (HELO outbound.icp-qv1-irony-out6.iinet.net.au) (203.59.1.109) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Mar 2010 01:49:23 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEABbbl0vLzoJq/2dsb2JhbACaV3O8S4R5BA Received: from unknown (HELO corb.contemporary.net.au) ([203.206.130.106]) by outbound.icp-qv1-irony-out6.iinet.net.au with ESMTP; 11 Mar 2010 09:49:19 +0800 Received: from [10.10.10.192] (utzon.contemporary.net.au [10.10.10.192]) by corb.contemporary.net.au (8.13.8/8.13.8) with ESMTP id o2B1nGVP026390; Thu, 11 Mar 2010 12:49:17 +1100 Message-ID: <4B984C19.80407@contemporary.net.au> Date: Thu, 11 Mar 2010 01:49:00 -0000 From: Chris Johns User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: tromey@redhat.com CC: gdb@sourceware.org Subject: Re: Reading a static variable in Python References: <4B971421.8080006@contemporary.net.au> 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: 2010-03/txt/msg00071.txt.bz2 On 11/03/2010 4:05 AM, Tom Tromey wrote: >>>>>> "Chris" == Chris Johns writes: > > Chris> I am adding pretty printers for RTEMS to gdb. In the RTEMS operating > Chris> system elements such as a semaphore are given an id. I would like to > Chris> print the actual semaphore data given a semaphore id. To do this I > Chris> need to read a kernel structure from a table indexed via a bit field > Chris> in the id. As an example the semaphore's table is declared in RTEMS > Chris> as: > > Chris> RTEMS_SEM_EXTERN Objects_Information _Semaphore_Information; > > This isn't really enough information for us to help you. > What does Objects_Information look like? > Yes sorry about that. It is a C struct [1]. > Chris> I am stuck on how to create a new gdb.Value variable in Python. > > Use gdb.parse_and_eval. Nice. This is an excellent solution. I suppose being an expression it can do the pointer maths as well. I was looking at ways to construct a gdb.Value with a gdb.Symbol as an argument. > This wasn't added until after 7.0. I am using a 7.1 snapshot as it has the 'source' command to load a Python file. This is also an excellent addition. Chris [1] http://www.rtems.org/onlinedocs/doxygen/cpukit/html/structObjects__Information.html