From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +JkxFGPSw2WdjRYAWB0awg (envelope-from ) for ; Wed, 07 Feb 2024 13:56:35 -0500 Received: by simark.ca (Postfix, from userid 112) id 4E9171E0C3; Wed, 7 Feb 2024 13:56:35 -0500 (EST) 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 3A1281E092 for ; Wed, 7 Feb 2024 13:56:33 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C18C5385800B for ; Wed, 7 Feb 2024 18:56:32 +0000 (GMT) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by sourceware.org (Postfix) with ESMTPS id 862023858C29 for ; Wed, 7 Feb 2024 18:56:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 862023858C29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 862023858C29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707332174; cv=none; b=dZHp1C8e9fB70j8pjh9taDuIOaRlAlynTAQENKBFnPA/EH0LxoxKQ6K2m5PSFbLZjK+IB8TZxOJqn7G6fQyC1cEo2cHqyporrLi979eAFifPJfA0xDf12qBLPxkBeOW8mBq0/cCogVXOuj4sq3rchRUU8Flusbeced1+fgwQg8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707332174; c=relaxed/simple; bh=c7A29VSFJUhQg9d61+KxAQC59aYQOWqvi+UcdljCmVE=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=gWm6v910TVo557RgyyYPKjtbS4V+Tpc8gBLKojhN7wQbYhe538hM5L0ZZMjYw/zQWTFJplgLAk1UocfWc2duPuFjRbcqT3pxZgaKqWUz69iAEpRiTXvJb2CG+Rens6gwezk02gGTsdsoNQklSxCU7tMdspK5QXfMWznxuD2lJ6o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4101eb5a115so5735235e9.1 for ; Wed, 07 Feb 2024 10:56:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707332171; x=1707936971; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0o8v4JbH+0DLpbrq7doL2Z0ZCSyI6HIF+klck6YbX24=; b=G8Hv+TOxmkwqBGBdlTiKq3Y1eysDMiuWPMlqlFrQsUKNtp/hkw4rFf2DzVUxbVW8ML Vy+hqLl+u1TVpultPPVvhk6mxzFyPuadPzs9aXY4FCa/C3SdQFmm87a8V+gc+04FDTGw UOpAZPq3ursU2P8iRra6mH1dlNb1va2gZ7KMegyPinP0hsTtsC2Cqd4cA1sXub/t7gGs qVbbcnfNMUqMsnRyNI0ccRkesaWI2w5nexrQ3tBdo9jiMjdHtSirnss7o2h0/YXYhINp M578E2gC1Z/rs6qSsOdJdBex2MQ4DYUD5EkguZoy97XWEIIdXMrP8udNX3jBaveV7VUD B+Sg== X-Gm-Message-State: AOJu0YxHZHHXlxb1rX/qDFo6imcKzgXC0oKiHTmdpAuuhR+UKan6Abw3 S3TMnKSzEizQ3DGMKlHJJs1T9WYZTc67Y+IqzTUuK2W/3ififp1/ X-Google-Smtp-Source: AGHT+IGmSNEHKrGY77Gyba/I2aXx6VvbU1/NhQS1lGPrSSORf88WvLqlYzIl3cS0IA0oCHQ8l/OcQw== X-Received: by 2002:a05:600c:4f8f:b0:40e:c722:2b9a with SMTP id n15-20020a05600c4f8f00b0040ec7222b9amr5231145wmq.32.1707332171081; Wed, 07 Feb 2024 10:56:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXN0voYRbK+dyPKImGb842KZWQZF0D7geP9dgCEDTMUvDAa3d7vJrULgITpOT6LGXuaErIhNolJJ3mG5KMKIWDqFoJ2Jx7gIhR91k5HnhddGygZ7Jx91Gh01WxXxb6cCW7Saz0UJKGbvn0hS6cUWGIvbhw0UkU= Received: from ?IPV6:2001:8a0:f923:4f00:d1ab:b98b:8238:4b55? ([2001:8a0:f923:4f00:d1ab:b98b:8238:4b55]) by smtp.gmail.com with ESMTPSA id m37-20020a05600c3b2500b0040ec66021a7sm2903067wms.1.2024.02.07.10.56.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Feb 2024 10:56:10 -0800 (PST) Message-ID: Date: Wed, 7 Feb 2024 18:56:08 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [FYI/pushed v4 08/25] Thread options & clone events (Linux GDBserver) Content-Language: en-US To: Tom Tromey , Luis Machado Cc: Simon Marchi , gdb-patches@sourceware.org, Andrew Burgess References: <20231113150427.477431-1-pedro@palves.net> <20231113150427.477431-9-pedro@palves.net> <87eddpej3r.fsf@tromey.com> <2e61811c-ff0f-44d0-bf6f-e98a9de87c33@arm.com> <87mssccmb3.fsf@tromey.com> <27777234-0335-4ef1-bc2b-34324d335e30@arm.com> <87sf24b0jd.fsf@tromey.com> From: Pedro Alves In-Reply-To: <87sf24b0jd.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Hi! On 2024-02-07 18:18, Tom Tromey wrote: >>>>>> "Luis" == Luis Machado writes: > > Luis> I see. Is this logic expected? Naturally I'd expect a process to > Luis> exist before a thread can exist. > > Me too but you can see it in > linux-low.cc:linux_process_target::handle_extended_wait. > > lwp_info *child_lwp = add_lwp (child_ptid); > [...] > if (event != PTRACE_EVENT_CLONE) > { > /* Add the new process to the tables and clone the breakpoint > lists of the parent. We need to do this even if the new process > will be detached, since we will need the process object and the > breakpoints to remove any breakpoints from memory when we > detach, and the client side will access registers. */ > process_info *child_proc = add_linux_process (new_pid, 0); > [...] > I don't recall off hand a reason that prevents us from tweaking this code a little to create the child process before the child lwp is created. I think that was how it was done before my changes, and I just reordered code to make it end up with fewer lines. I think we can create the child process earlier. I'll send a patch in a sec, once I test it. Pedro Alves