From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6558 invoked by alias); 2 Jun 2014 12:41:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 6491 invoked by uid 89); 2 Jun 2014 12:41:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga03.intel.com Received: from mga03.intel.com (HELO mga03.intel.com) (143.182.124.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Jun 2014 12:41:34 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 02 Jun 2014 05:41:31 -0700 X-ExtLoop1: 1 Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by azsmga001.ch.intel.com with ESMTP; 02 Jun 2014 05:41:30 -0700 Received: from irsmsx106.ger.corp.intel.com (163.33.3.31) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.123.3; Mon, 2 Jun 2014 13:41:29 +0100 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.136]) by IRSMSX106.ger.corp.intel.com ([169.254.8.14]) with mapi id 14.03.0123.003; Mon, 2 Jun 2014 13:41:29 +0100 From: "Metzger, Markus T" To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: RE: [PATCH v3 3/3] btrace, vdso: add vdso target sections Date: Mon, 02 Jun 2014 12:41:00 -0000 Message-ID: References: <1400655682-4014-1-git-send-email-markus.t.metzger@intel.com> <1400655682-4014-3-git-send-email-markus.t.metzger@intel.com> <5387663A.5040704@redhat.com> <53876874.3080503@redhat.com> In-Reply-To: <53876874.3080503@redhat.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00018.txt.bz2 > -----Original Message----- > From: Pedro Alves [mailto:palves@redhat.com] > Sent: Thursday, May 29, 2014 7:04 PM > Hmm, wait, nothing is removing the vdso symbols target sections, like eve= r, > not even when the process dies, isn't it? I guess that's it. Yes, that seems to be it. Target sections are typically owned by an so_list object and are removed when the so_list object is removed. Symfile target sections are owned by an objfile object and are removed in a free_objfile observer in symfile.c. That observer only removes target sections for OBJF_USERLOADED objfiles, though. The vdso target sections are owned by the vdso BFD and are never removed. When I change symfile_add_from_memory to create target sections like this: add_target_sections_of_objfile (objf); and further drop the restriction to only remove OBJF_USERLOADED objfiles in symfile_free_objfile, the test passes. diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index b29421e..ef48f7d 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -92,7 +92,6 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR= addr, struct section_addr_info *sai; unsigned int i; struct cleanup *cleanup; - struct target_section *sections, *sections_end, *tsec; =20 if (bfd_get_flavour (templ) !=3D bfd_target_elf_flavour) error (_("add-symbol-file-from-memory not supported for this target")); @@ -132,22 +131,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_A= DDR addr, from_tty ? SYMFILE_VERBOSE : 0, sai, OBJF_SHARED, NULL); =20 - sections =3D NULL; - sections_end =3D NULL; - - if (build_section_table (nbfd, §ions, §ions_end) =3D=3D 0) - { - make_cleanup (xfree, sections); - - /* Adjust the target section addresses by the load address. */ - for (tsec =3D sections; tsec !=3D sections_end; ++tsec) - { - tsec->addr +=3D loadbase; - tsec->endaddr +=3D loadbase; - } - - add_target_sections (&nbfd, sections, sections_end); - } + add_target_sections_of_objfile (objf); =20 /* This might change our ideas about frames already looked at. */ reinit_frame_cache (); diff --git a/gdb/symfile.c b/gdb/symfile.c index 64a83c6..caa0722 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3893,7 +3893,7 @@ static void symfile_free_objfile (struct objfile *objfile) { /* Remove the target sections of user-added objfiles. */ - if (objfile !=3D 0 && objfile->flags & OBJF_USERLOADED) + if (objfile !=3D NULL) remove_target_sections ((void *) objfile); } Alternatively, I could add another OBJF_ flag and another free_objfile obse= rver to also remove the symfile-from-memory target sections. Regards, Markus. Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052