From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 0DF463858D33 for ; Sat, 7 Jan 2023 11:24:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0DF463858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42b.google.com with SMTP id d17so3475422wrs.2 for ; Sat, 07 Jan 2023 03:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sjss1nkpmcYjeU3JSE7R8p4zafolyoLOnjBQ4DPedBo=; b=Od9yrZvfCkII4xATS4nx390OPjqlte0nJBLrVZgfi1BHGV29xf3tKoOqUVTQKMXYkt bsWfNFLNAZMCOgQ6NnkeuS0BlHvrcI5Wvo9p9lH6ZQkfIe1bHtTmPrRPhdcihzEwq7ao n45jb2Tnhlr9rk4+NcCYDwtNWY/6VLpqLlPDqrAz4uziHQwWUOCg6PS0uDuPdfPUpCiG 96pit1OWmH/eUeIrA8Vk04xrDj3gTXvPOGUwMZpE7mrUf9cwE0l8hBV7sRWpNQr2fBal PA4X4QMMAKrZ+mMa/eXX0chRkBrN7bOcmHh5U6UupQrlpX90AQGn5lRKU6LPd53WYW/L iGWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sjss1nkpmcYjeU3JSE7R8p4zafolyoLOnjBQ4DPedBo=; b=e/DFfC9785gzCcouriHnDas0AW2HBPpL5u4sQtjcWCkGSbpjj9gu/hLRr1nESQK531 pAJdK0gKiKvpra0yWQnumJdfcQCo/uxGdTJSwu8ZvO2IofHqidO7SCrnv87+ZlvFFK1A Hh7k5wqOwLciCz2H/lyqqcAy/xWxH6MtSlmLEXvUwjTp4dx9n33nKzm5pWBGaRcHmVKu xUhLaYC/aKlCTGiL8smlcBwJ0wuFKtOiJLGzBW0jl9tWC9p+OIkKoPKcfmiRmYv1DNm2 RtJ+Gp6qmlfF0Ct9AVEI2d40FqPs3p4xWerZ/K5ufNpHOx4hrGOVTNpANELBMnCSNZSA wo0A== X-Gm-Message-State: AFqh2kqv1Ev3AqNcDw3KoQLap5ik1kY/XwFQkfgaLYFXQrtn0VrsyRbS TBJVz7q8nRVdgI2gyChrZpni X-Google-Smtp-Source: AMrXdXthxgMBkTTaJC6pfVk/qkQfZC+CfYfmouuJU7iM8KCiuYKebHmXWb95xL6iyWHHiXRZOC0Vxg== X-Received: by 2002:adf:fe09:0:b0:242:149c:6d29 with SMTP id n9-20020adffe09000000b00242149c6d29mr32795961wrr.16.1673090652085; Sat, 07 Jan 2023 03:24:12 -0800 (PST) Received: from takamaka.gnat.com ([2a01:cb22:1d5:1100:ca82:1b83:d813:c72b]) by smtp.gmail.com with ESMTPSA id y7-20020a5d4707000000b00291f1a5ced6sm3556251wrq.53.2023.01.07.03.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 03:24:11 -0800 (PST) Received: by takamaka.gnat.com (Postfix, from userid 1000) id 7A8968288F; Sat, 7 Jan 2023 15:24:09 +0400 (+04) Date: Sat, 7 Jan 2023 15:24:09 +0400 From: Joel Brobecker To: Tom Tromey via Gdb-patches Cc: Andrew Burgess , Tom Tromey , Joel Brobecker Subject: Re: [PATCH 2/4] Don't erase empty indices in DWARF reader Message-ID: References: <20221215190759.2494095-1-tromey@adacore.com> <20221215190759.2494095-3-tromey@adacore.com> <878rj3zbtv.fsf@redhat.com> <87tu1rl3rh.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tu1rl3rh.fsf@tromey.com> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: Hi Tom, On Mon, Dec 19, 2022 at 10:09:06AM -0700, Tom Tromey via Gdb-patches wrote: > >>>>> "Andrew" == Andrew Burgess writes: > > >> The DWARF reader has some code to remove empty indices. However, I > >> think this code has been obsolete since some earlier changes to > >> parallel_for_each. This patch removes this code. > > Andrew> Would NULL entries cause problems later in GDB? Would it be worth > Andrew> replacing this code with an assert that there are no NULL entries? Or > Andrew> would an attempt to create a NULL entry trigger an assert/error > Andrew> elsewhere? > > If it could happen, it would cause a crash when doing any kind of > lookup, because cooked_index_vector iterates over the indices and calls > methods on each one. > > Andrew> Or maybe the cost of iterating over the list is what you want to remove > Andrew> here? In which case, could we guard an assert in '#ifdef DEVELOPER'? > > I don't think there's any performance issue, as the size of the array is > normally just the number of cores on the user machine. > > It's more that this is a leftover and can't happen any more, due to the > previous patch. It seems to me that the contract of parallel_for_each > should be that, if it returns results (i.e., not void), then each entry > in the result must be the result of actually calling the callback -- > i.e., not some default. > > That said, it's also fine to drop this patch. If we believe the code is dead, let's drop it. Maybe Andrew's assert suggestion could be helpful, although perhaps a complaint might be a better compromise in this case, as I would say a violation of this expectation would still mean a usable debugging experience for the user, so let's not break things with an assert? Thank you! -- Joel