From patchwork Wed Dec 13 22:38:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 82103 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 05900386181A for ; Wed, 13 Dec 2023 22:39:50 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id A8120385DC0B for ; Wed, 13 Dec 2023 22:38:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8120385DC0B 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 A8120385DC0B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702507136; cv=none; b=Wrw4vzudLBvRVetweyp51Hn3dQBYTj6gzTelOH0ZBJMqWW4slDEipigcN9aRIY439lVktQs+Wub/Ng6rb74qNZx6fOF6j9ZPY7cFD8auttxA0omcILo7Mkyt4skcDDL2+42wcOvGdGf1ouFQSpXv5/MgRP0BNvFbKHdmYy0k7aQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702507136; c=relaxed/simple; bh=dG50hXRwx7s/9G1BH6msvv26q+AeIY8bHBAZgf6zSz4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=XatLE6qhtio0khnequfV72SdcTgu28xjQW3qIwWtrV1ppzvF4dZ1w9CU4EB9mRJbBMGm7y8eNT/Owgc7SCTwQU4LJ4ks92QjF0XZFxPsUGiEaCG7BNpqzVYF4hE/0Su2N6w8qIw+XrXijyLjt96j0APR/LJVDvuHcYfGZU9jVvc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702507135; 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=8TB4ml5WEWKZLM1N3rUA8jew0S2J4Vo3IUxAjpxVXVk=; b=DGCY8xCGi7kfFA/EqhKUGgoZcr6IqHn7Xsiyjm3OF2YBJSG/ousE5D1peP2tia2xAXYfCp IWFL/XBRoiUi9q0YFKofRHZIVvLi9L+aj/0U26oyqEJNDWq5FWcjw50hIs1SuzvfXUrQiw n/9fNhT0+RCQ+MWZfS1DgPgOCa+CTBo= 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-15-cI6CceQNNu-qdUNeatTTpQ-1; Wed, 13 Dec 2023 17:38:54 -0500 X-MC-Unique: cI6CceQNNu-qdUNeatTTpQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40c1d2b1559so51792545e9.3 for ; Wed, 13 Dec 2023 14:38:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702507131; x=1703111931; 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=8TB4ml5WEWKZLM1N3rUA8jew0S2J4Vo3IUxAjpxVXVk=; b=nxFqv0K1vvzLIAptJusvVID2SuXAxSu6agsjCMqCE6zvooaI95yOGBOccRqKRxn5rl 4ra1jmnFNLIXTfDi8ow3ST6IQstexo9uImArDfx6GA9tjaokJjwhpugJztMr8vPfOdH0 cZYjJkfbRsCevUFXzetAFTX91ICnKzZ2+ih25BI5lg2SJrseICE48WCArtV1/otNccTV YcvRkekOY25BbT6XnkVllBPlCdmZ4rs3SZy013g2oUWaP7TpLdMzx1T6ObOfQMzmNIJ1 Ar2/duLcbAz0nTSyxx9hfpb9iUzuIx9PYagWluM4RxQv32xhuRi13jVwYHnTem2C26dU GumA== X-Gm-Message-State: AOJu0Yz2NA/u4t9gOMgfduFBeETRzIneiZg9j71ZVxpmx6BL/k2Ej7Pl HBObyWE4c8hpb8UQLITqH0nSqEB6n2TXdU2En6QLqLZYOqbs8e6Cax04YEd5Cmyst5I59fPCvJA vTBxuj+uCfQMbasO5cHccjMtd14rtJAIBKFwp/Yq12evAyxJoT67IbbrAri3NqON2RN4gwT4gXF uaNPPj0Q== X-Received: by 2002:a05:600c:54c7:b0:40c:3f11:e501 with SMTP id iw7-20020a05600c54c700b0040c3f11e501mr4205369wmb.126.1702507131362; Wed, 13 Dec 2023 14:38:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqxmF+g2gIlvTUu+WwotL4oopuKBgFbgStilf2oEPiRi7ABOF7/OSJt0TZiS4toYwINCx72w== X-Received: by 2002:a05:600c:54c7:b0:40c:3f11:e501 with SMTP id iw7-20020a05600c54c700b0040c3f11e501mr4205361wmb.126.1702507131030; Wed, 13 Dec 2023 14:38:51 -0800 (PST) Received: from localhost (105.226.159.143.dyn.plus.net. [143.159.226.105]) by smtp.gmail.com with ESMTPSA id l6-20020a05600c4f0600b0040b45282f88sm24258594wmq.36.2023.12.13.14.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:38:50 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv7 09/11] gdb: remove breakpoint_re_set_one Date: Wed, 13 Dec 2023 22:38:33 +0000 Message-Id: <3e279ff4165c36e3ab91bad262772981dd4ca102.1702507015.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.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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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.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 2e1cf3172d4..da47e99979f 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13007,17 +13007,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. */ @@ -13029,12 +13018,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 @@ -13051,7 +13039,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) {