From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19970 invoked by alias); 2 Jan 2013 17:32:09 -0000 Received: (qmail 19855 invoked by uid 22791); 2 Jan 2013 17:32:05 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Jan 2013 17:31:59 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r02HVweM000618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 2 Jan 2013 12:31:58 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r02HVvHR013500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 2 Jan 2013 12:31:57 -0500 From: Tom Tromey To: Tristan Su Cc: gdb@sourceware.org Subject: Re: can pahole print a struct definition in a given CU? References: Date: Wed, 02 Jan 2013 17:32:00 -0000 In-Reply-To: (Tristan Su's message of "Mon, 24 Dec 2012 22:15:41 +0800") Message-ID: <87fw2j5w4y.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2013-01/txt/msg00002.txt.bz2 >>>>> "Tristan" == Tristan Su writes: Tristan> I found pahole (python api) quite useful but jusst could not have it Tristan> print a struct in a given compilation unit. Tristan> With the ptype command: Tristan> (gdb) ptype S Tristan> but we can also specify the CU because the struct may have different Tristan> define in different CUs. Tristan> (gdb) ptype 'foo.c'::S Tristan> Is that possible/easy to make pahole support this? I couldn't think of an easy way. Though maybe that is just imagination failure on my part :) If I were doing this I would start by finding a way to expose evaluate_type to Python, say via a flag to parse_and_eval. Then I would make pahole use this. Tom