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.129.124]) by sourceware.org (Postfix) with ESMTPS id AE0473858D28 for ; Tue, 30 May 2023 20:47:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE0473858D28 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=1685479631; 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=6JwvSvi00T3QFo2Q7Z7grT2aXMFg+ffEGmTEpl48PX4=; b=C0is/pWQgluiKwa5KR5yo3I2wDZK6/y1kPYe6PQy2PcBHvxjIAR2b6E9nYH7WCiz2nP6LW aGQRVpdGTfopl8FedzFYBSl+M6RNyuoKxffraGhDhrAi5sN+UwIBSBIMgGGrTn9ZXJVi+I GgfWWy0thj8hDpRrz8/it5YRq4FFiWU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-gMWVICxLPISw0Ty-D2LXbQ-1; Tue, 30 May 2023 16:47:10 -0400 X-MC-Unique: gMWVICxLPISw0Ty-D2LXbQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-30af81cf4dbso398359f8f.2 for ; Tue, 30 May 2023 13:47:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685479629; x=1688071629; 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=6JwvSvi00T3QFo2Q7Z7grT2aXMFg+ffEGmTEpl48PX4=; b=hU7DOCdKT2HC2YDCHneSefneGGw0CoSxE+oyAx+WhabflbEJ1FpRz5pXleeKGDosUu +6j21LIogXLPuS9OgLJWieWXlqwMW5c/P0jtuQh41VwyihvEmB7cGoi3P20SiObI5Eut 1JoUKbnBEfLDnRqzRLUugPWwum//v2X/qe+En9OGnwbgGdxaqfUC5yDSnUGPNzvmpSy8 n4Je3O9HiRm+IP0rs3nN6cc8wHuGGkkmhs2TIzFb6KGSGPuSEBwCVfE51Di2cMDFRqxF LaDQRnnT3/dg1kAYdSfbCVwP3quVbZrXWKnWrQrFsO4+Kf+Es8k5Ml7wKYJwGpPlffZl Oojg== X-Gm-Message-State: AC+VfDztam8Vm4TXRnNoUAz+RCJrqL3WxcU1XzRKB+uqKyo6B7JoCT69 aAmYwyodT6ZHJB/TEBvAGw0pLvWmhTgrTml1MuGZ5YQDPueIARKHZQcLORKoTiaf4Uw+stV3h6t Oos9tDTeP5inaL1lHvuxdt8PqwhxMoLBhJ81mRSqyqc77arFV3Bt8L2/Xl7UuLzFNrbnLOTJhCc wGUk/SGw== X-Received: by 2002:a5d:550f:0:b0:301:2452:e4d with SMTP id b15-20020a5d550f000000b0030124520e4dmr3190418wrv.46.1685479628845; Tue, 30 May 2023 13:47:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7W1ARCQATD3jnFlSOhQ50SVN800InfK9bIRGgOEoCKY7rNwORkj1F9XdDoMm/iTSL7WMy8gQ== X-Received: by 2002:a5d:550f:0:b0:301:2452:e4d with SMTP id b15-20020a5d550f000000b0030124520e4dmr3190411wrv.46.1685479628542; Tue, 30 May 2023 13:47:08 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id m4-20020a5d4a04000000b003079c402762sm4406143wrq.19.2023.05.30.13.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 13:47:08 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 7/9] gdb: remove breakpoint_re_set_one Date: Tue, 30 May 2023 21:46:51 +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.8 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,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 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 ed3d61605bf..79a55d66f08 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12776,17 +12776,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. */ @@ -12798,12 +12787,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 @@ -12820,7 +12808,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