From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 320C23853D21 for ; Wed, 23 Aug 2023 15:59:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 320C23853D21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692806380; 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=wMRSRk+yZN9khNrGxCJIlSZ/VudyiBPScPz+b6lpB54=; b=fghIybRbE8VFuqU6lnpfrm/Mv/COxDJQk14G4VDL88w5Vaj/pO+75lelgBPcTn4CgTzhfo Xnc+mSiVeuww71AzmXNLrEHRfH5OOBoEQdoedMEd4k8fl+yJ8A7U8WfR4CdLMsYMifF0GI UOpvSXQpuFYVRwqTfUORTuzFqNeA7nI= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-396-XJgsx-4-OW66n3YMEqxa7A-1; Wed, 23 Aug 2023 11:59:39 -0400 X-MC-Unique: XJgsx-4-OW66n3YMEqxa7A-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2bcba79cedfso40668361fa.2 for ; Wed, 23 Aug 2023 08:59:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692806375; x=1693411175; 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=wMRSRk+yZN9khNrGxCJIlSZ/VudyiBPScPz+b6lpB54=; b=Gl8kREbedG61hzfxs/3LGad/4O38ygKD1bhpVXIETINeyHwBWhJPS/e3Nbmeuc+bSl EH+KqlperXesQ4xv0iFhmGk6YqYUh7QPW9Ri9MaP9dkj5S6QhUAyMfyt5bZzQTqedvWl V05RGzewWL+DHVTG6FR9Ufq52vP0GxmYbGVurN02qZCWIF1YtznXtUTHnvw85nBri8+N W1Z0KMOr3WfDpEDIOa7QUoOsv7tI6cXUm32neS2fCfk51VSqxfb9Mok6gwb2AlKzP1Gu el7SwnxTarL1j97jMiPTlItc3jLJ+Y+qqZFrt+L7GsaL57PAQNsHOexYHkObR1s+C3+i vqXA== X-Gm-Message-State: AOJu0Yyz2pPiuZdwQf9xctc9fgtPCSdtw7kYQCOlha9kXhJT+X7VXhLa iqiqYEudD/JZEw/pex795izRGX3zcm4eP5SOqNbB3QDst/EHm9FZ9utyIOtG8tihF0GWfub2kC5 nJgpn0edJ9yp/kWN0+fpfwMSsrWlkr4HEsd5WWTUYgZ89bCRtoNVQwgnLyiBcoTdHk/Svuu3WjA 2pS+z4EA== X-Received: by 2002:a05:6512:32a3:b0:500:9a45:63b with SMTP id q3-20020a05651232a300b005009a45063bmr926226lfe.13.1692806375155; Wed, 23 Aug 2023 08:59:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyrWpkUL5nOHTLwUY4uOuEKigw/hKlv7uf5mdzC/swdSQlbljT0QxEMmmvDh4t/i9clket4Q== X-Received: by 2002:a05:6512:32a3:b0:500:9a45:63b with SMTP id q3-20020a05651232a300b005009a45063bmr926215lfe.13.1692806374874; Wed, 23 Aug 2023 08:59:34 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id r10-20020aa7cfca000000b00521f4ee396fsm9404385edy.12.2023.08.23.08.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 08:59:34 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv4 08/10] gdb: remove breakpoint_re_set_one Date: Wed, 23 Aug 2023 16:59:13 +0100 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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_H4,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 List-Id: 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 10af2fa3373..be2ef196f80 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13003,17 +13003,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. */ @@ -13025,12 +13014,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 @@ -13047,7 +13035,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