From patchwork Fri Dec 29 09:27:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 82986 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 EA3F73858410 for ; Fri, 29 Dec 2023 09:34:12 +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 B612F3858414 for ; Fri, 29 Dec 2023 09:27:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B612F3858414 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 B612F3858414 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=1703842062; cv=none; b=qeuGsa8aGuN6Tm5gHUmhwhQo2FMJOt27Z27ntxz6q5ir5ktIPpy/+mIxQ1XPFRckR9SMj5dg95qw7219XpVlO/N+ekTG2m8DdNY7voqtmFmUoycnEz+8sWJBJig93l/vrU/UxqbWk3cQVvBz+UekwJ9QM6Q3PG50d80es1rKLwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703842062; c=relaxed/simple; bh=BtFfjLWoc9vgks496uGNNVyYwIpPBeyeqhAzM32YfVs=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=r84kHhPaiPrRdvOxS8sPPeSkZyRtMMgytTOG/XBVfUhKDQACACVFrHHTIZiZ6Y3yp4SefkaOtVt6vi25z/ybQlnncEtbfTeZK6eZIFFjHItbR3WH6d39PLPu47/f20kVw9H5rtwxOgwYVaUtNQku23TGvlCTJE0Ce4aR2aARIQE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703842047; 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=VTRPCagrhBsz4Zc64B2QZiPctRnQ9zbxK8znEohqx9o=; b=B6Amx3cx6+OLthpcWjqD1N902fTEwlSORTQlXs/i2m3w/h1cvFSzkGvvZZJu9QB6d6pxI5 RypzjSCdkQnSz3LFFNiYwmtKhlDqIOCgEdSgoxx/A/QrjgaP1mVpqCwnECO8p4YVZLDVJr bbSb6/f6pjb74s5ttDbhP9FoNRPpU/I= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-I0h8WlSPPwmC8wQ54XxAtQ-1; Fri, 29 Dec 2023 04:27:25 -0500 X-MC-Unique: I0h8WlSPPwmC8wQ54XxAtQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-40d427df857so67757275e9.3 for ; Fri, 29 Dec 2023 01:27:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703842044; x=1704446844; 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=VTRPCagrhBsz4Zc64B2QZiPctRnQ9zbxK8znEohqx9o=; b=lvjGbA/iX8Qy1DHGw4k+HdkFNumh2skT69fBgsnHu8SxLIgT7rUc3JUdJnSe4aIERw Gy07QySIRRo0JhSByRdboA/Kliy8VuFMc41FSWUgewp5vB5YYBUFW/u9XeBG2Cdz2bOE SO73JF2woG4VPmFplj3IIjj0N/mOIvVM+/EJb5hjTqp9AXGnDXJbk7vMh8OjyZ1/m2pF LqOfMQzo2sqRKV32qqVOYuNFPU/Q4wmRHnKMWW5R1OeYRt04UEYjeEGXx7KwE3uz7Dbu ZVYWtlkr2+8WnDtfpNf8qLnYdvrjjIdPhs4CEm6OJa42MP030K50ZghSJOAIfTdWmiSI I3eg== X-Gm-Message-State: AOJu0YxFMJ8iwoYGzxjg0OdjwUT3S48M0qhmPCIMEXBiCxOWaJXjnVuz WtkOgtpR4G6789o8GYXwcWcCbWBHRtDYyYa7wEr00Rs6No8JXiGZMJWEJfGp2y/VGizXv5+oWig czx30L3z1JtIR1Cklbdqkn36rlvTSXQhgKxuTuAFUtAiUNLvv0LYrEAeMiM33Si+l3i5W9uY3or 3TiZgxZgos9Bbm0Q== X-Received: by 2002:a05:600c:3595:b0:40d:5d69:bd11 with SMTP id p21-20020a05600c359500b0040d5d69bd11mr1833675wmq.58.1703842044062; Fri, 29 Dec 2023 01:27:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7oQHWMazRFPWUvdAz8ODrPV6KiyYfwhb38LgscuLqW9w+oboiGxzEJ2luC+IlaVmZ1N7BxQ== X-Received: by 2002:a05:600c:3595:b0:40d:5d69:bd11 with SMTP id p21-20020a05600c359500b0040d5d69bd11mr1833669wmq.58.1703842043767; Fri, 29 Dec 2023 01:27:23 -0800 (PST) Received: from localhost ([2a00:23c7:c696:e701:85a5:8a0c:1403:2dc]) by smtp.gmail.com with ESMTPSA id z10-20020a5d4d0a000000b00336a2566aa2sm14379868wrt.61.2023.12.29.01.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 01:27:23 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv8 07/14] gdb: remove breakpoint_re_set_one Date: Fri, 29 Dec 2023 09:27:02 +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=-13.3 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, 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 f0724b416d3..69c55c833f4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13218,17 +13218,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. */ @@ -13240,12 +13229,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 @@ -13262,7 +13250,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) {