From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 1C3563836C63 for ; Tue, 2 Mar 2021 10:43:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1C3563836C63 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x42a.google.com with SMTP id w11so19302684wrr.10 for ; Tue, 02 Mar 2021 02:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mlvmCJ5OhaV+gPRMo33FMEhqUfMsKkaBHtB95mTKWoY=; b=GzdCDYO0eL2MBxLaYXX/wQihGrAQBxsOjG/fSiBG0gUS8tOXHmeXj6JlRk7w43w1X8 1muPV/PXJ/9FQDu0gvSW8ES8C3O6tqJBmPB+yCzXJAFwOjmY8l0fhy88LIhfCHVoCZIH LCKrW0nS13fUPlV97wd92xfX/D3RjNX6r8Wa8rC1JMEo29ZoRv7Onkx/qppUl5/0eRdD t4aqzEvdAUlecUj0VcbskzzISkPeqNbC3KisZQepkEL8qSMWgtlT+s5Pv0EUNGqIdm2G qG16/PLCnRkgNSycRxJSNpipWR0yD6/r7njWuKv336qKz6rSl2p2XEZiKN6mR3nODseV yFbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mlvmCJ5OhaV+gPRMo33FMEhqUfMsKkaBHtB95mTKWoY=; b=JFUHAeZU6R0H400oIcEgQRqsc8iuSmlrltIomyEFajrSmBvxlH0I8nug/XOpzwJ3b4 RdPungj8q8h/5KMawfTLJN3rVAmnP54hQI3zTt9JHznWkGxdxjJWgC7disbZr/moA1tR +a3jh+ERPDe6i//0+YwQEZt9iGw6v7L35tglmDWP2oDGjprAIMbeXIfAVD1F3G4XBu+P 1bc5fMe5Y0DE0fHhG63G9Qg5EGg/6rbDGJxw5yO45rWbtEkDLQ9S5OZSUv3CoVuDcK43 sgQEzqKKRGiOWe4ZkELlWENdm/q5sRSWN3pX99DpTL1KwbAuf67k30zgrXqvcgZQm9VC /NmQ== X-Gm-Message-State: AOAM531ftDEHmo8SJaOIQHnBmn87uGB+Ygt0HNlRH0wrYRc4ca2vbrsy 7Uhgc2eHIjeKW5jTgcvSfRvSGg== X-Google-Smtp-Source: ABdhPJyWA2uRc8zhfB2Cw/T6y2QS9JHeP4t+zgYVYC3DYHAWj1YiRjCOcbz9Id9kVFfIjJ4pTwaI3g== X-Received: by 2002:a5d:6b47:: with SMTP id x7mr21979354wrw.170.1614681809182; Tue, 02 Mar 2021 02:43:29 -0800 (PST) Received: from localhost (host86-186-80-154.range86-186.btcentralplus.com. [86.186.80.154]) by smtp.gmail.com with ESMTPSA id h22sm2773855wmb.36.2021.03.02.02.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 02:43:28 -0800 (PST) Date: Tue, 2 Mar 2021 10:43:27 +0000 From: Andrew Burgess To: Natalia Saiapova Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 1/6] gdb: add in_cond_eval field to thread_control_state struct. Message-ID: <20210302104327.GO265215@embecosm.com> References: <20201009112719.629-1-natalia.saiapova@intel.com> <20201009112719.629-2-natalia.saiapova@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201009112719.629-2-natalia.saiapova@intel.com> X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 10:37:59 up 83 days, 15:22, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2021 10:43:31 -0000 * Natalia Saiapova via Gdb-patches [2020-10-09 13:27:13 +0200]: > This patch adds a new field to thread_control_state struct, which > is set to true when the thread is evaluating a breakpoint condition, > and false otherwise. > > gdb/ChangeLog: > 2020-08-27 Natalia Saiapova > Tankut Baris Aktemur > > * breakpoint.c (bpstat_check_breakpoint_conditions): Set/unset > thread->control.in_cond_eval. > * gdbthread.h (thread_control_state) : New boolean field. > > Co-authored-by: Natalia Saiapova > Co-authored-by: Tankut Baris Aktemur > > Signed-off-by: Natalia Saiapova > --- > gdb/breakpoint.c | 3 +++ > gdb/gdbthread.h | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 296b08c0afc..77f927dc645 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -5209,10 +5209,13 @@ bpstat_check_breakpoint_conditions (bpstat bs, thread_info *thread) > { > try > { > + thread->control.in_cond_eval = true; > condition_result = breakpoint_cond_eval (cond); > + thread->control.in_cond_eval = false; > } > catch (const gdb_exception &ex) > { > + thread->control.in_cond_eval = false; > exception_fprintf (gdb_stderr, ex, > "Error in testing breakpoint condition:\n"); > } Instead of these three writes, would you consider: try { scoped_restore save_in_cond_eval = make_scoped_restore (&thread->control.in_cond_eval, true); condition_result = breakpoint_cond_eval (cond); } catch (const gdb_exception &ex) { exception_fprintf (gdb_stderr, ex, "Error in testing breakpoint condition:\n"); } This should be identical in functionality, but seems more inline with GDB style, using RAII to handle restoring. Thanks, Andrew > diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h > index ab5771fdb47..9e93587f221 100644 > --- a/gdb/gdbthread.h > +++ b/gdb/gdbthread.h > @@ -158,6 +158,9 @@ struct thread_control_state > command. This is used to decide whether "set scheduler-locking > step" behaves like "on" or "off". */ > int stepping_command = 0; > + > + /* True if the thread is evaluating a BP condition. */ > + bool in_cond_eval = false; > }; > > /* Inferior thread specific part of `struct infcall_suspend_state'. */ > -- > 2.17.1 > > Intel Deutschland GmbH > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Gary Kershaw > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928 >