From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 05F173858D38 for ; Fri, 31 Mar 2023 02:15:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05F173858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.170] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 00FE11E0D2; Thu, 30 Mar 2023 22:15:45 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1680228946; bh=M7C0tCIvDpxVMQn8k7Go2mSR/auQx3UxQXIGJHHt9Tg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=jRu/KSdCFS7F8Onq75mB40Nk0cTaJlMBIgdNbO/L4sT7yelMemfuQ8wjL9Rrf2VlS YEiunnBQmFL8HuiijKFZauVGSUqXtrbFlQTg7WtZIrOUpcnm5KurlN+b4/O6TAW2DC yFnWGYkZLbTTAii9ZILlwg32rr3GLcRTRpY928fk= Message-ID: Date: Thu, 30 Mar 2023 22:15:45 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 02/10] gdb/python: make the gdb.unwinder.Unwinder class more robust Content-Language: fr To: Andrew Burgess , gdb-patches@sourceware.org References: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/10/23 09:55, Andrew Burgess via Gdb-patches wrote: > This commit makes a few related changes to the gdb.unwinder.Unwinder > class attributes: > > 1. The 'name' attribute is now a read-only attribute. This prevents > user code from changing the name after registering the unwinder. It > seems very unlikely that any user is actually trying to do this in > the wild, so I'm not very worried that this will upset anyone, > > 2. We now validate that the name is a string in the > Unwinder.__init__ method, and throw an error if this is not the > case. Hopefully nobody was doing this in the wild. This should > make it easier to ensure the 'info unwinder' command shows sane > output (how to display a non-string name for an unwinder?), > > 3. The 'enabled' attribute is now implemented with a getter and > setter. In the setter we ensure that the new value is a boolean, > but the real important change is that we call > 'gdb.invalidate_cached_frames()'. This means that the backtrace > will be updated if a user manually disables an unwinder (rather than > calling the 'disable unwinder' command). It is not unreasonable to > think that a user might register multiple unwinders (relating to > some project) and have one command that disables/enables all the > related unwinders. This command might operate by poking the enabled > attribute of each unwinder object directly, after this commit, this > would now work correctly. > > There's tests for all the changes, and lots of documentation updates > that both cover the new changes, but also further improve (I think) > the general documentation for GDB's Unwinder API. Hi Andrew, With this commit, I see: python global_test_unwinder.name = "foo"^M Traceback (most recent call last):^M File "", line 1, in ^M AttributeError: can't set attribute 'name'^M Error while executing Python code.^M (gdb) FAIL: gdb.python/py-unwind.exp: python global_test_unwinder.name = "foo" Simon