From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60079 invoked by alias); 21 Dec 2017 22:56:56 -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 60067 invoked by uid 89); 21 Dec 2017 22:56:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:sk:gdb@sou, H*c:alternative, honest X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Dec 2017 22:56:54 +0000 Received: by mail-wm0-f47.google.com with SMTP id f206so18545776wmf.5 for ; Thu, 21 Dec 2017 14:56:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0G3nVLSpmO0ZgnjnH7Xdk4LfC9SOlinGSixRx7uI2Pc=; b=tr1yZlh9WL4DzXkApinSWYXVY8NuGgzUtY2Q2rt9VVbSpicbx/p6jSgrlUsvuFd7vq 91e9IqPEOnSLNNyoWrrKxIlzrDjLdwkhuv6f67o0lYOQROxTbgkjbw262ouO8b1ZDDtb 5knhtYvyIHSIe6LXVG9X0ti7WL5sEEN/+Xv33viz/nEPMI3F5ri/EmuhkQOPF3Z0MGdL HRjgNhrLkeLFrzydIsRULqPEGBuiT29gznZEIsI3j5oxCpA7UcGRrZX6ucZOWGJ4BKb0 bme33vXiDSW9Uzk4eO+gAqvxoutcf1S12ik6YCzm69indk8og7PyB34qzxYXfUr25ShT XSMA== X-Gm-Message-State: AKGB3mIJSS55UHZRWuNE9/+uvMekjzujtJLlMvi2NKsy2yy5G4rD5qCt 27gDSf4GDoqQqjtlCUo7BqV0FmIcBJIdsVWvk7E= X-Google-Smtp-Source: ACJfBotLxQ2oGhsMkiXNZmiHIMxdErL7uIM9VXrAWzbBP6K8iunhtvnswZkh2n1LiVteiNJSMdCHSyr2JI5UuM74RZU= X-Received: by 10.28.26.139 with SMTP id a133mr10670785wma.90.1513897012458; Thu, 21 Dec 2017 14:56:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.196.196 with HTTP; Thu, 21 Dec 2017 14:56:52 -0800 (PST) In-Reply-To: References: From: Roman Popov Date: Thu, 21 Dec 2017 22:56:00 -0000 Message-ID: Subject: Re: Python API: Getting symbol by address To: Simon Marchi Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00015.txt.bz2 Thanks, so it is just not implemented yet. Unfortunately I can't quickly write a patch myself because I'm not familiar with gdb codebase. I don't even know how debuggers work to be honest . I've noticed that GDB can pretty-print function/method pointer values like this: print ( some_func_ptr_gdbvalue ) >>> (void (*)(int, int)) 0x4049f7 So I've unblocked myself by this ugly text parsing workaround: s = str (some_func_ptr_gdbvalue) symbol_name = s[s.find("<") + 1 : s.rfind(">")] gdb_symbol = gdb.lookup_symbol(symbol_name) 2017-12-21 14:24 GMT-08:00 Simon Marchi : > On 2017-12-21 13:20, Roman Popov wrote: > >> Hello, >> I have collection in C++ that stores pointers to functions and methods. I >> want to pretty-print pointed method and functions names. >> >> It is possible using GDB shell, for example: >> >> (gdb) info symbol 0x405ece >> >> top::test_thread() in section .text of test_procs >> >> >> However I found no way to do the same using Python API. Why such >> limitation? >> >> P/S Same question on stackoverflow : >> https://stackoverflow.com/questions/47916564/gdb-python-api- >> getting-symbol-name-from-address >> >> Thanks, >> Roman >> > > Hi Roman, > > As most things in the Python API (and GDB in general), it's likely because > no one took the time to do it. I don't see any technical reason not to > have it. If you take a shot at writing a patch for this, feel free to ask > if you are blocked. > > Thanks, > > Simon >