From patchwork Sat Sep 16 10:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 76234 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7994D3853D1D for ; Sat, 16 Sep 2023 10:19:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7994D3853D1D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694859574; bh=N+imonrpznzZO6+5BuwP29QmiMgXUzsmLHzHRageVDc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Bhkcg4ikrQSK5Y4anmOwBklc/bRa1mzPTSdipZto+mEAMS2BPJzpbnDQeEq3ixFES keuQXZx+L9FJqTqmHGaI3jKPp31ZxCFYXahmCtECF01ASt4k+3ch1O4iEjtsCxk7Vb Sh+IT2OSBFuX8BogbkvCrWRHku5AurfSpI9slqCQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 A3FC33858426 for ; Sat, 16 Sep 2023 10:18:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A3FC33858426 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-210-20QdFuQyPtCQIEIYFv18Pg-1; Sat, 16 Sep 2023 06:18:27 -0400 X-MC-Unique: 20QdFuQyPtCQIEIYFv18Pg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-31fa1631b0eso1926087f8f.2 for ; Sat, 16 Sep 2023 03:18:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694859506; x=1695464306; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N+imonrpznzZO6+5BuwP29QmiMgXUzsmLHzHRageVDc=; b=n3E4nIWlfYkZyWpEppB9O7vKrtYgiDcCyXjqp4DOqfk3PHmcJZlw9CS23htpwW+09x p3JTGkqd0VHlAbvF4Dzlwed7/CcOoySC1PbmPU/kVl4lExIlz+uM/8jx1wNtgRPgRj/v HsPPOGkwKbvUbOsZxkvAPQrTsR5Cc5yccs/BfCmOYAl6V75e1LQkdG/Vfs+9NcBj3qmv qlKJAoR8XXLYF5zQaVQC/aRSmeUBr4y2h52Fm7JSCB5x1xfpNHdeg+En5r5H0kpvCzsT ihhbKVxXG3G1jKPxhZBnoZsI8G9sk+yG/jDVXBJ0up1UL+XMtOx5bh8o+Q2XqXrDvJ2F 9mxg== X-Gm-Message-State: AOJu0YxdU0Pxiv032nM2NQn6o//u0V7TubE+lQIFrGu21iljQzhbsAYd MyUHuD8sJuC9OQKltpKav43/Y/iaQRCaWktM1WBR2Xhnglj/RYV/+QxU8Z67/L73/jDL0kM7foH AyyczzLIJ1//oBQmnQqvyfyjkdSLaRKPRznScSyYT6b9qih6ywjYlsfR7rFnZRW7YR/BM5wsg3G lp/GLpYg== X-Received: by 2002:a5d:6f0f:0:b0:320:1c7:fd30 with SMTP id ay15-20020a5d6f0f000000b0032001c7fd30mr1043245wrb.17.1694859506565; Sat, 16 Sep 2023 03:18:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYBxQIMU8jXqVLf27v6gR2jjt7n+ezoOp3ZLitCV/u09aMKNM+Img1BMgXgneXezNpQ6n1Lg== X-Received: by 2002:a5d:6f0f:0:b0:320:1c7:fd30 with SMTP id ay15-20020a5d6f0f000000b0032001c7fd30mr1043233wrb.17.1694859506301; Sat, 16 Sep 2023 03:18:26 -0700 (PDT) Received: from localhost (92.40.218.107.threembb.co.uk. [92.40.218.107]) by smtp.gmail.com with ESMTPSA id k8-20020a5d4288000000b0031431fb40fasm6793530wrq.89.2023.09.16.03.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 03:18:25 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 5/9] gdb: remove final user of the executable_changed observer Date: Sat, 16 Sep 2023 11:18:06 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, 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 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: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This commit continues with the task started in the previous commit, and is similar in many ways. The goal of the next couple of commits is to expose the executable_changed observable in the Python API as an event. Before I do this I would like to remove the additional call to the executable_changed observable which can be found in the reread_symbols function in the symfile.c file, as I don't believe that this use actually corresponds to a change in the current executable. The previous commit removed one user of the executable_changed observable and replaced it with a new_obfile observer instead, and this commit does the same thing. In auxv.c we use the executable_changed observable to call invalidate_auxv_cache, which then calls: invalidate_auxv_cache_inf (current_inferior ()); The auxv cache is already (additionally) cleared when an inferior exits and when an inferior appears. As with the previous commit, I think we can safely replace the use of the executable_changed observable with a use of the new_obfile observable. All the tests still pass, and with some locally placed printf calls, I think that the cache is still being cleared in all the cases that should matter. --- gdb/auxv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gdb/auxv.c b/gdb/auxv.c index 3c27c1f1ffe..9f599b04a4f 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -344,12 +344,14 @@ invalidate_auxv_cache_inf (struct inferior *inf) auxv_inferior_data.clear (inf); } -/* Invalidate current inferior's auxv cache. */ +/* Invalidate current inferior's auxv cache when all symbol table data is + cleared (indicated by OBJFILE being nullptr). */ static void -invalidate_auxv_cache (void) +auxv_new_objfile_observer (struct objfile *objfile) { - invalidate_auxv_cache_inf (current_inferior ()); + if (objfile == nullptr) + invalidate_auxv_cache_inf (current_inferior ()); } /* See auxv.h. */ @@ -613,5 +615,5 @@ This is information provided by the operating system at program startup.")); /* Observers used to invalidate the auxv cache when needed. */ gdb::observers::inferior_exit.attach (invalidate_auxv_cache_inf, "auxv"); gdb::observers::inferior_appeared.attach (invalidate_auxv_cache_inf, "auxv"); - gdb::observers::executable_changed.attach (invalidate_auxv_cache, "auxv"); + gdb::observers::new_objfile.attach (auxv_new_objfile_observer, "auxv"); }