From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4HYXD5b/nl/qdgAAWB0awg (envelope-from ) for ; Sun, 01 Nov 2020 13:33:58 -0500 Received: by simark.ca (Postfix, from userid 112) id 3A2231F08B; Sun, 1 Nov 2020 13:33:58 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A645A1E590 for ; Sun, 1 Nov 2020 13:33:57 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 619823858D37; Sun, 1 Nov 2020 18:33:57 +0000 (GMT) Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 12F883858D37 for ; Sun, 1 Nov 2020 18:33:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 12F883858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 83F20B04; Sun, 1 Nov 2020 19:33:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fPOIc2iQdYFV; Sun, 1 Nov 2020 19:33:51 +0100 (CET) Received: from function (lfbn-bor-1-56-204.w90-50.abo.wanadoo.fr [90.50.148.204]) by hera.aquilenet.fr (Postfix) with ESMTPSA id AC1F0AE1; Sun, 1 Nov 2020 19:33:51 +0100 (CET) Received: from samy by function with local (Exim 4.94) (envelope-from ) id 1kZIAo-008K7T-Jm; Sun, 01 Nov 2020 19:33:50 +0100 Date: Sun, 1 Nov 2020 19:33:50 +0100 From: Samuel Thibault To: Simon Marchi Subject: Re: [PATCH] Limit the switch_to_thread() calls in startup_inferior() Message-ID: <20201101183350.4kjanzjzuo7tmumz@function> References: <20201014084940.1289-1-n54@gmx.com> <1b79497d-a376-0c48-9544-ef1bb3056fc9@simark.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1b79497d-a376-0c48-9544-ef1bb3056fc9@simark.ca> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hello, (Note that I have never really hacked very much into gdb's inferior management, so I don't know much how things are supposed to be working.) Simon Marchi, le sam. 24 oct. 2020 22:58:05 -0400, a ecrit: > I tried to wrap my head around this and understand the need for the > switch_to_thread, what could be the impacts of your change, and I just > can't give anything close to a definitive answer. > [...] > Samuel, as the last person who touched gnu-nat.c, do you have a bit of > time to test Kamil's patch on Hurd, see if it breaks starting inferiors? I am not really sure what I am supposed to test. I tried a program that starts a second thread which just pause()s. With Kamil's patch I can switch & backtrace between the two threads. (gdb) r Starting program: /home/samy/test ^C[New Thread 13012.6] [New Thread 13012.7] Thread 5 received signal SIGINT, Interrupt. 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3 (gdb) info thread Id Target Id Frame * 5 Thread 13012.5 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3 6 Thread 13012.6 0x0109dc74 in _hurd_intr_rpc_mach_msg () from /lib/i386-gnu/libc.so.0.3 7 Thread 13012.7 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3 (gdb) bt #0 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3 #1 0x01079cc6 in mach_msg () from /lib/i386-gnu/libc.so.0.3 [...] #5 0x0104cdca in pthread_join () from /lib/i386-gnu/libpthread.so.0.3 #6 0x0803254b in main () at test.c:13 (gdb) thread 7 [Switching to thread 7 (Thread 13012.7)] #0 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3 (gdb) bt #0 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3 [...] #3 0x0114e4ce in pause () from /lib/i386-gnu/libc.so.0.3 #4 0x080324fa in f (foo=0x0) at test.c:6 #5 0x0104c3ff in entry_point () from /lib/i386-gnu/libpthread.so.0.3 #6 0x00000000 in ?? () > And what if you remove all the switch_to_thread from that function, does > it still work? If I remove all calls from that fonction I am getting (gdb) r Starting program: /home/samy/test Can't fetch registers from thread bogus thread id 1: No such thread (gdb) info thread Id Target Id Frame 5 Thread 18821.5 0x000021e0 in ?? () The current thread has terminated. See `help thread'. Since I now have a built tree I can easily experiment more. Samuel