From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 56EC53858D28 for ; Tue, 20 Feb 2024 15:41:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56EC53858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 56EC53858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708443707; cv=none; b=G18R2GcBYEWYiH/AjOoQbqSDksh2lD9B/tOOb4azTNNRumBEjWbUBaC7L4C36AYpisydioPrGG1ow3gG2SEH/Nw7B6GMrzzpWgjWgxSunbB8WnySjXcmSK/OmuVCWJCGDB40wMvMZqlrJXx8TvMLxqkHYjwG6cWxGLjtUtBdGog= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708443707; c=relaxed/simple; bh=c2ABsRGRRpZlX/MOR2zQ2GLt0FMATihHSMt0iNzW110=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EjtBEKnuzuZpyv4UC+vK9Eynrr2TATtXAC8qtkBdHuco5x1UmLN1OGcOzCPWdqtk1sPFq7kbO7w+oROK+3b84nhHW03tzq1xpo42XEBKLRaG+lxJoGTAYwDI79mgVtxFA29N37F9c37Tkm175cGYyYNG34c5Rhj2M3xBrOugZQQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTPS id cMVXrv0TAAxAkcSFdrK7K8; Tue, 20 Feb 2024 15:41:45 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id cSFcrq9xK6yYjcSFcr6rc2; Tue, 20 Feb 2024 15:41:44 +0000 X-Authority-Analysis: v=2.4 cv=U64xDvru c=1 sm=1 tr=0 ts=65d4c838 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=k7vzHIieQBIA:10 a=Qbun_eYptAEA:10 a=-mzg8xfAkMchKzG7SjEA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=D31ZEPzqIHBKQcyujQaDPc12yoptFVOFQFJUSq3F4gg=; b=IwI3iYcLVXJ/E2vQ1EAhyh6BH4 Y6yiB8UQ2tZBUhGzwYjMmfktfA7kkcYVDq+UXcdtdE75cbbhGDSACZ/toCQE8oNB+zPs9jWFh58j2 9yz1o67eJ5MtcMjw6GKV6xJCi; Received: from 71-211-170-195.hlrn.qwest.net ([71.211.170.195]:52148 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rcSFb-003wMS-2Q; Tue, 20 Feb 2024 08:41:43 -0700 From: Tom Tromey To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 6/8] [gdb/dap] Don't let dap log string grow indefinitely References: <20240219082341.21313-1-tdevries@suse.de> <20240219082341.21313-6-tdevries@suse.de> X-Attribution: Tom Date: Tue, 20 Feb 2024 08:41:42 -0700 In-Reply-To: <20240219082341.21313-6-tdevries@suse.de> (Tom de Vries's message of "Mon, 19 Feb 2024 09:23:39 +0100") Message-ID: <875xyj2le1.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.170.195 X-Source-L: No X-Exim-ID: 1rcSFb-003wMS-2Q X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-170-195.hlrn.qwest.net (murgatroyd) [71.211.170.195]:52148 X-Source-Auth: tom+tromey.com X-Email-Count: 14 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNdsKkGcGaTqeHxCKdUQjLMlyS4Oih2Rj4Zur4KMH9V2WeMOn0n/9ZLZDRFrYfaQUa4sKqlazvB8iPA0WiKcoHK99dmTh4F/9Y6qvM6Xn1sgsjM3uW3j UXIEayecc1XrEz3k+0d+FiEBxcXK9NG+1Qb8AhigqJTMBJ+lyf1iWCnmUGgd+2m459AzIjr1rp1x1xIIpg5yzula/G/u7VvYOJM= X-Spam-Status: No, score=-3016.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Tom" == Tom de Vries writes: Tom> As mentioned in commit "[gdb/dap] Fix race between dap startup and dap log Tom> file", initially logging to a string has the drawback that the string can keep Tom> growing indefinitely if a log file is never set. Tom> Fix this by: Tom> - using the pre_command_loop interpreter hook to detect this situation, and Tom> - stopping the logging to string. Adding a pre_command_loop hook like this seems fine. If you really want to solve the early logging problem, what I'd suggest is using this patch and then splitting 'run' into two parts, with the second part doing all the actual work. Tom> +void Tom> +dap_interp::pre_command_loop () Tom> +{ Tom> + gdbpy_enter enter_py; Tom> + Tom> + gdbpy_ref<> dap_module (PyImport_ImportModule ("gdb.dap")); Tom> + if (dap_module == nullptr) Tom> + gdbpy_handle_exception (); Tom> + Tom> + gdbpy_ref<> func (PyObject_GetAttrString (dap_module.get (), Tom> + "pre_command_loop")); Tom> + if (func == nullptr) Tom> + gdbpy_handle_exception (); Tom> + Tom> + gdbpy_ref<> result_obj (PyObject_CallObject (func.get (), nullptr)); Tom> + if (result_obj == nullptr) Tom> + gdbpy_handle_exception (); IMO the bulk of this should be refactored into a helper function now. It's nearly identical to dap_interp::init. Tom