From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26741 invoked by alias); 27 Mar 2012 01:11:38 -0000 Received: (qmail 26731 invoked by uid 22791); 27 Mar 2012 01:11:36 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-wg0-f43.google.com (HELO mail-wg0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Mar 2012 01:11:23 +0000 Received: by wgbdr12 with SMTP id dr12so3496496wgb.12 for ; Mon, 26 Mar 2012 18:11:22 -0700 (PDT) Received: by 10.180.103.134 with SMTP id fw6mr25003705wib.0.1332810682083; Mon, 26 Mar 2012 18:11:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.69.138 with HTTP; Mon, 26 Mar 2012 18:10:41 -0700 (PDT) In-Reply-To: <4F670EC2.2020407@redhat.com> References: <4F65F322.2000204@redhat.com> <4F66B75C.1090404@mentor.com> <4F66F9A2.2060407@redhat.com> <4F670EC2.2020407@redhat.com> From: Hui Zhu Date: Tue, 27 Mar 2012 01:11:00 -0000 Message-ID: Subject: Re: 'info symbol' equivalent in python? To: Avi Kivity Cc: Matt Rice , Hui Zhu , gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2012-03/txt/msg00074.txt.bz2 For current gdb, you can get the output of "info symbol" and parse it. http://kgtp.googlecode.com/svn/trunk/add-ons/hotcode.py function get_line_from_sym is a example for it. Thanks, Hui On Mon, Mar 19, 2012 at 18:47, Avi Kivity wrote: > On 03/19/2012 12:43 PM, Matt Rice wrote: >> On 3/19/12, Avi Kivity wrote: >> > On 03/19/2012 06:34 AM, Hui Zhu wrote: >> >> http://sourceware.org/gdb/current/onlinedocs/gdb/Symbols-In-Python.ht= ml#Symbols-In-Python >> >> >> >> >> >> On 03/18/12 22:37, Avi Kivity wrote: >> >>> Is there a gdb python API for 'info symbol'? >> >>> >> >> >> > >> > These give lookup the symbol given a name. =A0I want to lookup a symbol >> > given an address (like 'info symbol'). >> >> sounds like you're looking for the block_for_pc and gdb.Block's >> function attribute, >> >> (gdb) py print repr(gdb.block_for_pc(0x0000000000400598).function) >> >> (gdb) py print gdb.block_for_pc(0x0000000000400598).function >> main >> (gdb) > > Similar. =A0I want the names of static/global variables, not functions. > > -- > error compiling committee.c: too many arguments to function >