From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id A46ED3858D1E for ; Fri, 23 Feb 2024 17:01:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A46ED3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A46ED3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708707701; cv=none; b=O/F3TMhG9cnPcOLSE/HMDQbypTJJcGwjGh7qNPxs9AqKbnQBRXsfQIquuBAOv6dnpA7yh6Ko3Ni/54Uhj82ZHzIhyvg/waQia77c9KBWVcZpNhPgw3xOld0yBSYtbu15c6nOoK4U1ebYfV+uuATAe7ZTTLD64nJ2OpGQemaTCVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708707701; c=relaxed/simple; bh=Q8E2WxL/rbaY6tYOH5p8LNyWHXON9AdjccSXiJmT3ds=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TsEdIqtHLULF7BSIArsJTHPUHsFSnRM5xF93aCGU73lrZjANkmirtE0BncShWoCT9r43NbOWJJGSq6+YtSyBUUhFF5wftxDB7bZDOqB+LrXM8uXFKIc7F7ZoSKZrwWpwn58KZU+J2HxXFliQIz9i2BtbjbTw30/PrhZ0fY6Hma8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-365169e0938so3063495ab.0 for ; Fri, 23 Feb 2024 09:01:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1708707690; x=1709312490; darn=sourceware.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=L74J+anBTNxfwW48M4gNAVTnS2f6ALsFww5wx0aXq9E=; b=ESFgst4S6HHTewtim/dgEAjtTFZ4Zv3hiQiFyG8RLUTfUgCJENRoWLitFfFdmtjYyU aGH7ABMQ6qZT6pg+SwexpjIrl6WexmfEgujB9gYdx/RZtJaMBsKreJB0umTkQ7Xj8Hd9 NwbEeGOwriAzh8kMM+LtE3ER1rb/WNH2dWCNdxL4YCIQxHmQEI02dPrEdbGnRu7V1JOR XS3CilGfATfx/LgzQnRxeh36s6BitdoFdR6N/b2Is3/QbyabgPQOyeXZSlrIY0/YLnO3 +ZQBMgh9Gy1r7/zqoDONuUvvbXxiUpul3Q4eQRtNOGtnEKzRdRY99gwItGyqQNfUmd9r UrGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708707690; x=1709312490; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L74J+anBTNxfwW48M4gNAVTnS2f6ALsFww5wx0aXq9E=; b=kFivgIjThFTsRU4VO6b01fcY/NBjquyiHjXCwM7YoSLc31atfK2L2Q7MtQmRVtL2QK wSOU2MRPuHMEqgaT5GW/5HfOcZYlGExbBSblVjvcg+AJ5OjSmcv/dI/01cVrs9eM0V04 7mzUj+nQ+EqPf5wbQwJDmhgGo1NiYYJFuWA+hMHjdYG0Rj1Wx8QYnI/UINca8ygCbqsd j8x9m5+0YWM8HO8m0iuvsJybveaZ10tJhgos1TGl6vogkFReB5B24VqFEpmwlkfmpMnX FaA0hXKa7r4pLjLhX91fgT8vUqhZ5vSXb3lhZed/hPddr7mebyd7+sJDIzFgB9o1UgHR lpjA== X-Gm-Message-State: AOJu0YxsqbRmVTNbHWeUbICP2WeFRBlencc32exXzlAcNm0FH29qEWI2 ey+uLIIbKUR366je94jPrS/9bcz6WaHD+YDfsCey/L15WPXeE+n9f/O/UPXleG+N8hp7SOEGYP0 = X-Google-Smtp-Source: AGHT+IHBKM/cd0wF0AaKe0sbh6tO9KA1lQZiQc20FEEhYKcOD/x/+WnGjxH1ie+yxw0r3OvcQEB6sQ== X-Received: by 2002:a05:6e02:e02:b0:365:1c5:7a5a with SMTP id a2-20020a056e020e0200b0036501c57a5amr366860ilk.4.1708707689799; Fri, 23 Feb 2024 09:01:29 -0800 (PST) Received: from murgatroyd (71-211-170-195.hlrn.qwest.net. [71.211.170.195]) by smtp.gmail.com with ESMTPSA id bg10-20020a056e02310a00b003642a638341sm3681858ilb.86.2024.02.23.09.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:01:29 -0800 (PST) From: Tom Tromey To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/dap] Fix exit race References: <20240213150141.28034-1-tdevries@suse.de> X-Attribution: Tom Date: Fri, 23 Feb 2024 10:01:28 -0700 In-Reply-To: <20240213150141.28034-1-tdevries@suse.de> (Tom de Vries's message of "Tue, 13 Feb 2024 16:01:41 +0100") Message-ID: <87sf1jxggn.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-Spam-Status: No, score=-11.4 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,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: >>>>> "Tom" == Tom de Vries writes: Tom> When running test-case gdb.dap/eof.exp, we're likely to get a coredump due to Tom> a segfault in new_threadstate. Tom> - send_gdb("quit") I think we need a different fix for this. This patch on its own caused a regression in the internal AdaCore test suite -- the exit status of gdb is now wrong. Now, I'm not 100% sure why this is. Like, maybe the AdaCore test suite is killing gdb if it pauses. However, I thought I'd try to reproduce this in the gdb test suite. I wrote the appended. With this patch in place, dap_shutdown just hangs, which happens because gdb doesn't exit on its own accord. I tried adding send_gdb("quit") to Server.main_loop, but of course this just reintroduces the crash here. But I tend to think this would be the right thing to do, and so adding some kind of special case in gdb's Python layer would be appropriate. Tom diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp index 72c22d00711..54795a34e39 100644 --- a/gdb/testsuite/lib/dap-support.exp +++ b/gdb/testsuite/lib/dap-support.exp @@ -400,6 +400,15 @@ proc dap_check_log_file_re { re } { proc dap_shutdown {{terminate false}} { dap_check_request_and_response "shutdown" disconnect \ [format {o terminateDebuggee [l %s]} $terminate] + + # Check gdb's exit status. + global gdb_spawn_id + set result [wait -i $gdb_spawn_id] + gdb_assert {[lindex $result 2] == 0} + gdb_assert {[lindex $result 3] == 0} + + clear_gdb_spawn_id + dap_check_log_file }