From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 385513858D20 for ; Wed, 21 Feb 2024 13:39:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 385513858D20 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 385513858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708522780; cv=none; b=wfNxhBYurkyoQe6boKwBZIIanzWvsENhD2yw/JZVJf94rVQA1e07IxaVLNqCsr2jYgb4VJD09oGOLv0bJLpzqccQysnuyGdOP+ZgaGVXA/an4uK8id3h7te+9KP9BXzQoMIOZSb1o5SnJbhCKqQqtd2w6CQfljAE3FKhS3dyegk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708522780; c=relaxed/simple; bh=Qt04RAXVex0NDZlV7Z803WHu71/nyaZk5PUICFVOGDQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=BhwdDCgTPfeq+MFEsvD5u5QttXUZZsTI4CjoqS9MPNcaRy6f6SXvDxqSgULCUyNaGfpa+QXs28JRpYlaxO0kpZT9Ex92kkeo3R8JOGPUm1o74DasqtMJ500jz8AtjOZ3a2ojz7tQ3uwrbC2G7OD6CLc3DlZppWMAyCLUpygDKrw= 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 3D8A1221A4; Wed, 21 Feb 2024 13:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708522777; 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=J4iLHmDISF0MMi5HhIkIpw9xB540EwVAQbJ+Ym72cwg=; b=MDm5d90FnsN81B5cj06CRGswAIt0wbsXUkSNh0FOOu6LPuT9+6yTeYrEmd22+mXpcq5suc j4Eo7xPQIH4R3rjMvQ7ATq3NwkiUXNUjW7foCC9WrJDEQK4X+8jvtqsEG+UwHoyGytOFq9 W1KUdkXeeATzOi661quPi+c1H43SpDI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708522777; 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=J4iLHmDISF0MMi5HhIkIpw9xB540EwVAQbJ+Ym72cwg=; b=66E6yaAvGxzpnZ3GLFsWk5KmSphdF3YWDxTZrDFvkZWLXv8neSRUXGEf1NwtzdAG+KHL5u fQiKKtnO6armcQCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708522777; 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=J4iLHmDISF0MMi5HhIkIpw9xB540EwVAQbJ+Ym72cwg=; b=MDm5d90FnsN81B5cj06CRGswAIt0wbsXUkSNh0FOOu6LPuT9+6yTeYrEmd22+mXpcq5suc j4Eo7xPQIH4R3rjMvQ7ATq3NwkiUXNUjW7foCC9WrJDEQK4X+8jvtqsEG+UwHoyGytOFq9 W1KUdkXeeATzOi661quPi+c1H43SpDI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708522777; 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=J4iLHmDISF0MMi5HhIkIpw9xB540EwVAQbJ+Ym72cwg=; b=66E6yaAvGxzpnZ3GLFsWk5KmSphdF3YWDxTZrDFvkZWLXv8neSRUXGEf1NwtzdAG+KHL5u fQiKKtnO6armcQCw== 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 273D1139D0; Wed, 21 Feb 2024 13:39:37 +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 DopUCBn91WVqdgAAD6G6ig (envelope-from ); Wed, 21 Feb 2024 13:39:37 +0000 Message-ID: <19b6273d-5b08-4905-a570-b7d007296380@suse.de> Date: Wed, 21 Feb 2024 14:39:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 8/8] [gdb/dap] Fix race between dap exit and gdb exit Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20240219082341.21313-1-tdevries@suse.de> <20240219082341.21313-8-tdevries@suse.de> <87wmqz16ci.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87wmqz16ci.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -1.29 X-Spamd-Result: default: False [-1.29 / 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.00)[23.41%]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; 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-Status: No, score=-6.2 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:51, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> +@in_gdb_thread > Tom> +def _on_gdb_exiting(event): > Tom> + dap_thread_join() > > I think it's better not to export dap_thread_join and then import it > here, but instead just add to the event listener exactly where it's > needed. > Done in a v2. > Tom> + global _dap_thread_for_gdb_thread > Tom> + _dap_thread_for_gdb_thread = start_thread("DAP", really_start_dap) > > You don't even need a new global if you add the listener here. > OK, reverted back to using _dap_thread in a v2. > Tom> +def dap_thread_join(): > Tom> + global _dap_thread_for_gdb_thread > Tom> + if _dap_thread_for_gdb_thread != None: > > None of this will be necessary with the above, but FYI in Python it's > idiomatic to do this comparison with "if blah is not None" When running test-case gdb.dap/type_check.exp, the dap module is imported, but no server is started and consequently there's no dap thread. If we don't test for none here, we get a python exception telling us that None doesn't support join. In the v2, I've rewritten this into an early exit with a comment to make it more clear. Thanks, - Tom