From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id t0tiOmbi7mVBTwIAWB0awg (envelope-from ) for ; Mon, 11 Mar 2024 06:52:22 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J2HmzYtX; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DCEE71E0D2; Mon, 11 Mar 2024 06:52:22 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CA4231E0AC for ; Mon, 11 Mar 2024 06:52:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 252753858D20 for ; Mon, 11 Mar 2024 10:52:20 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 68D44385840D for ; Mon, 11 Mar 2024 10:51:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68D44385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 68D44385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710154321; cv=none; b=dXGmsbvSdS5uk9eN7DEjtQbwNfIIl/vqxMpEcQc1iCj0Tu9+OltRv4tNIgLEDr4vLlL2qrmkHwYjBgT5ScddGGphoP+NrDWlIkqn6RtTiJlw8ysf4Ieibvv+PcR807VnEPw5nBuCAifbFgcBvI7d5WOcFnXMGkbgs87QBSH1wpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710154321; c=relaxed/simple; bh=icyT8tOXNzMZAfuL9HHKTU9YXDsnOShOvxagxRgbUvc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=cMZfASffOIciq3+qrOJZgtzGjEUgTxbo0NqXZJmuV4cEZVRjRCrflkH0jbAPi0I+7GBVs8t84LkYVVCf322kNxinABeKa0xxNvldaVxN6gFTxb7/3Vt0rFf3YVRJ/7pFlco/yUMyqwLZoF95rzdGxihsqIc7gqbggs6fGiZWodE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710154319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HcXUeYr2oJaCFeJokpk05BIlajtsutkxLHb5jIJO1Qw=; b=J2HmzYtXAHph1AGpFP8Fdbut/q7UQUXcFUOWvOe6khfc6+7xoo9y+v0doo7w6y8IC2mDuB 4gzocIY1/9ggNQj0A4A4N2eIcxYGKAYnq2e0nmqOzcRNkMlQr/UuKVmOsB9p7NQHUiu5J4 9L9FYtQI25uQmjlP6v8Zf4FuhvtcpnE= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-466-YfqDJ4yiN6Ka4mUhNPmPBw-1; Mon, 11 Mar 2024 06:51:57 -0400 X-MC-Unique: YfqDJ4yiN6Ka4mUhNPmPBw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a45acc7f191so279787266b.0 for ; Mon, 11 Mar 2024 03:51:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710154316; x=1710759116; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HcXUeYr2oJaCFeJokpk05BIlajtsutkxLHb5jIJO1Qw=; b=ggpY1Ei4dmNcv55H1ty29mjtRRhToC+ZGctXe02DVBJuEsCkdjFwMxDHb1kabJsvE9 sWj61Muzw7+2k3W8OeiAQpJfyWgtMJfM4Gift5ihBcn972t7gC7jXEqPt8SjvU8UjFy7 CMOIGYlUHEiHmXDonC0i0vaknqQtxiduBHqSuqXfwxJmcEpbhmcBlbLQcRm1xOAYCghr 0yH3gutukCy5wV4v8iSHn8qTPwuStrHiCEKnutDB1RhFyKG9NEvYidsZo2xVfp7ZiiKB Kyj5+QsqdjzRpLQlb4MU/bomuIlxpWfnAtEkGjcwY/4erbdlXtnG+u0JcS9pdXe7azVx /0FQ== X-Gm-Message-State: AOJu0Yzf18RCsaVx0nfkjg/o3qJgCW8GXz+JLfKpmyFjhR+c+kXcJp5M 7eGuHN3QSSvosKKSoHnkPx+P/U2ewuKQDp+a/JYoLBZFPjg3SRHeAf8aSYkdGk0XJHJedJshXt5 OIzDl3o62+Et8a85PIqaWNvTISjS2fonr/LFP3S0znSS7C8EAZUpbhxdtRyw= X-Received: by 2002:a17:906:d9ca:b0:a45:c027:372 with SMTP id qk10-20020a170906d9ca00b00a45c0270372mr3156994ejb.68.1710154316721; Mon, 11 Mar 2024 03:51:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHl7Cz/8hR0Hh2jbOSXZziE+sIiprsDxN1addc0C1j/Yl6fpVCI5VzrNR3vzCbnihVy3Uhe8w== X-Received: by 2002:a17:906:d9ca:b0:a45:c027:372 with SMTP id qk10-20020a170906d9ca00b00a45c0270372mr3156973ejb.68.1710154316137; Mon, 11 Mar 2024 03:51:56 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-227-180.bb.vodafone.cz. [94.112.227.180]) by smtp.gmail.com with ESMTPSA id y26-20020a170906471a00b00a45ad52d510sm2748618ejq.139.2024.03.11.03.51.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Mar 2024 03:51:55 -0700 (PDT) Message-ID: <5f8514e7-3df4-406b-ae77-4da30e8dd871@redhat.com> Date: Mon, 11 Mar 2024 11:51:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] gdb: make gdbarch store a vector of frame unwinders To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20240306125135.766567-1-blarsen@redhat.com> <20240306125135.766567-2-blarsen@redhat.com> <87y1asr8c6.fsf@tromey.com> From: Guinevere Larsen In-Reply-To: <87y1asr8c6.fsf@tromey.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On 08/03/2024 17:34, Tom Tromey wrote: >>>>>> Guinevere Larsen writes: >> Before this commit, all frame unwinders would be stored in the obstack >> of a gdbarch and accessed by using the registry system. This made for >> unwieldy code, and unnecessarily complex logic in the frame_unwinder >> implementation, along with making frame_unwind structs be unable to have >> non-trivial constructors. >> Seeing as a future patch of this series wants to refactor the >> frame_unwind struct to use inheritance, obstack storage would no longer >> be viable. In preparation for that change, this commit adds an >> std::vector to gdbarch to store the unwinders in. >> There should be no user-visible changes. > I'm not really sure about this patch. > > Like on the one hand, it is fine. The arch is going to store the > unwinder table. > > On the other hand, the registry system is there to let modules be kind > of independent. The lines are blurry though. > >> +std::vector& > Missing spaces in here. > >> -static const registry::key >> - frame_unwind_data; > An alternative approach would be to just use a different type in here. > > This can use the default destruction approach and then it's just > allocated with 'new'. So then you can use any old C++ type. I guess you're right, but would it make any real difference to have the gdbarch store a vector out right, or to store a vector in an obfuscated way? I looked back through the git log and the latest change that could have added a significant change to how unwinders are stored could have happened in early 2014, so I don't really think the registry would meaningfully save in complexity. But if you feel strongly that the registry is better, I can rework this patch to work with that instead... Or just drop it. Once Andrew informed of obstack_new, this patch felt unnecessary to the series as a whole, just a related cleanup that I forgot to reword. > > FWIW I think the real issue with obstack allocation isn't constructors > but destruction. See https://sourceware.org/pipermail/gdb-patches/2024-February/206888.html I see what you mean (though I don't necessarily understand why). I would prefer if we could not restrict the destructors, but since GDB doesn't ever dealloc gdbarches to begin with, I don't think that would be a big issue either way. -- Cheers, Guinevere Larsen She/Her/Hers