From patchwork Mon May 15 19:27:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 69400 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 331D73856246 for ; Mon, 15 May 2023 19:29:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 331D73856246 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684178945; bh=yE1vC2rESeNgkJeL8IZ100B6ToTIjQDT28pnh1sdagA=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=pgYpTayDiKEZLcf6wfNj217EtmZJwAqBZVAybv9v2grreM60ul/h0HEhcthm5XooZ fEoj+Dp8K8FOIRbCizluKUeJOzhTAiRiViuCzPle61t4Nx83aYPpYsst470nKq7YwW C+YF28lv8zvGXCdmGbN9Lm6h1SSh4Exi2zlHJGq8= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 616CC3857701 for ; Mon, 15 May 2023 19:28:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 616CC3857701 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-zd-POR6ePLWx1y2clFMSYg-1; Mon, 15 May 2023 15:28:04 -0400 X-MC-Unique: zd-POR6ePLWx1y2clFMSYg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f433a2308bso582015e9.0 for ; Mon, 15 May 2023 12:28:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684178883; x=1686770883; 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=yE1vC2rESeNgkJeL8IZ100B6ToTIjQDT28pnh1sdagA=; b=g8sqSnEHuUHxDd8TIyjeYHR5tNoG8hP+arS4EzTEGK9jd9cynY9srIzYsXojblFIDL l8HtoCTPuVKR17T6hUHfctDn+ALPqrWX142JTTWL2Jzk9dr89KxQjleYWdgqls9URS8q VvZ9xFKEkJ+6ZaNv/1xrB2tnr7IN+06aL0fLn9MypslEQN8xWY6ReVv0wcXELgMENBM0 +h2M0nCTV8/d/DpnubOGIrvPsyjKJQNhBpLMJnOJFiZaJvA0InxESZB+40e/sayRfdcR k1AMtOjigMjvKMKyROzBLpQP3UKryOPu/JgrWYJeaoPo5R5m4LCR15TAvRSBydedhcMg KZYA== X-Gm-Message-State: AC+VfDzmD/Nfmnc/EKXznDG89PQXEw7dPMpzIjI8dJwo5G08WZG86sp0 LNe4FJTr+GjsoquEXtlRviWBsYQ34FYb0tag7Xup1cBGf2iSFb+jOUzsM5wLqPkBApRApyIpt81 zE4b2x9wxsZabh8CWtcnagqbJz/n0diQ25jzEfIh8Zqj9IS6tNGW5VC9FJ3tYS3DpOOb/yEVc3w Xyee5Urg== X-Received: by 2002:a05:600c:19c6:b0:3f5:b15:87ee with SMTP id u6-20020a05600c19c600b003f50b1587eemr2841741wmq.18.1684178883245; Mon, 15 May 2023 12:28:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56AXkJ094WND50AdlVMsudgkmndngs0hZXejltFnKcDzsBgdW0QkZYd4Gr3UsWbyNSL8o6Cw== X-Received: by 2002:a05:600c:19c6:b0:3f5:b15:87ee with SMTP id u6-20020a05600c19c600b003f50b1587eemr2841727wmq.18.1684178882917; Mon, 15 May 2023 12:28:02 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id t9-20020a7bc3c9000000b003f31d44f0cbsm306625wmj.29.2023.05.15.12.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 12:28:02 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 7/9] gdb: remove breakpoint_re_set_one Date: Mon, 15 May 2023 20:27:43 +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=-11.7 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, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.29 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" During a later patch I wanted to reset a single breakpoint, so I called breakpoint_re_set_one. However, this is not the right thing to do. If we look at breakpoint_re_set then we see that there's a whole bunch of state that needs to be preserved prior to calling breakpoint_re_set_one, and after calling breakpoint_re_set_one we still need to call update_global_location_list. I could just update the comment on breakpoint_re_set_one to make it clearer how the function should be used -- or more likely to warn that the function should only be used as a helper from breakpoint_re_set. However, breakpoint_re_set_one is only 3 lines long. So I figure it might actually be easier to just fold breakpoint_re_set_one into breakpoint_re_set, then there's no risk of accidentally calling breakpoint_re_set_one when we shouldn't. There should be no user visible changes after this commit. --- gdb/breakpoint.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c4accfb6d28..be035def12a 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12812,17 +12812,6 @@ create_sals_from_location_spec_default (location_spec *locspec, parse_breakpoint_sals (locspec, canonical); } -/* Reset a breakpoint. */ - -static void -breakpoint_re_set_one (breakpoint *b) -{ - input_radix = b->input_radix; - set_language (b->language); - - b->re_set (); -} - /* Re-set breakpoint locations for the current program space. Locations bound to other program spaces are left untouched. */ @@ -12834,12 +12823,11 @@ breakpoint_re_set (void) scoped_restore save_input_radix = make_scoped_restore (&input_radix); scoped_restore_current_pspace_and_thread restore_pspace_thread; - /* breakpoint_re_set_one sets the current_language to the language - of the breakpoint it is resetting (see prepare_re_set_context) - before re-evaluating the breakpoint's location. This change can - unfortunately get undone by accident if the language_mode is set - to auto, and we either switch frames, or more likely in this context, - we select the current frame. + /* To ::re_set each breakpoint we set the current_language to the + language of the breakpoint before re-evaluating the breakpoint's + location. This change can unfortunately get undone by accident if + the language_mode is set to auto, and we either switch frames, or + more likely in this context, we select the current frame. We prevent this by temporarily turning the language_mode to language_mode_manual. We restore it once all breakpoints @@ -12856,7 +12844,9 @@ breakpoint_re_set (void) { try { - breakpoint_re_set_one (b); + input_radix = b->input_radix; + set_language (b->language); + b->re_set (); } catch (const gdb_exception &ex) {