From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GEjDDswJ0WfF0gwAWB0awg (envelope-from ) for ; Wed, 12 Mar 2025 00:13:00 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=GfUCtVy/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 382171E105; Wed, 12 Mar 2025 00:13:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FORGED_MUA_MOZILLA, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0CA1E1E05C for ; Wed, 12 Mar 2025 00:12:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 928543858405 for ; Wed, 12 Mar 2025 04:12:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 928543858405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1741752778; bh=mGIOXkh2pRdhPGNGUzPrhUbe423FgA6Syu1w7eBRrO4=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=GfUCtVy/Ak+utJ1+0RYqITTsM7ZaInOqInKl4et/d/Som18edxXS5mwavs++K6Oi9 Q6LsZkuMB2hMfSWInp5lL5GZ+A9zZ5ArWmKoD+qe0voEK7zPXw5BocDLp/f04xRdH+ c0a10Q0Gb10K7OvoLFSKbd0ddyD7NRp141vUhaLk= Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazolkn190130003.outbound.protection.outlook.com [IPv6:2a01:111:f403:d20a::3]) by sourceware.org (Postfix) with ESMTPS id 2F09D3858D21 for ; Wed, 12 Mar 2025 04:12:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F09D3858D21 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F09D3858D21 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1741752734; cv=pass; b=YoJ5xrd7kJrcCdPnOfxueLk8sOcGHgdPyxSufrUiD268x5rmncg7xQSM9xn6/llPTixH8xy5vfsYUYRvYBwdEGhhVA8il2uGwPibhXkpykCdNE/dmioyOWqXpE+NXdBRKb66Lzt5dhKcA4h9EmFRIM55Wb/AEEUqbneRdIlxmIQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1741752734; c=relaxed/simple; bh=ygdLGAZY5fA+uSktCL+FbtOUPzqcE9S2M97/eZqxIRc=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=lSs0k5axj8egZFuLDx0uRcN5sByhSAKmw4C2k9Q5BbWKM+h27c8YcIP7NsXPE6UJWerlo+RAPYMpqx5blAuuxdPxiF47Y99bPEqPeK/IZTicptwyOAOcYNSo1kK1uyzFWGp5GxW7LAn1W50A1o8WjTUzDzyQXFMU/3SzgVoEmvk= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F09D3858D21 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Yul9O18X24s/qVDVdAfDX9sV+89XH36VdQ9+pFBx++WCwihZIcij3aWA+pizFbBf3fyPc18kN9CVsEYhMsZeeaTFRsX388cokst4yc1/PFWKTxptAGwiIbL4NMOmroBFKNXTX4r+CG8HWqNefL74NHbhlETKtTWoIBrL6jVbYHpDPMKR7hUJRMB4YkcDzRoYk6TguzicIz73r5thrwR+ndU9c+etBknGtZ+9uB266SlG2TwtsZMWhwkVjavvRWMdckdBQvQ1XGmrw9vNi0NT7aQUdCBQ5Cas9OM2Z1lEQhocMD0PtezJUETLK6CEyQaX3Z3ndruNFpHyPB5s5BKIZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mGIOXkh2pRdhPGNGUzPrhUbe423FgA6Syu1w7eBRrO4=; b=ENGwyxsLcsl1p64D9x2bZ+bq2FsuWjlf+A4vd+D9SQQ2slrq8DmuZhhrEPs7UoHGAB00OCfiBfZFAGDNw/5nVBf7W+vAXKGLe0914/6EZqlNZUQQfJLFWxKKXc43PtK2m4RwTF++jcXm459iI+oO2n1nhpp4du9tL0XJ+cofJWrWZWmNGT00VAf1gdKbaRA3owLdrN9cHLh4yyqaw3azH85Y5TwEmogyNdpyvwKB5fYuouNNB5ljGoDsaXhmv8zssuUfC2doG/1n+Yz+QwFQVvAIqB88lK+7VHiVL+5RPyrwax1gH5QlUD7rnKG8QfZb2Yxwj6ZvkCe/54YtDVjESA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AS8PR05MB8230.eurprd05.prod.outlook.com (2603:10a6:20b:31b::15) by VI1PR05MB10632.eurprd05.prod.outlook.com (2603:10a6:800:1c3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.21; Wed, 12 Mar 2025 04:12:11 +0000 Received: from AS8PR05MB8230.eurprd05.prod.outlook.com ([fe80::ccaa:112f:aeae:6eae]) by AS8PR05MB8230.eurprd05.prod.outlook.com ([fe80::ccaa:112f:aeae:6eae%4]) with mapi id 15.20.8511.020; Wed, 12 Mar 2025 04:12:10 +0000 Message-ID: Date: Wed, 12 Mar 2025 09:12:07 +0500 User-Agent: Mozilla Thunderbird Subject: Re: Multi-threading support on DragonFlyBSD To: Simon Marchi , gdb@sourceware.org References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: GVZP280CA0025.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:276::16) To AS8PR05MB8230.eurprd05.prod.outlook.com (2603:10a6:20b:31b::15) X-Microsoft-Original-Message-ID: <61f63fbd-c6ef-4f22-8025-d27429393350@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR05MB8230:EE_|VI1PR05MB10632:EE_ X-MS-Office365-Filtering-Correlation-Id: 09e3387b-c217-415d-f7dc-08dd611c0f89 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199028|5072599009|19110799003|15080799006|8060799006|6090799003|7092599003|440099028|3412199025; X-Microsoft-Antispam-Message-Info: =?utf-8?B?bGtZR1N5N296N0NxR1cvMFUvZnNFOEZ6TFVFcDZmMEl4eWlHMXpaT0hyWVBG?= =?utf-8?B?a2RRMC83Vmxkc2daSHdnRGprWElUb3o1RHNJbmUvcWhEN2l1bFR4TWk3NGNL?= =?utf-8?B?YkdHNSs1cGlQNXkyaWc4bTNzVldJRXEzaXBCd2JzRDNRUHR4NFV3NlhlYm5i?= =?utf-8?B?aG9CWnRaUlJTcjZKODlZanRMLy8vZVlldWx6djZwNkRnU25ieEJpZ3J2L3g1?= =?utf-8?B?MTBSSTJuUWhuVFJEYnM1ZDdxZFQ0WTBEbDZ4M21IS00rVTluRFZ3L3Z1WWEz?= =?utf-8?B?dCtoRVFsV0F3b0xsSjQ0ZW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tZaXl2RXJEb2JHZTlSVG9zc1JYQVkvMXhmc0Nqa255RXVV?= =?utf-8?B?eSs5c2EzajQ2MStSUnArbk5sUGxmdDF6eW1uWlM4a3hSNFQzdUxtdWtBOVA1?= =?utf-8?B?dkozMVJTRmJ1NjdYZ0JEajlGNTY0TmdLd2REc2ZZclByY2ZZTmZhNHVzdE9R?= =?utf-8?B?aTlKU3JkTEkyMTF1ZkhKYlcvSWxLdjZkK1lsMjZ2SDRocFlFRkIyN1dXejcx?= =?utf-8?B?eWEwb0NIdzdVYWkyN0JZL2RIZXVYS0s0dXh2YnhLZHhrMnREUG1zbXdNeG5Q?= =?utf-8?B?MGdXbm1kZHNyOVZwbUlYSW1RRW4rQnNzMDZOY3AzendjbDFNcXlPeGQyLzVk?= =?utf-8?Q?TMlXKjpisruc82190U=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09e3387b-c217-415d-f7dc-08dd611c0f89 X-MS-Exchange-CrossTenant-AuthSource: AS8PR05MB8230.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2025 04:12:10.8855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB10632 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Zigachev via Gdb Reply-To: Sergey Zigachev Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" > If another thread (that is being ran freely) happens to hit a breakpoint > while single stepping the selected thread, then indeed you should report > that SIGTRAP. GDB will present that stop to the user, and the step will > be aborted. The stepping thread will be asked to stop, and will be > stopped at an arbitrary place. Ok, that means I got the "abort the step" part wrong. > I think that the SIGTRAP at #10 is spurious. It is perhaps a leftover > from the step command at #5/#6? Yes, it is, I didn't think this was a leftover though. 🙂 > When thread 2 hits breakpoint_2 at #7, then the step from thread 1 > aborts and should be forgotten. When you step again at #8/#9, you start > from a blank slate. Got that, too. Currently, I made sure to report to GDB result of every event it requested to get. Apparently, that's not how it should work. > It's possible that the code path taken in that case clears something > that causes the spurious SIGTRAP to be forgotten. I think there's no spurious SIGTRAPs for other threads, for GDB it looks like the inferior runs only single thread at this point in time. I can be wrong on that one. > Ok, so if I understand correctly, you do some kind of "ptrace resume", > which is blocking, and it unblocks when something happens. When that > returns, the kernel has stopped all threads for you. In a sense that > simplifies some things, but it would make async/non-stop harder to > implement. Yes, it's a "ptrace wait" request which is blocking, I have "ptrace resume", too, which doesn't block. I'm ok to change both user and kernel space if that would make GDB usage better for end user. > This kind of logic is managed at a higher level (infrun), not by > targets. I don't think that your target_ops::wait method is the place > for such decision. I'm not super familiar with this, I just know it's > managed by spaghetti-like functions like `handle_signal_stop`. OK, it makes sense. Thanks for your comments, it's rather eye-opening experience. My mental model about how gdb core operates is really wrong. > Given what you said above, about how your debug interface works, > non-stop/async is probably not a priority. Well, I implemented the kernel part myself. So if it doesn't fit GDB (and later LLDB), then I can redo that. Any information about how one should implement target dependent code for GDB is appreciated. Wiki pages, articles, existing "canonical" targets to learn from (maybe less complex than Linux one?), etc. -Sergey