From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77225 invoked by alias); 16 Jun 2017 20:55:20 -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 77200 invoked by uid 89); 16 Jun 2017 20:55:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-wr0-f176.google.com Received: from mail-wr0-f176.google.com (HELO mail-wr0-f176.google.com) (209.85.128.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Jun 2017 20:55:17 +0000 Received: by mail-wr0-f176.google.com with SMTP id 36so43987368wry.3 for ; Fri, 16 Jun 2017 13:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DErVSZfAtPChvigG0onCl7kxMIpFC19uOn7kPRy4wMc=; b=P4XLQLIMtxxTSYRDKeRE5a3UMdBeaqDpqZrsecHsEGzav5GlJBF1pbR0g9T3cOnYMs mXuNaQdSpdl83wsXWmxDPwxIv6IcPuSewu3MMY6qHJdTrhl2ZNtg7PVhx6nayHOw3zwD hOC2SR0mBfmPX3bHCbtnr1EAKV3ARhimfrQit9MM5wfHMXqpEcIjXICtKZ7GNrwoUGpB e9g80KIS0avVPFOa+JeCE0YLx9ztilmklUL9BcDYu8AZZEmOMK/PGPI7unS4k8o/zgFz QfUk6/4YXRJYh5TOQXgrG6krW3xCGMpsgRICFrb9oA5aIJWsjlQyBmMfgdq5TNmkFVg8 Ac3g== X-Gm-Message-State: AKS2vOzBpZyKt74B5nigdU+zcwtmrXMgC1iS3etrDT1lvQC8aBPsq15O mnQ6WBCvb/USFoKB8vTfZoHX0R/dGhvf X-Received: by 10.223.131.166 with SMTP id 35mr8828992wre.161.1497646519922; Fri, 16 Jun 2017 13:55:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.147.9 with HTTP; Fri, 16 Jun 2017 13:55:19 -0700 (PDT) From: Evan Driscoll Date: Fri, 16 Jun 2017 20:55:00 -0000 Message-ID: Subject: Python Symbol API question/weirdness To: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2017-06/txt/msg00012.txt.bz2 [I wrote most of this with 7.11, but I tried again with 8.0 and still have the same problem. See below for more.] I've got a toy program (can send out source and/or binary if it'd be helpful) that calls raise(SIGTRAP) in it. At that point, I can ask for a backtrace: (gdb) bt #0 0x00007ffff7a43428 in __GI_raise (sig=sig@entry=5) ... and then use 'info symbol' to get some information based on that address, and cross-check it with the symbol name that it gives back: (gdb) info symbol 0x00007ffff7a43428 raise + 56 in section .text of /lib/x86_64-linux-gnu/libc.so.6 (gdb) info symbol raise raise in section .text of /lib/x86_64-linux-gnu/libc.so.6 (gdb) python print(gdb.parse_and_eval("raise")) {} 0x7ffff7a433f0 <__GI_raise> I'm not sure the following is relevant, but just in case: (gdb) print &raise $2 = ( *) 0x7ffff7a433f0 <__GI_raise> (gdb) print &__GI_raise $3 = (int (*)(int)) 0x7ffff7a433f0 <__GI_raise> However, I can't look up that symbol in Python using lookup_global_symbol: (gdb) python print(gdb.lookup_symbol("raise")) (None, False) (gdb) python print(gdb.lookup_global_symbol("raise")) None Setting a domain doesn't seem to help: >>> ds = [gdb.SYMBOL_UNDEF_DOMAIN, ... gdb.SYMBOL_VAR_DOMAIN, ... gdb.SYMBOL_STRUCT_DOMAIN, ... gdb.SYMBOL_LABEL_DOMAIN, ... gdb.SYMBOL_VARIABLES_DOMAIN, ... gdb.SYMBOL_FUNCTIONS_DOMAIN, ... gdb.SYMBOL_TYPES_DOMAIN, ... ] >>> for d in ds: print(gdb.lookup_global_symbol("raise", d)) None None None None None None None Does anyone have any idea what might be going on? I think I don't actually need this to work, but I am curious what is going on. Maybe something with symbol aliases? With GDB 8.0 instead of 7.11, things change slightly but remain largely the same. __GI_raise never shows up -- the backtrace just says "raise" instead, and 'print __GI_raise' and 'info symbol __GI_raise' both produce errors. Thanks, Evan