From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 5011A3858D20 for ; Wed, 21 Feb 2024 13:34:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5011A3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5011A3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708522475; cv=none; b=WtjB5yNS0ma0McB14ipXp5toRRloykl7ttzMfXDMEbVaaneJFQM8JHIVoj9QwK99D7U+3RGLA2bsitESYoa1C/r9j37Ith1lUwu6LERUcYlykeaIQL1KNgzk0LDXCW8rVKkwteL9jjpZWiMCvLlCo6qi/uZyK9Bxcjd0QbR7bII= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708522475; c=relaxed/simple; bh=4oC/5vaEdyzWkCdb6/W98znkg4RAki9us3tDTVncoUE=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=wXwZFMT+HnS25ytyt0wp6I9oh7vX6XmD8uNhMwoL/5AuNUW/l2zKpec9F+6NWo+K8oC4lQNuauknaJlQquPBD9+zN+INJfZ4LgpvUPwsuE2yNiHUN2lRpUJJ53ykwxifi0h4R0TMrT9lQMNvwUEv4oQJCNNV3GSD9uA1sVxh4jE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5E86C21FFB; Wed, 21 Feb 2024 13:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708522472; h=from:from:reply-to: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=qFnibhSgB8fZVAmKUNuMmYCvUioOHVSZEa/0JBMs46w=; b=bQV1vj6R7490hucGtZM6UBxRQXzlaUsJPlfGwa5bRReFhDUXiJQGv/8wkp/SNy1UnW9wat MJEcbp8oXGG2TDUC3Y+AWHmlklpQF0bRnejf2eAqO2IzwUaGWAZFiHwg2HUwqRphT8/38r FBOHnZv9//5EGm3fRI4kgRnErdPsu/U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708522472; h=from:from:reply-to: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=qFnibhSgB8fZVAmKUNuMmYCvUioOHVSZEa/0JBMs46w=; b=EPVq6dm7usNuJfLWSo28zeiP16z0THkATknTTpA6ISnZYUMegAVMqzvRMdJjVK+PCPrbaj dljZ18M8f1x/tKCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708522472; h=from:from:reply-to: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=qFnibhSgB8fZVAmKUNuMmYCvUioOHVSZEa/0JBMs46w=; b=bQV1vj6R7490hucGtZM6UBxRQXzlaUsJPlfGwa5bRReFhDUXiJQGv/8wkp/SNy1UnW9wat MJEcbp8oXGG2TDUC3Y+AWHmlklpQF0bRnejf2eAqO2IzwUaGWAZFiHwg2HUwqRphT8/38r FBOHnZv9//5EGm3fRI4kgRnErdPsu/U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708522472; h=from:from:reply-to: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=qFnibhSgB8fZVAmKUNuMmYCvUioOHVSZEa/0JBMs46w=; b=EPVq6dm7usNuJfLWSo28zeiP16z0THkATknTTpA6ISnZYUMegAVMqzvRMdJjVK+PCPrbaj dljZ18M8f1x/tKCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 39F18139D0; Wed, 21 Feb 2024 13:34:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id jS+QDOj71WU7dQAAD6G6ig (envelope-from ); Wed, 21 Feb 2024 13:34:32 +0000 Message-ID: <1d3bdb52-241f-4db1-b0bc-46031ea96ef9@suse.de> Date: Wed, 21 Feb 2024 14:34:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/8] [gdb/dap] Don't let dap log string grow indefinitely Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20240219082341.21313-1-tdevries@suse.de> <20240219082341.21313-6-tdevries@suse.de> <875xyj2le1.fsf@tromey.com> From: Tom de Vries In-Reply-To: <875xyj2le1.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-0.15 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-0.06)[61.82%]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Level: X-Spam-Score: -0.15 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,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: On 2/20/24 16:41, Tom Tromey wrote: >>>>>> "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. > Done in a v2. I did the split between thread setup and thread start, though I'm not sure that's where you want it. > > 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. Done in a v2. Thanks, - Tom