From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id DkvkDnSAP2hRCQAAWB0awg (envelope-from ) for ; Tue, 03 Jun 2025 19:08:36 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Of3QQkhw; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2894C1E102; Tue, 3 Jun 2025 19:08:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 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 F34211E0C2 for ; Tue, 3 Jun 2025 19:08:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62854385842D for ; Tue, 3 Jun 2025 23:08:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62854385842D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Of3QQkhw Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 4AC3F3858D34 for ; Tue, 3 Jun 2025 23:08:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4AC3F3858D34 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4AC3F3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748992081; cv=none; b=jCVu0N9OSfkFHTaK84DRuBMoxEkpE8xHeMUY7/x5DahppuZls4nOT2qx4INmhyMaca5JO6JlQMUmo3D8ySZ85w/P5fTQIzy+bZvdX0/tqylGabCqVtr7XW1ae8VuY+6DiSVmhVHev+t2B0B8PCfAnovO03eSecLtvzSuFGxAWbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748992081; c=relaxed/simple; bh=AayMbyPL6aamYPx0OChbPilIhSBnv8EGR/tQH04PUOY=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=F3wG2k725XDK1JdPP2+71WZtZge4uykrM1qEJDKsdffkF4fuBd2u8bCFoFim37w5FvmIkdDjR9KsamJa5JpI4a9wRSfS8iGrTbo5ptdCc5FWezuBiECS5zLs4x4HOuBywoWV5mtxG/j8R8JMZ26aJAOlKOESz/R8Yc8QSrOk6o0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AC3F3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748992081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CWrNPRP6D0dGGwk3+kcPKb+YiURAhmcfvW8iYLwfOZc=; b=Of3QQkhwRQ9GwIN7Gt2BHeTzTRrmtZ4GwPS3wz2d1K/oZoI2+emWT9/wLfkxjI2BJHGfDE zRlXjzOPnS+MeskvI8McmyrtjiDyHmp6YoZVumEf1qcLPJJwZQyrSDx3WKN+YHSDiHrVO3 2FHUMhb3z/c0z6qiQ+3yV/yN4WLuu6w= Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-mxj5yvOwOq6XHx2JeFTO3w-1; Tue, 03 Jun 2025 19:07:59 -0400 X-MC-Unique: mxj5yvOwOq6XHx2JeFTO3w-1 X-Mimecast-MFC-AGG-ID: mxj5yvOwOq6XHx2JeFTO3w_1748992079 Received: by mail-vs1-f69.google.com with SMTP id ada2fe7eead31-4e5d11fcb27so457510137.0 for ; Tue, 03 Jun 2025 16:07:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748992079; x=1749596879; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CWrNPRP6D0dGGwk3+kcPKb+YiURAhmcfvW8iYLwfOZc=; b=BeHkrn46eclBbzq5XLhtnDIoPh6xtoh6LMQIVeQhsPDKb8u43+1q65ZmZzpRIjURz9 8/xIGA+Qsw6zr+LMdz2yBQm2GR55qeoID1FfV5i0/VTUaXlPcxTmDzRCu7BrHRmNCCmh cOk3Yx0dniG5Zm1lrp6WB2SpuPCKQVBuuiqqZLcV8Vq6uAsLY64T/RL7VbgB9CyCph7z X3QeikKhP47NWHOufWHN3CZDb2Z4ArHAYdTm0r/ZyXs0AkWR/T5qSl0mZ0v2eIbESYG9 t1AQ72jdMoE2awtAbZVjdY0/jGO8+80YZVDHIuP1+Zl6o3u8eOnLIlmH713090L+IZgh tZkw== X-Forwarded-Encrypted: i=1; AJvYcCWWCqx92yso/eWGrcdrYx/YO5PeKN9wsiE76nGAq2ubD/Re+UsmKxPs5Hl6giE3IwWraZM6oz3gB+ZAmA==@sourceware.org X-Gm-Message-State: AOJu0YyxCI7qplxfFdOQvCFQuTjDqUbFVKpxQUZpBl/iymX3GrXL4yhZ Cxoll4lEcdK1nLCKMrmPV6tfxn79eN2RlO3P7IRcdEZyvx082CzyvfSPcR5U95y8SVksdriIfMo oYTtU/6Y4ocCNf2+eqB8Hv9deAQIGvGnMrtnucM369tOiql5YlBpVPDz2Z/0+H0/J/4ZYK8E= X-Gm-Gg: ASbGnct3Ugc/8PAjnTCKDoE5bzIY5x8DvA3dOIMMqSl8mXU4saK4A6nct8GgfHbs8fT 356sCsUWHMA4V5JE7fjUinjk8PRyWj6ujZ3OZkyexmhOab0d+YrEZtlkdQPTYggGcaBPhFKGE/W XNY5HD8AqObnE7boSfSpibXraEI1pTNo0oxSAQEMNjFOKq/Ezw54cB7XHBUvRf26bINn1fwk8Q9 A0Z6CMwh/BaAzPnofWA6payxIpkH8qamSUNugHv6GhAYhX7+F4OKABadyIyWJPDL72vkMemdOvJ 9QqSe92IIYOr87sVST/GpS0= X-Received: by 2002:a05:6102:5548:b0:4c1:9695:c7c with SMTP id ada2fe7eead31-4e746e4977bmr333675137.24.1748992078942; Tue, 03 Jun 2025 16:07:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVzgwMO8TlmBnmvGX2K56W6DBO5I8LnwdfIxifedM28bhpZQjEhgve4ypIMLYlb8oOMbVvNw== X-Received: by 2002:a05:6102:5548:b0:4c1:9695:c7c with SMTP id ada2fe7eead31-4e746e4977bmr333655137.24.1748992078604; Tue, 03 Jun 2025 16:07:58 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1000? ([2804:14d:8084:9a69::1000]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4e6444964casm9326758137.13.2025.06.03.16.07.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Jun 2025 16:07:58 -0700 (PDT) Message-ID: <0bc50478-6756-4825-8080-031e3aef864a@redhat.com> Date: Tue, 3 Jun 2025 20:07:55 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/solib: pass lm_info, original_name and name to solib constructor To: Simon Marchi , gdb-patches@sourceware.org References: <20250603153257.55235-1-simon.marchi@efficios.com> From: Guinevere Larsen In-Reply-To: <20250603153257.55235-1-simon.marchi@efficios.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: G-yI8mLTm_hojmy2ZCppQjKDPDjsNFzyfQxujlPsiQQ_1748992079 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 6/3/25 12:32 PM, Simon Marchi wrote: > diff --git a/gdb/solib-target.c b/gdb/solib-target.c > index 68dc3cc92c0a..dce90a5f8c8e 100644 > --- a/gdb/solib-target.c > +++ b/gdb/solib-target.c > @@ -244,14 +244,7 @@ solib_target_current_sos (void) > > /* Build a struct solib for each entry on the list. */ > for (lm_info_target_up &info : library_list) > - { > - auto &new_solib = sos.emplace_back (); > - > - /* We don't need a copy of the name in INFO anymore. */ > - new_solib.name = std::move (info->name); > - new_solib.original_name = new_solib.name; > - new_solib.lm_info = std::move (info); > - } > + sos.emplace_back (std::move (info), info->name, info->name); This is a bad idea. I double checked with c++ folk and while no compilers warn about this, if the compiler evaluates things right to left (like gcc) this works, but if they evaluate left to right (like clang), then info->name will be de-referencing null and segfault. This might also depend on ABI, but the end result is the same: fragile at best. we'll need something that saves or moves info->name to pass it to the emplace_back constructor > > return sos; > } -- Cheers, Guinevere Larsen She/Her/Hers