From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sPXoFv6HYmTWHwsAWB0awg (envelope-from ) for ; Mon, 15 May 2023 15:29:02 -0400 Received: by simark.ca (Postfix, from userid 112) id 5A5831E11E; Mon, 15 May 2023 15:29:02 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=qq+riWyq; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EB2651E0D6 for ; Mon, 15 May 2023 15:29:01 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 81F0A385772D for ; Mon, 15 May 2023 19:29:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81F0A385772D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684178941; 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=qq+riWyq57DlQS2pMd/owaPRIM2zVQYd7xF3AgZefr88taOtGct/CrPTDSBHaYuqx 1uKIoEA5KU631SmlxSLZR2sp+KiIotEuH57wT/EP+7dM4rqHPJX0MZCjsPTB4Es7p1 IJEY6i6eqoOdVXQa7oHGIzuTARIHazBEy0sHLpmY= 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@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) { -- 2.25.4