From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 110F43858CD1 for ; Thu, 21 Mar 2024 17:11:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 110F43858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 110F43858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711041085; cv=none; b=cCfBApcxw1Gvfpebd3zlYeUDFHtl/AQtd64a7HyU2fKED59S1FaHyMxR6R72gnZf8ALcq8hviQuCP5Aq+qFh+BCUqkqdU86jUQ6Q48BjHCEtkFZ4xthaPeTHpd1IqMUSgviFNEugTSvijxjaZ0Lbbd+YhpqH2E/FKcJFbAw82iw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711041085; c=relaxed/simple; bh=kiWO8ZgksuMpGYawyaMxQCBc8/43rji436AX5777jqg=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=gM+7nhHej+SkNUK6OhAnCkP+9GIzkPUoPnGEZqV3WO8TqocE5BTu4jXeVG8DWXfK27cEWw0Y1/Y3P6eY347Kc+SHVzWY9t0Ho6GeLwNirLElyRM1EraGHJ/I4ZF6+3nx6HUmMINzTAfVlrGtWav0Fgt4QjqR7C6OrtLdORnPVVo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rnLwp-00062v-BT; Thu, 21 Mar 2024 13:11:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6aJkaLcTPka/HTT0R5z00GD9zNCtlHd67r1h4dQlr0g=; b=DEB/yks1A2/l YJwf2K0QNcdbpFSBz27IScrAaJ/CdUl3JZfPBozoGN4Ol754M0vL2iFetGox+damUswWfGGLSSvQZ gmIDj7OWgd+sIVtu9EH4f/tJ4iSo2jfrWDhVw6jWlxuZt6ZB7SXEfIzW9A0TFPw7nve4SsZXpCrHr z2d40P9ZANVDmS/nzygM0mPWS/UhgzcI6opujt6uFeXaps7E4+ofJEUNe89NSv//v9zJWdNe+WLrn gy8I02HHSTx/hRbMc5vlquMi6xTSx9tZAa+BD0BGme2ijV/71QM7BMbKShztO6c6vNJXPXBldCJof s2GmHeeNLwuWeRKesvvz0A==; Date: Thu, 21 Mar 2024 19:11:19 +0200 Message-Id: <86o7b71pe0.fsf@gnu.org> From: Eli Zaretskii To: Pedro Alves Cc: gdb-patches@sourceware.org In-Reply-To: <20240321164331.967577-1-pedro@palves.net> (message from Pedro Alves on Thu, 21 Mar 2024 16:43:31 +0000) Subject: Re: [PATCH] Fix setting watchpoints when current thread is running (PR gdb/31521) References: <20240321164331.967577-1-pedro@palves.net> X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,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: > From: Pedro Alves > Date: Thu, 21 Mar 2024 16:43:31 +0000 > > Currently, when the current thread is running, you can print global > variables. However, if you try to set a watchpoint on the same > globals, GDB errors out, complaining that the selected thread is > running. Like so: > > (gdb) c& > Continuing. > (gdb) p global > $1 = 1098377287 > (gdb) watch global > Selected thread is running. > > This patch makes setting the watchpoint work. The problem is that > update_watchpoint calls get_selected_frame unconditionally. We can > skip it if the watchpoint expression is only watching globals. What does this mean in practice? E.g., suppose GDB sets the watchpoint when the selected thread is changing the variable to be watched -- will the thread stop or won't it? IOW, I don't understand what happens with programming the debug registers while some thread is running. > New NEWS blurb added. I don't think we need to change anything in the > manual. If this is deemed a bugfix, then we don't need to say anything in NEWS, either, IMO. > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -28,6 +28,11 @@ maintenance info line-table > if the line is considered the start of the epilgoue, and thus a point at > which the frame can be considered destroyed. > > +watch > +awatch > +rwatch > + GDB now lets you set a watchpoint even if the selected thread is running. > + Reviewed-By: Eli Zaretskii