From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Kevin Buettner To: "Metzger, Markus T" Cc: gdb-patches@sourceware.org, "Lu@sourceware.org" , "Lu, Hongjiu" 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-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 22:36:07 -0000 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)