From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96763 invoked by alias); 26 Jul 2019 22:05:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 96740 invoked by uid 89); 26 Jul 2019 22:05:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.7 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=no version=3.3.1 spammy=HX-Languages-Length:1464, concluded X-HELO: mail-oi1-f170.google.com Received: from mail-oi1-f170.google.com (HELO mail-oi1-f170.google.com) (209.85.167.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Jul 2019 22:05:30 +0000 Received: by mail-oi1-f170.google.com with SMTP id w79so41329868oif.10 for ; Fri, 26 Jul 2019 15:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MH+jzxdCG0gDTS3E3REOOR3pFWm6WdqS+YJpdD59Ci0=; b=Y9wU2UvyMphUmOZFCc8itBF4/BwjhsfTycnqwTPx8LM7bFgFwPBtcns8Z0jQjOEWTS NVF4VLYKZysKiXDMdlh9VpjCtkK391AtD/HzeBy2ajhX+4BQOkw4Tnr36zNxKOnInqGe vSJKE9Y6/JSz4L9LUCMOBYXqywCxZk7HgJHzbPqsHDGVZDvrDI96vOuHsBV+DgGsrjhC 93i84lKcolB90jB5/QEhVkFxISLj9aiX4GZVRO0EEyl5j8b/xi16a1B1rhZBDlCn7Kr2 m3pbvNIeKz7Uz0Tcss6W6WMIEOuaDL0z8pkGzUW6kaL7xmZnNWM0lybIcFaP3ie1qGP0 2UAQ== MIME-Version: 1.0 References: <20190605012421.252953-1-cbiesinger@google.com> <8f4bcc74-18a0-c8f6-b97d-aef05021a656@simark.ca> In-Reply-To: <8f4bcc74-18a0-c8f6-b97d-aef05021a656@simark.ca> From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Fri, 26 Jul 2019 22:05:00 -0000 Message-ID: Subject: Re: [PATCH][PR/24474] Make gdb.lookup_static_symbol also check the STATIC_SCOPE To: Simon Marchi Cc: Christian Biesinger via gdb-patches Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2019-07/txt/msg00598.txt.bz2 On Mon, Jul 15, 2019 at 8:28 PM Simon Marchi wrote: > Would it be an option to add a gdb.lookup_static_symbol function, that would only look through > the static blocks? Its behavior could be that if you don't pass a block, it searches through > all the static blocks until it finds a matching symbol (just like your patch does with > gdb.lookup_global_symbol if no symbol is found). And if you pass a block, it restricts the > search to the static block linked to that block, ensuring you find the static symbol you want. Thanks for your response! I have started implementing this and concluded that I would prefer not to add a block argument with this behavior to lookup_static_symbol: - If I add it with the behavior you suggest, this will be very confusing to use because it won't find function-local static variables (they are not part of the static block) - It does not add new functionality. You can already access static symbols if you have a block: [sym for sym in block if sym.addr_class == gdb.SYMBOL_LOC_STATIC]. And you can already do that in a function's static block too, using block.static_block. - I'd be happy to add a patch that adds makes block['foo'] work, in addition to the currently-existing iteration Conversely, lookup_static_symbol without a block does add new functionality. I will send a new patch with this in a moment. Christian