From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by sourceware.org (Postfix) with ESMTPS id DB5D53857806 for ; Wed, 16 Mar 2022 12:07:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DB5D53857806 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id q7-20020a7bce87000000b00382255f4ca9so3092497wmj.2 for ; Wed, 16 Mar 2022 05:07:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=SKLrVoVt5zKxRW5UIQnLaTHDLN3b6URARFx+r6QHExg=; b=18XRkVmIz/VIwubQtBp5amMA0QomWOI+PySGH4E8i8RdVhgCEAGBbXzAjV+ScfvXom LPlsA0JZF5ws1LGuVvrxzy4uZl63EirHH3xkHbYU/i7H15eO8Ttwp5JbMRAUcQ6NsnEw KElNlmeOwJmlBJQciHXTNwvJYOWefrzoTXsUio4mFcGaaXj8G7F75Yy7H+sTtGKKyDlu lZ45tAoaAha7j4Q735mTOV0LhPgwHh291BmR+rbggVYxaUobF7mkKPsKJ6TZDd9aG27Q D2FKxovtFLK1rfDY2od55gEX1m7AlSCEn7Ul2+LNZGgWF9KHMuEepojE9XcpUynLo+sw qsFg== X-Gm-Message-State: AOAM530vTXL4QSmPpcWD88mwJt7MmpwfyPTdYBxUA9wBRw16nuUgQoun D3KuPZ/bTubz4zDrIXtp9708yrWkNrA= X-Google-Smtp-Source: ABdhPJzcSvf9i/AHAIELm+mZzTPf7q8jYefdClX/PzW5ZS0WgFr6m7BfT8fWJDnL8fWe6BF2DRUdDA== X-Received: by 2002:a05:600c:1e06:b0:389:b587:27fb with SMTP id ay6-20020a05600c1e0600b00389b58727fbmr7066627wmb.18.1647432464587; Wed, 16 Mar 2022 05:07:44 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id 2-20020a1c1902000000b00380d3873d6asm1589222wmz.43.2022.03.16.05.07.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Mar 2022 05:07:43 -0700 (PDT) Message-ID: <5835f3ee-9026-2b37-9bdd-e14aba0247d8@palves.net> Date: Wed, 16 Mar 2022 12:07:41 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] Remove 'target_mach' global from score-tdep.c Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20220315223154.6517-1-tom@tromey.com> From: Pedro Alves In-Reply-To: <20220315223154.6517-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2022 12:07:47 -0000 On 2022-03-15 22:31, Tom Tromey wrote: > I randomly noticed that score-tdep.c sets a global variable from > score_gdbarch_init, and then reuses this in other spots in the file. > > This seems incorrect to me, at least if multiple inferiors or targets > are used; or potentially if there is a single gdb session that > switches back and forth between (sub-)architectures, causing the > global to be invalid. > > This patch fixes the problem by deferring the lookup. > > I wrote this just based on inspection, though, and have no way to test > it. I wonder if other *-tdep.c files have similar issues. Looks fine. I think we should just drop the whole score port, though. See here, from 2014 (!): https://sourceware.org/pipermail/gdb/2014-October/044643.html Pedro Alves