From patchwork Mon Oct 30 16:11:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 78771 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 2C67438323E0 for ; Mon, 30 Oct 2023 16:12:04 +0000 (GMT) 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 1F3BB3858C78 for ; Mon, 30 Oct 2023 16:11:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F3BB3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1F3BB3858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698682293; cv=none; b=WypKaVUYNWFRYkSecAY+V/nkyqyN3rKmqXTLOvKpGP5ohmkLPxPEuSykQzb/uVKyfgO6nlaIQHeEbqMZ/I4CA4i50DRxlbLx7EpLWvR54DmxA3YnlFu9hAd8pglDmu50ZefQJ9SgaNhlf0QPW35GLeTIM+L64RKnrhntGrkgLkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698682293; c=relaxed/simple; bh=v2f+zB/NKSUGVUEkOX+ihbC2i3ea/xTwVLdibUrHDvs=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=IJXxh8sTb0tqSEk6WKKQkZgE1NHTehKIBClOzN2tIGgspEXK2IBdzvPqnPFEJjoR7ko6HaVM/Uspa4lTtBo8SpzwACwzCcFZQbNKOH+gYSiH2kJNLByWP+mmq/VjDNNGyYGODHmevSCVHLJgw5j5URvoRB5aJdqWGw0LEq5dZks= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698682291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n9gMVYhl477noOHDN/rv0xYh4ofU2CTUCPEUAWvJs+E=; b=IotMqJWb9p/gtB78o3cWVMlUomSGxrjU+MDvwd9wjo4zhWQaXCsuhcP+qBMAFGraOjp6wg cXPsx4CGr5C6QiFHVLLY/r2bOS9k/tL/4fzJPkp94C0f4F8OsqnbHKxxaXFqFdBf78/mX/ YPtHvYSSqFS5PoJIjHVEVaRB160PMqI= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-50-Rh8ULsdGORqUE7EkNnmxIg-1; Mon, 30 Oct 2023 12:11:30 -0400 X-MC-Unique: Rh8ULsdGORqUE7EkNnmxIg-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9c983b42c3bso634902066b.1 for ; Mon, 30 Oct 2023 09:11:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698682289; x=1699287089; 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=n9gMVYhl477noOHDN/rv0xYh4ofU2CTUCPEUAWvJs+E=; b=DgS4S9j8hzewW3L7SpDAp99+CcetV2eElsVe/lr8DVymLAvoY4DdV5k4fBjihNnqFR Eibu0PCUaNbM4wfiJkVvbVLowWyVpWUcNKD+gAaqTnWW3vGcuXTBpFAYWYekThXsYE0i Nd7m9q/K9JJSH4lFhFKAXOIbI3i8PxQx0bDaxTItwEVaGp5AoMoY4XFJLXckAN8FAvVK PehVzSryUfHpU7BwL37OlcWiM+AiMqQMm/QXb52ioaiNVM9BfmWQqBZHc9l1/VU/LIzv Na/vpk77CywdZGvkpkDKBgQ0w68vX+OQ2vPJ9Zhsl8wHe+pWzawzNL26P4frq2jNz0WY 8iHw== X-Gm-Message-State: AOJu0YxPNWKMpzMwoy2+jOuEbYM+RkCJ89sOWSRkctJr3MPzo3vIBQqw N82043qQ2DJ1Cqihup31EM3OC6NZyqGZ3UWtq7M8H/34Cv/sXM3QxNqARDL7ctTlqM2XeoF5f7a quLDVVlAPR/2PQQIdUEljXbNagEFMRFPoTH9JT3xpVo11sD+kTTRUfoiDnsaPd8qBnkSBnTTVAs KbbLIKdw== X-Received: by 2002:a17:907:982:b0:9c3:ba22:4d65 with SMTP id bf2-20020a170907098200b009c3ba224d65mr68746ejc.4.1698682288963; Mon, 30 Oct 2023 09:11:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5BmTKcD+uyG2wzef2IRVqdm2MnT71UHBywx7pLz+DdQLqMksC1Wxj33ls6gGtnfxHF8HmfA== X-Received: by 2002:a17:907:982:b0:9c3:ba22:4d65 with SMTP id bf2-20020a170907098200b009c3ba224d65mr68733ejc.4.1698682288749; Mon, 30 Oct 2023 09:11:28 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id z12-20020a17090655cc00b0099bc2d1429csm6209793ejp.72.2023.10.30.09.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:11:28 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv6 08/10] gdb: remove breakpoint_re_set_one Date: Mon, 30 Oct 2023 16:11:12 +0000 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.9 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, 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 6370c17c4e0..34dd7c320b1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13015,17 +13015,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. */ @@ -13037,12 +13026,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 @@ -13059,7 +13047,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) {