From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3379 invoked by alias); 27 Jul 2018 12:41:31 -0000 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 Received: (qmail 3367 invoked by uid 89); 27 Jul 2018 12:41:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:sk:x23-v6m, Station, United, united X-HELO: mail-wr1-f49.google.com Received: from mail-wr1-f49.google.com (HELO mail-wr1-f49.google.com) (209.85.221.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Jul 2018 12:41:28 +0000 Received: by mail-wr1-f49.google.com with SMTP id e7-v6so4914197wrs.9 for ; Fri, 27 Jul 2018 05:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=undo-io.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BwpndXq4uD9dxC/W1is4LmD8s+pNY2NQJ8hUXsLjb9k=; b=dNN15BBlRRzdtvAOvX9oo7JF7vVhS/V7LgOwbswsLECdNjIpL8gWstcOMh3uXkppoY RQMSSOsY9IBhwzeEwHY0xO0j9gKERHvFwYr7rSWMFKAYD1uRKfTHxdigtpdqdTpR4gbm 0aeRLeHNGRiyekFQrAaKDV5xINcAqZA91IZfy2W0WQrxPQpWEpRYMZBGqrlHmF2cP5NP lMp309KcmscAtMxK2V2E3rBAli8tVDVEdW9bqhKJkvLOS/E4xmIt/XnwWeaiL9YFu5Ao TJV/7/hCMEe+8smfBhOla7wu3ilgEntlcHdR+Re256hD9FEoKPWV89wpYOP16js4BCrE 7m1w== MIME-Version: 1.0 Received: by 2002:a1c:c901:0:0:0:0:0 with HTTP; Fri, 27 Jul 2018 05:41:26 -0700 (PDT) In-Reply-To: References: From: Emiliano Testa Date: Fri, 27 Jul 2018 12:41:00 -0000 Message-ID: Subject: Re: How to do "info address" directly from python? To: David Griffiths Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00044.txt.bz2 I'm not knowledgeable in this context much... googling a bit helped in finding this: https://blog.0x972.info/?d=2015/11/02/10/10/23-looking-up-source-code-lines-from-gdbpython-and-openmp-complications does it look helpful? Cheers Emiliano On 27 July 2018 at 13:16, David Griffiths wrote: > Hi, I can obtain the address of a non-debug symbol in python by doing: > > gdb.execute("info address %s" % symbol, to_string=True) > > and then parsing the result, but is there a way to obtain that information > directly using the python api? I've tried things like > gdb.lookup_global_symbol, gdb.lookup_type and gdb.parse_and_eval but none > of them return anything. > > I'd prefer not to use gdb.execute as it sometimes gets the output of the > command mixed up with the output of a preceding gdb.write. > > Cheers, > > David > -- Emiliano Testa Undo software engineer 22 Station Road Cambridge CB1 2JD United Kingdom