From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yJzCN8VYTGSCDTkAWB0awg (envelope-from ) for ; Fri, 28 Apr 2023 19:37:41 -0400 Received: by simark.ca (Postfix, from userid 112) id E16911E221; Fri, 28 Apr 2023 19:37:41 -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=j5lZx6rE; 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 968AD1E0D5 for ; Fri, 28 Apr 2023 19:37:41 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE3103857728 for ; Fri, 28 Apr 2023 23:37:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE3103857728 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682725061; 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=j5lZx6rENmXGKMQSdsGCzHqrTJLYBBgvLVHbVHa+2MdC4Ra5m1jhRdouMofZxrJwx mOM2LYO9PXPInw0o78laZY+5FDeth+U3E2iHhaX+zP737ZQGo/lScvZJTizoLIZ5Mu +DUbb3Mgs0EzP0IvkARF85Bvz0glkDwgp/gCS/CU= 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 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 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) { -- 2.25.4