From patchwork Fri Apr 28 23:35: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: 68523 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 0BAE8385772A for ; Fri, 28 Apr 2023 23:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BAE8385772A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682725079; bh=ul1jNmPdV1bt4XVz26vk/bmLwHSMCRoma1CPgODWsDY=; 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=Z6UOwSITTCsvrLQO8bEYG0FtIxMs2oz51wst9xsjAhPIU0LEhgVVGrC08Gx4pCqby WefE8za+J9uAdqw2SwQy+llk5eJZDKlePJRukzPyV9OTpO0Itv5/CcAMKa8u5WWox+ L6pVhzScE61dQy1HSpUd7jVpsZMGbIcDaiTNDPg4= 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 ACE4B3857700 for ; Fri, 28 Apr 2023 23:36:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACE4B3857700 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-605-N-s0zEeMPvCHotrIwzXAOA-1; Fri, 28 Apr 2023 19:36:00 -0400 X-MC-Unique: N-s0zEeMPvCHotrIwzXAOA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f191fc08b7so801665e9.0 for ; Fri, 28 Apr 2023 16:35:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682724958; x=1685316958; 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=ul1jNmPdV1bt4XVz26vk/bmLwHSMCRoma1CPgODWsDY=; b=UF4cgIc5mgC9CsKS2EIwV9CIauI140qEdeTheAeWWO7Pgrl8Ld/o2aVJ+lCtGS86mx vxHZvxL0Oz7kBFeJFFYLFB94W/VEtqqE7mZTbescMwWtSUSIv+tflGpukuRKkxpe6uX+ nU0kumKC+auHbBtKDRYytq/ehHTh0j+eQSQBDyFAEDzcIy4BLItJ1HkV1W86TlLSrcuv 2Ed6vvAdOYGYIvszp9HixOqkMzNaq4E2EDZEF8jHfquCv0HuScX5d+FVpCtGVqdNFnnE Cx9XUthL79INVngnX+FzgFo+6htZuf4gVnox8ib3J3dzBiOI4zzIjODQjeXO2LrDcu/B 6avw== X-Gm-Message-State: AC+VfDyUq12Hs1DFvhAGlA8WBuDv97ViGUzuyEfWF2uMW1cAdyNVmzGJ lzP8PQpSKOI5/qlOdRE9QTio57v/5x43LucBRWJJHuzyQNZzs1zWJgasMzYSG9/Os1OXp66f6ZY AOCQNJXFPUw+gxIduos0muPslb5M3Tre4yUix2B1zY++VsqPpELbqvw/aXSr+81dNQS4kXgN8aS 4AAxSZ5w== X-Received: by 2002:a7b:cb89:0:b0:3ed:a80e:6dfa with SMTP id m9-20020a7bcb89000000b003eda80e6dfamr5190197wmi.40.1682724958606; Fri, 28 Apr 2023 16:35:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7atIUeBQ1luJBY0KGhCeRvw3cjbzm8DAkGmjrT3YafY1EJIb/sInhGk9O+eDAVuPgE3MWlkQ== X-Received: by 2002:a7b:cb89:0:b0:3ed:a80e:6dfa with SMTP id m9-20020a7bcb89000000b003eda80e6dfamr5190191wmi.40.1682724958366; Fri, 28 Apr 2023 16:35:58 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id v19-20020a05600c215300b003ee20b4b2dasm25719296wml.46.2023.04.28.16.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 16:35:58 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 7/9] gdb: remove breakpoint_re_set_one Date: Sat, 29 Apr 2023 00:35:43 +0100 Message-Id: <458da4094f71ed6e15a87fe9e995110a36c3209e.1682724005.git.aburgess@redhat.com> 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.6 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_H2, 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 483777ce19b..e6e8fcd485e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12811,17 +12811,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. */ @@ -12833,12 +12822,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 @@ -12855,7 +12843,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) {