From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id g/meOGslvmKHyAkAWB0awg (envelope-from ) for ; Thu, 30 Jun 2022 18:36:27 -0400 Received: by simark.ca (Postfix, from userid 112) id D48181E22B; Thu, 30 Jun 2022 18:36:27 -0400 (EDT) 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=Bi//juLa; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 72FC81E222 for ; Thu, 30 Jun 2022 18:36:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8C073858424 for ; Thu, 30 Jun 2022 22:36:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8C073858424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1656628585; bh=www8an4KBIPJ5we4LKn8FGGV3yUmHyRMVZUC5Gk6VgM=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Bi//juLaBJBcHU5t/CMZFUsiOi1xVF2pvnH3NqB4YgeYuJLqSOnADVrNq5JaU3+pD 3U4Sa0F5VQ9lFdWnRRexHJiue6bGeoG6o2bxfMDFsUSrVC91/pHOEJvkSo7vTXk0s/ kGkOvEH6cmm1mc8bug5Xea+34naepLQUWodo9VAQ= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 670433858C39 for ; Thu, 30 Jun 2022 22:36:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 670433858C39 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-307-3dCWwJr-OdyyTvkzCmAMFw-1; Thu, 30 Jun 2022 18:35:59 -0400 X-MC-Unique: 3dCWwJr-OdyyTvkzCmAMFw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD376811E75; Thu, 30 Jun 2022 22:35:58 +0000 (UTC) Received: from f35-zws-1 (unknown [10.2.16.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F0372166B26; Thu, 30 Jun 2022 22:35:58 +0000 (UTC) Date: Thu, 30 Jun 2022 15:35:57 -0700 To: "Metzger, Markus T" Subject: Re: [PATCH v5 03/15] gdb, gdbserver: support dlmopen() Message-ID: <20220630153557.2ae9bd95@f35-zws-1> In-Reply-To: References: <20220602132514.957983-1-markus.t.metzger@intel.com> <20220602132514.957983-4-markus.t.metzger@intel.com> <20220618210213.73f6b911@f35-zws-1> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: , From: Kevin Buettner via Gdb-patches Reply-To: Kevin Buettner Cc: "Lu@sourceware.org" , "Lu, Hongjiu" , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Mon, 27 Jun 2022 12:55:57 +0000 "Metzger, Markus T" wrote: > Thanks for your review, Kevin, [...] > >I was puzzled for a while by the uses of std:swap() in the above > >snippets of code. I checked the rest of the GDB sources and found > >that (at least in GDB) this is not a common idiom. I'd appreciate > >it if you could add a few lines of explanation for at least one > >of them. > > Do those comments help? Yes! Thanks for adding them. Kevin > > diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c > index 1f2abcf16ef..b231888b001 100644 > --- a/gdb/solib-svr4.c > +++ b/gdb/solib-svr4.c > @@ -1346,6 +1346,10 @@ svr4_current_sos_direct (struct svr4_info *info) > && (library_list.solib_lists[0] == nullptr)) > library_list.solib_lists.erase (0); > > + /* Replace the (empty) solib_lists in INFO with the one generated > + from the target. We don't want to copy it on assignment and then > + delete the original afterwards, so let's just swap the > + internals. */ > std::swap (info->solib_lists, library_list.solib_lists); > return; > } > @@ -1872,7 +1876,11 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base, > if (!svr4_current_sos_via_xfer_libraries (&library_list, annex)) > return 0; > > - /* We expect gdbserver to provide updates for the namespace that > + /* Get the so list from the target. We replace the list in the > + target response so we can easily check that the response only > + covers one namespace. > + > + We expect gdbserver to provide updates for the namespace that > contains LM, which whould be this namespace... */ > so_list *sos = nullptr; > if (library_list.solib_lists.find (debug_base)